mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 14:26:23 -04:00
deps: update K8s dependencies (#1599)
* deps: update K8s dependencies * deps: bump controller runtime * chore: tidy * bump helm and migrate controller runtime * fix helm deprecation --------- Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> Co-authored-by: Leonard Cohnen <lc@edgeless.systems>
This commit is contained in:
parent
81c9c5205c
commit
2afddcb0f8
25 changed files with 467 additions and 1773 deletions
|
@ -39,7 +39,6 @@ go_library(
|
|||
"@io_k8s_sigs_controller_runtime//pkg/log",
|
||||
"@io_k8s_sigs_controller_runtime//pkg/predicate",
|
||||
"@io_k8s_sigs_controller_runtime//pkg/reconcile",
|
||||
"@io_k8s_sigs_controller_runtime//pkg/source",
|
||||
"@io_k8s_utils//clock",
|
||||
"@org_golang_x_mod//semver",
|
||||
],
|
||||
|
|
|
@ -23,7 +23,6 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"sigs.k8s.io/controller-runtime/pkg/source"
|
||||
|
||||
updatev1alpha1 "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/api/v1alpha1"
|
||||
)
|
||||
|
@ -148,16 +147,16 @@ func (r *AutoscalingStrategyReconciler) SetupWithManager(mgr ctrl.Manager) error
|
|||
return ctrl.NewControllerManagedBy(mgr).
|
||||
For(&updatev1alpha1.AutoscalingStrategy{}).
|
||||
Watches(
|
||||
&source.Kind{Type: &updatev1alpha1.ScalingGroup{}},
|
||||
client.Object(&updatev1alpha1.ScalingGroup{}),
|
||||
handler.EnqueueRequestsFromMapFunc(r.findObjectsForDeployment),
|
||||
builder.WithPredicates(scalingGroupChangePredicate()),
|
||||
).
|
||||
Complete(r)
|
||||
}
|
||||
|
||||
func (r *AutoscalingStrategyReconciler) findObjectsForDeployment(_ client.Object) []reconcile.Request {
|
||||
func (r *AutoscalingStrategyReconciler) findObjectsForDeployment(ctx context.Context, _ client.Object) []reconcile.Request {
|
||||
var autoscalingStrats updatev1alpha1.AutoscalingStrategyList
|
||||
err := r.List(context.Background(), &autoscalingStrats)
|
||||
err := r.List(ctx, &autoscalingStrats)
|
||||
if err != nil {
|
||||
return []reconcile.Request{}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/handler"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"sigs.k8s.io/controller-runtime/pkg/source"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -122,15 +121,15 @@ func (r *JoiningNodesReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
|||
return ctrl.NewControllerManagedBy(mgr).
|
||||
For(&updatev1alpha1.JoiningNode{}).
|
||||
Watches(
|
||||
&source.Kind{Type: &corev1.Node{}},
|
||||
client.Object(&corev1.Node{}),
|
||||
handler.EnqueueRequestsFromMapFunc(r.findAllJoiningNodes),
|
||||
).
|
||||
Complete(r)
|
||||
}
|
||||
|
||||
func (r *JoiningNodesReconciler) findAllJoiningNodes(obj client.Object) []reconcile.Request {
|
||||
func (r *JoiningNodesReconciler) findAllJoiningNodes(ctx context.Context, obj client.Object) []reconcile.Request {
|
||||
var joiningNodesList updatev1alpha1.JoiningNodeList
|
||||
err := r.List(context.TODO(), &joiningNodesList, client.MatchingFields{joiningNodeNameKey: obj.GetName()})
|
||||
err := r.List(ctx, &joiningNodesList, client.MatchingFields{joiningNodeNameKey: obj.GetName()})
|
||||
if err != nil {
|
||||
return []reconcile.Request{}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/handler"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/source"
|
||||
|
||||
nodemaintenancev1beta1 "github.com/edgelesssys/constellation/v2/3rdparty/node-maintenance-operator/api/v1beta1"
|
||||
updatev1alpha1 "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/api/v1alpha1"
|
||||
|
@ -239,27 +238,27 @@ func (r *NodeVersionReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
|||
return ctrl.NewControllerManagedBy(mgr).
|
||||
For(&updatev1alpha1.NodeVersion{}).
|
||||
Watches(
|
||||
&source.Kind{Type: &updatev1alpha1.ScalingGroup{}},
|
||||
client.Object(&updatev1alpha1.ScalingGroup{}),
|
||||
handler.EnqueueRequestsFromMapFunc(r.findObjectsForScalingGroup),
|
||||
builder.WithPredicates(scalingGroupImageChangedPredicate()),
|
||||
).
|
||||
Watches(
|
||||
&source.Kind{Type: &updatev1alpha1.AutoscalingStrategy{}},
|
||||
client.Object(&updatev1alpha1.AutoscalingStrategy{}),
|
||||
handler.EnqueueRequestsFromMapFunc(r.findAllNodeVersions),
|
||||
builder.WithPredicates(autoscalerEnabledStatusChangedPredicate()),
|
||||
).
|
||||
Watches(
|
||||
&source.Kind{Type: &corev1.Node{}},
|
||||
client.Object(&corev1.Node{}),
|
||||
handler.EnqueueRequestsFromMapFunc(r.findAllNodeVersions),
|
||||
builder.WithPredicates(nodeReadyPredicate()),
|
||||
).
|
||||
Watches(
|
||||
&source.Kind{Type: &nodemaintenancev1beta1.NodeMaintenance{}},
|
||||
client.Object(&nodemaintenancev1beta1.NodeMaintenance{}),
|
||||
handler.EnqueueRequestsFromMapFunc(r.findAllNodeVersions),
|
||||
builder.WithPredicates(nodeMaintenanceSucceededPredicate()),
|
||||
).
|
||||
Watches(
|
||||
&source.Kind{Type: &updatev1alpha1.JoiningNode{}},
|
||||
client.Object(&updatev1alpha1.JoiningNode{}),
|
||||
handler.EnqueueRequestsFromMapFunc(r.findAllNodeVersions),
|
||||
builder.WithPredicates(joiningNodeDeletedPredicate()),
|
||||
).
|
||||
|
|
|
@ -104,7 +104,7 @@ func joiningNodeDeletedPredicate() predicate.Predicate {
|
|||
}
|
||||
|
||||
// findObjectsForScalingGroup requests a reconcile call for the node image referenced by a scaling group.
|
||||
func (r *NodeVersionReconciler) findObjectsForScalingGroup(rawScalingGroup client.Object) []reconcile.Request {
|
||||
func (r *NodeVersionReconciler) findObjectsForScalingGroup(_ context.Context, rawScalingGroup client.Object) []reconcile.Request {
|
||||
scalingGroup := rawScalingGroup.(*updatev1alpha1.ScalingGroup)
|
||||
return []reconcile.Request{
|
||||
{NamespacedName: types.NamespacedName{Name: scalingGroup.Spec.NodeVersion}},
|
||||
|
@ -112,9 +112,9 @@ func (r *NodeVersionReconciler) findObjectsForScalingGroup(rawScalingGroup clien
|
|||
}
|
||||
|
||||
// findAllNodeVersions requests a reconcile call for all node versions.
|
||||
func (r *NodeVersionReconciler) findAllNodeVersions(_ client.Object) []reconcile.Request {
|
||||
func (r *NodeVersionReconciler) findAllNodeVersions(ctx context.Context, _ client.Object) []reconcile.Request {
|
||||
var nodeVersionList updatev1alpha1.NodeVersionList
|
||||
err := r.List(context.TODO(), &nodeVersionList)
|
||||
err := r.List(ctx, &nodeVersionList)
|
||||
if err != nil {
|
||||
return []reconcile.Request{}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
|
@ -249,7 +250,7 @@ func TestFindObjectsForScalingGroup(t *testing.T) {
|
|||
}
|
||||
assert := assert.New(t)
|
||||
reconciler := NodeVersionReconciler{}
|
||||
requests := reconciler.findObjectsForScalingGroup(&scalingGroup)
|
||||
requests := reconciler.findObjectsForScalingGroup(context.TODO(), &scalingGroup)
|
||||
assert.ElementsMatch(wantRequests, requests)
|
||||
}
|
||||
|
||||
|
@ -283,7 +284,7 @@ func TestFindAllNodeVersions(t *testing.T) {
|
|||
reconciler := NodeVersionReconciler{
|
||||
Client: newStubReaderClient(t, []runtime.Object{tc.nodeVersion}, nil, tc.listNodeVersionsErr),
|
||||
}
|
||||
requests := reconciler.findAllNodeVersions(nil)
|
||||
requests := reconciler.findAllNodeVersions(context.TODO(), nil)
|
||||
assert.ElementsMatch(tc.wantRequests, requests)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"sigs.k8s.io/controller-runtime/pkg/source"
|
||||
|
||||
updatev1alpha1 "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/api/v1alpha1"
|
||||
)
|
||||
|
@ -155,7 +154,7 @@ func (r *PendingNodeReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
|||
return ctrl.NewControllerManagedBy(mgr).
|
||||
For(&updatev1alpha1.PendingNode{}).
|
||||
Watches(
|
||||
&source.Kind{Type: &corev1.Node{}},
|
||||
client.Object(&corev1.Node{}),
|
||||
handler.EnqueueRequestsFromMapFunc(r.findObjectsForNode),
|
||||
builder.WithPredicates(nodeStateChangePredicate()),
|
||||
).
|
||||
|
@ -192,9 +191,9 @@ func nodeStateChangePredicate() predicate.Predicate {
|
|||
}
|
||||
|
||||
// findObjectsForNode requests reconciliation for PendingNode whenever the corresponding Node state changes.
|
||||
func (r *PendingNodeReconciler) findObjectsForNode(rawNode client.Object) []reconcile.Request {
|
||||
func (r *PendingNodeReconciler) findObjectsForNode(ctx context.Context, rawNode client.Object) []reconcile.Request {
|
||||
var pendingNodesList updatev1alpha1.PendingNodeList
|
||||
err := r.List(context.Background(), &pendingNodesList, client.MatchingFields{nodeNameKey: rawNode.GetName()})
|
||||
err := r.List(ctx, &pendingNodesList, client.MatchingFields{nodeNameKey: rawNode.GetName()})
|
||||
if err != nil {
|
||||
return []reconcile.Request{}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ func TestFindObjectsForNode(t *testing.T) {
|
|||
reconciler := PendingNodeReconciler{
|
||||
Client: newStubReaderClient(t, []runtime.Object{tc.pendingNode}, nil, tc.listPendingNodesErr),
|
||||
}
|
||||
requests := reconciler.findObjectsForNode(&corev1.Node{
|
||||
requests := reconciler.findObjectsForNode(context.TODO(), &corev1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "pending-node",
|
||||
},
|
||||
|
|
|
@ -22,7 +22,6 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"sigs.k8s.io/controller-runtime/pkg/source"
|
||||
|
||||
updatev1alpha1 "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/api/v1alpha1"
|
||||
)
|
||||
|
@ -124,7 +123,7 @@ func (r *ScalingGroupReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
|||
return ctrl.NewControllerManagedBy(mgr).
|
||||
For(&updatev1alpha1.ScalingGroup{}).
|
||||
Watches(
|
||||
&source.Kind{Type: &updatev1alpha1.NodeVersion{}},
|
||||
client.Object(&updatev1alpha1.NodeVersion{}),
|
||||
handler.EnqueueRequestsFromMapFunc(r.findObjectsForNodeVersion),
|
||||
builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}),
|
||||
).
|
||||
|
@ -132,12 +131,12 @@ func (r *ScalingGroupReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
|||
}
|
||||
|
||||
// findObjectsForNodeVersion requests reconcile calls for every scaling group referencing the node image.
|
||||
func (r *ScalingGroupReconciler) findObjectsForNodeVersion(nodeVersion client.Object) []reconcile.Request {
|
||||
func (r *ScalingGroupReconciler) findObjectsForNodeVersion(ctx context.Context, nodeVersion client.Object) []reconcile.Request {
|
||||
attachedScalingGroups := &updatev1alpha1.ScalingGroupList{}
|
||||
listOps := &client.ListOptions{
|
||||
FieldSelector: fields.OneTermEqualSelector(nodeVersionField, nodeVersion.GetName()),
|
||||
}
|
||||
if err := r.List(context.TODO(), attachedScalingGroups, listOps); err != nil {
|
||||
if err := r.List(ctx, attachedScalingGroups, listOps); err != nil {
|
||||
return []reconcile.Request{}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue