0

I am building an operator using operator-sdk version 1.2 and I do understand we have a reconciliation loop but I was referring to some GitHub repos and unable to make out the use of the NewController function. It seems that these GitHub repos are developed using operator-sdk but in operator-sdk 1.2, I do not need to find any Newcontroller function.

For example, I was referring to https://github.com/oracle/mysql-operator and looking at the https://github.com/oracle/mysql-operator/blob/master/pkg/controllers/cluster/controller.go and I do not find NewControllerfunction in the current operator-sdk.

Also, I do not understand how this MySQL operator is using kubeconfig? Do we need to pass the kubeconfig location to execute the command in the container? Is there a way to read the kube config without passing kubeconfig location in operator-sdk?

1 Answer 1

1

If you're building a new operator and you plan to use Operator SDK, then I recommend reading the official Operator SDK: Go tutorial. You can find another example of Go-based operator here.

Concerning the kube config, it will use your default location if you don't specify anything. So the default kubeconfig your kubectl is configured with.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the reply. I am using operator-sdk 1.2 and following the docs that you referred to in your post. However, do you know what is this NewController function in MySQL operator and why there is no reconciliation loop?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.