-
Notifications
You must be signed in to change notification settings - Fork 451
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
Add ability to use feature-gates in the operator #1619
Conversation
pkg/flags/flags.go
Outdated
featureGatesFlag = "feature-gates" | ||
) | ||
|
||
func Flags(reg *featuregate.Registry) *flag.FlagSet { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the same comments as in the original PR #1557
The package name should probably be changed or include all operator flags. There are as well missing docs.
How do consumers know which feature flags are supported by the operator - take a look at #1557 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pavolloffay It should be possible to include the list of registered featuregates during startup, I can add that.
Also, how to you feel about the addition of the flag
/featuregate
package? Should we handle the feature gate flags like we do the rest of the flags in main.go
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have a package for it, but the current flags
name is too generic and therefore I would expect it handles all operator flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have confirmed that the latest featuregate package includes the registered gates as default values:
func main() {
colfeaturegate.GlobalRegistry().MustRegister("basic", colfeaturegate.StageAlpha)
colfeaturegate.GlobalRegistry().MustRegister("advanced", colfeaturegate.StageBeta)
colfeaturegate.GlobalRegistry().MustRegister("false", colfeaturegate.StageStable, colfeaturegate.WithRegisterRemovalVersion("v0.0.1"))
// registers any flags that underlying libraries might use
opts := zap.Options{}
flagset := featuregate.Flags(colfeaturegate.GlobalRegistry())
opts.BindFlags(flag.CommandLine)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.CommandLine.AddGoFlagSet(flagset)
...
}
❯ go run ./main.go --help
Usage of /var/folders/kv/z8h_0xts4h7dcr7fl3jsfr540000gp/T/go-build2330073747/b001/exe/main:
--auto-instrumentation-dotnet-image string The default OpenTelemetry DotNet instrumentation image. This image is used when no image is specified in the CustomResource. (default "ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-dotnet:0.0.0")
--auto-instrumentation-java-image string The default OpenTelemetry Java instrumentation image. This image is used when no image is specified in the CustomResource. (default "ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-java:0.0.0")
--auto-instrumentation-nodejs-image string The default OpenTelemetry NodeJS instrumentation image. This image is used when no image is specified in the CustomResource. (default "ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:0.0.0")
--auto-instrumentation-python-image string The default OpenTelemetry Python instrumentation image. This image is used when no image is specified in the CustomResource. (default "ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:0.0.0")
--collector-image string The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource. (default "ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:0.0.0")
--enable-leader-election Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.
--feature-gates flag Comma-delimited list of feature gate identifiers. Prefix with '-' to disable the feature. '+' or no prefix will enable the feature. (default advanced,-basic,false)
--health-probe-addr string The address the probe endpoint binds to. (default ":8081")
--kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster.
--labels stringArray Labels to filter away from propagating onto deploys
--metrics-addr string The address the metric endpoint binds to. (default ":8080")
--operator-opamp-bridge-image string The default OpenTelemetry Operator OpAMP Bridge image. This image is used when no image is specified in the CustomResource. (default "ghcr.io/open-telemetry/opentelemetry-operator/operator-opamp-bridge:0.0.0")
--target-allocator-image string The default OpenTelemetry target allocator image. This image is used when no image is specified in the CustomResource. (default "ghcr.io/open-telemetry/opentelemetry-operator/target-allocator:0.0.0")
--tls-cipher-suites strings Comma-separated list of cipher suites for the server. Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants). If omitted, the default Go cipher suites will be used
--tls-min-version string Minimum TLS version supported. Value must match version names from https://golang.org/pkg/crypto/tls/#pkg-constants. (default "VersionTLS12")
--webhook-port int The port the webhook endpoint binds to. (default 9443)
--zap-devel Development Mode defaults(encoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn). Production Mode defaults(encoder=jsonEncoder,logLevel=Info,stackTraceLevel=Error)
--zap-encoder encoder Zap log encoding (one of 'json' or 'console')
--zap-log-level level Zap Level to configure the verbosity of logging. Can be one of 'debug', 'info', 'error', or any integer value > 0 which corresponds to custom debug levels of increasing verbosity
--zap-stacktrace-level level Zap Level at and above which stacktraces are captured (one of 'info', 'error', 'panic').
--zap-time-encoding time-encoding Zap time encoding (one of 'epoch', 'millis', 'nano', 'iso8601', 'rfc3339' or 'rfc3339nano'). Defaults to 'epoch'.
pflag: help requested
exit status 2
f193c76
to
78e980d
Compare
@TylerHelmuth thank you for taking this on 🙇 vacation meant little working time for me :) |
* Add ability to use feature-gates in the operator * Add changelog * Apply feedback
This PR adds the ability to use feature gates in the operator, but does not add any feature gates specifically. It is based on #1557, but with the most recent
featuregate
changes. My goal is to add this capability as a standalone PR so it can be used in #1557 and #1555.Closes #1548