Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl flags should be separated from spin k8s flags #1

Closed
bacongobbler opened this issue Feb 2, 2024 · 1 comment · Fixed by #19
Closed

kubectl flags should be separated from spin k8s flags #1

bacongobbler opened this issue Feb 2, 2024 · 1 comment · Fixed by #19
Labels
area: cli Improvements or additions to the CLI. type: feature request New feature or request

Comments

@bacongobbler
Copy link
Collaborator

Currently, all kubectl flags and k8s flags are grouped into the same flag set. They should be separated so the user can easily differentiate between feature flags that are specific to kubernetes/kubectl vs. the k8s plugin.
Current:

><> spin k8s deploy --help
deploy spin app

Usage:
  k8s deploy [flags]

Flags:
      --as string                      Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --as-uid string                  UID to impersonate for the operation.
      --cache-dir string               Default cache directory (default "/home/bacongobbler/.kube/cache")
      --certificate-authority string   Path to a cert file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
      --context string                 The name of the kubeconfig context to use
      --disable-compression            If true, opt-out of response compression for all requests to the server
      --dry-run                        only print the SpinApp resource file without deploying
  -f, --from string                    Reference in the registry of the Spin application
  -h, --help                           help for deploy
      --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kubeconfig string              Path to the kubeconfig file to use for CLI requests.
  -n, --namespace string               If present, the namespace scope for this CLI request
  -r, --replicas int32                 Number of replicas for the spin app (default 2)
      --request-timeout string         The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
  -s, --server string                  The address and port of the Kubernetes API server
      --tls-server-name string         Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use

Expected:

><> spin k8s deploy --help
deploy spin app

Usage:
  k8s deploy [flags]

Flags:
  -f, --from string                    Reference in the registry of the Spin application
      --dry-run                        only print the SpinApp resource file without deploying
  -r, --replicas int32                 Number of replicas for the spin app (default 2)

kubectl flags:
      --as string                      Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --as-uid string                  UID to impersonate for the operation.
      --cache-dir string               Default cache directory (default "/home/bacongobbler/.kube/cache")
      --certificate-authority string   Path to a cert file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
      --context string                 The name of the kubeconfig context to use
      --disable-compression            If true, opt-out of response compression for all requests to the server
  -h, --help                           help for deploy
      --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kubeconfig string              Path to the kubeconfig file to use for CLI requests.
  -n, --namespace string               If present, the namespace scope for this CLI request
      --request-timeout string         The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
  -s, --server string                  The address and port of the Kubernetes API server
      --tls-server-name string         Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use
@bacongobbler bacongobbler added type: feature request New feature or request area: cli Improvements or additions to the CLI. labels Feb 20, 2024
@bacongobbler
Copy link
Collaborator Author

Not possible with cobra at this time without writing some custom flag grouping logic.

spf13/cobra#1327

I think it'd be easier to add a prefix to these flags similar to how we do this in Helm. e.g.

Flags:
      --burst-limit int                 client-side default throttling limit (default 100)
      --debug                           enable verbose output
  -h, --help                            help for helm
      --kube-apiserver string           the address and the port for the Kubernetes API server
      --kube-as-group stringArray       group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --kube-as-user string             username to impersonate for the operation
      --kube-ca-file string             the certificate authority file for the Kubernetes API server connection
      --kube-context string             name of the kubeconfig context to use
      --kube-insecure-skip-tls-verify   if true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure
      --kube-tls-server-name string     server name to use for Kubernetes API server certificate validation. If it is not provided, the hostname used to contact the server is used
      --kube-token string               bearer token used for authentication
      --kubeconfig string               path to the kubeconfig file
  -n, --namespace string                namespace scope for this request
      --qps float32                     queries per second used when communicating with the Kubernetes API, not including bursting
      --registry-config string          path to the registry config file
      --repository-cache string         path to the file containing cached repository indexes
      --repository-config string        path to the file containing repository names and URLs

@bacongobbler bacongobbler linked a pull request Feb 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cli Improvements or additions to the CLI. type: feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant