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

[chore] Refactor Webhooks to their own packages #2210

Merged
merged 18 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/operator-opamp-bridge/agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func TestAgent_onMessage(t *testing.T) {
},
},
status: &protobufs.RemoteConfigStatus{
LastRemoteConfigHash: []byte("good/testnamespace405"),
LastRemoteConfigHash: []byte("good/testnamespace401"),
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved
Status: protobufs.RemoteConfigStatuses_RemoteConfigStatuses_APPLIED,
},
},
Expand Down
36 changes: 18 additions & 18 deletions config/webhook/manifests.yaml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The order of these is reversing, but is a noop AFAICT

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /mutate-opentelemetry-io-v1alpha1-instrumentation
path: /mutate-opentelemetry-io-v1alpha1-opentelemetrycollector
Copy link
Member

Choose a reason for hiding this comment

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

why are these changes here?

I am concerned that this will cause issues for the upgrade (also the upgrade test was changed )

failurePolicy: Fail
name: minstrumentation.kb.io
name: mopentelemetrycollector.kb.io
rules:
- apiGroups:
- opentelemetry.io
Expand All @@ -22,17 +22,17 @@ webhooks:
- CREATE
- UPDATE
resources:
- instrumentations
- opentelemetrycollectors
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-opentelemetry-io-v1alpha1-opentelemetrycollector
path: /mutate-opentelemetry-io-v1alpha1-instrumentation
failurePolicy: Fail
name: mopentelemetrycollector.kb.io
name: minstrumentation.kb.io
rules:
- apiGroups:
- opentelemetry.io
Expand All @@ -42,7 +42,7 @@ webhooks:
- CREATE
- UPDATE
resources:
- opentelemetrycollectors
- instrumentations
sideEffects: None
- admissionReviewVersions:
- v1
Expand Down Expand Up @@ -76,9 +76,9 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /validate-opentelemetry-io-v1alpha1-instrumentation
path: /validate-opentelemetry-io-v1alpha1-opentelemetrycollector
failurePolicy: Fail
name: vinstrumentationcreateupdate.kb.io
name: vopentelemetrycollectorcreateupdate.kb.io
rules:
- apiGroups:
- opentelemetry.io
Expand All @@ -88,17 +88,17 @@ webhooks:
- CREATE
- UPDATE
resources:
- instrumentations
- opentelemetrycollectors
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-opentelemetry-io-v1alpha1-instrumentation
path: /validate-opentelemetry-io-v1alpha1-opentelemetrycollector
failurePolicy: Ignore
name: vinstrumentationdelete.kb.io
name: vopentelemetrycollectordelete.kb.io
rules:
- apiGroups:
- opentelemetry.io
Expand All @@ -107,17 +107,17 @@ webhooks:
operations:
- DELETE
resources:
- instrumentations
- opentelemetrycollectors
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-opentelemetry-io-v1alpha1-opentelemetrycollector
path: /validate-opentelemetry-io-v1alpha1-instrumentation
failurePolicy: Fail
name: vopentelemetrycollectorcreateupdate.kb.io
name: vinstrumentationcreateupdate.kb.io
rules:
- apiGroups:
- opentelemetry.io
Expand All @@ -127,17 +127,17 @@ webhooks:
- CREATE
- UPDATE
resources:
- opentelemetrycollectors
- instrumentations
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-opentelemetry-io-v1alpha1-opentelemetrycollector
path: /validate-opentelemetry-io-v1alpha1-instrumentation
failurePolicy: Ignore
name: vopentelemetrycollectordelete.kb.io
name: vinstrumentationdelete.kb.io
rules:
- apiGroups:
- opentelemetry.io
Expand All @@ -146,5 +146,5 @@ webhooks:
operations:
- DELETE
resources:
- opentelemetrycollectors
- instrumentations
sideEffects: None
3 changes: 2 additions & 1 deletion controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import (
"github.com/open-telemetry/opentelemetry-operator/internal/config"
"github.com/open-telemetry/opentelemetry-operator/internal/manifests"
"github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector/testdata"
collectorwebhook "github.com/open-telemetry/opentelemetry-operator/internal/webhook/collector"
// +kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -125,7 +126,7 @@ func TestMain(m *testing.M) {
os.Exit(1)
}

if err = (&v1alpha1.OpenTelemetryCollector{}).SetupWebhookWithManager(mgr); err != nil {
if err = collectorwebhook.SetupWebhook(mgr, config.New()); err != nil {
fmt.Printf("failed to SetupWebhookWithManager: %v", err)
os.Exit(1)
}
Expand Down
1 change: 1 addition & 0 deletions internal/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func New(opts ...Option) Config {
autoInstrumentationNodeJSImage: o.autoInstrumentationNodeJSImage,
autoInstrumentationPythonImage: o.autoInstrumentationPythonImage,
autoInstrumentationDotNetImage: o.autoInstrumentationDotNetImage,
autoInstrumentationGoImage: o.autoInstrumentationGoImage,
autoInstrumentationApacheHttpdImage: o.autoInstrumentationApacheHttpdImage,
autoInstrumentationNginxImage: o.autoInstrumentationNginxImage,
labelsFilter: o.labelsFilter,
Expand Down
Loading
Loading