mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
Bump sigs.k8s.io/controller-runtime from 0.20.0 to 0.23.3 (#134)
Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.20.0 to 0.23.3. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/kubernetes-sigs/controller-runtime/releases">sigs.k8s.io/controller-runtime's releases</a>.</em></p> <blockquote> <h2>v0.23.3</h2> <h2>What's Changed</h2> <ul> <li>🐛 Ensure DefaulterRemoveUnknownOrOmitableFields is still working even if objects are equal by <a href="https://github.com/k8s-infra-cherrypick-robot"><code>@k8s-infra-cherrypick-robot</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3469">kubernetes-sigs/controller-runtime#3469</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/kubernetes-sigs/controller-runtime/compare/v0.23.2...v0.23.3">https://github.com/kubernetes-sigs/controller-runtime/compare/v0.23.2...v0.23.3</a></p> <h2>v0.23.2</h2> <h2>What's Changed</h2> <ul> <li>🐛 Fix fake client's SSA status patch resource version check by <a href="https://github.com/k8s-infra-cherrypick-robot"><code>@k8s-infra-cherrypick-robot</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3446">kubernetes-sigs/controller-runtime#3446</a></li> <li>✨ Reduce memory usage of default webhooks by <a href="https://github.com/k8s-infra-cherrypick-robot"><code>@k8s-infra-cherrypick-robot</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3467">kubernetes-sigs/controller-runtime#3467</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/kubernetes-sigs/controller-runtime/compare/v0.23.1...v0.23.2">https://github.com/kubernetes-sigs/controller-runtime/compare/v0.23.1...v0.23.2</a></p> <h2>v0.23.1</h2> <h2>What's Changed</h2> <ul> <li>🐛 Cache reader: Wait for cache sync when ReaderFailOnMissingInformer is true by <a href="https://github.com/k8s-infra-cherrypick-robot"><code>@k8s-infra-cherrypick-robot</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3433">kubernetes-sigs/controller-runtime#3433</a></li> <li>🐛 Fix panic when using CRs with embedded pointer structs by <a href="https://github.com/k8s-infra-cherrypick-robot"><code>@k8s-infra-cherrypick-robot</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3436">kubernetes-sigs/controller-runtime#3436</a></li> <li>🌱 Test cache reader waits for cache sync by <a href="https://github.com/k8s-infra-cherrypick-robot"><code>@k8s-infra-cherrypick-robot</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3438">kubernetes-sigs/controller-runtime#3438</a></li> <li>🐛 Fakeclient: Fix status apply if existing object has managedFields set by <a href="https://github.com/k8s-infra-cherrypick-robot"><code>@k8s-infra-cherrypick-robot</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3437">kubernetes-sigs/controller-runtime#3437</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/kubernetes-sigs/controller-runtime/compare/v0.23.0...v0.23.1">https://github.com/kubernetes-sigs/controller-runtime/compare/v0.23.0...v0.23.1</a></p> <h2>v0.23.0</h2> <h2>🔆 Highlights</h2> <ul> <li>Client: Add subresource Apply support by <a href="https://github.com/alvaroaleman"><code>@alvaroaleman</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3321">kubernetes-sigs/controller-runtime#3321</a></li> <li>Conversion: Enable implementation of conversion outside of API packages by <a href="https://github.com/sbueringer"><code>@sbueringer</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3335">kubernetes-sigs/controller-runtime#3335</a></li> <li>Priorityqueue: Various improvements, bug fixes and now enabled per default</li> <li>Webhooks: Generic Validator and Defaulter by <a href="https://github.com/alvaroaleman"><code>@alvaroaleman</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3360">kubernetes-sigs/controller-runtime#3360</a></li> </ul> <h2>⚠️ Breaking changes</h2> <ul> <li>Dependencies: Update to k8s.io/* v1.35 by <a href="https://github.com/alvaroaleman"><code>@alvaroaleman</code></a> <a href="https://github.com/dongjiang1989"><code>@dongjiang1989</code></a> <a href="https://github.com/kannon92"><code>@kannon92</code></a> (<a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3316">#3316</a>, <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3349">#3349</a>, <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3386">#3386</a>, <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3391">#3391</a>, <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3401">#3401</a>)</li> <li>Client: Add subresource Apply support by <a href="https://github.com/alvaroaleman"><code>@alvaroaleman</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3321">kubernetes-sigs/controller-runtime#3321</a></li> <li>Events: Migration to the new events API by <a href="https://github.com/clebs"><code>@clebs</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3262">kubernetes-sigs/controller-runtime#3262</a> <ul> <li>Using the new <code>GetEventRecorderFor</code> requires updating your rbac for events to use the <code>events.k8s.io</code> apiGroup rather than the `` (core) apiGroup</li> </ul> </li> <li>Fakeclient: Set ResourceVersion for SSA Create by <a href="https://github.com/alvaroaleman"><code>@alvaroaleman</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3311">kubernetes-sigs/controller-runtime#3311</a></li> <li>Webhooks: Generic Validator and Defaulter by <a href="https://github.com/alvaroaleman"><code>@alvaroaleman</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3360">kubernetes-sigs/controller-runtime#3360</a> <ul> <li>Existing code of the form <code>builder.WebhookManagedBy(mgr).For(&corev1.Deployment{})</code> has to be changed to <code>builder.WebhookManagedBy(mgr, &appsv1.Deployment{})</code></li> <li>Existing webhook implementations have to be changed to take the concrete object rather than <code>runtime.Object</code>, for example from <code>ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error)</code> to <code>ValidateCreate(ctx context.Context, obj *appsv1.Deployment) (admission.Warnings, error)</code></li> </ul> </li> </ul> <h2>✨ Features</h2> <ul> <li>Cache: Allow fine-granular SyncPeriod configuration by <a href="https://github.com/sbueringer"><code>@sbueringer</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3376">kubernetes-sigs/controller-runtime#3376</a></li> <li>Client: Add FieldOwner option to client.Options by <a href="https://github.com/aerfio"><code>@aerfio</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3389">kubernetes-sigs/controller-runtime#3389</a></li> <li>Client: Add FieldValidation option to client.Options by <a href="https://github.com/aerfio"><code>@aerfio</code></a> in <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/pull/3393">kubernetes-sigs/controller-runtime#3393</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/f9589b9f2b9dddf8532b432bb8315f2820ab9971"><code>f9589b9</code></a> Merge pull request <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3469">#3469</a> from k8s-infra-cherrypick-robot/cherry-pick-3468-to-...</li> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/25615ad1d1229db805cec6b0f3f29f284fe53be1"><code>25615ad</code></a> Ensure DefaulterRemoveUnknownOrOmitableFields is still working even if object...</li> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/8122a6266696b980fc9219c2fbb48bb4ce60d12b"><code>8122a62</code></a> Merge pull request <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3467">#3467</a> from k8s-infra-cherrypick-robot/cherry-pick-3463-to-...</li> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/35093c6117da44c29f3a03d06e379d606814018d"><code>35093c6</code></a> Reduce memory usage of default webhooks</li> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/4dbfa5c66aa24a35003c41507385c2a91e94d404"><code>4dbfa5c</code></a> [release-0.23] 🐛 Fix fake client's SSA status patch resource version check (#...</li> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/f52bbb8bb1a2275cbe90dec8d6c12d5cacb1a7de"><code>f52bbb8</code></a> Merge pull request <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3437">#3437</a> from k8s-infra-cherrypick-robot/cherry-pick-3430-to-...</li> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/4f41337fdd898537c6633a174cd539cb2e0c4d15"><code>4f41337</code></a> Merge pull request <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3438">#3438</a> from k8s-infra-cherrypick-robot/cherry-pick-3434-to-...</li> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/e29a1b93fae5c5f22c992c57b11dcf90ccc35c53"><code>e29a1b9</code></a> seedling: Test cache reader waits for cache sync</li> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/83c8dc31c46c621c336c8a7749ee41658b6d17e1"><code>83c8dc3</code></a> bug: Fakeclient: Fix status apply if existing object has managedFields set</li> <li><a href="https://github.com/kubernetes-sigs/controller-runtime/commit/bf6bcd55b4d5eba00273426d61db313dcd2a6c7f"><code>bf6bcd5</code></a> Merge pull request <a href="https://redirect.github.com/kubernetes-sigs/controller-runtime/issues/3436">#3436</a> from k8s-infra-cherrypick-robot/cherry-pick-3431-to-...</li> <li>Additional commits viewable in <a href="https://github.com/kubernetes-sigs/controller-runtime/compare/v0.20.0...v0.23.3">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Philip Laine <philip.laine@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
co-authored by
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Philip Laine
parent
ad42dfe3e5
commit
81f7a2bd51
@@ -5,12 +5,10 @@ import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
logf "sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
netbirdiov1 "github.com/netbirdio/kubernetes-operator/api/v1"
|
||||
@@ -22,7 +20,7 @@ var nbgrouplog = logf.Log.WithName("nbgroup-resource")
|
||||
|
||||
// SetupNBGroupWebhookWithManager registers the webhook for NBGroup in the manager.
|
||||
func SetupNBGroupWebhookWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).For(&netbirdiov1.NBGroup{}).
|
||||
return ctrl.NewWebhookManagedBy(mgr, &netbirdiov1.NBGroup{}).
|
||||
WithValidator(&NBGroupCustomValidator{client: mgr.GetClient()}).
|
||||
Complete()
|
||||
}
|
||||
@@ -33,24 +31,20 @@ type NBGroupCustomValidator struct {
|
||||
client client.Client
|
||||
}
|
||||
|
||||
var _ webhook.CustomValidator = &NBGroupCustomValidator{}
|
||||
var _ admission.Validator[*netbirdiov1.NBGroup] = &NBGroupCustomValidator{}
|
||||
|
||||
// ValidateCreate implements webhook.CustomValidator so a webhook will be registered for the type NBGroup.
|
||||
func (v *NBGroupCustomValidator) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
|
||||
func (v *NBGroupCustomValidator) ValidateCreate(ctx context.Context, group *netbirdiov1.NBGroup) (admission.Warnings, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateUpdate implements webhook.CustomValidator so a webhook will be registered for the type NBGroup.
|
||||
func (v *NBGroupCustomValidator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
|
||||
func (v *NBGroupCustomValidator) ValidateUpdate(ctx context.Context, old, new *netbirdiov1.NBGroup) (admission.Warnings, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ValidateDelete implements webhook.CustomValidator so a webhook will be registered for the type NBGroup.
|
||||
func (v *NBGroupCustomValidator) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
|
||||
nbgroup, ok := obj.(*netbirdiov1.NBGroup)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expected a NBGroup object but got %T", obj)
|
||||
}
|
||||
func (v *NBGroupCustomValidator) ValidateDelete(ctx context.Context, nbgroup *netbirdiov1.NBGroup) (admission.Warnings, error) {
|
||||
nbgrouplog.Info("Validation for NBGroup upon deletion", "name", nbgroup.GetName())
|
||||
|
||||
for _, o := range nbgroup.OwnerReferences {
|
||||
|
||||
@@ -5,17 +5,15 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/google/uuid"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
logf "sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
"github.com/google/uuid"
|
||||
netbirdiov1 "github.com/netbirdio/kubernetes-operator/api/v1"
|
||||
)
|
||||
|
||||
@@ -25,7 +23,7 @@ var nbsetupkeylog = logf.Log.WithName("nbsetupkey-resource")
|
||||
|
||||
// SetupNBSetupKeyWebhookWithManager registers the webhook for NBSetupKey in the manager.
|
||||
func SetupNBSetupKeyWebhookWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).For(&netbirdiov1.NBSetupKey{}).
|
||||
return ctrl.NewWebhookManagedBy(mgr, &netbirdiov1.NBSetupKey{}).
|
||||
WithValidator(&NBSetupKeyCustomValidator{client: mgr.GetClient()}).
|
||||
Complete()
|
||||
}
|
||||
@@ -36,14 +34,10 @@ type NBSetupKeyCustomValidator struct {
|
||||
client client.Client
|
||||
}
|
||||
|
||||
var _ webhook.CustomValidator = &NBSetupKeyCustomValidator{}
|
||||
var _ admission.Validator[*netbirdiov1.NBSetupKey] = &NBSetupKeyCustomValidator{}
|
||||
|
||||
// ValidateCreate implements webhook.CustomValidator so a webhook will be registered for the type NBSetupKey.
|
||||
func (v *NBSetupKeyCustomValidator) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
|
||||
nbSetupKey, ok := obj.(*netbirdiov1.NBSetupKey)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expected a NBSetupKey object but got %T", obj)
|
||||
}
|
||||
func (v *NBSetupKeyCustomValidator) ValidateCreate(ctx context.Context, nbSetupKey *netbirdiov1.NBSetupKey) (admission.Warnings, error) {
|
||||
nbsetupkeylog.Info("Validating NBSetupKey", "namespace", nbSetupKey.Namespace, "name", nbSetupKey.Name)
|
||||
|
||||
if nbSetupKey.Spec.SecretKeyRef.Name == "" {
|
||||
@@ -77,16 +71,12 @@ func (v *NBSetupKeyCustomValidator) ValidateCreate(ctx context.Context, obj runt
|
||||
}
|
||||
|
||||
// ValidateUpdate implements webhook.CustomValidator so a webhook will be registered for the type NBSetupKey.
|
||||
func (v *NBSetupKeyCustomValidator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
|
||||
return v.ValidateCreate(ctx, newObj)
|
||||
func (v *NBSetupKeyCustomValidator) ValidateUpdate(ctx context.Context, old, new *netbirdiov1.NBSetupKey) (admission.Warnings, error) {
|
||||
return v.ValidateCreate(ctx, new)
|
||||
}
|
||||
|
||||
// ValidateDelete implements webhook.CustomValidator so a webhook will be registered for the type NBSetupKey.
|
||||
func (v *NBSetupKeyCustomValidator) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
|
||||
nbSetupKey, ok := obj.(*netbirdiov1.NBSetupKey)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expected a NBSetupKey object but got %T", obj)
|
||||
}
|
||||
func (v *NBSetupKeyCustomValidator) ValidateDelete(ctx context.Context, nbSetupKey *netbirdiov1.NBSetupKey) (admission.Warnings, error) {
|
||||
nbsetupkeylog.Info("Validating NBSetupKey deletion", "namespace", nbSetupKey.Namespace, "name", nbSetupKey.Name)
|
||||
|
||||
var pods corev1.PodList
|
||||
|
||||
@@ -21,12 +21,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
logf "sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
netbirdiov1 "github.com/netbirdio/kubernetes-operator/api/v1"
|
||||
)
|
||||
@@ -42,7 +41,7 @@ var podlog = logf.Log.WithName("pod-resource")
|
||||
|
||||
// SetupPodWebhookWithManager registers the webhook for Pod in the manager.
|
||||
func SetupPodWebhookWithManager(mgr ctrl.Manager, managementURL, clientImage string) error {
|
||||
return ctrl.NewWebhookManagedBy(mgr).For(&corev1.Pod{}).
|
||||
return ctrl.NewWebhookManagedBy(mgr, &corev1.Pod{}).
|
||||
WithDefaulter(&PodNetbirdInjector{
|
||||
client: mgr.GetClient(),
|
||||
managementURL: managementURL,
|
||||
@@ -59,14 +58,10 @@ type PodNetbirdInjector struct {
|
||||
clientImage string
|
||||
}
|
||||
|
||||
var _ webhook.CustomDefaulter = &PodNetbirdInjector{}
|
||||
var _ admission.Defaulter[*corev1.Pod] = &PodNetbirdInjector{}
|
||||
|
||||
// Default implements webhook.CustomDefaulter so a webhook will be registered for the Kind Pod.
|
||||
func (d *PodNetbirdInjector) Default(ctx context.Context, obj runtime.Object) error {
|
||||
pod, ok := obj.(*corev1.Pod)
|
||||
if !ok {
|
||||
return fmt.Errorf("expected a Pod object but got %T", obj)
|
||||
}
|
||||
func (d *PodNetbirdInjector) Default(ctx context.Context, pod *corev1.Pod) error {
|
||||
podlog.Info("Defaulting for Pod", "name", pod.GetName())
|
||||
|
||||
// if the setup key annotation is missing, do nothing.
|
||||
|
||||
Reference in New Issue
Block a user