mirror of https://github.com/kubernetes/kops.git
parent
8b8bb18815
commit
8a1934ae8b
3
Makefile
3
Makefile
|
|
@ -77,6 +77,7 @@ codegen: kops-gobindata
|
|||
|
||||
test:
|
||||
go test k8s.io/kops/upup/pkg/... -args -v=1 -logtostderr
|
||||
go test k8s.io/kops/pkg/... -args -v=1 -logtostderr
|
||||
|
||||
crossbuild:
|
||||
mkdir -p .build/dist/
|
||||
|
|
@ -199,6 +200,7 @@ gofmt:
|
|||
gofmt -w -s cmd/
|
||||
gofmt -w -s examples/
|
||||
gofmt -w -s federation/
|
||||
gofmt -w -s pkg/
|
||||
gofmt -w -s util/
|
||||
gofmt -w -s upup/pkg/
|
||||
gofmt -w -s pkg/
|
||||
|
|
@ -211,6 +213,7 @@ gofmt:
|
|||
govet:
|
||||
go vet \
|
||||
k8s.io/kops/cmd/... \
|
||||
k8s.io/kops/pkg/... \
|
||||
k8s.io/kops/channels/... \
|
||||
k8s.io/kops/examples/... \
|
||||
k8s.io/kops/federation/... \
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import (
|
|||
|
||||
// not used too much yet :)
|
||||
type ValidateClusterCmd struct {
|
||||
FullSpec bool
|
||||
}
|
||||
|
||||
var validateClusterCmd ValidateClusterCmd
|
||||
|
|
@ -53,29 +52,27 @@ func init() {
|
|||
}
|
||||
|
||||
validateCmd.cobraCommand.AddCommand(cmd)
|
||||
|
||||
//cmd.Flags().BoolVar(&validateClusterCmd.FullSpec, "full", false, "Validate a cluster")
|
||||
}
|
||||
|
||||
// Run a validation
|
||||
// Validate Your Kubernetes Cluster
|
||||
func (c *ValidateClusterCmd) Run(args []string) error {
|
||||
|
||||
err := rootCommand.ProcessArgs(args)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("Process args filed %v", err)
|
||||
}
|
||||
|
||||
cluster, err := rootCommand.Cluster()
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("Cannot get cluster for %v", err)
|
||||
}
|
||||
|
||||
clientset, err := rootCommand.Clientset()
|
||||
clientSet, err := rootCommand.Clientset()
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("Cannot get clientSet for %q: %v", cluster.Name, err)
|
||||
}
|
||||
|
||||
list, err := clientset.InstanceGroups(cluster.Name).List(k8sapi.ListOptions{})
|
||||
list, err := clientSet.InstanceGroups(cluster.Name).List(k8sapi.ListOptions{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Cannot get nodes for %q: %v", cluster.Name, err)
|
||||
}
|
||||
|
|
@ -143,9 +140,8 @@ func (c *ValidateClusterCmd) Run(args []string) error {
|
|||
return role
|
||||
})
|
||||
|
||||
nodes := validationCluster.NodeList
|
||||
fmt.Println("\nNODE STATUS")
|
||||
err = t.Render(nodes.Items, os.Stdout, "NAME", "ROLE", "READY")
|
||||
err = t.Render(validationCluster.NodeList.Items, os.Stdout, "NAME", "ROLE", "READY")
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Cannot render nodes for %q: %v", cluster.Name, err)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ It allows you to create, destroy, upgrade and maintain clusters.
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
@ -37,5 +37,6 @@ It allows you to create, destroy, upgrade and maintain clusters.
|
|||
* [kops toolbox](kops_toolbox.md) - Misc infrequently used commands
|
||||
* [kops update](kops_update.md) - update clusters
|
||||
* [kops upgrade](kops_upgrade.md) - upgrade clusters
|
||||
* [kops validate](kops_validate.md) - validate a kubernetes cluster
|
||||
* [kops version](kops_version.md) - Print the client version information
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ kops completion
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ kops create -f FILENAME
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -25,18 +25,17 @@ kops create cluster
|
|||
--master-zones string Zones in which to run masters (must be an odd number)
|
||||
--model string Models to apply (separate multiple models with commas) (default "config,proto,cloudup")
|
||||
--network-cidr string Set to override the default network CIDR
|
||||
--networking string Networking mode to use. kubenet (default), classic, external, cni. (default "kubenet")
|
||||
--networking string Networking mode to use. kubenet (default), classic, external, cni, kopeio-vxlan, weave. (default "kubenet")
|
||||
--node-count int Set the number of nodes
|
||||
--node-size string Set instance size for nodes
|
||||
--out string Path to write any local output
|
||||
--project string Project to use (must be set on GCE)
|
||||
--ssh-public-key string SSH public key to use (default "~/.ssh/id_rsa.pub")
|
||||
--target string Target - direct, terraform (default "direct")
|
||||
-t, --topology string Controls network topology for the cluster. public|private. Default is 'public'. (default "public")
|
||||
--vpc string Set to use a shared VPC
|
||||
--yes Specify --yes to immediately create the cluster
|
||||
--zones string Zones in which to run the cluster
|
||||
--topology string Specify --topology=[public|private] to enable/disable public/private networking for all master and nodes. Default is 'public'
|
||||
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
|
@ -48,7 +47,7 @@ kops create cluster
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
@ -56,3 +55,4 @@ kops create cluster
|
|||
|
||||
### SEE ALSO
|
||||
* [kops create](kops_create.md) - Create a resource by filename or stdin
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops create instancegroup
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Create secrets.
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ kops create secret sshpublickey
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Delete clusters
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ kops delete cluster CLUSTERNAME [--yes]
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops delete instancegroup
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops delete secret
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ describe objects
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ kops describe secrets
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ edit items
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops edit cluster
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops edit federation
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops edit instancegroup
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export clusters/kubecfg
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops export kubecfg CLUSTERNAME
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ list or get objects
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ kops get clusters
|
|||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
-o, --output string output format. One of: table, yaml (default "table")
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ kops get federations
|
|||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
-o, --output string output format. One of: table, yaml (default "table")
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ kops get instancegroups
|
|||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
-o, --output string output format. One of: table, yaml (default "table")
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ kops get secrets
|
|||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
-o, --output string output format. One of: table, yaml (default "table")
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import clusters
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ kops import cluster
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ rolling update clusters
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ kops rolling-update cluster
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Manage secrets & keys
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops secrets create
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops secrets describe
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops secrets expose
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops secrets get
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Misc infrequently used commands
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ kops toolbox convert-imported
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Update clusters
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ kops update cluster
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ kops update federation
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ upgrade clusters
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ kops upgrade cluster
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
## kops validate
|
||||
|
||||
validate a kubernetes cluster
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
validate a kubernetes cluster
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-o, --output string output format. One of: table, yaml (default "table")
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--config string config file (default is $HOME/.kops.yaml)
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [kops](kops.md) - kops is kubernetes ops
|
||||
* [kops validate cluster](kops_validate_cluster.md) - Validate cluster
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
## kops validate cluster
|
||||
|
||||
Validate cluster
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Validate a kubernetes cluster
|
||||
|
||||
```
|
||||
kops validate cluster
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--config string config file (default is $HOME/.kops.yaml)
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
-o, --output string output format. One of: table, yaml (default "table")
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [kops validate](kops_validate.md) - validate a kubernetes cluster
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ kops version
|
|||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files (default false)
|
||||
--name string Name of cluster
|
||||
--state string Location of state storage
|
||||
--state string Location of state storage (default "s3://oscar-ai-k8s-dev")
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
|
|
|
|||
|
|
@ -344,6 +344,19 @@ func isNodeStatusDefined(node *v1.Node) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Get The Status of a Node
|
||||
func GetNodeConditionStatus(nodeConditions []v1.NodeCondition) v1.ConditionStatus {
|
||||
s := v1.ConditionUnknown
|
||||
for _, element := range nodeConditions {
|
||||
if element.Type == "Ready" {
|
||||
s = element.Status
|
||||
break
|
||||
}
|
||||
}
|
||||
return s
|
||||
|
||||
}
|
||||
|
||||
// Node is ready if:
|
||||
// 1) it's Ready condition is set to true
|
||||
// 2) doesn't have NetworkUnavailable condition set to true
|
||||
|
|
|
|||
|
|
@ -18,11 +18,9 @@ package kops
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"fmt"
|
||||
|
||||
//"github.com/golang/glog"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
|
||||
|
|
@ -33,25 +31,25 @@ const (
|
|||
|
||||
// A cluster to validate
|
||||
type ValidationCluster struct {
|
||||
MastersReady bool
|
||||
MastersReadyArray []*ValidationNode
|
||||
MastersNotReadyArray []*ValidationNode
|
||||
MastersCount int
|
||||
MastersReady bool `json:"mastersReady,omitempty"`
|
||||
MastersReadyArray []*ValidationNode `json:"mastersReadyArray,omitempty"`
|
||||
MastersNotReadyArray []*ValidationNode `json:"mastersNotReadyArray,omitempty"`
|
||||
MastersCount int `json:"mastersCount,omitempty"`
|
||||
|
||||
NodesReady bool
|
||||
NodesReadyArray []*ValidationNode
|
||||
NodesNotReadyArray []*ValidationNode
|
||||
NodesCount int
|
||||
NodesReady bool `json:"nodesReady,omitempty"`
|
||||
NodesReadyArray []*ValidationNode `json:"nodesReadyArray,omitempty"`
|
||||
NodesNotReadyArray []*ValidationNode `json:"nodesNotReadyArray,omitempty"`
|
||||
NodesCount int `json:"nodesCount,omitempty"`
|
||||
|
||||
NodeList *v1.NodeList
|
||||
NodeList *v1.NodeList `json:"nodeList,omitempty"`
|
||||
}
|
||||
|
||||
// A K8s node to be validated
|
||||
type ValidationNode struct {
|
||||
Zone string
|
||||
Role string
|
||||
Hostname string
|
||||
Status v1.ConditionStatus
|
||||
Zone string `json:"zone,omitempty"`
|
||||
Role string `json:"role,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Status v1.ConditionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ValidateClusterWithIg validate a k8s clsuter with a provided instance group list
|
||||
|
|
@ -59,6 +57,7 @@ func ValidateCluster(clusterName string, instanceGroupList *InstanceGroupList) (
|
|||
|
||||
var instanceGroups []*InstanceGroup
|
||||
validationCluster := &ValidationCluster{}
|
||||
|
||||
for i := range instanceGroupList.Items {
|
||||
ig := &instanceGroupList.Items[i]
|
||||
instanceGroups = append(instanceGroups, ig)
|
||||
|
|
@ -89,8 +88,20 @@ func ValidateCluster(clusterName string, instanceGroupList *InstanceGroupList) (
|
|||
return nil, fmt.Errorf("Cannot get nodes for %q: %v", clusterName, err)
|
||||
}
|
||||
|
||||
return validateTheNodes(clusterName,validationCluster)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func validateTheNodes(clusterName string, validationCluster *ValidationCluster) (*ValidationCluster, error) {
|
||||
nodes := validationCluster.NodeList
|
||||
|
||||
if nodes == nil || nodes.Items == nil {
|
||||
return validationCluster, errors.New("No nodes found in validationCluster")
|
||||
}
|
||||
|
||||
for _, node := range nodes.Items {
|
||||
|
||||
role := Node
|
||||
|
|
@ -144,15 +155,3 @@ func ValidateCluster(clusterName string, instanceGroupList *InstanceGroupList) (
|
|||
return validationCluster, fmt.Errorf("You cluster is NOT ready %s", clusterName)
|
||||
}
|
||||
}
|
||||
|
||||
func GetNodeConditionStatus(nodeConditions []v1.NodeCondition) v1.ConditionStatus {
|
||||
s := v1.ConditionUnknown
|
||||
for _, element := range nodeConditions {
|
||||
if element.Type == "Ready" {
|
||||
s = element.Status
|
||||
break
|
||||
}
|
||||
}
|
||||
return s
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,220 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package kops
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"fmt"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/resource"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
|
||||
)
|
||||
|
||||
func Test_ValidateClusterPositive(t *testing.T) {
|
||||
|
||||
nodeList, err := dummyClient("true", "true").Core().Nodes().List(v1.ListOptions{})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
validationCluster := &ValidationCluster{NodeList: nodeList, NodesCount: 1, MastersCount: 1}
|
||||
validationCluster, err = validateTheNodes("foo", validationCluster)
|
||||
|
||||
if err != nil {
|
||||
printDebug(validationCluster)
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ValidateClusterMasterAndNodeNotReady(t *testing.T) {
|
||||
|
||||
nodeList, err := dummyClient("false", "false").Core().Nodes().List(v1.ListOptions{})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
validationCluster := &ValidationCluster{NodeList: nodeList, NodesCount: 1, MastersCount: 1}
|
||||
validationCluster, err = validateTheNodes("foo", validationCluster)
|
||||
|
||||
if err == nil {
|
||||
printDebug(validationCluster)
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ValidateClusterNodeNotReady(t *testing.T) {
|
||||
|
||||
nodeList, err := dummyClient("true", "false").Core().Nodes().List(v1.ListOptions{})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
validationCluster := &ValidationCluster{NodeList: nodeList, NodesCount: 1, MastersCount: 1}
|
||||
validationCluster, err = validateTheNodes("foo", validationCluster)
|
||||
|
||||
if err == nil {
|
||||
printDebug(validationCluster)
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ValidateClusterMastersNotEnough(t *testing.T) {
|
||||
|
||||
nodeList, err := dummyClient("true", "true").Core().Nodes().List(v1.ListOptions{})
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
validationCluster := &ValidationCluster{NodeList: nodeList, NodesCount: 1, MastersCount: 3}
|
||||
validationCluster, err = validateTheNodes("foo", validationCluster)
|
||||
|
||||
if err == nil {
|
||||
printDebug(validationCluster)
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func printDebug(validationCluster *ValidationCluster) {
|
||||
fmt.Printf("cluster - masters ready: %v, nodes ready: %v\n", validationCluster.MastersReady, validationCluster.NodesReady)
|
||||
fmt.Printf("mastersNotReady %v\n", len(validationCluster.MastersNotReadyArray))
|
||||
fmt.Printf("mastersCount %v, mastersReady %v\n", validationCluster.MastersCount, len(validationCluster.MastersReadyArray))
|
||||
fmt.Printf("nodesNotReady %v\n", len(validationCluster.NodesNotReadyArray))
|
||||
fmt.Printf("nodesCount %v, nodesReady %v\n", validationCluster.NodesCount, len(validationCluster.NodesReadyArray))
|
||||
|
||||
}
|
||||
|
||||
const NODE_READY = "nodeReady"
|
||||
|
||||
func dummyClient(masterReady string, nodeReady string) *fake.Clientset {
|
||||
return fake.NewSimpleClientset(makeNodeList(
|
||||
[]map[string]string{
|
||||
{
|
||||
"name": "master1",
|
||||
"kubernetes.io/role": "master",
|
||||
NODE_READY: masterReady,
|
||||
},
|
||||
{
|
||||
"name": "node1",
|
||||
"kubernetes.io/role": "node",
|
||||
NODE_READY: nodeReady,
|
||||
},
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
func dummyNode(nodeMap map[string]string) v1.Node {
|
||||
|
||||
nodeReady := v1.ConditionFalse
|
||||
if nodeMap[NODE_READY] == "true" {
|
||||
nodeReady = v1.ConditionTrue
|
||||
}
|
||||
expectedNode := v1.Node{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: nodeMap["name"],
|
||||
Labels: map[string]string{
|
||||
"kubernetes.io/role": nodeMap["kubernetes.io/role"],
|
||||
},
|
||||
},
|
||||
Spec: v1.NodeSpec{},
|
||||
Status: v1.NodeStatus{
|
||||
Conditions: []v1.NodeCondition{
|
||||
{
|
||||
Type: v1.NodeOutOfDisk,
|
||||
Status: v1.ConditionTrue,
|
||||
Reason: "KubeletOutOfDisk",
|
||||
Message: "out of disk space",
|
||||
},
|
||||
{
|
||||
Type: v1.NodeMemoryPressure,
|
||||
Status: v1.ConditionFalse,
|
||||
Reason: "KubeletHasSufficientMemory",
|
||||
Message: "kubelet has sufficient memory available",
|
||||
},
|
||||
{
|
||||
Type: v1.NodeDiskPressure,
|
||||
Status: v1.ConditionFalse,
|
||||
Reason: "KubeletHasSufficientDisk",
|
||||
Message: "kubelet has sufficient disk space available",
|
||||
},
|
||||
{
|
||||
Type: v1.NodeReady,
|
||||
Status: nodeReady,
|
||||
Reason: "KubeletReady",
|
||||
Message: "kubelet is posting ready status",
|
||||
},
|
||||
},
|
||||
NodeInfo: v1.NodeSystemInfo{
|
||||
MachineID: "123",
|
||||
SystemUUID: "abc",
|
||||
BootID: "1b3",
|
||||
KernelVersion: "3.16.0-0.bpo.4-amd64",
|
||||
OSImage: "Debian GNU/Linux 7 (wheezy)",
|
||||
//OperatingSystem: goruntime.GOOS,
|
||||
//Architecture: goruntime.GOARCH,
|
||||
ContainerRuntimeVersion: "test://1.5.0",
|
||||
//KubeletVersion: version.Get().String(),
|
||||
//KubeProxyVersion: version.Get().String(),
|
||||
},
|
||||
Capacity: v1.ResourceList{
|
||||
v1.ResourceCPU: *resource.NewMilliQuantity(2000, resource.DecimalSI),
|
||||
v1.ResourceMemory: *resource.NewQuantity(20E9, resource.BinarySI),
|
||||
v1.ResourcePods: *resource.NewQuantity(0, resource.DecimalSI),
|
||||
v1.ResourceNvidiaGPU: *resource.NewQuantity(0, resource.DecimalSI),
|
||||
},
|
||||
Allocatable: v1.ResourceList{
|
||||
v1.ResourceCPU: *resource.NewMilliQuantity(1800, resource.DecimalSI),
|
||||
v1.ResourceMemory: *resource.NewQuantity(19900E6, resource.BinarySI),
|
||||
v1.ResourcePods: *resource.NewQuantity(0, resource.DecimalSI),
|
||||
v1.ResourceNvidiaGPU: *resource.NewQuantity(0, resource.DecimalSI),
|
||||
},
|
||||
Addresses: []v1.NodeAddress{
|
||||
{Type: v1.NodeLegacyHostIP, Address: "127.0.0.1"},
|
||||
{Type: v1.NodeInternalIP, Address: "127.0.0.1"},
|
||||
{Type: v1.NodeHostName, Address: nodeMap["name"]},
|
||||
},
|
||||
// images will be sorted from max to min in node status.
|
||||
Images: []v1.ContainerImage{
|
||||
{
|
||||
Names: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"},
|
||||
SizeBytes: 456,
|
||||
},
|
||||
{
|
||||
Names: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"},
|
||||
SizeBytes: 123,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
return expectedNode
|
||||
}
|
||||
|
||||
// MakeNodeList constructs api.NodeList from list of node names and a NodeResource.
|
||||
func makeNodeList(nodes []map[string]string) *v1.NodeList {
|
||||
list := v1.NodeList{
|
||||
Items: make([]v1.Node, len(nodes)),
|
||||
}
|
||||
for i := range nodes {
|
||||
list.Items[i] = dummyNode(nodes[i])
|
||||
}
|
||||
return &list
|
||||
}
|
||||
Loading…
Reference in New Issue