Skip to content

Commit

Permalink
fix: Add controller=true to ownerreferences to correctly reconcile on…
Browse files Browse the repository at this point in the history
… .Owns() (#281)
  • Loading branch information
ellistarn authored Jul 12, 2023
1 parent a916ac0 commit 9d1bd14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/core/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ func (r *NodeReconciler) SetupWithManager(mgr ctrl.Manager, healthzHandler *rcHe
return ctrl.NewControllerManagedBy(mgr).
For(&corev1.Node{}).
WithOptions(controller.Options{MaxConcurrentReconciles: MaxNodeConcurrentReconciles}).
Owns(&v1alpha1.CNINode{}).Complete(r)
Owns(&v1alpha1.CNINode{}).
Complete(r)
}

func (r *NodeReconciler) Check() healthz.Checker {
Expand Down
2 changes: 2 additions & 0 deletions pkg/k8s/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
rcv1alpha1 "github.com/aws/amazon-vpc-resource-controller-k8s/apis/vpcresources/v1alpha1"
"github.com/aws/amazon-vpc-resource-controller-k8s/pkg/config"
"github.com/prometheus/client_golang/prometheus"
"github.com/samber/lo"

appv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -244,6 +245,7 @@ func (k *k8sWrapper) CreateCNINode(node *v1.Node) error {
Kind: node.Kind,
Name: node.Name,
UID: node.UID,
Controller: lo.ToPtr(true),
},
},
},
Expand Down

0 comments on commit 9d1bd14

Please sign in to comment.