Open
Description
We speak over it in the Migration guide to +1.0.0 but we need to have a doc for ti with details steps and just link in the migration guide. See: https://master.sdk.operatorframework.io/docs/building-operators/golang/project_migration_guide/#migrate-maingo.
Steps required to make it work on the cluster
- Import the lib
go get -u github.com/operator-framework/operator-lib
- Update main.go which will be as:
ctx := context.TODO()
// Become the leader before proceeding
err := leader.Become(ctx, "anyproject-lock")
if err != nil {
os.Exit(1)
}
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
})
if err != nil {
setupLog.Error(err, "unable to start manager")
os.Exit(1)
}
- Update the manager.yaml file with:
...
spec:
containers:
- command:
- /manager
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
...
- Add rbac permission to the controllers
+kubebuilder:rbac:groups=core,resources=pods,verbs=get;list
- Run
make manifests