-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathoptions.go
50 lines (41 loc) · 3.38 KB
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Copyright 2020 The Knative 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 gke
import (
"github.com/spf13/cobra"
"knative.dev/toolbox/pkg/clustermanager/kubetest2"
)
func addOptions(gkeCmd *cobra.Command, cfg *kubetest2.GKEClusterConfig) {
f := gkeCmd.Flags()
f.StringVar(&cfg.GCPServiceAccount, "gcp-service-account", "", "The GCP service account used for creating the cluster.")
f.StringVar(&cfg.Environment, "environment", "prod", "The GKE environment, must be one of prod, staging, staging2 and test.")
f.StringVar(&cfg.CommandGroup, "command-group", "", "The gcloud command group, must be alpha, beta or empty.")
f.StringVar(&cfg.GCPProjectID, "gcp-project-id", "", "GCP project ID for creating the cluster")
f.StringVar(&cfg.Name, "name", "", "The GKE cluster name.")
f.StringVar(&cfg.Region, "region", "us-east1", "The region to create the GKE cluster.")
f.StringSliceVar(&cfg.BackupRegions, "backup-regions", []string{"us-west1", "us-central1"}, "The backup regions if the cluster creation runs into stockout issue in the primary region.")
f.StringVar(&cfg.Machine, "machine", "e2-standard-4", "The machine type for the GKE cluster.")
f.IntVar(&cfg.MinNodes, "min-nodes", 1, "The minimum number of nodes.")
f.IntVar(&cfg.MaxNodes, "max-nodes", 3, "The maximum number of nodes.")
f.StringVar(&cfg.ImageType, "image-type", "cos_containerd", "The image type to use for the cluster.")
f.StringVar(&cfg.Network, "network", "e2e-network", "The network name for the GKE cluster.")
f.StringVar(&cfg.ReleaseChannel, "release-channel", "", "The release channel of the GKE cluster, can be one of (empty, rapid, regular, stable). When it's used, --cluster-version must be empty or a valid version in the channel."+
"Reference: https://cloud.google.com/kubernetes-engine/docs/concepts/release-channels")
f.StringVar(&cfg.Version, "cluster-version", "latest", "The version of the GKE cluster. If --release-channel is not empty, it must be empty or a valid version in the channel")
f.StringVar(&cfg.Scopes, "scopes", "cloud-platform", "Scopes for the GKE cluster, should be comma-separated.")
f.StringVar(&cfg.Addons, "addons", "", "Addons for the GKE cluster, should be comma-separated.")
f.BoolVar(&cfg.EnableWorkloadIdentity, "enable-workload-identity", false, "Whether to enable workload identity for this cluster or not.")
f.StringVar(&cfg.PrivateClusterAccessLevel, "private-cluster-access-level", "", "Private cluster access level, if not empty, must be one of 'no', 'limited' or 'unrestricted'")
f.StringSliceVar(&cfg.PrivateClusterMasterIPSubnetRange, "private-cluster-master-ip-subnet-range", []string{"172.16.0.32/28", "173.16.0.32/28", "174.16.0.32/28"}, "The master IP subnet range for the private cluster. Its length must be the same as the number of clusters if private cluster is requested.")
f.StringVar(&cfg.ExtraGcloudFlags, "extra-gcloud-flags", "", "The extra gcloud flags that will be used for cluster creation.")
}