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

deprecate OPERATOR_NAME environment variable #3361

Closed
camilamacedo86 opened this issue Jul 8, 2020 · 2 comments
Closed

deprecate OPERATOR_NAME environment variable #3361

camilamacedo86 opened this issue Jul 8, 2020 · 2 comments
Labels
kubebuilder-integration Relates to rewriting the SDK in Kubebuilder plugin form language/ansible Issue is related to an Ansible operator project language/helm Issue is related to a Helm operator project
Milestone

Comments

@camilamacedo86
Copy link
Contributor

camilamacedo86 commented Jul 8, 2020

We need to deprecate: OPERATOR_NAME environment variable is an artifact of the legacy operator-sdk project scaffolding and use --leader-election-id should be used instead.

The OperatorName is the name of the directory of the operator by default which in go we set the info in the repo attribute in the PROJECT file. However, if we will or not use the repo for Ansible/Helm is an ongoing discussion. See: #3341 (comment)

Example:

	if operatorName, found := os.LookupEnv("OPERATOR_NAME"); found {
		setupLog.Info("environment variable OPERATOR_NAME has been deprecated, use --leader-election-id instead.")
		if pflag.Lookup("leader-election-id").Changed {
			setupLog.Info("ignoring OPERATOR_NAME environment variable since --leader-election-id is set")
		} else {
			leaderElectionID = operatorName
		}
	}

	options := ctrl.Options{
		MetricsBindAddress:      metricsAddr,
		LeaderElection:          enableLeaderElection,
		LeaderElectionID:        leaderElectionID,
		LeaderElectionNamespace: leaderElectionNamespace,
		NewClient:               manager.NewDelegatingClientFunc(),
	}
@camilamacedo86 camilamacedo86 added language/ansible Issue is related to an Ansible operator project language/helm Issue is related to a Helm operator project kubebuilder-integration Relates to rewriting the SDK in Kubebuilder plugin form labels Jul 8, 2020
@camilamacedo86 camilamacedo86 added this to the v1.0.0 milestone Jul 8, 2020
@estroz
Copy link
Member

estroz commented Jul 24, 2020

This is done, but there are still a bunch of references to this in testdata.

@camilamacedo86
Copy link
Contributor Author

camilamacedo86 commented Jul 25, 2020

Hi @estroz,

IMO this can be closed with #3539
then, we need a new issue to Port the Ansible Molecule tests for the new layout since the env can just be found in these tests.
See that the mock in https://github.com/operator-framework/operator-sdk/tree/master/test/ansible still using the legacy layout. See: #3540

c/c @asmacdo @fabianvf

@estroz estroz closed this as completed Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kubebuilder-integration Relates to rewriting the SDK in Kubebuilder plugin form language/ansible Issue is related to an Ansible operator project language/helm Issue is related to a Helm operator project
Projects
None yet
Development

No branches or pull requests

2 participants