Skip to content

Commit

Permalink
Omit useless data from OperatingSystemConfig in Secrets reconcile…
Browse files Browse the repository at this point in the history
…d by `gardener-node-agent` (gardener#9723)
  • Loading branch information
rfranzke authored and ske-prow[bot] committed Jul 10, 2024
1 parent 33af561 commit a35b8ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ func OperatingSystemConfigSecret(
*corev1.Secret,
error,
) {
// This OperatingSystemConfig object should only contain the data relevant for gardener-node-agent reconciliation to
// prevent undesired changes of the computed checksum of this object.
operatingSystemConfig := &extensionsv1alpha1.OperatingSystemConfig{
ObjectMeta: metav1.ObjectMeta{
Name: osc.Name,
Labels: osc.Labels,
Annotations: osc.Annotations,
Spec: extensionsv1alpha1.OperatingSystemConfigSpec{
Units: osc.Spec.Units,
Files: osc.Spec.Files,
},
Status: extensionsv1alpha1.OperatingSystemConfigStatus{
ExtensionUnits: osc.Status.ExtensionUnits,
ExtensionFiles: osc.Status.ExtensionFiles,
},
Spec: osc.Spec,
Status: osc.Status,
}

// The OperatingSystemConfig will be deployed to the shoot to get processed by gardener-node-agent. It doesn't
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake"

gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
"github.com/gardener/gardener/pkg/client/kubernetes"
. "github.com/gardener/gardener/pkg/component/extensions/operatingsystemconfig/original/components/nodeagent"
Expand Down Expand Up @@ -89,6 +90,14 @@ var _ = Describe("Secrets", func() {
ExtensionUnits: []extensionsv1alpha1.Unit{{
Name: "some-other-unit.service",
}},
ExtensionFiles: []extensionsv1alpha1.File{{
Path: "/some/other/path",
}},
DefaultStatus: extensionsv1alpha1.DefaultStatus{
LastOperation: &gardencorev1beta1.LastOperation{
LastUpdateTime: metav1.Now(),
},
},
},
}
})
Expand All @@ -101,7 +110,7 @@ var _ = Describe("Secrets", func() {
Name: secretName,
Namespace: "kube-system",
Annotations: map[string]string{
"checksum/data-script": "b0a0d190d45f0d67d97bf30d7e45d9cbbaa86bbe99f34bc095a6fd172d1a18a2",
"checksum/data-script": "931abcfaf3fd3152748ec51b8f139a22a48a3ac6d8fff1c56a3aa2e07d2a39f1",
},
Labels: map[string]string{
"gardener.cloud/role": "operating-system-config",
Expand All @@ -111,12 +120,7 @@ var _ = Describe("Secrets", func() {
Data: map[string][]byte{"osc.yaml": []byte(`apiVersion: extensions.gardener.cloud/v1alpha1
kind: OperatingSystemConfig
metadata:
annotations:
bar: foo
creationTimestamp: null
labels:
foo: bar
name: osc-name
spec:
files:
- content:
Expand All @@ -129,6 +133,9 @@ spec:
units:
- name: some-unit.service
status:
extensionFiles:
- content: {}
path: /some/other/path
extensionUnits:
- name: some-other-unit.service
`)},
Expand Down

0 comments on commit a35b8ef

Please sign in to comment.