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

doc: how to use the SDK leader election with new layout #3676

Open
camilamacedo86 opened this issue Aug 7, 2020 · 3 comments
Open

doc: how to use the SDK leader election with new layout #3676

camilamacedo86 opened this issue Aug 7, 2020 · 3 comments
Labels
blocked kind/documentation Categorizes issue or PR as related to documentation. language/go Issue is related to a Go operator project lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Milestone

Comments

@camilamacedo86
Copy link
Contributor

camilamacedo86 commented Aug 7, 2020

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
@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 5, 2020
@camilamacedo86
Copy link
Contributor Author

/lifecycle frozen

@openshift-ci-robot openshift-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 5, 2020
@estroz
Copy link
Member

estroz commented Mar 17, 2021

Blocked on operator-framework/operator-lib#48.

@estroz estroz added kind/documentation Categorizes issue or PR as related to documentation. blocked labels Mar 17, 2021
@estroz estroz modified the milestones: Post 1.0 Docs, Backlog Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked kind/documentation Categorizes issue or PR as related to documentation. language/go Issue is related to a Go operator project lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

4 participants