Skip to content

Commit d3cc203

Browse files
authored
Merge branch 'kubevirt:main' into move-destructive-flag-to-label-filter
2 parents 9b510ae + 2b04a3d commit d3cc203

File tree

19 files changed

+202
-191
lines changed

19 files changed

+202
-191
lines changed

cmd/cdi-operator/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ go_library(
1818
"//vendor/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1:go_default_library",
1919
"//vendor/sigs.k8s.io/controller-runtime/pkg/cache:go_default_library",
2020
"//vendor/sigs.k8s.io/controller-runtime/pkg/client/config:go_default_library",
21+
"//vendor/sigs.k8s.io/controller-runtime/pkg/healthz:go_default_library",
2122
"//vendor/sigs.k8s.io/controller-runtime/pkg/log:go_default_library",
2223
"//vendor/sigs.k8s.io/controller-runtime/pkg/log/zap:go_default_library",
2324
"//vendor/sigs.k8s.io/controller-runtime/pkg/manager:go_default_library",

cmd/cdi-operator/operator.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535

3636
"sigs.k8s.io/controller-runtime/pkg/cache"
3737
"sigs.k8s.io/controller-runtime/pkg/client/config"
38+
"sigs.k8s.io/controller-runtime/pkg/healthz"
3839
logf "sigs.k8s.io/controller-runtime/pkg/log"
3940
"sigs.k8s.io/controller-runtime/pkg/log/zap"
4041
"sigs.k8s.io/controller-runtime/pkg/manager"
@@ -98,6 +99,7 @@ func main() {
9899
LeaderElectionNamespace: namespace,
99100
LeaderElectionID: "cdi-operator-leader-election-helper",
100101
LeaderElectionResourceLock: "leases",
102+
HealthProbeBindAddress: ":8444",
101103
Metrics: server.Options{
102104
BindAddress: ":8443",
103105
SecureServing: true,
@@ -159,6 +161,15 @@ func main() {
159161
os.Exit(1)
160162
}
161163

164+
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
165+
log.Error(err, "unable to set up health check")
166+
os.Exit(1)
167+
}
168+
if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
169+
log.Error(err, "unable to set up ready check")
170+
os.Exit(1)
171+
}
172+
162173
log.Info("Starting the Manager.")
163174

164175
// Start the Manager

pkg/controller/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ go_library(
4444
"//vendor/k8s.io/api/core/v1:go_default_library",
4545
"//vendor/k8s.io/api/networking/v1:go_default_library",
4646
"//vendor/k8s.io/api/storage/v1:go_default_library",
47+
"//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library",
4748
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
4849
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
4950
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",

pkg/controller/clone-controller_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,13 @@ var _ = Describe("Clone controller reconcile loop", func() {
226226

227227
DescribeTable("Should create new source pod if none exists, and target pod is marked ready and", func(sourceVolumeMode corev1.PersistentVolumeMode, podFunc func(*corev1.PersistentVolumeClaim) *corev1.Pod) {
228228
testPvc := cc.CreatePvc("testPvc1", "default", map[string]string{
229-
cc.AnnCloneRequest: "default/source",
230-
cc.AnnPodReady: "true",
231-
cc.AnnCloneToken: "foobaz",
232-
AnnUploadClientName: "uploadclient",
233-
cc.AnnCloneSourcePod: "default-testPvc1-source-pod",
234-
cc.AnnPodNetwork: "net1"}, nil)
229+
cc.AnnCloneRequest: "default/source",
230+
cc.AnnPodReady: "true",
231+
cc.AnnCloneToken: "foobaz",
232+
AnnUploadClientName: "uploadclient",
233+
cc.AnnCloneSourcePod: "default-testPvc1-source-pod",
234+
cc.AnnPodNetwork: "net1",
235+
"unrelatedAnnotation": "test"}, nil)
235236
testPvc.Spec.VolumeMode = &sourceVolumeMode
236237
sourcePvc := cc.CreatePvc("source", "default", map[string]string{}, nil)
237238
sourcePvc.Spec.VolumeMode = &sourceVolumeMode
@@ -270,6 +271,8 @@ var _ = Describe("Clone controller reconcile loop", func() {
270271
Expect(sourcePod.GetAnnotations()[cc.AnnPodNetwork]).To(Equal("net1"))
271272
Expect(sourcePod.GetAnnotations()[cc.AnnPodSidecarInjectionIstio]).To(Equal(cc.AnnPodSidecarInjectionIstioDefault))
272273
Expect(sourcePod.GetAnnotations()[cc.AnnPodSidecarInjectionLinkerd]).To(Equal(cc.AnnPodSidecarInjectionLinkerdDefault))
274+
// Should not pass unrelated annotations to the pod
275+
Expect(sourcePod.GetAnnotations()["unrelatedAnnotation"]).To(BeEmpty())
273276
Expect(sourcePod.Spec.Affinity).ToNot(BeNil())
274277
Expect(sourcePod.Spec.Affinity.PodAffinity).ToNot(BeNil())
275278
l := len(sourcePod.Spec.Affinity.PodAffinity.PreferredDuringSchedulingIgnoredDuringExecution)

pkg/controller/dataimportcron-controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,13 @@ func (r *DataImportCronReconciler) updateContainerImageDesiredDigest(ctx context
657657
if err != nil {
658658
return false, err
659659
}
660+
platform := cron.Spec.Template.Spec.Source.Registry.Platform
661+
if platform != nil && platform.Architecture != "" {
662+
if workloadNodePlacement.NodeSelector == nil {
663+
workloadNodePlacement.NodeSelector = map[string]string{}
664+
}
665+
workloadNodePlacement.NodeSelector[corev1.LabelArchStable] = platform.Architecture
666+
}
660667

661668
containerImage := strings.TrimPrefix(*cron.Spec.Template.Spec.Source.Registry.URL, "docker://")
662669

pkg/controller/datasource-controller.go

Lines changed: 65 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ const (
6161
maxReferenceDepthReached = "MaxReferenceDepthReached"
6262
selfReference = "SelfReference"
6363
crossNamespaceReference = "CrossNamespaceReference"
64+
65+
dataSourcePvcField = "spec.source.pvc"
66+
dataSourceSnapshotField = "spec.source.snapshot"
67+
dataSourceDataSourceField = "spec.source.dataSource"
6468
)
6569

6670
// Reconcile loop for DataSourceReconciler
@@ -237,55 +241,20 @@ func NewDataSourceController(mgr manager.Manager, log logr.Logger, installerLabe
237241
}
238242

239243
func addDataSourceControllerWatches(mgr manager.Manager, c controller.Controller, log logr.Logger) error {
240-
const dataSourcePvcField = "spec.source.pvc"
241-
const dataSourceSnapshotField = "spec.source.snapshot"
242-
const dataSourceDataSourceField = "spec.source.dataSource"
243-
244-
getKey := func(namespace, name string) string {
245-
return namespace + "/" + name
246-
}
247-
248-
appendMatchingDataSourceRequests := func(ctx context.Context, indexingKey string, obj client.Object, reqs []reconcile.Request) []reconcile.Request {
249-
var dataSources cdiv1.DataSourceList
250-
matchingFields := client.MatchingFields{indexingKey: getKey(obj.GetNamespace(), obj.GetName())}
251-
if err := mgr.GetClient().List(ctx, &dataSources, matchingFields); err != nil {
252-
log.Error(err, "Unable to list DataSources", "matchingFields", matchingFields)
253-
return reqs
254-
}
255-
for _, ds := range dataSources.Items {
256-
reqs = append(reqs, reconcile.Request{NamespacedName: types.NamespacedName{Namespace: ds.Namespace, Name: ds.Name}})
257-
}
258-
return reqs
244+
if err := setupIndexers(mgr); err != nil {
245+
return err
259246
}
260-
261-
if err := c.Watch(source.Kind(mgr.GetCache(), &cdiv1.DataSource{},
262-
handler.TypedEnqueueRequestsFromMapFunc[*cdiv1.DataSource](func(ctx context.Context, obj *cdiv1.DataSource) []reconcile.Request {
263-
reqs := []reconcile.Request{
264-
{
265-
NamespacedName: types.NamespacedName{
266-
Name: obj.Name,
267-
Namespace: obj.Namespace,
268-
},
269-
},
270-
}
271-
return appendMatchingDataSourceRequests(ctx, dataSourceDataSourceField, obj, reqs)
272-
}),
273-
predicate.TypedFuncs[*cdiv1.DataSource]{
274-
CreateFunc: func(e event.TypedCreateEvent[*cdiv1.DataSource]) bool { return true },
275-
DeleteFunc: func(e event.TypedDeleteEvent[*cdiv1.DataSource]) bool { return true },
276-
UpdateFunc: func(e event.TypedUpdateEvent[*cdiv1.DataSource]) bool {
277-
return !sameSourceSpec(e.ObjectOld, e.ObjectNew) ||
278-
!sameConditions(e.ObjectOld, e.ObjectNew)
279-
},
280-
},
281-
)); err != nil {
247+
if err := setupWatches(mgr, c, log); err != nil {
282248
return err
283249
}
250+
return nil
251+
}
284252

253+
func setupIndexers(mgr manager.Manager) error {
285254
if err := mgr.GetFieldIndexer().IndexField(context.TODO(), &cdiv1.DataSource{}, dataSourcePvcField, func(obj client.Object) []string {
286255
if pvc := obj.(*cdiv1.DataSource).Spec.Source.PVC; pvc != nil {
287256
ns := cc.GetNamespace(pvc.Namespace, obj.GetNamespace())
288-
return []string{getKey(ns, pvc.Name)}
257+
return []string{types.NamespacedName{Name: pvc.Name, Namespace: ns}.String()}
289258
}
290259
return nil
291260
}); err != nil {
@@ -295,32 +264,54 @@ func addDataSourceControllerWatches(mgr manager.Manager, c controller.Controller
295264
if err := mgr.GetFieldIndexer().IndexField(context.TODO(), &cdiv1.DataSource{}, dataSourceSnapshotField, func(obj client.Object) []string {
296265
if snapshot := obj.(*cdiv1.DataSource).Spec.Source.Snapshot; snapshot != nil {
297266
ns := cc.GetNamespace(snapshot.Namespace, obj.GetNamespace())
298-
return []string{getKey(ns, snapshot.Name)}
267+
return []string{types.NamespacedName{Name: snapshot.Name, Namespace: ns}.String()}
299268
}
300269
return nil
301270
}); err != nil {
302271
return err
303272
}
304273

305274
if err := mgr.GetFieldIndexer().IndexField(context.TODO(), &cdiv1.DataSource{}, dataSourceDataSourceField, func(obj client.Object) []string {
306-
ds := obj.(*cdiv1.DataSource)
307-
if sourceDS := ds.Spec.Source.DataSource; sourceDS != nil {
308-
ns := cc.GetNamespace(sourceDS.Namespace, ds.GetNamespace())
309-
return []string{getKey(ns, sourceDS.Name)}
275+
if sourceDS := obj.(*cdiv1.DataSource).Spec.Source.DataSource; sourceDS != nil {
276+
ns := cc.GetNamespace(sourceDS.Namespace, obj.GetNamespace())
277+
return []string{types.NamespacedName{Name: sourceDS.Name, Namespace: ns}.String()}
310278
}
311279
return nil
312280
}); err != nil {
313281
return err
314282
}
315283

316-
mapToDataSource := func(ctx context.Context, obj client.Object) []reconcile.Request {
317-
reqs := appendMatchingDataSourceRequests(ctx, dataSourcePvcField, obj, nil)
318-
return appendMatchingDataSourceRequests(ctx, dataSourceSnapshotField, obj, reqs)
284+
return nil
285+
}
286+
287+
func setupWatches(mgr manager.Manager, c controller.Controller, log logr.Logger) error {
288+
if err := c.Watch(source.Kind(mgr.GetCache(), &cdiv1.DataSource{},
289+
handler.TypedEnqueueRequestsFromMapFunc(func(ctx context.Context, obj *cdiv1.DataSource) []reconcile.Request {
290+
reqs := []reconcile.Request{
291+
{
292+
NamespacedName: types.NamespacedName{
293+
Name: obj.Name,
294+
Namespace: obj.Namespace,
295+
},
296+
},
297+
}
298+
return appendMatchingDataSourceRequests(ctx, mgr, dataSourceDataSourceField, obj, reqs, log)
299+
}),
300+
predicate.TypedFuncs[*cdiv1.DataSource]{
301+
CreateFunc: func(e event.TypedCreateEvent[*cdiv1.DataSource]) bool { return true },
302+
DeleteFunc: func(e event.TypedDeleteEvent[*cdiv1.DataSource]) bool { return true },
303+
UpdateFunc: func(e event.TypedUpdateEvent[*cdiv1.DataSource]) bool {
304+
return !sameSourceSpec(e.ObjectOld, e.ObjectNew) ||
305+
!sameConditions(e.ObjectOld, e.ObjectNew)
306+
},
307+
},
308+
)); err != nil {
309+
return err
319310
}
320311

321312
if err := c.Watch(source.Kind(mgr.GetCache(), &cdiv1.DataVolume{},
322-
handler.TypedEnqueueRequestsFromMapFunc[*cdiv1.DataVolume](func(ctx context.Context, obj *cdiv1.DataVolume) []reconcile.Request {
323-
return mapToDataSource(ctx, obj)
313+
handler.TypedEnqueueRequestsFromMapFunc(func(ctx context.Context, obj *cdiv1.DataVolume) []reconcile.Request {
314+
return mapToDataSource(ctx, mgr, obj, log)
324315
}),
325316
predicate.TypedFuncs[*cdiv1.DataVolume]{
326317
CreateFunc: func(e event.TypedCreateEvent[*cdiv1.DataVolume]) bool { return true },
@@ -336,8 +327,8 @@ func addDataSourceControllerWatches(mgr manager.Manager, c controller.Controller
336327
}
337328

338329
if err := c.Watch(source.Kind(mgr.GetCache(), &corev1.PersistentVolumeClaim{},
339-
handler.TypedEnqueueRequestsFromMapFunc[*corev1.PersistentVolumeClaim](func(ctx context.Context, obj *corev1.PersistentVolumeClaim) []reconcile.Request {
340-
return mapToDataSource(ctx, obj)
330+
handler.TypedEnqueueRequestsFromMapFunc(func(ctx context.Context, obj *corev1.PersistentVolumeClaim) []reconcile.Request {
331+
return mapToDataSource(ctx, mgr, obj, log)
341332
}),
342333
predicate.TypedFuncs[*corev1.PersistentVolumeClaim]{
343334
CreateFunc: func(e event.TypedCreateEvent[*corev1.PersistentVolumeClaim]) bool { return true },
@@ -361,8 +352,8 @@ func addDataSourceControllerWatches(mgr manager.Manager, c controller.Controller
361352
}
362353
}
363354
if err := c.Watch(source.Kind(mgr.GetCache(), &snapshotv1.VolumeSnapshot{},
364-
handler.TypedEnqueueRequestsFromMapFunc[*snapshotv1.VolumeSnapshot](func(ctx context.Context, obj *snapshotv1.VolumeSnapshot) []reconcile.Request {
365-
return mapToDataSource(ctx, obj)
355+
handler.TypedEnqueueRequestsFromMapFunc(func(ctx context.Context, obj *snapshotv1.VolumeSnapshot) []reconcile.Request {
356+
return mapToDataSource(ctx, mgr, obj, log)
366357
}),
367358
predicate.TypedFuncs[*snapshotv1.VolumeSnapshot]{
368359
CreateFunc: func(e event.TypedCreateEvent[*snapshotv1.VolumeSnapshot]) bool { return true },
@@ -379,6 +370,24 @@ func addDataSourceControllerWatches(mgr manager.Manager, c controller.Controller
379370
return nil
380371
}
381372

373+
func appendMatchingDataSourceRequests(ctx context.Context, mgr manager.Manager, indexingKey string, obj client.Object, reqs []reconcile.Request, log logr.Logger) []reconcile.Request {
374+
var dataSources cdiv1.DataSourceList
375+
matchingFields := client.MatchingFields{indexingKey: client.ObjectKeyFromObject(obj).String()}
376+
if err := mgr.GetClient().List(ctx, &dataSources, matchingFields); err != nil {
377+
log.Error(err, "Unable to list DataSources", "matchingFields", matchingFields)
378+
return reqs
379+
}
380+
for _, ds := range dataSources.Items {
381+
reqs = append(reqs, reconcile.Request{NamespacedName: types.NamespacedName{Namespace: ds.Namespace, Name: ds.Name}})
382+
}
383+
return reqs
384+
}
385+
386+
func mapToDataSource(ctx context.Context, mgr manager.Manager, obj client.Object, log logr.Logger) []reconcile.Request {
387+
reqs := appendMatchingDataSourceRequests(ctx, mgr, dataSourcePvcField, obj, nil, log)
388+
return appendMatchingDataSourceRequests(ctx, mgr, dataSourceSnapshotField, obj, reqs, log)
389+
}
390+
382391
func sameSourceSpec(objOld, objNew client.Object) bool {
383392
dsOld, okOld := objOld.(*cdiv1.DataSource)
384393
dsNew, okNew := objNew.(*cdiv1.DataSource)

pkg/controller/import-controller_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ var _ = Describe("ImportConfig Controller reconcile loop", func() {
297297
})
298298

299299
It("Should create a POD if a PVC with all needed annotations is passed", func() {
300-
pvc := cc.CreatePvc("testPvc1", "default", map[string]string{cc.AnnEndpoint: testEndPoint, cc.AnnImportPod: "importer-testPvc1", cc.AnnPodNetwork: "net1"}, nil)
300+
pvc := cc.CreatePvc("testPvc1", "default", map[string]string{cc.AnnEndpoint: testEndPoint, cc.AnnImportPod: "importer-testPvc1", cc.AnnPodNetwork: "net1", "unrelatedAnnotation": "test"}, nil)
301301
pvc.Status.Phase = v1.ClaimBound
302302
reconciler = createImportReconciler(pvc)
303303
_, err := reconciler.Reconcile(context.TODO(), reconcile.Request{NamespacedName: types.NamespacedName{Name: "testPvc1", Namespace: "default"}})
@@ -318,6 +318,8 @@ var _ = Describe("ImportConfig Controller reconcile loop", func() {
318318
Expect(pod.GetAnnotations()[cc.AnnPodNetwork]).To(Equal("net1"))
319319
Expect(pod.GetAnnotations()[cc.AnnPodSidecarInjectionIstio]).To(Equal(cc.AnnPodSidecarInjectionIstioDefault))
320320
Expect(pod.GetAnnotations()[cc.AnnPodSidecarInjectionLinkerd]).To(Equal(cc.AnnPodSidecarInjectionLinkerdDefault))
321+
// Should not pass unrelated annotations to the pod
322+
Expect(pod.GetAnnotations()["unrelatedAnnotation"]).To(BeEmpty())
321323
})
322324

323325
It("Should not pass non-approved PVC annotation to created POD", func() {

pkg/controller/storageprofile-controller.go

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414

1515
v1 "k8s.io/api/core/v1"
1616
storagev1 "k8s.io/api/storage/v1"
17+
apiequality "k8s.io/apimachinery/pkg/api/equality"
1718
k8serrors "k8s.io/apimachinery/pkg/api/errors"
1819
"k8s.io/apimachinery/pkg/api/meta"
1920
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -129,17 +130,49 @@ func (r *StorageProfileReconciler) reconcileStorageProfile(sc *storagev1.Storage
129130
}
130131

131132
func (r *StorageProfileReconciler) updateStorageProfile(prevStorageProfile runtime.Object, storageProfile *cdiv1.StorageProfile, log logr.Logger) error {
132-
if prevStorageProfile == nil {
133+
var prevSP *cdiv1.StorageProfile
134+
if p, ok := prevStorageProfile.(*cdiv1.StorageProfile); ok {
135+
prevSP = p
136+
}
137+
138+
if prevSP == nil {
133139
return r.client.Create(context.TODO(), storageProfile)
134-
} else if !reflect.DeepEqual(prevStorageProfile, storageProfile) {
135-
// Updates have happened, update StorageProfile.
140+
}
141+
142+
if storageProfileSpecMetaChanged(prevSP, storageProfile) {
136143
log.Info("Updating StorageProfile", "StorageProfile.Name", storageProfile.Name, "storageProfile", storageProfile)
137-
return r.client.Update(context.TODO(), storageProfile)
144+
if err := r.client.Update(context.TODO(), storageProfile); err != nil {
145+
return err
146+
}
147+
}
148+
149+
if !reflect.DeepEqual(prevSP.Status, storageProfile.Status) {
150+
log.Info("Updating StorageProfile Status", "StorageProfile.Name", storageProfile.Name, "storageProfile", storageProfile)
151+
if err := r.client.Status().Update(context.TODO(), storageProfile); err != nil {
152+
return err
153+
}
138154
}
139155

140156
return nil
141157
}
142158

159+
// storageProfileSpecMetaChanged returns true if Spec, Labels, or Annotations differ
160+
func storageProfileSpecMetaChanged(previous, desired *cdiv1.StorageProfile) bool {
161+
if previous == nil || desired == nil {
162+
return previous != desired
163+
}
164+
if !apiequality.Semantic.DeepEqual(previous.Spec, desired.Spec) {
165+
return true
166+
}
167+
if !apiequality.Semantic.DeepEqual(previous.GetLabels(), desired.GetLabels()) {
168+
return true
169+
}
170+
if !apiequality.Semantic.DeepEqual(previous.GetAnnotations(), desired.GetAnnotations()) {
171+
return true
172+
}
173+
return false
174+
}
175+
143176
func (r *StorageProfileReconciler) getStorageProfile(sc *storagev1.StorageClass) (*cdiv1.StorageProfile, runtime.Object, error) {
144177
var prevStorageProfile runtime.Object
145178
storageProfile := &cdiv1.StorageProfile{}

pkg/controller/storageprofile-controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ func createStorageProfileReconciler(objects ...runtime.Object) *StorageProfileRe
605605
_ = ocpconfigv1.Install(s)
606606

607607
// Create a fake client to mock API calls.
608-
cl := fake.NewClientBuilder().WithScheme(s).WithRuntimeObjects(objs...).Build()
608+
cl := fake.NewClientBuilder().WithScheme(s).WithRuntimeObjects(objs...).WithStatusSubresource(&cdiv1.StorageProfile{}).Build()
609609

610610
rec := record.NewFakeRecorder(10)
611611
// Create a ReconcileMemcached object with the scheme and fake client.

pkg/controller/upload-controller_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ var _ = Describe("reconcilePVC loop", func() {
360360
})
361361

362362
It("Should create the service and pod with passed annotations", func() {
363-
testPvc := cc.CreatePvc(testPvcName, "default", map[string]string{cc.AnnCloneRequest: "default/testPvc2", AnnUploadPod: uploadResourceName, cc.AnnPodNetwork: "net1"}, nil)
363+
testPvc := cc.CreatePvc(testPvcName, "default", map[string]string{cc.AnnCloneRequest: "default/testPvc2", AnnUploadPod: uploadResourceName, cc.AnnPodNetwork: "net1", "unrelatedAnnotation": "test"}, nil)
364364
testPvcSource := cc.CreatePvc("testPvc2", "default", map[string]string{}, nil)
365365
reconciler := createUploadReconciler(testPvc, testPvcSource)
366366
By("Verifying the pod and service do not exist")
@@ -384,6 +384,8 @@ var _ = Describe("reconcilePVC loop", func() {
384384
Expect(uploadPod.GetAnnotations()[cc.AnnPodNetwork]).To(Equal("net1"))
385385
Expect(uploadPod.GetAnnotations()[cc.AnnPodSidecarInjectionIstio]).To(Equal(cc.AnnPodSidecarInjectionIstioDefault))
386386
Expect(uploadPod.GetAnnotations()[cc.AnnPodSidecarInjectionLinkerd]).To(Equal(cc.AnnPodSidecarInjectionLinkerdDefault))
387+
// Should not pass unrelated annotations to the pod
388+
Expect(uploadPod.GetAnnotations()["unrelatedAnnotation"]).To(BeEmpty())
387389
expectDeadline(uploadPod)
388390

389391
uploadService = &corev1.Service{}

0 commit comments

Comments
 (0)