Skip to content

Commit 7dd1b10

Browse files
committed
refactor: scope PR to extensions/ only
Remove Sandbox→Pod annotation propagation from sandbox_controller.go per maintainer feedback. The in-place annotation/resource propagation is a sig-apps design question and will be a separate follow-up. This PR now only touches extensions/ (SandboxClaim workspaceResources).
1 parent c4e38c9 commit 7dd1b10

4 files changed

Lines changed: 17 additions & 40 deletions

File tree

controllers/sandbox_controller.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,6 @@ func (r *SandboxReconciler) reconcilePod(ctx context.Context, sandbox *sandboxv1
451451
if pod.Labels == nil {
452452
pod.Labels = make(map[string]string)
453453
}
454-
if pod.Annotations == nil {
455-
pod.Annotations = make(map[string]string)
456-
}
457454
changed := false
458455
if pod.Labels[sandboxLabel] != nameHash {
459456
pod.Labels[sandboxLabel] = nameHash
@@ -466,12 +463,6 @@ func (r *SandboxReconciler) reconcilePod(ctx context.Context, sandbox *sandboxv1
466463
changed = true
467464
}
468465
}
469-
for k, v := range sandbox.Spec.PodTemplate.ObjectMeta.Annotations {
470-
if pod.Annotations[k] != v {
471-
pod.Annotations[k] = v
472-
changed = true
473-
}
474-
}
475466

476467
// Set controller reference if the pod is not controlled by anything.
477468
if controllerRef := metav1.GetControllerOf(pod); controllerRef == nil {

controllers/sandbox_controller_test.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,6 @@ func TestReconcilePod(t *testing.T) {
620620
"agents.x-k8s.io/sandbox-name-hash": nameHash,
621621
"custom-label": "label-val",
622622
},
623-
Annotations: map[string]string{
624-
"custom-annotation": "anno-val",
625-
},
626623
OwnerReferences: []metav1.OwnerReference{sandboxControllerRef(sandboxName)},
627624
},
628625
Spec: corev1.PodSpec{
@@ -702,7 +699,7 @@ func TestReconcilePod(t *testing.T) {
702699
wantPod: nil,
703700
},
704701
{
705-
name: "adopts existing pod via annotation - pod gets metadata and owner reference",
702+
name: "adopts existing pod via annotation - pod gets label and owner reference",
706703
initialObjs: []runtime.Object{
707704
&corev1.Pod{
708705
ObjectMeta: metav1.ObjectMeta{
@@ -730,11 +727,6 @@ func TestReconcilePod(t *testing.T) {
730727
Spec: sandboxv1alpha1.SandboxSpec{
731728
Replicas: ptr.To(int32(1)),
732729
PodTemplate: sandboxv1alpha1.PodTemplate{
733-
ObjectMeta: sandboxv1alpha1.PodMetadata{
734-
Annotations: map[string]string{
735-
"example.com/workspace": "true",
736-
},
737-
},
738730
Spec: corev1.PodSpec{
739731
Containers: []corev1.Container{
740732
{
@@ -753,9 +745,6 @@ func TestReconcilePod(t *testing.T) {
753745
Labels: map[string]string{
754746
sandboxLabel: nameHash,
755747
},
756-
Annotations: map[string]string{
757-
"example.com/workspace": "true",
758-
},
759748
OwnerReferences: []metav1.OwnerReference{sandboxControllerRef(sandboxName)},
760749
},
761750
Spec: corev1.PodSpec{
@@ -808,9 +797,6 @@ func TestReconcilePod(t *testing.T) {
808797
"agents.x-k8s.io/sandbox-name-hash": nameHash,
809798
"custom-label": "label-val",
810799
},
811-
Annotations: map[string]string{
812-
"custom-annotation": "anno-val",
813-
},
814800
// Should still have the original controller reference
815801
OwnerReferences: []metav1.OwnerReference{
816802
{

extensions/api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/controllers/sandboxclaim_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ func TestSandboxClaimAdoptionAppliesWorkspaceResources(t *testing.T) {
12981298
ObjectMeta: sandboxv1alpha1.PodMetadata{
12991299
Annotations: map[string]string{
13001300
"example.com/workspace": "true",
1301-
"test-annotation": "template",
1301+
"test-annotation": "template",
13021302
},
13031303
},
13041304
Spec: corev1.PodSpec{

0 commit comments

Comments
 (0)