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

Reconcile v1beta1 collector CRD #2703

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

pavolloffay
Copy link
Member

@pavolloffay pavolloffay commented Mar 4, 2024

Description:

Do not merge this. the PR will be split into smaller PRs.

Link to tracking Issue:
Resolves: #2620

This can be merged after #2708

Follow ups:

Testing:

Documentation:

upgrade upgradeFunc
// deprecated use upgradeV1beta1.
upgrade upgradeFunc
upgradeV1beta1 upgradeFuncV1beta1
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't want to rewrite old upgrade procedures hence I am adding this API and just adopting tests to work (they need a valid collector spec because v1beta1 is a minimal doing validation)

Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if we should also include some deprecations around these collector version upgrades. like do we need to keep around something that upgrades collector from 0.30.0 to 0.31.0?

@pavolloffay pavolloffay changed the title V1beta1 webhookPOC: Reconcile v1beta1 crd Reconcile v1beta1 collector CRD Mar 6, 2024
@pavolloffay pavolloffay force-pushed the v1beta1-webhook branch 2 times, most recently from 3636c19 to e92d64b Compare March 6, 2024 17:19
Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

This looks like a good time to upgrade kubebuilder and other similar dependencies. WDYT?

@pavolloffay
Copy link
Member Author

This looks like a good time to upgrade kubebuilder and other similar dependencies. WDYT?

Could you please be more specific about why it is related to this PR?

@swiatekm
Copy link
Contributor

swiatekm commented Mar 6, 2024

This looks like a good time to upgrade kubebuilder and other similar dependencies. WDYT?

Could you please be more specific about why it is related to this PR?

There's some differences in output, so it would be easier if we switch before officially publishing v1beta1 CRDs. But you're right, that doesn't need to happen in this PR.

@pavolloffay pavolloffay marked this pull request as ready for review March 7, 2024 09:13
@pavolloffay pavolloffay requested a review from a team March 7, 2024 09:13
@@ -39,7 +39,8 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true,maxDescLen=200"
# kubectl apply does not work on large CRDs.
CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true,maxDescLen=0"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we want to publish CRDs with no descriptions on fields?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately the kubectl apply on the CRD will not work (https://github.com/open-telemetry/opentelemetry-operator?tab=readme-ov-file#getting-started).

It will break installations, maybe helm, gitops and e2e tests?

I can take a look at enabling descriptions in a follow-up PR. There we will better see what the implications are. Please book a follow-up ticket if you think we should have descriptions.

Copy link
Contributor

Choose a reason for hiding this comment

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

apis/v1alpha1/opentelemetrycollector_types.go Outdated Show resolved Hide resolved
apis/v1beta1/collector_webhook.go Show resolved Hide resolved
Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

I don't see any problems. We should track the issue with descriptions and v1beta1 webhook though.

@pavolloffay
Copy link
Member Author

pavolloffay commented Mar 8, 2024

thanks for the approval. I have created follow issues and linked them to the PR description.

@jaronoff97 I think this PR deserves your review as well and please merge it once 0.96.0 operator is released so we have some time to test it in the main.

Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

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

mostly questions to confirm my understanding of what's happening here. This looks pretty good overall though.

subtext: |
Users are expected to migrate to `otelcol.v1beta1.opentelemetry.io`.
The support for `otelcol.v1alpha1.opentelemetry.io` will be removed in the future.
Follow https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#upgrade-existing-objects-to-a-new-stored-version for version migration.
Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if we should include our own documentation for how to do this. Specifically calling out the deprecated fields and the things to migrate. Especially when it comes to migrating the TA to the new TA crd as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think what we have might be good enough for now. However we should definitely talk about until when v1alpha1 will be served.

@@ -39,7 +39,8 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true,maxDescLen=200"
# kubectl apply does not work on large CRDs.
CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true,maxDescLen=0"
Copy link
Contributor

Choose a reason for hiding this comment

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

apis/v1beta1/collector_webhook.go Outdated Show resolved Hide resolved
kind: OpenTelemetryCollector
name: opentelemetrycollectors.opentelemetry.io
resources:
- kind: ConfigMaps
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this autogenerated? Aren't we missing some resources like HPA, PDB, ingress, etc?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes it is, the annotation is on the collector type. This is the same as for v1alpha1 and it's just a hint for users to understand which objects are managed.

Copy link
Contributor

Choose a reason for hiding this comment

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

i see. should we update it with the rest of the resources so its accurate going forward? Maybe a good separate PR...

Copy link
Member Author

Choose a reason for hiding this comment

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

type: OwnNamespace
- supported: true
- supported: false
Copy link
Contributor

Choose a reason for hiding this comment

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

what do these flags do?

Copy link
Member Author

Choose a reason for hiding this comment

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

IIRC It's for the OLM to allow watching of single or multiple namespaces. This was required for introducing the new version.

Copy link
Contributor

Choose a reason for hiding this comment

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

hm in practice this makes me nervous, doesn't this imply that the operator can no longer watch any namespaces? can you link me the doc?

Copy link
Member Author

Copy link
Member Author

Choose a reason for hiding this comment

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

I have noted this in the release notes

@@ -2,15 +2,16 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: opampbridges.opentelemetry.io
name: opentelemetrycollectors.opentelemetry.io
Copy link
Contributor

Choose a reason for hiding this comment

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

why does it think its changing the opampbridge CRD here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this manually. The file was not used anyways.

if err != nil {
u.Log.Error(err, "failed to upgrade managed otelcol instances", "name", otelcol.Name, "namespace", otelcol.Namespace)
return otelcol, err
if available.upgrade != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if we should be recording some metrics about these upgrades:

  • how often they succeed / fail
  • reason for failure

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is out of the scope of this PR. We should probably book a separate ticket for this if necessary.

upgrade upgradeFunc
// deprecated use upgradeV1beta1.
upgrade upgradeFunc
upgradeV1beta1 upgradeFuncV1beta1
Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if we should also include some deprecations around these collector version upgrades. like do we need to keep around something that upgrades collector from 0.30.0 to 0.31.0?

Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

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

two questions. One other thing i thought of which would be a good followup to book would be disabling the reconciliation of v1alpha1 resources behind a featuregate

type: OwnNamespace
- supported: true
- supported: false
Copy link
Contributor

Choose a reason for hiding this comment

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

hm in practice this makes me nervous, doesn't this imply that the operator can no longer watch any namespaces? can you link me the doc?

internal/status/collector/handle.go Outdated Show resolved Hide resolved
internal/status/collector/collector.go Show resolved Hide resolved
@pavolloffay
Copy link
Member Author

One other thing i thought of which would be a good followup to book would be disabling the reconciliation of v1alpha1 resources behind a featuregate

This PR removes v1alpha1 reconciliation. The remaining v1alpha1 pieces will be: CRD and webhooks. Both of these require manifests at the installation time so they cannot be controlled via the operator feature flag.

@pavolloffay pavolloffay force-pushed the v1beta1-webhook branch 6 times, most recently from 9bda806 to 1c69e22 Compare March 12, 2024 14:03
@jaronoff97
Copy link
Contributor

@pavolloffay let's wait to merge this until after #2756 is done

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
@pavolloffay pavolloffay merged commit 9710eed into open-telemetry:main Mar 14, 2024
31 checks passed
swiatekm added a commit to swiatekm/opentelemetry-operator that referenced this pull request Mar 29, 2024
swiatekm added a commit to swiatekm/opentelemetry-operator that referenced this pull request Apr 2, 2024
pavolloffay pushed a commit that referenced this pull request Apr 3, 2024
pavolloffay added a commit to pavolloffay/opentelemetry-operator that referenced this pull request Apr 5, 2024
pavolloffay added a commit to pavolloffay/opentelemetry-operator that referenced this pull request Apr 12, 2024
pavolloffay added a commit that referenced this pull request Apr 12, 2024
#2813)

* Revert "Revert" Add reconciliation for Collector v1beta1 CRD (#2703)" (#2800)"

This reverts commit 57024fc.

* Fix image

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Clarify hostport

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix issue after israel

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

---------

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
…lemetry#2703)"… (open-telemetry#2813)

* Revert "Revert" Add reconciliation for Collector v1beta1 CRD (open-telemetry#2703)" (open-telemetry#2800)"

This reverts commit 57024fc.

* Fix image

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Clarify hostport

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix issue after israel

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

---------

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
rubenvp8510 pushed a commit to rubenvp8510/opentelemetry-operator that referenced this pull request May 7, 2024
…lemetry#2703)"… (open-telemetry#2813)

* Revert "Revert" Add reconciliation for Collector v1beta1 CRD (open-telemetry#2703)" (open-telemetry#2800)"

This reverts commit 57024fc.

* Fix image

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Clarify hostport

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix issue after israel

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

* Fix

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>

---------

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
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.

Enable direct reconciliation of the v1beta1 types
3 participants