Skip to content

Commit

Permalink
[PLAT-10499][PLAT-10777][PLAT-11248]Support CRUD operations for Provi…
Browse files Browse the repository at this point in the history
…ders - Create kubernetes provider

Summary:
```
Create a Kubernetes provider in YugabyteDB Anywhere

Usage:
  yba provider create kubernetes [flags]

Aliases:
  kubernetes, k8s

Flags:
      --type string               [Required] Kubernetes cloud type. Allowed values: aks, eks, gke, custom.
      --image-registry string     [Optional] Kubernetes Image Registry. (default "quay.io/yugabyte/yugabyte")
      --pull-secret-file string   [Required] Kuberenetes Pull Secret File Path.
      --kubeconfig-file string    [Optional] Kuberenetes Config File Path.
      --storage-class string      [Optional] Kubernetes Storage Class.
      --region stringArray        [Required] Region associated with the Kubernetes provider. Minimum number of required regions = 1. Provide the following comma separated fields as key-value pairs:"region-name=<region-name>,config-name=<config-name>,config-file-path=<path-for-the-kubernetes-region-config-file>,storage-class=<storage-class>,cert-manager-cluster-issuer=<cert-manager-cluster-issuer>,cert-manager-issuer=<cert-manager-issuer>,domain=<domain>,namespace=<namespace>,pod-address-template=<pod-address-template>,overrirdes-file-path=<path-for-file-contanining-overries>". Region name is a required key-value. Config name (and Config File Path provided together), Storage Class, Cert Manager Cluster Issuer, Cert Manager Issuer, Domain, Namespace, Pod Address Template and Overrides File Path are optional. Each region needs to be added using a separate --region flag.
      --zone stringArray          [Required] Zone associated to the Kubernetes Region defined. Provide the following comma separated fields as key-value pairs:"zone-name=<zone-name>,region-name=<region-name>,config-name=<config-name>,config-file-path=<path-for-the-kubernetes-region-config-file>,storage-class=<storage-class>,cert-manager-cluster-issuer=<cert-manager-cluster-issuer>,cert-manager-issuer=<cert-manager-issuer>,domain=<domain>,namespace=<namespace>,pod-address-template=<pod-address-template>,overrirdes-file-path=<path-for-file-contanining-overries>". Zone name and Region name are required values.  Config name (and Config File Path provided together), Storage Class, Cert Manager Cluster Issuer, Cert Manager Issuer, Domain, Namespace, Pod Address Template and Overrides File Path are optional. Each --region definition must have atleast one corresponding --zone definition. Multiple --zone definitions can be provided per region.Each zone needs to be added using a separate --zone flag.
      --airgap-install            [Optional] Do YugabyteDB nodes have access to public internet to download packages.
  -h, --help                      help for kubernetes

Global Flags:
  -a, --apiToken string        YugabyteDB Anywhere api token.
      --config string          Config file, defaults to $HOME/.yba-cli.yaml
      --debug                  Use debug mode, same as --logLevel debug.
  -H, --host string            YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string        Select the desired log level format. (default "info")
      --no-color               Disable colors in output , defaults to false.
  -o, --output string          Select the desired output format. Allowed values: table, json, pretty. (default "table")
  -n, --provider-name string   [Required] The name of the provider to be created.
      --timeout duration       Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait                   Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Test Plan:
Creating a provider with overrides in one zone:
```
./yba provider create kubernetes -n dkumar --type gke \
--pull-secret-file <YAML file path> \
--region region-name=us-west1 \
--zone zone-name=us-west1-b,region-name=us-west1,storage-class=yb-standard,overrirdes-file-path=<YAML file path> \
--zone zone-name=us-west1-a,region-name=us-west1,storage-class=yb-standard \
--zone zone-name=us-west1-c,region-name=us-west1,storage-class=yb-standard --debug
```

Reviewers: sneelakantan, vpatibandla

Reviewed By: sneelakantan

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D31006
  • Loading branch information
Deepti-yb committed Mar 8, 2024
1 parent 6a12204 commit 4082892
Show file tree
Hide file tree
Showing 13 changed files with 673 additions and 24 deletions.
2 changes: 1 addition & 1 deletion managed/yba-cli/cmd/provider/create/aws_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func init() {
"custom-ssh-keypair-file-path")

createAWSProviderCmd.Flags().Bool("airgap-install", false,
"[Optional] Are YugabyteDB nodes installed in an air-gapped environment, "+
"[Optional] Are YugabyteDB nodes installed in an air-gapped environment,"+
" lacking access to the public internet for package downloads, "+
"defaults to false.")

Expand Down
2 changes: 1 addition & 1 deletion managed/yba-cli/cmd/provider/create/azu_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func init() {
"custom-ssh-keypair-file-path")

createAzureProviderCmd.Flags().Bool("airgap-install", false,
"[Optional] Are YugabyteDB nodes installed in an air-gapped environment, "+
"[Optional] Are YugabyteDB nodes installed in an air-gapped environment,"+
" lacking access to the public internet for package downloads, "+
"defaults to false.")
}
Expand Down
2 changes: 1 addition & 1 deletion managed/yba-cli/cmd/provider/create/create_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func init() {
CreateProviderCmd.AddCommand(createAWSProviderCmd)
CreateProviderCmd.AddCommand(createGCPProviderCmd)
CreateProviderCmd.AddCommand(createAzureProviderCmd)
// CreateProviderCmd.AddCommand(createK8sProviderCmd)
CreateProviderCmd.AddCommand(createK8sProviderCmd)
CreateProviderCmd.AddCommand(createOnpremProviderCmd)

CreateProviderCmd.PersistentFlags().StringP("provider-name", "n", "",
Expand Down
7 changes: 7 additions & 0 deletions managed/yba-cli/cmd/provider/create/createproviderutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ func waitForCreateProviderTask(
}

}

func valueNotFoundForKeyError(key string) {
logrus.Fatalln(
formatter.Colorize(
fmt.Sprintf("Key \"%s\" specified but value is empty\n", key),
formatter.RedColor))
}
2 changes: 1 addition & 1 deletion managed/yba-cli/cmd/provider/create/gcp_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func init() {
"custom-ssh-keypair-file-path")

createGCPProviderCmd.Flags().Bool("airgap-install", false,
"[Optional] Are YugabyteDB nodes installed in an air-gapped environment, "+
"[Optional] Are YugabyteDB nodes installed in an air-gapped environment,"+
" lacking access to the public internet for package downloads, "+
"defaults to false.")
}
Expand Down
Loading

0 comments on commit 4082892

Please sign in to comment.