func processVars() { flag.String("targetDirs", "", "Local directories to back up.") flag.String("s3Host", "", "S3 host.") flag.String("s3AccessKey", "", "S3 access key.") flag.String("s3SecretKey", "", "S3 secret key.") flag.String("s3BucketName", "", "S3 Bucket Name.") flag.Int("remoteWorkerCount", 5, "Number of workers performing actions against S3 host.") flag.Bool("dryRun", false, "Flag to indicate that this should be a dry run.") flag.Parse() viper.BindPFlag("targetDirs", flag.CommandLine.Lookup("targetDirs")) viper.BindPFlag("s3Host", flag.CommandLine.Lookup("s3Host")) viper.BindPFlag("s3AccessKey", flag.CommandLine.Lookup("s3AccessKey")) viper.BindPFlag("s3SecretKey", flag.CommandLine.Lookup("s3SecretKey")) viper.BindPFlag("s3BucketName", flag.CommandLine.Lookup("s3BucketName")) viper.BindPFlag("remoteWorkerCount", flag.CommandLine.Lookup("remoteWorkerCount")) viper.BindPFlag("dryRun", flag.CommandLine.Lookup("dryRun")) viper.AutomaticEnv() viper.SetEnvPrefix("PERSONAL_BACKUP") viper.BindEnv("targetDirs") viper.BindEnv("s3Host") viper.BindEnv("s3AccessKey") viper.BindEnv("s3SecretKey") viper.BindEnv("s3BucketName") viper.BindEnv("remoteWorkerCount") viper.SetDefault("remoteWorkerCount", 5) }
// Bool creates a new entry in the flag set of boolean value. // The environment value used as a default, if it exists func Bool(flagName, envName string, value bool, usage string) *bool { verifyNames(flagName, envName) envValStr := lookupEnv(envName) if envValStr != "" { value, _ = strconv.ParseBool(envValStr) } flag.Bool(flagName, value, usage) return pflag.Bool(flagName, value, usage) }
"fmt" "io/ioutil" "os" "os/exec" "path" "path/filepath" "strings" flag "github.com/spf13/pflag" ) // This needs to be updated when we cut a new release series. const latestReleaseBranch = "release-1.1" var ( verbose = flag.Bool("verbose", false, "On verification failure, emit pre-munge and post-munge versions.") verify = flag.Bool("verify", false, "Exit with status 1 if files would have needed changes but do not change.") rootDir = flag.String("root-dir", "", "Root directory containing documents to be processed.") // "repo-root" seems like a dumb name, this is the relative path (from rootDir) to get to the repoRoot relRoot = flag.String("repo-root", "..", `Appended to --root-dir to get the repository root. It's done this way so that generally you just have to set --root-dir. Examples: * --root-dir=docs/ --repo-root=.. means the repository root is ./ * --root-dir=/usr/local/long/path/repo/docs/ --repo-root=.. means the repository root is /usr/local/long/path/repo/ * --root-dir=/usr/local/long/path/repo/docs/admin --repo-root=../.. means the repository root is /usr/local/long/path/repo/`) skipMunges = flag.String("skip-munges", "", "Comma-separated list of munges to *not* run. Available munges are: "+availableMungeList) repoRoot string ErrChangesNeeded = errors.New("mungedocs: changes required") // This records the files in the rootDir in upstream/latest-release
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/factory" "github.com/golang/glog" flag "github.com/spf13/pflag" ) var ( addr = flag.String("addr", "127.0.0.1", "The address to use for the apiserver.") port = flag.Int("port", 8080, "The port for the apiserver to use.") dockerEndpoint = flag.String("docker_endpoint", "", "If non-empty, use this for the docker endpoint to communicate with") etcdServer = flag.String("etcd_server", "http://localhost:4001", "If non-empty, path to the set of etcd server to use") // TODO: Discover these by pinging the host machines, and rip out these flags. nodeMilliCPU = flag.Int64("node_milli_cpu", 1000, "The amount of MilliCPU provisioned on each node") nodeMemory = flag.Int64("node_memory", 3*1024*1024*1024, "The amount of memory (in bytes) provisioned on each node") masterServiceNamespace = flag.String("master_service_namespace", api.NamespaceDefault, "The namespace from which the kubernetes master services should be injected into pods") enableProfiling = flag.Bool("profiling", false, "Enable profiling via web interface host:port/debug/pprof/") deletingPodsQps = flag.Float32("deleting_pods_qps", 0.1, "") deletingPodsBurst = flag.Int("deleting_pods_burst", 10, "") ) type delegateHandler struct { delegate http.Handler } func (h *delegateHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { if h.delegate != nil { h.delegate.ServeHTTP(w, req) return } w.WriteHeader(http.StatusNotFound) }
"fmt" "io/ioutil" "os" "os/exec" "path" "path/filepath" "strings" flag "github.com/spf13/pflag" ) // This needs to be updated when we cut a new release series. const latestReleaseBranch = "release-1.2" var ( verbose = flag.Bool("verbose", false, "On verification failure, emit pre-munge and post-munge versions.") verify = flag.Bool("verify", false, "Exit with status 1 if files would have needed changes but do not change.") norecurse = flag.Bool("norecurse", false, "Only process the files of --root-dir.") rootDir = flag.String("root-dir", "", "Root directory containing documents to be processed.") // "repo-root" seems like a dumb name, this is the relative path (from rootDir) to get to the repoRoot relRoot = flag.String("repo-root", "..", `Appended to --root-dir to get the repository root. It's done this way so that generally you just have to set --root-dir. Examples: * --root-dir=docs/ --repo-root=.. means the repository root is ./ * --root-dir=/usr/local/long/path/repo/docs/ --repo-root=.. means the repository root is /usr/local/long/path/repo/ * --root-dir=/usr/local/long/path/repo/docs/admin --repo-root=../.. means the repository root is /usr/local/long/path/repo/`) skipMunges = flag.String("skip-munges", "", "Comma-separated list of munges to *not* run. Available munges are: "+availableMungeList) repoRoot string ErrChangesNeeded = errors.New("mungedocs: changes required")
package main import ( "bytes" "errors" "fmt" "io/ioutil" "os" "path/filepath" "strings" flag "github.com/spf13/pflag" ) var ( verify = flag.Bool("verify", false, "Exit with status 1 if files would have needed changes but do not change.") rootDir = flag.String("root-dir", "", "Root directory containing documents to be processed.") ErrChangesNeeded = errors.New("mungedocs: changes required") ) func visitAndVerify(path string, i os.FileInfo, e error) error { return visitAndChangeOrVerify(path, i, e, false) } func visitAndChange(path string, i os.FileInfo, e error) error { return visitAndChangeOrVerify(path, i, e, true) } // Either change a file or verify that it needs no changes (according to modify argument) func visitAndChangeOrVerify(path string, i os.FileInfo, e error, modify bool) error {
"k8s.io/kubernetes/cmd/libs/go2idl/args" clientgenargs "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/args" "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators" "k8s.io/kubernetes/pkg/api/unversioned" "github.com/golang/glog" flag "github.com/spf13/pflag" ) var ( test = flag.BoolP("test", "t", false, "set this flag to generate the client code for the testdata") inputVersions = flag.StringSlice("input", []string{"api/", "extensions/"}, "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\". Default to \"api/,extensions\"") clientsetName = flag.StringP("clientset-name", "n", "internalclientset", "the name of the generated clientset package.") clientsetPath = flag.String("clientset-path", "k8s.io/kubernetes/pkg/client/clientset_generated/", "the generated clientset will be output to <clientset-path>/<clientset-name>. Default to \"k8s.io/kubernetes/pkg/client/clientset_generated/\"") clientsetOnly = flag.Bool("clientset-only", false, "when set, client-gen only generates the clientset shell, without generating the individual typed clients") fakeClient = flag.Bool("fake-clientset", true, "when set, client-gen will generate the fake clientset that can be used in tests") ) func versionToPath(group string, version string) (path string) { const base = "k8s.io/kubernetes/pkg" // special case for the core group if group == "api" { path = filepath.Join(base, "api", version) } else { path = filepath.Join(base, "apis", group, version) } return } func parseInputVersions() (paths []string, groupVersions []unversioned.GroupVersion, gvToPath map[unversioned.GroupVersion]string, err error) {
"path/filepath" "k8s.io/kubernetes/cmd/libs/go2idl/args" "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators" "k8s.io/kubernetes/pkg/api/unversioned" "github.com/golang/glog" flag "github.com/spf13/pflag" ) var ( test = flag.BoolP("test", "t", false, "set this flag to generate the client code for the testdata") inputVersions = flag.StringSlice("input", []string{"api/", "extensions/"}, "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\". Default to \"api/,extensions\"") clientsetName = flag.StringP("clientset-name", "n", "release_1_1", "the name of the generated clientset package.") clientsetPath = flag.String("clientset-path", "k8s.io/kubernetes/pkg/client/clientset_generated/", "the generated clientset will be output to <clientset-path>/<clientset-name>. Default to \"k8s.io/kubernetes/pkg/client/clientset_generated/\"") clientsetOnly = flag.Bool("clientset-only", false, "when set, client-gen only generates the clientset shell, without generating the individual typed clients") ) func versionToPath(group string, version string) (path string) { const base = "k8s.io/kubernetes/pkg" // special case for the legacy group if group == "api" { path = filepath.Join(base, "api", version) } else { path = filepath.Join(base, "apis", group, version) } return } func parseInputVersions() ([]string, []unversioned.GroupVersion, error) { var visitedGroups = make(map[string]struct{})
type updatedTitleMessage struct { Name string Title string } // Flag specifications. var ( dbFilename = flag.String("database", "feeds.db", "database to use") target = flag.String("target", "", "target directory to download to") checkInterval = flag.Int("check_interval", 3600, "seconds between checks during normal operation") rapidCheckInterval = flag.Int("rapid_check_interval", 60, "seconds between checks when we suspect there will be a new item") rapidCheckDuration = flag.Int("rapid_check_duration", 3600, "seconds that we suspect there will be a new item") downloadDelay = flag.Int("download_delay", 30, "seconds to wait before downloading the file") requestDelay = flag.Int("request_delay", 5, "seconds to wait between requests") checkImmediate = flag.Bool("check_immediately", false, "if set, check immediately on startup") updateCommand = flag.String("update_command", "", "command to run after an update is noticed") download = flag.Bool("download", true, "if unset, do not actually download files") ) var requestDelayTicker <-chan time.Time func downloadUrl(url string) error { if !*download { return errors.New("downloading disabled by flag") } // Figure out the filename to download to. lastSeparatorIndex := strings.LastIndex(url, "/") if lastSeparatorIndex == -1 { return errors.New("malformed url (no slash!?)")
func init() { //Register the `--version` flag flag.Bool("version", false, "Show the version information") }
"net/http/httputil" "net/url" "os" "time" flag "github.com/spf13/pflag" ) const ( usage = "kubernetes-ldap <options>" ReadWriteTimeout = time.Minute * 60 ) var flPort = flag.Uint("port", 4000, "Local port this proxy server will run on") var flInsecure = flag.Bool("ldap-insecure", false, "Disable LDAP TLS") var flLdapHost = flag.String("ldap-host", "", "Host or IP of the LDAP server") var flLdapPort = flag.Uint("ldap-port", 389, "LDAP server port") var flBaseDN = flag.String("ldap-base-dn", "", "LDAP user base DN in the form 'dc=example,dc=com'") var flUserLoginAttribute = flag.String("ldap-user-attribute", "uid", "LDAP Username attribute for login") var flSearchUserDN = flag.String("ldap-search-user-dn", "", "Search user DN for this app to find users (e.g.: cn=admin,dc=example,dc=com).") var flSearchUserPassword = flag.String("ldap-search-user-password", "", "Search user password") var flTLSCertFile = flag.String("tls-cert-file", "", "File containing x509 Certificate for HTTPS. (CA cert, if any, concatenated after server cert).") var flTLSPrivateKeyFile = flag.String("tls-private-key-file", "", "File containing x509 private key matching --tls-cert-file.") var flCertDirectory = flag.String("cert-dir", "", "The directory where the TLS certs are located (by default /var/run/kubernetes). "+ "If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.") // TODO(bc): Change to consistent format (host/port) var flApiserver = flag.String("apiserver", "", "Address of Kubernetes API server (e.g.: http://k8smaster.kismatic.com:8080")
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" "github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag" "github.com/golang/glog" flag "github.com/spf13/pflag" ) const defaultRootDir = "/var/lib/kubelet" var ( config = flag.String("config", "", "Path to the config file or directory of files") syncFrequency = flag.Duration("sync_frequency", 10*time.Second, "Max period between synchronizing running containers and config") fileCheckFrequency = flag.Duration("file_check_frequency", 20*time.Second, "Duration between checking config files for new data") httpCheckFrequency = flag.Duration("http_check_frequency", 20*time.Second, "Duration between checking http for new data") manifestURL = flag.String("manifest_url", "", "URL for accessing the container manifest") enableServer = flag.Bool("enable_server", true, "Enable the info server") address = util.IP(net.ParseIP("127.0.0.1")) port = flag.Uint("port", ports.KubeletPort, "The port for the info server to serve on") hostnameOverride = flag.String("hostname_override", "", "If non-empty, will use this string as identification instead of the actual hostname.") networkContainerImage = flag.String("network_container_image", kubelet.NetworkContainerImage, "The image that network containers in each pod will use.") dockerEndpoint = flag.String("docker_endpoint", "", "If non-empty, use this for the docker endpoint to communicate with") etcdServerList util.StringList etcdConfigFile = flag.String("etcd_config", "", "The config file for the etcd client. Mutually exclusive with -etcd_servers") rootDirectory = flag.String("root_dir", defaultRootDir, "Directory path for managing kubelet files (volume mounts,etc).") allowPrivileged = flag.Bool("allow_privileged", false, "If true, allow containers to request privileged mode. [default=false]") registryPullQPS = flag.Float64("registry_qps", 0.0, "If > 0, limit registry pull QPS to this value. If 0, unlimited. [default=0.0]") registryBurst = flag.Int("registry_burst", 10, "Maximum size of a bursty pulls, temporarily allows pulls to burst to this number, while still not exceeding registry_qps. Only used if --registry_qps > 0") runonce = flag.Bool("runonce", false, "If true, exit after spawning pods from local manifests or remote urls. Exclusive with --etcd_servers, --api_servers, and --enable-server") enableDebuggingHandlers = flag.Bool("enable_debugging_handlers", true, "Enables server endpoints for log collection and local running of containers and commands") minimumGCAge = flag.Duration("minimum_container_ttl_duration", 1*time.Minute, "Minimum age for a finished container before it is garbage collected. Examples: '300ms', '10s' or '2h45m'") maxContainerCount = flag.Int("maximum_dead_containers_per_container", 5, "Maximum number of old instances of a container to retain per container. Each container takes up some disk space. Default: 5.")
"strconv" "time" "github.com/golang/glog" "github.com/spf13/pflag" kextensions "k8s.io/kubernetes/pkg/apis/extensions" kcache "k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/util" ) var ( argEtcdMutationTimeout = pflag.Duration("etcd-mutation-timeout", 10*time.Second, "Crash after retrying etcd mutation for a specified duration") argEtcdServer = pflag.String("etcd-server", "http://127.0.0.1:4001", "URL to etcd server") argKubecfgFile = pflag.String("kubecfg-file", "", "Location of kubecfg file for access to kubernetes master service; --kube-master-url overrides the URL part of this; if neither this nor --kube-master-url are provided, defaults to service account tokens") argKubeMasterURL = pflag.String("kube-master-url", "", "URL to reach kubernetes master. Env variables in this flag will be expanded.") argVersion = pflag.Bool("version", false, "Display the version number and exit.") ) // VERSION will be set at build time via linker magic. var VERSION string const ( // vulcand backend supported type backendType = "http" // Base vulcand etcd key etcdKey = "/vulcand" // vulcand frontend supported type frontendType = "http" // Maximum number of attempts to connect to etcd server. k8sAPIVersion = "v1" maxConnectAttempts = 12
"will be used.") readOnlyPort = flag.Int("read_only_port", 7080, ""+ "The port from which to serve read-only resources. If 0, don't serve on a "+ "read-only address. It is assumed that firewall rules are set up such that "+ "this port is not reachable from outside of the cluster.") securePort = flag.Int("secure_port", 8443, "The port from which to serve HTTPS with authentication and authorization. If 0, don't serve HTTPS ") tlsCertFile = flag.String("tls_cert_file", "", ""+ "File containing x509 Certificate for HTTPS. (CA cert, if any, concatenated after server cert). "+ "If HTTPS serving is enabled, and --tls_cert_file and --tls_private_key_file are not provided, "+ "a self-signed certificate and key are generated for the public address and saved to /var/run/kubernetes.") tlsPrivateKeyFile = flag.String("tls_private_key_file", "", "File containing x509 private key matching --tls_cert_file.") apiPrefix = flag.String("api_prefix", "/api", "The prefix for API requests on the server. Default '/api'.") storageVersion = flag.String("storage_version", "", "The version to store resources with. Defaults to server preferred") cloudProvider = flag.String("cloud_provider", "", "The provider for cloud services. Empty string for no provider.") cloudConfigFile = flag.String("cloud_config", "", "The path to the cloud provider configuration file. Empty string for no configuration file.") healthCheckMinions = flag.Bool("health_check_minions", true, "If true, health check minions and filter unhealthy ones. Default true.") eventTTL = flag.Duration("event_ttl", 48*time.Hour, "Amount of time to retain events. Default 2 days.") tokenAuthFile = flag.String("token_auth_file", "", "If set, the file that will be used to secure the secure port of the API server via token authentication.") authorizationMode = flag.String("authorization_mode", "AlwaysAllow", "Selects how to do authorization on the secure port. One of: "+strings.Join(apiserver.AuthorizationModeChoices, ",")) authorizationPolicyFile = flag.String("authorization_policy_file", "", "File with authorization policy in csv format, used with --authorization_mode=ABAC, on the secure port.") admissionControl = flag.String("admission_control", "AlwaysAdmit", "Ordered list of plug-ins to do admission control of resources into cluster. Comma-delimited list of: "+strings.Join(admission.GetPlugins(), ", ")) admissionControlConfigFile = flag.String("admission_control_config_file", "", "File with admission control configuration.") etcdServerList util.StringList etcdConfigFile = flag.String("etcd_config", "", "The config file for the etcd client. Mutually exclusive with -etcd_servers.") corsAllowedOriginList util.StringList allowPrivileged = flag.Bool("allow_privileged", false, "If true, allow privileged containers.") portalNet util.IPNet // TODO: make this a list enableLogsSupport = flag.Bool("enable_logs_support", true, "Enables server endpoint for log collection") runtimeConfig util.ConfigurationMap kubeletConfig = client.KubeletConfig{ Port: 10250,