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

Remove v1alpha1 webhooks #2861

Merged
merged 3 commits into from
Apr 17, 2024

Conversation

pavolloffay
Copy link
Member

Resolves #2736

@pavolloffay pavolloffay requested a review from a team April 16, 2024 13:06
@pavolloffay pavolloffay force-pushed the v1beta1-remove-webhook branch from 6d933ab to ee90473 Compare April 16, 2024 13:16
@@ -50,47 +86,353 @@ func (c CollectorWebhook) Default(_ context.Context, obj runtime.Object) error {
if !ok {
return fmt.Errorf("expected an OpenTelemetryCollector, received %T", obj)
}
return c.defaulter(otelcol)
if len(otelcol.Spec.Mode) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move this logic to that defaulter method?

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 am not sure what you mean, this is the Default method.

Copy link
Contributor

Choose a reason for hiding this comment

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

i meant keeping this in the internal method (defaulter), but i guess it doesn't really matter

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 see the point of the internal defaulter method

apis/v1beta1/collector_webhook.go Outdated Show resolved Hide resolved
controllers/suite_test.go Outdated Show resolved Hide resolved
@@ -44,7 +43,7 @@ func (c ComponentType) String() string {
}

// ConfigToComponentPorts converts the incoming configuration object into a set of service ports required by the exporters.
func ConfigToComponentPorts(logger logr.Logger, cType ComponentType, config map[interface{}]interface{}) ([]v1beta1.PortsSpec, error) {
func ConfigToComponentPorts(logger logr.Logger, cType ComponentType, config map[interface{}]interface{}) ([]corev1.ServicePort, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should be using the ports spec here right?

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 needed to change this back to corev1.ServicePort to avoid a circular dependency.

Originally it was using the type from corev1 but it was changed here https://github.com/open-telemetry/opentelemetry-operator/pull/2763/files#diff-39548fb5f0030535966b3fb437c08814c648216539e297c034f3da6ac5b43a9bR47

Copy link
Contributor

Choose a reason for hiding this comment

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

doing this is going to make it very hard to complete #2603 because we want to be able to use those types. Is it possible to avoid this by moving the methods?

@pavolloffay pavolloffay force-pushed the v1beta1-remove-webhook branch from ea7f12d to 4226f74 Compare April 16, 2024 16:38
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/open-telemetry/opentelemetry-operator/internal/config"
ta "github.com/open-telemetry/opentelemetry-operator/internal/manifests/targetallocator/adapters"
Copy link
Contributor

Choose a reason for hiding this comment

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

this is unfortunate – I would love it if there were a way out of this conundrum... I don't think that needs to be in this PR but is related to the work I'm doing in #2603. Could you open a ticket and write a TODO here linking it for us to prevent pulling from the manifests package

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean moving the methods from internal/manifests/collector/adapters/config_to_ports.go to the API package?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah... something like that... I think with the new capabilities from the v1beta1 change we really may want to rethink how we can handle all of these adapters.

@pavolloffay pavolloffay force-pushed the v1beta1-remove-webhook branch from 335a11a to 2eafde3 Compare April 16, 2024 17:09
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
@pavolloffay pavolloffay force-pushed the v1beta1-remove-webhook branch from 2eafde3 to 9fd0e9b Compare April 16, 2024 17:33
@pavolloffay pavolloffay added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Apr 16, 2024
Signed-off-by: Pavol Loffay <[email protected]>
@pavolloffay pavolloffay force-pushed the v1beta1-remove-webhook branch from a83b23d to d46ff95 Compare April 16, 2024 17:38
@@ -202,7 +202,7 @@ func getConfigContainerPorts(logger logr.Logger, cfgYaml string, conf v1beta1.Co
}
}

metricsPort, err := adapters.ConfigToMetricsPort(conf.Service)
metricsPort, err := conf.Service.MetricsPort()
Copy link
Contributor

Choose a reason for hiding this comment

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

very clean, i like it!

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.

looks great now! sorry for the merge conflict 🙈

@pavolloffay pavolloffay merged commit 6af3e4c into open-telemetry:main Apr 17, 2024
31 checks passed
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
* Remove v1alpha1 webhooks

Signed-off-by: Pavol Loffay <[email protected]>

* Fix

Signed-off-by: Pavol Loffay <[email protected]>

* Fix

Signed-off-by: Pavol Loffay <[email protected]>

---------

Signed-off-by: Pavol Loffay <[email protected]>
rubenvp8510 pushed a commit to rubenvp8510/opentelemetry-operator that referenced this pull request May 7, 2024
* Remove v1alpha1 webhooks

Signed-off-by: Pavol Loffay <[email protected]>

* Fix

Signed-off-by: Pavol Loffay <[email protected]>

* Fix

Signed-off-by: Pavol Loffay <[email protected]>

---------

Signed-off-by: Pavol Loffay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate v1alpha1 webhook to v1beta1
2 participants