Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var APIDocs = &cobra.Command{ Use: "api", Short: "Generate docs ", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { printAPIDocs(args) }, }
View Source
var Access = &cobra.Command{
Use: "kubeconfig",
Short: "Generate kubeconfig files",
}
View Source
var Apply = &cobra.Command{ Use: "apply", Short: "Apply a configuration to a resource by filename", Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { ns, _ := cmd.Flags().GetString("namespace") p := getPlatform(cmd) for _, spec := range args { data, err := ioutil.ReadFile(spec) if err != nil { log.Fatalf("Could not read %s: %v", spec, err) } template, err := text.Template(string(data), p.PlatformConfig) if err != nil { log.Fatalf("failed to template %s: %v", spec, err) } if err := p.ApplyText(ns, template); err != nil { log.Fatalf("failed to apply %s: %v", spec, err) } } }, }
View Source
var Backup = &cobra.Command{ Use: "backup", Short: "Create new velero backup", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { if _, err := velero.CreateBackup(getPlatform(cmd)); err != nil { log.Fatalf("Error creating backup %v", err) } }, }
View Source
var CA = &cobra.Command{
Use: "ca",
Short: "Commands for generating CA certs",
}
View Source
var Cleanup = &cobra.Command{ Use: "cleanup", Aliases: []string{"terminate"}, Short: "Terminate a cluster and destroy all VM's and resources associated with it", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { if err := provision.Cleanup(getPlatform(cmd)); err != nil { log.Fatalf("Failed to cleanup cluster, %s", err) } }, }
View Source
var Config = &cobra.Command{
Use: "config",
Short: "Commands for working with config files",
}
View Source
var Conformance = &cobra.Command{ Use: "conformance", Short: "Run conformance tests using sonobuoy", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { if err := phases.ConformanceTest(getPlatform(cmd), phases.ConformanceTestOptions{ Certification: certification, KubeBench: kubeBench, Quick: quick, Wait: wait, OutputDir: outputDir, }); err != nil { log.Fatalf("Failed to run conformance tests: %v", err) } }, }
View Source
var Consul = &cobra.Command{
Use: "consul",
}
View Source
var DB = &cobra.Command{
Use: "db",
}
View Source
var DNS = &cobra.Command{
Use: "dns",
}
View Source
var Deploy = &cobra.Command{
Use: "deploy",
}
View Source
var Exec = &cobra.Command{ Use: "exec", Short: "Execute a shell command inside pods matching selector", Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { command := args[0] args = args[1:] if len(args) > 0 { command = command + " " + strings.Join(args, " ") } ns, _ := cmd.Flags().GetString("namespace") container, _ := cmd.Flags().GetString("container") selector, _ := cmd.Flags().GetString("selector") p := getPlatform(cmd) client, err := p.GetClientset() if err != nil { log.Fatalf("unable to get clientset: %v", err) } pods, err := client.CoreV1().Pods(ns).List(metav1.ListOptions{LabelSelector: selector}) if err != nil { log.Fatalf("unable to list pods: %v", err) } for _, pod := range pods.Items { if pod.Status.Phase != v1.PodRunning { log.Warnf("Skipping %s in %s phase", pod.Name, pod.Status.Phase) continue } _container := container if _container == "" { _container = pod.Spec.Containers[0].Name } stdout, stderr, err := p.ExecutePodf(ns, pod.Name, _container, command) if err != nil { log.Errorf("[%s/%s] %s %s %v", pod.Name, _container, stdout, stderr, err) } else { log.Infof("[%s/%s] %s %s", pod.Name, _container, stdout, stderr) } } }, }
View Source
var ExecNode = &cobra.Command{ Use: "exec-node", Short: "Execute a shell command inside host mounted daemonset on each node", Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { command := args[0] args = args[1:] if len(args) > 0 { command = command + " " + strings.Join(args, " ") } selector, _ := cmd.Flags().GetString("selector") p := getPlatform(cmd) client, err := p.GetClientset() if err != nil { log.Fatalf("unable to get clientset: %v", err) } nodes, err := client.CoreV1().Nodes().List(metav1.ListOptions{ LabelSelector: selector, }) if err != nil { log.Fatalf("unable to list nodes: %v", err) } for _, node := range nodes.Items { stdout, err := p.Executef(node.Name, 60*time.Second, command) if err != nil { log.Errorf("[%s] %s %v", node.Name, stdout, err) } else { log.Infof("[%s] %s", node.Name, stdout) } } }, }
View Source
var Harbor = &cobra.Command{
Use: "harbor",
Short: "Commmands for deploying and interacting with harbor",
}
Harbor is the parent command for interactor with the harbor docker registry
View Source
var Images = &cobra.Command{
Use: "images",
Short: "Commands for working with docker images",
}
View Source
var Logs = &cobra.Command{ Use: "logs", Short: "Retrieve and export logs from ElasticSearch", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { name, _ := cmd.Flags().GetString("name") kql, _ := cmd.Flags().GetString("query") pod, _ := cmd.Flags().GetString("pod") count, _ := cmd.Flags().GetInt("count") namespace, _ := cmd.Flags().GetString("namespace") cluster, _ := cmd.Flags().GetString("cluster") since, _ := cmd.Flags().GetString("since") from, _ := cmd.Flags().GetString("from") to, _ := cmd.Flags().GetString("to") timestamps, _ := cmd.Flags().GetBool("timestamps") if err := elastic.ExportLogs(getPlatform(cmd), name, elastic.Query{ Pod: pod, Count: count, Cluster: cluster, Namespace: namespace, Since: since, Query: kql, From: from, Timestamps: timestamps, To: to, }); err != nil { log.Fatalf("Failed to export logs, %s", err) } }, }
View Source
var MachineImages = &cobra.Command{ Use: "machine-images", Aliases: []string{"vm"}, Short: "Commands for working with machine images", }
View Source
var NSX = &cobra.Command{
Use: "nsx",
Short: "Commands for interacting with NSX clusters",
}
View Source
var Namespace = &cobra.Command{
Use: "namespace",
Short: "Commands for manipulating namespaces",
}
View Source
var Opa = &cobra.Command{
Use: "opa",
}
View Source
var PhaseOrder = []string{"calico", "nsx", "base", "stubs", "postgres-operator", "dex", "vault"}
View Source
var Phases = map[string]DeployFn{ "auditbeat": auditbeat.Deploy, "base": base.Install, "calico": calico.Install, "canary": canary.Deploy, "configmap-reloader": configmapreloader.Deploy, "dex": dex.Install, "eck": eck.Deploy, "elasticsearch": elasticsearch.Deploy, "eventrouter": eventrouter.Deploy, "fluentd": fluentdoperator.Deploy, "filebeat": filebeat.Deploy, "gitops": flux.Install, "harbor": harbor.Deploy, "journalbeat": journalbeat.Deploy, "kube-web-view": kubewebview.Install, "monitoring": monitoring.Install, "opa": opa.Install, "nsx": nsx.Install, "packetbeat": packetbeat.Deploy, "postgres-operator": postgresoperator.Deploy, "registry-creds": registrycreds.Install, "s3-upload-cleaner": s3uploadcleaner.Deploy, "sealed-secrets": sealedsecrets.Install, "stubs": stubs.Install, "tekton": tekton.Install, "vault": vault.Deploy, "velero": velero.Install, }
View Source
var PhasesExtra = map[string]DeployFn{ "cert-manager": certmanager.Install, "platform-operator": platformoperator.Install, "vsphere": vsphere.Install, "quack": quack.Install, }
View Source
var Provision = &cobra.Command{
Use: "provision",
Short: "Commands for provisioning clusters and VMs",
}
View Source
var Render = &cobra.Command{ Use: "render", Short: "Generate kubeconfig files", Run: func(cmd *cobra.Command, args []string) { base := getConfig(cmd) data, _ := yaml.Marshal(base) fmt.Println(string(data)) }, }
View Source
var Report = &cobra.Command{
Use: "report",
}
View Source
var Rolling = &cobra.Command{
Use: "rolling",
}
View Source
var RollingRestart = &cobra.Command{ Use: "restart", Short: "Rolling restart of all nodes", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { if err := provision.RollingRestart(getPlatform(cmd), rollingOpts); err != nil { log.Fatalf("Failed to restart nodes, %s", err) } }, }
View Source
var RollingUpdate = &cobra.Command{ Use: "update", Short: "Rolling update of all nodes", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { if err := provision.RollingUpdate(getPlatform(cmd), rollingOpts); err != nil { log.Fatalf("Failed to update nodes %s", err) } }, }
View Source
var Snapshot = &cobra.Command{ Use: "snapshot", Short: "Take a snapshot of the running system", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { opts.Namespaces = args if err := snapshot.Take(getPlatform(cmd), opts); err != nil { log.Fatalf("Failed to get cluster snapshot, %s", err) } }, }
View Source
var Status = &cobra.Command{ Use: "status", Short: "Print the status of the cluster and each node", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { if err := provision.Status(getPlatform(cmd)); err != nil { logger.Fatalf("Failed to get cluster status, %s", err) } }, }
View Source
var TerminateNodes = &cobra.Command{ Use: "terminate-node [nodes]", Short: "Cordon and terminate the specified nodes", Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { if err := provision.TerminateNodes(getPlatform(cmd), args); err != nil { log.Fatalf("Failed terminate nodes %s", err) } }, }
View Source
var TerminateOrphans = &cobra.Command{ Use: "terminate-orphans", Short: "Terminate all orphaned VM's that have not successfully joined the cluster", Run: func(cmd *cobra.Command, args []string) { if err := provision.TerminateOrphans(getPlatform(cmd)); err != nil { log.Fatalf("Failed terminate nodes %s", err) } }, }
View Source
var Test = &cobra.Command{
Use: "test",
}
View Source
var Upgrade = &cobra.Command{ Use: "upgrade", Short: "Upgrade the kubernetes control plane", Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { if err := provision.Upgrade(getPlatform(cmd)); err != nil { logger.Fatalf("Failed to upgrade cluster, %s", err) } }, }
View Source
var Vault = &cobra.Command{
Use: "vault",
Short: "Commands for working with vault",
}
Functions ¶
func GlobalPreRun ¶
Types ¶
type KubeTypes ¶
type KubeTypes []Pair
KubeTypes is an array to represent all available types in a parsed file. [0] is for the type itself
func ParseDocumentationFrom ¶
ParseDocumentationFrom gets all types' documentation and returns them as an array. Each type is again represented as an array (we have to use arrays as we need to be sure for the order of the fields). This function returns fields and struct definitions that have no documentation as {name, ""}.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.