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

Update README.md #3559

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update README.md #3559

wants to merge 1 commit into from

Conversation

somnathbm
Copy link

The FeatureGate needs to be set via extraArgs parameter of the Opentelemetry Operator. It's very hard to figure out the correct way.

Description:

Link to tracking Issue(s):

  • Resolves: #issue-number

Testing:

Documentation:

The FeatureGate needs to be set via `extraArgs` parameter of the Opentelemetry Operator. It's very hard to figure out the correct way.
@somnathbm somnathbm requested a review from a team as a code owner December 19, 2024 12:09
@swiatekm
Copy link
Contributor

It looks like you want to update the Helm Chart README here instead. The operator itself accepts a --feature-gates flag, same as the collector.

@@ -584,7 +584,7 @@ instrumentation.opentelemetry.io/inject-sdk: "true"

#### Controlling Instrumentation Capabilities

The operator allows specifying, via the flags, which languages the Instrumentation resource may instrument.
The operator allows specifying, via the flags (`--set manager.extraArgs={"<Name-of-the-gate>=<Value>"}`), which languages the Instrumentation resource may instrument.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the operator it self it would look a bit different.

setup: "add-operator-arg OPERATOR_ARG='--feature-gates=operator.sidecarcontainers.native' prepare-e2e"

@somnathbm
Copy link
Author

It looks like you want to update the Helm Chart README here instead. The operator itself accepts a --feature-gates flag, same as the collector.

Ok. May be I'm missing out something. I couldn't find how to pass this --fearure-flags directly while installing the operator Helm chart. It would be really helpful if you give me a documentation link or whatever.
Then I would quickly close this PR.

@swiatekm
Copy link
Contributor

It looks like you want to update the Helm Chart README here instead. The operator itself accepts a --feature-gates flag, same as the collector.

Ok. May be I'm missing out something. I couldn't find how to pass this --fearure-flags directly while installing the operator Helm chart. It would be really helpful if you give me a documentation link or whatever. Then I would quickly close this PR.

In the operator Helm Chart, you can use the manager.featureGatesMap parameter to set these easily.

@somnathbm
Copy link
Author

It looks like you want to update the Helm Chart README here instead. The operator itself accepts a --feature-gates flag, same as the collector.

Ok. May be I'm missing out something. I couldn't find how to pass this --fearure-flags directly while installing the operator Helm chart. It would be really helpful if you give me a documentation link or whatever. Then I would quickly close this PR.

In the operator Helm Chart, you can use the manager.featureGatesMap parameter to set these easily.

I gave it a try.

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
-f ~/values.yaml \
--set "manager.collectorImage.repository=otel/opentelemetry-collector-k8s"

OR like this

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
--set "manager.collectorImage.repository=otel/opentelemetry-collector-k8s" \
--set "manager.featureGatesMap.nativeSideCarContainers=true" \
--set "manager.featureGatesMap.golangFlags=true"

The default values.yaml has featureGatesMap: {}. So I have modified it as below:

featureGatesMap:
    targetAllocatorMtls: false
    targetAllocatorCR: false
    targetAllocatorFallbackStrategy: false
    nativeSideCarContainers: true
    prometheusOperator: false
    golangFlags: true
    collectorDefaultConfig: false

With these set, no matter what I do, all I get is Additional property is not allowed

@swiatekm
Copy link
Contributor

It looks like you want to update the Helm Chart README here instead. The operator itself accepts a --feature-gates flag, same as the collector.

Ok. May be I'm missing out something. I couldn't find how to pass this --fearure-flags directly while installing the operator Helm chart. It would be really helpful if you give me a documentation link or whatever. Then I would quickly close this PR.

In the operator Helm Chart, you can use the manager.featureGatesMap parameter to set these easily.

I gave it a try.

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
-f ~/values.yaml \
--set "manager.collectorImage.repository=otel/opentelemetry-collector-k8s"

OR like this

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
--set "manager.collectorImage.repository=otel/opentelemetry-collector-k8s" \
--set "manager.featureGatesMap.nativeSideCarContainers=true" \
--set "manager.featureGatesMap.golangFlags=true"

The default values.yaml has featureGatesMap: {}. So I have modified it as below:

featureGatesMap:
    targetAllocatorMtls: false
    targetAllocatorCR: false
    targetAllocatorFallbackStrategy: false
    nativeSideCarContainers: true
    prometheusOperator: false
    golangFlags: true
    collectorDefaultConfig: false

With these set, no matter what I do, all I get is Additional property is not allowed

You need to use the verbatim feature flag name. For example, if you want native sidecar containers:

manager:
  featureGatesMap:
    operator.sidecarcontainers.native: true

You can see the allowed values here.

@somnathbm
Copy link
Author

It looks like you want to update the Helm Chart README here instead. The operator itself accepts a --feature-gates flag, same as the collector.

Ok. May be I'm missing out something. I couldn't find how to pass this --fearure-flags directly while installing the operator Helm chart. It would be really helpful if you give me a documentation link or whatever. Then I would quickly close this PR.

In the operator Helm Chart, you can use the manager.featureGatesMap parameter to set these easily.

I gave it a try.

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
-f ~/values.yaml \
--set "manager.collectorImage.repository=otel/opentelemetry-collector-k8s"

OR like this

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
--set "manager.collectorImage.repository=otel/opentelemetry-collector-k8s" \
--set "manager.featureGatesMap.nativeSideCarContainers=true" \
--set "manager.featureGatesMap.golangFlags=true"

The default values.yaml has featureGatesMap: {}. So I have modified it as below:

featureGatesMap:
    targetAllocatorMtls: false
    targetAllocatorCR: false
    targetAllocatorFallbackStrategy: false
    nativeSideCarContainers: true
    prometheusOperator: false
    golangFlags: true
    collectorDefaultConfig: false

With these set, no matter what I do, all I get is Additional property is not allowed

You need to use the verbatim feature flag name. For example, if you want native sidecar containers:

manager:
  featureGatesMap:
    operator.sidecarcontainers.native: true

You can see the allowed values here.

The operator (manager container) has crashed after installing the chart like this:

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
-f ~/values.yaml \
--set manager.collectorImage.repository=otel/opentelemetry-collector-k8s

Error log:

k logs -n hms-dev opentelemetry-operator-67466d9b75-56l7x -c manager
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
go.opentelemetry.io/collector/featuregate.(*flagValue).Set(0xc0004d0040, {0x7fffb0993fec?, 0xc0007600c0?})
	/home/runner/go/pkg/mod/go.opentelemetry.io/collector/[email protected]/flag.go:55 +0x147
github.com/spf13/pflag.(*flagValueWrapper).Set(0x320a7e0?, {0x7fffb0993fec?, 0x3a98930?})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/golangflag.go:53 +0x22
github.com/spf13/pflag.(*FlagSet).Set(0xc0000e9c00, {0x3a98930, 0xd}, {0x7fffb0993fec, 0x3b})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:463 +0xa2
github.com/spf13/pflag.(*FlagSet).Parse.func1(0x320a7e0?, {0x7fffb0993fec?, 0x7fffb0993fde?})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1138 +0x32
github.com/spf13/pflag.(*FlagSet).parseLongArg(0xc0000e9c00, {0x7fffb0993fdc, 0x4b}, {0xc0000500d0, 0x0, 0x0}, 0xc00073e538)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1000 +0x24f
github.com/spf13/pflag.(*FlagSet).parseArgs(0xc0000e9c00, {0xc000050080?, 0x98?, 0x3937980?}, 0xc00073e538)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1108 +0x1b1
github.com/spf13/pflag.(*FlagSet).Parse(0xc0000e9c00, {0xc000050080, 0x6, 0x6})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1141 +0xd8
github.com/spf13/pflag.Parse(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1190
main.main()
	/home/runner/work/opentelemetry-operator/opentelemetry-operator/main.go:190 +0x117b

@swiatekm
Copy link
Contributor

It looks like you want to update the Helm Chart README here instead. The operator itself accepts a --feature-gates flag, same as the collector.

Ok. May be I'm missing out something. I couldn't find how to pass this --fearure-flags directly while installing the operator Helm chart. It would be really helpful if you give me a documentation link or whatever. Then I would quickly close this PR.

In the operator Helm Chart, you can use the manager.featureGatesMap parameter to set these easily.

I gave it a try.

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
-f ~/values.yaml \
--set "manager.collectorImage.repository=otel/opentelemetry-collector-k8s"

OR like this

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
--set "manager.collectorImage.repository=otel/opentelemetry-collector-k8s" \
--set "manager.featureGatesMap.nativeSideCarContainers=true" \
--set "manager.featureGatesMap.golangFlags=true"

The default values.yaml has featureGatesMap: {}. So I have modified it as below:

featureGatesMap:
    targetAllocatorMtls: false
    targetAllocatorCR: false
    targetAllocatorFallbackStrategy: false
    nativeSideCarContainers: true
    prometheusOperator: false
    golangFlags: true
    collectorDefaultConfig: false

With these set, no matter what I do, all I get is Additional property is not allowed

You need to use the verbatim feature flag name. For example, if you want native sidecar containers:

manager:
  featureGatesMap:
    operator.sidecarcontainers.native: true

You can see the allowed values here.

The operator (manager container) has crashed after installing the chart like this:

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
-f ~/values.yaml \
--set manager.collectorImage.repository=otel/opentelemetry-collector-k8s

Error log:

k logs -n hms-dev opentelemetry-operator-67466d9b75-56l7x -c manager
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
go.opentelemetry.io/collector/featuregate.(*flagValue).Set(0xc0004d0040, {0x7fffb0993fec?, 0xc0007600c0?})
	/home/runner/go/pkg/mod/go.opentelemetry.io/collector/[email protected]/flag.go:55 +0x147
github.com/spf13/pflag.(*flagValueWrapper).Set(0x320a7e0?, {0x7fffb0993fec?, 0x3a98930?})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/golangflag.go:53 +0x22
github.com/spf13/pflag.(*FlagSet).Set(0xc0000e9c00, {0x3a98930, 0xd}, {0x7fffb0993fec, 0x3b})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:463 +0xa2
github.com/spf13/pflag.(*FlagSet).Parse.func1(0x320a7e0?, {0x7fffb0993fec?, 0x7fffb0993fde?})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1138 +0x32
github.com/spf13/pflag.(*FlagSet).parseLongArg(0xc0000e9c00, {0x7fffb0993fdc, 0x4b}, {0xc0000500d0, 0x0, 0x0}, 0xc00073e538)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1000 +0x24f
github.com/spf13/pflag.(*FlagSet).parseArgs(0xc0000e9c00, {0xc000050080?, 0x98?, 0x3937980?}, 0xc00073e538)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1108 +0x1b1
github.com/spf13/pflag.(*FlagSet).Parse(0xc0000e9c00, {0xc000050080, 0x6, 0x6})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1141 +0xd8
github.com/spf13/pflag.Parse(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/flag.go:1190
main.main()
	/home/runner/work/opentelemetry-operator/opentelemetry-operator/main.go:190 +0x117b

Are you sure the content of your values.yaml is what I posted? I just tried this locally and it installed correctly. If you still can't install this way, could you open an issue in https://github.com/open-telemetry/opentelemetry-helm-charts?

@somnathbm
Copy link
Author

@swiatekm values.yaml

Yes this is the same values.yaml I have used. I have only modified the featureGatesMap block as below:

featureGatesMap:
    operator.targetallocator.mtls: false
    operator.collector.targetallocatorcr: false
    operator.sidecarcontainers.native: true
    operator.observability.prometheus: false
    operator.golang.flags: true
    operator.collector.default.config: false

After that I just tried to install like:

helm install -n hms-dev opentelemetry-operator open-telemetry/opentelemetry-operator \
-f ~/Downloads/values.yaml \
--set manager.collectorImage.repository=otel/opentelemetry-collector-k8s

Doing so in my case unfortunately, crashes the operator manager container.
PS - Kube version - v1.31 (minikube)

@swiatekm
Copy link
Contributor

swiatekm commented Jan 2, 2025

@somnathbm this is a bug in the Helm Chart. The above configuration results in the following command line argument for operator: --feature-gates=,,operator.golang.flags,,operator.sidecarcontainers.native,, which is not correct and leads to an error (which shouldn't be a panic, and that's arguably a bug in otel collector's featuregate package). I've opened a Helm Chart issue here: open-telemetry/opentelemetry-helm-charts#1481.

The reason this worked for me is that I only set a single flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants