kubebuilder icon indicating copy to clipboard operation
kubebuilder copied to clipboard

Introducing ENV instead of flags for operator's `main.go` skeleton manifest

Open AlmogBaku opened this issue 3 years ago • 16 comments

What do you want to happen?

Configuring operators with Environment Variables instead of flags is considered as best practice, especially due to the limitation to provide dynamic configurations over the flags (i.e. Secrets, ConfigMaps, etc.)

Using flags can allow easier extensibility of the scaffold main.go, and compatibility with the 12factor manifest.

In addition, I highly recommend the usage of caarl0s/env repository for simplicity or

Extra Labels

No response

AlmogBaku avatar Oct 16 '21 11:10 AlmogBaku

I don't mind writing a PR if this is an acceptable feature.

AlmogBaku avatar Oct 16 '21 11:10 AlmogBaku

I think you are overstating it that env vars are a best practice. 12factor was an important step in the ops journey for many but it is neither dogma nor overall applicable in a modern setting. I think the more important "best practice" is consistency with all other Kubernetes daemons which use CLI flags rather than env vars. That said, if wanted to introduce Viper to the default skeleton to support both transparently, maybe that would be nice?

coderanger avatar Oct 16 '21 20:10 coderanger

+1 for the @coderanger POV and suggestion. @AlmogBaku, please feel free to contribute with PRs.

Your help is more than welcome.

camilamacedo86 avatar Oct 16 '21 23:10 camilamacedo86

@camilamacedo86, the reason I'm asking is to know if there's an acceptance to the concept since it's a major chunk ;-)

Viper looks good. I haven't known this one :)

AlmogBaku avatar Oct 17 '21 12:10 AlmogBaku

Isn’t ComponentConfig the approach to solve this problem?

https://book.kubebuilder.io/component-config-tutorial/tutorial.html

https://docs.google.com/document/d/1FdaEJUEh091qf5B98HM6_8MS764iXrxxigNIdwHYW9c/edit#heading=h.yrvizvdexvtq

jeesmon avatar Oct 17 '21 14:10 jeesmon

the reason I'm asking is to know if there's an acceptance to the concept since it's a major chunk ;-)

It really depends on how much it complicates things. As Jeesmon mentioned, there's potentially some motion towards in-band config via custom objects though that also hasn't gained much traction.

coderanger avatar Oct 17 '21 23:10 coderanger

label this as support and add to next milestone

jmrodri avatar Nov 04 '21 16:11 jmrodri

Hey, Since this is a design feature, let's try to agree upon the design before I'll jump to implementation.

I see that the ComponentConfig was contributed by @pwittrock, are you available on Slack for a brief chat?

AlmogBaku avatar Nov 05 '21 13:11 AlmogBaku

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Feb 03 '22 14:02 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Mar 26 '22 08:03 k8s-triage-robot

@camilamacedo86 should we add it to go/v4 or also for go/v3?

AlmogBaku avatar Mar 26 '22 11:03 AlmogBaku

/remove-lifecycle rotten

AlmogBaku avatar Apr 21 '22 08:04 AlmogBaku

/assign @AlmogBaku

rashmigottipati avatar Apr 21 '22 16:04 rashmigottipati

note: make sure viper can handle one dash arguments as go flags (to support backward compatibility)

AlmogBaku avatar Apr 21 '22 16:04 AlmogBaku

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jul 20 '22 16:07 k8s-triage-robot

/remove-lifecycle stale

AlmogBaku avatar Jul 25 '22 21:07 AlmogBaku

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Oct 23 '22 22:10 k8s-triage-robot

/remove-lifecycle stale

AlmogBaku avatar Oct 25 '22 20:10 AlmogBaku

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 23 '23 20:01 k8s-triage-robot

/remove-lifecycle stale

AlmogBaku avatar Jan 24 '23 17:01 AlmogBaku

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Apr 24 '23 17:04 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar May 24 '23 17:05 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Jun 23 '23 18:06 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jun 23 '23 18:06 k8s-ci-robot