-
Notifications
You must be signed in to change notification settings - Fork 458
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
Allow version before 0.52 to upgrade #1126
Changes from 18 commits
3bef8a8
a3f8809
86b7ebb
842f720
b13f969
c280e66
302ef45
6b520ce
2a6c730
30fa35a
dbc4074
690a843
3c2c6e9
ce1b940
db8da58
0b4d703
ce19c23
06f8a4f
620f486
50db127
e2889f7
a10fa97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add here some docs that explain why this test is there? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added comment. |
||
kind: TestSuite | ||
crdDir: ./tests/_build/crds/ | ||
artifactsDir: ./tests/_build/artifacts/ | ||
kindContainers: | ||
- local/opentelemetry-operator:e2e | ||
- ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:v0.49.0 | ||
commands: | ||
- command: make cert-manager | ||
- command: kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/download/v0.49.0/opentelemetry-operator.yaml | ||
- command: kubectl rollout status -w deployment/opentelemetry-operator-controller-manager -n opentelemetry-operator-system | ||
- command: sleep 60 | ||
testDirs: | ||
- ./tests/e2e-upgrade/ | ||
timeout: 150 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import ( | |
"fmt" | ||
|
||
appsv1 "k8s.io/api/apps/v1" | ||
apiequality "k8s.io/apimachinery/pkg/api/equality" | ||
k8serrors "k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/types" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
@@ -70,6 +71,16 @@ func expectedDaemonSets(ctx context.Context, params Params, expected []appsv1.Da | |
return fmt.Errorf("failed to get: %w", err) | ||
} | ||
|
||
// Selector is an immutable field, if set, we cannot modify it otherwise we will face reconciliation error. | ||
if !apiequality.Semantic.DeepEqual(desired.Spec.Selector, existing.Spec.Selector) { | ||
params.Log.V(2).Info("Spec.Selector change detected, trying to delete, the new collector daemonset will be created in the next reconcile cycle", "daemonset.name", existing.Name, "daemonset.namespace", existing.Namespace) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is the next reconcile loop? Maybe we should be more explicit and force the creation and continue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since the operator is watching the delete event, the next loop will happen when the collector got deleted (you can try manually delete the deployment and operator created almost immediately). Normally we shall not do 2 updates at one time, which will generate extra events. |
||
|
||
if err := params.Client.Delete(ctx, existing); err != nil { | ||
return fmt.Errorf("failed to request deleting daemonset: %w", err) | ||
} | ||
continue | ||
} | ||
|
||
// it exists already, merge the two if the end result isn't identical to the existing one | ||
updated := existing.DeepCopy() | ||
if updated.Annotations == nil { | ||
|
@@ -89,9 +100,6 @@ func expectedDaemonSets(ctx context.Context, params Params, expected []appsv1.Da | |
updated.ObjectMeta.Labels[k] = v | ||
} | ||
|
||
// Selector is an immutable field, if set, we cannot modify it otherwise we will face reconciliation error. | ||
updated.Spec.Selector = existing.Spec.Selector.DeepCopy() | ||
|
||
patch := client.MergeFrom(existing) | ||
if err := params.Client.Patch(ctx, updated, patch); err != nil { | ||
return fmt.Errorf("failed to apply changes: %w", err) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: simplest-collector | ||
annotations: | ||
operatorVersion: "v0.49.0" | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/version: latest | ||
status: | ||
readyReplicas: 1 | ||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: simplest-collector-headless | ||
spec: | ||
ports: | ||
- appProtocol: grpc | ||
name: jaeger-grpc | ||
port: 14250 | ||
protocol: TCP | ||
targetPort: 14250 | ||
- appProtocol: grpc | ||
name: otlp-grpc | ||
port: 4317 | ||
protocol: TCP | ||
targetPort: 4317 | ||
- appProtocol: http | ||
name: otlp-http | ||
port: 4318 | ||
protocol: TCP | ||
targetPort: 4318 | ||
- appProtocol: http | ||
name: otlp-http-legacy | ||
port: 55681 | ||
protocol: TCP | ||
targetPort: 4318 | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: simplest-collector | ||
spec: | ||
ports: | ||
- appProtocol: grpc | ||
name: jaeger-grpc | ||
port: 14250 | ||
protocol: TCP | ||
targetPort: 14250 | ||
- appProtocol: grpc | ||
name: otlp-grpc | ||
port: 4317 | ||
protocol: TCP | ||
targetPort: 4317 | ||
- appProtocol: http | ||
name: otlp-http | ||
port: 4318 | ||
protocol: TCP | ||
targetPort: 4318 | ||
- appProtocol: http | ||
name: otlp-http-legacy | ||
port: 55681 | ||
protocol: TCP | ||
targetPort: 4318 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
metadata: | ||
name: simplest | ||
annotations: | ||
operatorVersion: "v0.49.0" | ||
spec: | ||
replicas: 1 | ||
config: | | ||
receivers: | ||
jaeger: | ||
protocols: | ||
grpc: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
processors: | ||
|
||
exporters: | ||
logging: | ||
|
||
service: | ||
pipelines: | ||
traces: | ||
receivers: [jaeger,otlp] | ||
processors: [] | ||
exporters: [logging] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: kubectl apply -f ../../_build/manifests/01-opentelemetry-operator.yaml | ||
- command: kubectl rollout status -w deployment/opentelemetry-operator-controller-manager -n opentelemetry-operator-system | ||
- command: sleep 60 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: simplest-collector | ||
annotations: | ||
operatorVersion: "latest" | ||
status: | ||
readyReplicas: 2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
metadata: | ||
name: simplest | ||
annotations: | ||
operatorVersion: "latest" | ||
spec: | ||
replicas: 2 | ||
config: | | ||
receivers: | ||
jaeger: | ||
protocols: | ||
grpc: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
processors: | ||
|
||
exporters: | ||
logging: | ||
|
||
service: | ||
pipelines: | ||
traces: | ||
receivers: [jaeger,otlp] | ||
processors: [] | ||
exporters: [logging] |
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.
is the upgrade test executed on the CI?
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.
Just added.