Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/controller/aggregates_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
ConditionTypeAggregatesUpdated = "AggregatesUpdated"
ConditionAggregatesSuccess = "Success"
ConditionAggregatesFailed = "Failed"
AggregatesControllerName = "aggregates"
)

type AggregatesController struct {
Expand Down Expand Up @@ -138,7 +139,7 @@ func (ac *AggregatesController) SetupWithManager(mgr ctrl.Manager) error {
ac.computeClient.Microversion = "2.40" // gophercloud only supports numeric ids

return ctrl.NewControllerManagedBy(mgr).
Named("aggregates").
Named(AggregatesControllerName).
For(&kvmv1.Hypervisor{}).
Complete(ac)
}
Expand Down
5 changes: 3 additions & 2 deletions internal/controller/decomission_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ import (
)

const (
decommissionFinalizerName = "cobaltcore.cloud.sap/decommission-hypervisor"
decommissionFinalizerName = "cobaltcore.cloud.sap/decommission-hypervisor"
DecommissionControllerName = "nodeDecommission"
)

type NodeDecommissionReconciler struct {
Expand Down Expand Up @@ -222,7 +223,7 @@ func (r *NodeDecommissionReconciler) SetupWithManager(mgr ctrl.Manager) error {
})

return ctrl.NewControllerManagedBy(mgr).
Named("nodeDecommission").
Named(DecommissionControllerName).
For(&corev1.Node{}).
WithEventFilter(predicateFilter).
Complete(r)
Expand Down
4 changes: 3 additions & 1 deletion internal/controller/eviction_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ type EvictionReconciler struct {
}

const (
evictionFinalizerName = "eviction-controller.cloud.sap/finalizer"
evictionFinalizerName = "eviction-controller.cloud.sap/finalizer"
EvictionControllerName = "eviction"
)

// +kubebuilder:rbac:groups=kvm.cloud.sap,resources=evictions,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -565,6 +566,7 @@ func (r *EvictionReconciler) SetupWithManager(mgr ctrl.Manager) error {
r.rand = rand.New(rand.NewSource(time.Now().UnixNano()))

return ctrl.NewControllerManagedBy(mgr).
Named(EvictionControllerName).
For(&kvmv1.Eviction{}).
Complete(r)
}
8 changes: 5 additions & 3 deletions internal/controller/hypervisor_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ import (
)

const (
labelLifecycleMode = "cobaltcore.cloud.sap/node-hypervisor-lifecycle"
annotationAggregates = "nova.openstack.cloud.sap/aggregates"
annotationCustomTraits = "nova.openstack.cloud.sap/custom-traits"
labelLifecycleMode = "cobaltcore.cloud.sap/node-hypervisor-lifecycle"
annotationAggregates = "nova.openstack.cloud.sap/aggregates"
annotationCustomTraits = "nova.openstack.cloud.sap/custom-traits"
HypervisorControllerName = "hypervisor"
)

var transferLabels = []string{
Expand Down Expand Up @@ -172,6 +173,7 @@ func (hv *HypervisorController) SetupWithManager(mgr ctrl.Manager) error {
}

return ctrl.NewControllerManagedBy(mgr).
Named(HypervisorControllerName).
For(&corev1.Node{}).
WithEventFilter(novaVirtLabeledPredicate).
Complete(hv)
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/maintenance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const (
labelCriticalComponent = "node.gardener.cloud/critical-component"
labelCriticalComponentsNotReady = "node.gardener.cloud/critical-components-not-ready"
valueReasonTerminating = "terminating"
MaintenanceControllerName = "maintenance"
)

// The counter-side in gardener is here:
Expand Down Expand Up @@ -260,7 +261,7 @@ func (r *MaintenanceController) SetupWithManager(mgr ctrl.Manager, namespace str
}

return ctrl.NewControllerManagedBy(mgr).
Named("maintenance").
Named(MaintenanceControllerName).
For(&corev1.Node{}).
Owns(&appsv1.Deployment{}). // trigger the r.Reconcile whenever an Own-ed deployment is created/updated/deleted
Owns(&policyv1.PodDisruptionBudget{}).
Expand Down
6 changes: 5 additions & 1 deletion internal/controller/node_certificate_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"
)

const (
NodeCertificateControllerName = "certificate"
)

type NodeCertificateController struct {
k8sclient.Client
Scheme *runtime.Scheme
Expand Down Expand Up @@ -191,7 +195,7 @@ func (r *NodeCertificateController) SetupWithManager(mgr ctrl.Manager, namespace
}

return ctrl.NewControllerManagedBy(mgr).
Named("certificate").
Named(NodeCertificateControllerName).
For(&corev1.Node{}).
WithEventFilter(novaVirtLabeledPredicate).
Complete(r)
Expand Down
7 changes: 4 additions & 3 deletions internal/controller/node_eviction_label_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ import (
)

const (
disabledSuffix = "-disabled"
labelMl2MechanismDriver = "neutron.openstack.cloud.sap/ml2-mechanism-driver"
disabledSuffix = "-disabled"
labelMl2MechanismDriver = "neutron.openstack.cloud.sap/ml2-mechanism-driver"
NodeEvictionLabelControllerName = "nodeEvictionLabel"
)

type NodeEvictionLabelReconciler struct {
Expand Down Expand Up @@ -188,7 +189,7 @@ func (r *NodeEvictionLabelReconciler) SetupWithManager(mgr ctrl.Manager) error {
_ = logger.FromContext(ctx)

return ctrl.NewControllerManagedBy(mgr).
Named("nodeEvictionLabel").
Named(NodeEvictionLabelControllerName).
For(&corev1.Node{}). // trigger the r.Reconcile whenever a node is created/updated/deleted.
Owns(&kvmv1.Eviction{}). // trigger the r.Reconcile whenever an Own-ed eviction is created/updated/deleted
Complete(r)
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/onboarding_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const (
testImageName = "cirros-d240801-kvm"
testPrefixName = "ohooc-"
testVolumeType = "kvm-pilot"
OnboardingControllerName = "onboarding"
)

type OnboardingController struct {
Expand Down Expand Up @@ -575,7 +576,7 @@ func (r *OnboardingController) SetupWithManager(mgr ctrl.Manager) error {
r.testNetworkClient.ResourceBase = fmt.Sprintf("%vv2.0/", r.testNetworkClient.Endpoint)

return ctrl.NewControllerManagedBy(mgr).
Named("onboarding").
Named(OnboardingControllerName).
For(&kvmv1.Hypervisor{}).
Complete(r)
}
3 changes: 2 additions & 1 deletion internal/controller/traits_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
ConditionTypeTraitsUpdated = "TraitsUpdated"
ConditionTraitsSuccess = "Success"
ConditionTraitsFailed = "Failed"
TraitsControllerName = "traits"
)

type TraitsController struct {
Expand Down Expand Up @@ -171,7 +172,7 @@ func (tc *TraitsController) SetupWithManager(mgr ctrl.Manager) error {
tc.serviceClient.Microversion = "1.39" // yoga, or later

return ctrl.NewControllerManagedBy(mgr).
Named("traits").
Named(TraitsControllerName).
For(&kvmv1.Hypervisor{}).
Complete(tc)
}
Loading