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?
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.