func BindSignerCertOptions(options *SignerCertOptions, flags *pflag.FlagSet, prefix string) { flags.StringVar(&options.CertFile, prefix+"signer-cert", "openshift.local.config/master/ca.crt", "The certificate file.") flags.StringVar(&options.KeyFile, prefix+"signer-key", "openshift.local.config/master/ca.key", "The key file.") flags.StringVar(&options.SerialFile, prefix+"signer-serial", "openshift.local.config/master/ca.serial.txt", "The serial file that keeps track of how many certs have been signed.") // autocompletion hints cobra.MarkFlagFilename(flags, prefix+"signer-cert") cobra.MarkFlagFilename(flags, prefix+"signer-key") cobra.MarkFlagFilename(flags, prefix+"signer-serial") }
func BindCreateSignerCertOptions(options *CreateSignerCertOptions, flags *pflag.FlagSet, prefix string) { flags.StringVar(&options.CertFile, prefix+"cert", "openshift.local.config/master/ca.crt", "The certificate file.") flags.StringVar(&options.KeyFile, prefix+"key", "openshift.local.config/master/ca.key", "The key file.") flags.StringVar(&options.SerialFile, prefix+"serial", "openshift.local.config/master/ca.serial.txt", "The serial file that keeps track of how many certs have been signed.") flags.StringVar(&options.Name, prefix+"name", DefaultSignerName(), "The name of the signer.") flags.BoolVar(&options.Overwrite, prefix+"overwrite", options.Overwrite, "Overwrite existing cert files if found. If false, any existing file will be left as-is.") // autocompletion hints cobra.MarkFlagFilename(flags, prefix+"cert") cobra.MarkFlagFilename(flags, prefix+"key") cobra.MarkFlagFilename(flags, prefix+"serial") }
func BindCreateSignerCertOptions(options *CreateSignerCertOptions, flags *pflag.FlagSet, prefix string) { flags.StringVar(&options.CertFile, prefix+"cert", "openshift.local.config/master/ca.crt", "The certificate file.") flags.StringVar(&options.KeyFile, prefix+"key", "openshift.local.config/master/ca.key", "The key file.") flags.StringVar(&options.SerialFile, prefix+"serial", "openshift.local.config/master/ca.serial.txt", "The serial file that keeps track of how many certs have been signed.") flags.StringVar(&options.Name, prefix+"name", DefaultSignerName(), "The name of the signer.") flags.BoolVar(&options.Overwrite, prefix+"overwrite", options.Overwrite, "Overwrite existing cert files if found. If false, any existing file will be left as-is.") // set dynamic value annotation - allows man pages to be generated and verified flags.SetAnnotation(prefix+"name", "manpage-def-value", []string{"openshift-signer@<current_timestamp>"}) // autocompletion hints cobra.MarkFlagFilename(flags, prefix+"cert") cobra.MarkFlagFilename(flags, prefix+"key") cobra.MarkFlagFilename(flags, prefix+"serial") }
// BindMasterArgs binds the options to the flags with prefix + default flag names func BindMasterArgs(args *MasterArgs, flags *pflag.FlagSet, prefix string) { flags.Var(&args.MasterAddr, prefix+"master", "The master address for use by OpenShift components (host, host:port, or URL). Scheme and port default to the --listen scheme and port. When unset, attempt to use the first public IPv4 non-loopback address registered on this host.") flags.Var(&args.MasterPublicAddr, prefix+"public-master", "The master address for use by public clients, if different (host, host:port, or URL). Defaults to same as --master.") flags.Var(&args.EtcdAddr, prefix+"etcd", "The address of the etcd server (host, host:port, or URL). If specified, no built-in etcd will be started.") flags.Var(&args.DNSBindAddr, prefix+"dns", "The address to listen for DNS requests on.") flags.BoolVar(&args.PauseControllers, prefix+"pause", false, "If true, wait for a signal before starting the controllers.") flags.StringVar(&args.EtcdDir, prefix+"etcd-dir", "openshift.local.etcd", "The etcd data directory.") flags.StringSliceVar(&args.APIServerCAFiles, prefix+"certificate-authority", args.APIServerCAFiles, "Optional files containing signing authorities to use (in addition to the generated signer) to verify the API server's serving certificate.") flags.StringSliceVar(&args.CORSAllowedOrigins, prefix+"cors-allowed-origins", []string{}, "List of allowed origins for CORS, comma separated. An allowed origin can be a regular expression to support subdomain matching. CORS is enabled for localhost, 127.0.0.1, and the asset server by default.") // autocompletion hints cobra.MarkFlagFilename(flags, prefix+"etcd-dir") cobra.MarkFlagFilename(flags, prefix+"certificate-authority") }
// BindNodeArgs binds the options to the flags with prefix + default flag names func BindNodeArgs(args *NodeArgs, flags *pflag.FlagSet, prefix string) { flags.StringVar(&args.VolumeDir, prefix+"volume-dir", "openshift.local.volumes", "The volume storage directory.") // TODO rename this node-name and recommend uname -n flags.StringVar(&args.NodeName, prefix+"hostname", args.NodeName, "The hostname to identify this node with the master.") flags.StringVar(&args.NetworkPluginName, prefix+"network-plugin", args.NetworkPluginName, "The network plugin to be called for configuring networking for pods.") // autocompletion hints cobra.MarkFlagFilename(flags, prefix+"volume-dir") }
func DefaultClientConfig(flags *pflag.FlagSet) clientcmd.ClientConfig { loadingRules := config.NewOpenShiftClientConfigLoadingRules() flags.StringVar(&loadingRules.ExplicitPath, config.OpenShiftConfigFlagName, "", "Path to the config file to use for CLI requests.") cobra.MarkFlagFilename(flags, config.OpenShiftConfigFlagName) overrides := &clientcmd.ConfigOverrides{} overrideFlags := clientcmd.RecommendedConfigOverrideFlags("") overrideFlags.ContextOverrideFlags.Namespace.ShortName = "n" overrideFlags.AuthOverrideFlags.Username.LongName = "" overrideFlags.AuthOverrideFlags.Password.LongName = "" clientcmd.BindOverrideFlags(overrides, flags, overrideFlags) cobra.MarkFlagFilename(flags, overrideFlags.AuthOverrideFlags.ClientCertificate.LongName) cobra.MarkFlagFilename(flags, overrideFlags.AuthOverrideFlags.ClientKey.LongName) cobra.MarkFlagFilename(flags, overrideFlags.ClusterOverrideFlags.CertificateAuthority.LongName) clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, overrides) return clientConfig }
// BindMasterArgs binds the options to the flags with prefix + default flag names func BindMasterArgs(args *MasterArgs, flags *pflag.FlagSet, prefix string) { flags.Var(&args.MasterAddr, prefix+"master", "The master address for use by OpenShift components (host, host:port, or URL). Scheme and port default to the --listen scheme and port. When unset, attempt to use the first public IPv4 non-loopback address registered on this host.") flags.Var(&args.MasterPublicAddr, prefix+"public-master", "The master address for use by public clients, if different (host, host:port, or URL). Defaults to same as --master.") flags.Var(&args.EtcdAddr, prefix+"etcd", "The address of the etcd server (host, host:port, or URL). If specified, no built-in etcd will be started.") flags.Var(&args.DNSBindAddr, prefix+"dns", "The address to listen for DNS requests on.") flags.BoolVar(&args.PauseControllers, prefix+"pause", false, "If true, wait for a signal before starting the controllers.") flags.StringVar(&args.EtcdDir, prefix+"etcd-dir", "openshift.local.etcd", "The etcd data directory.") flags.Var(&args.NodeList, prefix+"nodes", "The hostnames of each node. This currently must be specified up front. Comma delimited list") flags.Var(&args.CORSAllowedOrigins, prefix+"cors-allowed-origins", "List of allowed origins for CORS, comma separated. An allowed origin can be a regular expression to support subdomain matching. CORS is enabled for localhost, 127.0.0.1, and the asset server by default.") // autocompletion hints cobra.MarkFlagFilename(flags, prefix+"etcd-dir") }
// BindNodeArgs binds the options to the flags with prefix + default flag names func BindNodeArgs(args *NodeArgs, flags *pflag.FlagSet, prefix string, components bool) { if components { args.Components.Bind(flags, prefix+"%s", "The set of node components to") } flags.StringVar(&args.NetworkPluginName, prefix+"network-plugin", args.NetworkPluginName, "The network plugin to be called for configuring networking for pods.") flags.StringVar(&args.VolumeDir, prefix+"volume-dir", "openshift.local.volumes", "The volume storage directory.") // TODO rename this node-name and recommend uname -n flags.StringVar(&args.NodeName, prefix+"hostname", args.NodeName, "The hostname to identify this node with the master.") // set dynamic value annotation - allows man pages to be generated and verified flags.SetAnnotation(prefix+"hostname", "manpage-def-value", []string{"<hostname>"}) // autocompletion hints cobra.MarkFlagFilename(flags, prefix+"volume-dir") }