Madhu Kiran Seelam
Madhu Kiran Seelam

Reputation: 534

provide custom command line options for kubectl for kubernetes operator

I have one kubernetes operator (ex: kubectl get oracle_ctrl). Now I want to provide custom arguments for the kubectl command. ex: kubectl apply oracle_ctrl --auto-discover=true --name=vcn1

I can write one more controller to do the same job. But I don't want to write one more controller and make use of existing controller.

Is it possible to use operator-sdk to provide custom args to kubectl?

Upvotes: 0

Views: 356

Answers (1)

David Maze
David Maze

Reputation: 159975

No, this isn't possible.

kubernetes/kubectl#914 has a little bit further discussion of this, but its essential description is "we should start the proposal and design process to eventually write something better than kubectl create to support it". Your CRD can define additional columns to be shown in kubectl get but this is really the only kubectl-related extension point. You could potentially create a kubectl plugin or another CLI tool that does what you need.

Rather than using the kubectl imperative tools, it's often a better practice to directly write YAML artifacts and commit them to source control. You can parameterize these using tools like Helm or Kustomize. If kubectl apply -f or helm install is your primary way of loading things into the cluster, then you don't need custom CLI options to make this work.

Upvotes: 2

Related Questions