metropolis: add cluster domain config and metroctl param
This adds a --cluster parameter to metroctl and a cluster domain field
to the bootstrap configuration. It is not yet used anywhere, but later
the cluster domain will be used to identify the cluster.
The length of the cluster domain is limited to 80, to allow for
constructing subdomains. This limit could be increased later if needed,
but it cannot easily be decreased, so I chose a conservative value that
should be enough in most cases.
Change-Id: I627cca8eb1d92c4b06e4dfd6b6926a013e8f33ae
Reviewed-on: https://review.monogon.dev/c/monogon/+/3508
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/cli/metroctl/main.go b/metropolis/cli/metroctl/main.go
index 21f87a6..6d26d4c 100644
--- a/metropolis/cli/metroctl/main.go
+++ b/metropolis/cli/metroctl/main.go
@@ -22,6 +22,8 @@
}
type metroctlFlags struct {
+ // cluster is the domain name identifying the target cluster.
+ cluster string
// clusterEndpoints is a list of the targeted cluster's endpoints, used by
// commands that perform RPC on it.
clusterEndpoints []string
@@ -53,6 +55,7 @@
var flags metroctlFlags
func init() {
+ rootCmd.PersistentFlags().StringVar(&flags.cluster, "cluster", "", "Cluster domain")
rootCmd.PersistentFlags().StringSliceVar(&flags.clusterEndpoints, "endpoints", nil, "A list of the target cluster's endpoints.")
rootCmd.PersistentFlags().StringVar(&flags.proxyAddr, "proxy", "", "SOCKS5 proxy address")
rootCmd.PersistentFlags().StringVar(&flags.configPath, "config", filepath.Join(xdg.ConfigHome, "metroctl"), "An alternative cluster config path")