From e9c00b9f2cb4f434b0c2f639f56d23b6826faffb Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Tue, 13 Aug 2024 17:35:45 +0200 Subject: [PATCH] golangci-lint: Bump to latest to fix high memory consumption - Update deprecated fields in `.golangci.yaml`. - Remove deprecated `--deadline` flag. - Replace deprecated `k8s.io/utils/pointer` with new generic `k8s.io/utils/ptr` package. --- .golangci.yaml | 8 +- Makefile | 2 +- api/v1beta1/webhook_test.go | 8 +- hack/golangci-lint.sh | 6 +- .../controller/externaldns/deployment_test.go | 494 +++++++++--------- pkg/operator/controller/externaldns/pod.go | 10 +- .../controller/externaldns/pod_test.go | 42 +- test/common/common.go | 8 +- test/e2e/util.go | 4 +- 9 files changed, 292 insertions(+), 290 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 531d0bba..c3e29ec8 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -24,8 +24,9 @@ run: # from this option's value (see skip-dirs-use-default). # "/" will be replaced by current OS file path separator to properly work # on Windows. - skip-dirs: - - vendor + issues: + exclude-dirs: + - vendor # default is true. Enables skipping of directories: # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ @@ -50,7 +51,8 @@ run: output: # colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions # default is "colored-line-number" - format: tab + formats: + - format: tab # print lines of code with issue, default is true print-issued-lines: true diff --git a/Makefile b/Makefile index 2899e70a..05e82535 100644 --- a/Makefile +++ b/Makefile @@ -211,7 +211,7 @@ endef .PHONY: lint ## Checks the code with golangci-lint lint: $(GOLANGCI_LINT_BIN) - $(GOLANGCI_LINT_BIN) run -c .golangci.yaml --deadline=30m + $(GOLANGCI_LINT_BIN) run -c .golangci.yaml $(GOLANGCI_LINT_BIN): mkdir -p $(BIN_DIR) diff --git a/api/v1beta1/webhook_test.go b/api/v1beta1/webhook_test.go index 8b26b6c9..08b32c4d 100644 --- a/api/v1beta1/webhook_test.go +++ b/api/v1beta1/webhook_test.go @@ -6,7 +6,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) func makeExternalDNS(name string, domains []ExternalDNSDomain) *ExternalDNS { @@ -139,7 +139,7 @@ var _ = Describe("ExternalDNS admission webhook", func() { { ExternalDNSDomainUnion: ExternalDNSDomainUnion{ MatchType: DomainMatchTypeRegex, - Pattern: pointer.String(`(.*\.test.com`), + Pattern: ptr.To[string](`(.*\.test.com`), }, FilterType: FilterTypeInclude, }, @@ -166,14 +166,14 @@ var _ = Describe("ExternalDNS admission webhook", func() { { ExternalDNSDomainUnion: ExternalDNSDomainUnion{ MatchType: DomainMatchTypeExact, - Name: pointer.String("abc.test.com"), + Name: ptr.To[string]("abc.test.com"), }, FilterType: FilterTypeInclude, }, { ExternalDNSDomainUnion: ExternalDNSDomainUnion{ MatchType: DomainMatchTypeExact, - Name: pointer.String(`(.*)\.test\.com`), + Name: ptr.To[string](`(.*)\.test\.com`), }, FilterType: FilterTypeInclude, }, diff --git a/hack/golangci-lint.sh b/hack/golangci-lint.sh index 5bb46fe8..d0954050 100755 --- a/hack/golangci-lint.sh +++ b/hack/golangci-lint.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -GOLANGCI_VERSION="1.51.2" +GOLANGCI_VERSION="1.59.1" OUTPUT_PATH=${1:-./bin/golangci-lint} @@ -10,10 +10,10 @@ GOARCH=$(go env GOARCH) case $GOOS in linux) - CHECKSUM="4de479eb9d9bc29da51aec1834e7c255b333723d38dbd56781c68e5dddc6a90b" + CHECKSUM="c30696f1292cff8778a495400745f0f9c0406a3f38d8bb12cef48d599f6c7791" ;; darwin) - CHECKSUM="0549cbaa2df451cf3a2011a9d73a9cb127784d26749d9cd14c9f4818af104d44" + CHECKSUM="2f945063394a489c0037f0369c0ce21bc007565c08f90b924a35f4c04721cbc0" ;; *) echo "Unsupported OS $GOOS" diff --git a/pkg/operator/controller/externaldns/deployment_test.go b/pkg/operator/controller/externaldns/deployment_test.go index 04d59027..83d6ab85 100644 --- a/pkg/operator/controller/externaldns/deployment_test.go +++ b/pkg/operator/controller/externaldns/deployment_test.go @@ -32,7 +32,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -148,7 +148,7 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -201,9 +201,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -276,9 +276,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -383,9 +383,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -457,7 +457,7 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -515,9 +515,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -616,9 +616,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -717,9 +717,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -793,9 +793,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -893,9 +893,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -934,9 +934,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1040,9 +1040,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1115,9 +1115,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1193,9 +1193,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1293,9 +1293,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1368,9 +1368,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1471,9 +1471,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1545,9 +1545,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1614,9 +1614,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1685,9 +1685,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1760,9 +1760,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1793,9 +1793,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1869,9 +1869,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -1943,9 +1943,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2018,9 +2018,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2094,9 +2094,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2168,7 +2168,7 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -2216,9 +2216,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2286,9 +2286,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2359,7 +2359,7 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -2407,9 +2407,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2478,9 +2478,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2574,9 +2574,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2645,9 +2645,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2740,9 +2740,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2776,9 +2776,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2877,9 +2877,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -2947,9 +2947,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3042,9 +3042,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3112,9 +3112,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3210,9 +3210,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3279,9 +3279,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3347,9 +3347,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3417,9 +3417,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3445,9 +3445,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3516,9 +3516,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3585,9 +3585,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3655,9 +3655,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3726,9 +3726,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3815,9 +3815,9 @@ func TestDesiredExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3963,9 +3963,9 @@ func TestExternalDNSDeploymentChanged(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3977,9 +3977,9 @@ func TestExternalDNSDeploymentChanged(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -3993,9 +3993,9 @@ func TestExternalDNSDeploymentChanged(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(true), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](true), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -4006,9 +4006,9 @@ func TestExternalDNSDeploymentChanged(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -4020,9 +4020,9 @@ func TestExternalDNSDeploymentChanged(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -4036,9 +4036,9 @@ func TestExternalDNSDeploymentChanged(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -4211,7 +4211,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -4257,9 +4257,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -4340,7 +4340,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -4386,9 +4386,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -4470,7 +4470,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -4516,9 +4516,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -4599,7 +4599,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -4644,9 +4644,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -4729,7 +4729,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -4776,9 +4776,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -4917,7 +4917,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -4963,9 +4963,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -5071,7 +5071,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -5126,9 +5126,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -5214,7 +5214,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -5261,9 +5261,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -5344,7 +5344,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -5464,7 +5464,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -5511,9 +5511,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -5655,7 +5655,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -5702,9 +5702,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -5922,7 +5922,7 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { { ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: "openshift", - ExpirationSeconds: pointer.Int64(3600), + ExpirationSeconds: ptr.To[int64](3600), Path: "token", }, }, @@ -5974,9 +5974,9 @@ func TestEnsureExternalDNSDeployment(t *testing.T) { Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -6084,109 +6084,109 @@ func TestSecurityContextChanged(t *testing.T) { { name: "current RunAsNonRoot is nil", currentSC: &corev1.SecurityContext{}, - desiredSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(false)}, + desiredSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](false)}, changed: true, }, { // should be ignored to handle defaulting name: "desired RunAsNonRoot is nil", - currentSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(false)}, + currentSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](false)}, desiredSC: &corev1.SecurityContext{}, updatedSC: &corev1.SecurityContext{}, changed: false, }, { name: "RunAsNonRoot changes true->false", - currentSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(true)}, - desiredSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(false)}, + currentSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](true)}, + desiredSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](false)}, changed: true, }, { name: "RunAsNonRoot changes false->true", - currentSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(true)}, - desiredSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(false)}, + currentSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](true)}, + desiredSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](false)}, changed: true, }, { name: "RunAsNonRoot changes is same", - currentSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(true)}, - desiredSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(true)}, - updatedSC: &corev1.SecurityContext{RunAsNonRoot: pointer.Bool(true)}, + currentSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](true)}, + desiredSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](true)}, + updatedSC: &corev1.SecurityContext{RunAsNonRoot: ptr.To[bool](true)}, changed: false, }, { name: "current Privileged is nil", currentSC: &corev1.SecurityContext{}, - desiredSC: &corev1.SecurityContext{Privileged: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{Privileged: pointer.Bool(false)}, + desiredSC: &corev1.SecurityContext{Privileged: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{Privileged: ptr.To[bool](false)}, changed: true, }, { // should be ignored to handle defaulting name: "desired Privileged is nil", desiredSC: &corev1.SecurityContext{}, - currentSC: &corev1.SecurityContext{Privileged: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{Privileged: pointer.Bool(false)}, + currentSC: &corev1.SecurityContext{Privileged: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{Privileged: ptr.To[bool](false)}, changed: false, }, { name: "Privileged changes true->false", - currentSC: &corev1.SecurityContext{Privileged: pointer.Bool(true)}, - desiredSC: &corev1.SecurityContext{Privileged: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{Privileged: pointer.Bool(false)}, + currentSC: &corev1.SecurityContext{Privileged: ptr.To[bool](true)}, + desiredSC: &corev1.SecurityContext{Privileged: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{Privileged: ptr.To[bool](false)}, changed: true, }, { name: "Privileged changes false->true", - currentSC: &corev1.SecurityContext{Privileged: pointer.Bool(true)}, - desiredSC: &corev1.SecurityContext{Privileged: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{Privileged: pointer.Bool(false)}, + currentSC: &corev1.SecurityContext{Privileged: ptr.To[bool](true)}, + desiredSC: &corev1.SecurityContext{Privileged: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{Privileged: ptr.To[bool](false)}, changed: true, }, { name: "Privileged is same", - currentSC: &corev1.SecurityContext{Privileged: pointer.Bool(true)}, - desiredSC: &corev1.SecurityContext{Privileged: pointer.Bool(true)}, - updatedSC: &corev1.SecurityContext{Privileged: pointer.Bool(true)}, + currentSC: &corev1.SecurityContext{Privileged: ptr.To[bool](true)}, + desiredSC: &corev1.SecurityContext{Privileged: ptr.To[bool](true)}, + updatedSC: &corev1.SecurityContext{Privileged: ptr.To[bool](true)}, changed: false, }, { name: "current AllowPrivilegeEscalation is nil", currentSC: &corev1.SecurityContext{}, - desiredSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(false)}, + desiredSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](false)}, changed: true, }, { // should be ignored to handle defaulting name: "desired AllowPrivilegeEscalation is nil", desiredSC: &corev1.SecurityContext{}, - currentSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(false)}, + currentSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](false)}, changed: false, }, { name: "AllowPrivilegeEscalation changes true->false", - currentSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(true)}, - desiredSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(false)}, + currentSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](true)}, + desiredSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](false)}, changed: true, }, { name: "AllowPrivilegeEscalation changes false->true", - currentSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(true)}, - desiredSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(false)}, - updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(false)}, + currentSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](true)}, + desiredSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](false)}, + updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](false)}, changed: true, }, { name: "AllowPrivilegeEscalation is same", - currentSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(true)}, - desiredSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(true)}, - updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: pointer.Bool(true)}, + currentSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](true)}, + desiredSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](true)}, + updatedSC: &corev1.SecurityContext{AllowPrivilegeEscalation: ptr.To[bool](true)}, changed: false, }, { @@ -6302,14 +6302,14 @@ func TestSecurityContextChanged(t *testing.T) { desiredSC: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}}, updatedSC: &corev1.SecurityContext{ SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}, - RunAsUser: pointer.Int64(1007), + RunAsUser: ptr.To[int64](1007), }, changed: true, }, { name: "Don't update security context if diff in other fields", currentSC: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}}, - desiredSC: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}, RunAsUser: pointer.Int64(1007)}, + desiredSC: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}, RunAsUser: ptr.To[int64](1007)}, updatedSC: &corev1.SecurityContext{ SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}, }, @@ -6738,7 +6738,7 @@ func testAWSExternalDNSDomainFilter(zones []string, source operatorv1beta1.Exter { ExternalDNSDomainUnion: operatorv1beta1.ExternalDNSDomainUnion{ MatchType: operatorv1beta1.DomainMatchTypeExact, - Name: pointer.String("abc.com"), + Name: ptr.To[string]("abc.com"), }, FilterType: operatorv1beta1.FilterTypeInclude, }, diff --git a/pkg/operator/controller/externaldns/pod.go b/pkg/operator/controller/externaldns/pod.go index 90669d0c..be6ab44e 100644 --- a/pkg/operator/controller/externaldns/pod.go +++ b/pkg/operator/controller/externaldns/pod.go @@ -25,7 +25,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" configv1 "github.com/openshift/api/config/v1" @@ -146,9 +146,9 @@ func (b *externalDNSContainerBuilder) defaultContainer(name string) *corev1.Cont Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{allCapabilities}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -599,7 +599,7 @@ func (b *externalDNSVolumeBuilder) awsVolumes() []corev1.Volume { Sources: []corev1.VolumeProjection{{ ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ Audience: boundSATokenAudience, - ExpirationSeconds: pointer.Int64(boundSATokenExpirationSeconds), + ExpirationSeconds: ptr.To[int64](boundSATokenExpirationSeconds), Path: boundSATokenPath, }, }}, diff --git a/pkg/operator/controller/externaldns/pod_test.go b/pkg/operator/controller/externaldns/pod_test.go index 618e8958..82bfafc2 100644 --- a/pkg/operator/controller/externaldns/pod_test.go +++ b/pkg/operator/controller/externaldns/pod_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" "github.com/openshift/external-dns-operator/api/v1beta1" ) @@ -24,7 +24,7 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("abc.com"), + Name: ptr.To[string]("abc.com"), }, FilterType: v1beta1.FilterTypeInclude, }, @@ -37,21 +37,21 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("abc.com"), + Name: ptr.To[string]("abc.com"), }, FilterType: v1beta1.FilterTypeInclude, }, { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("def.com"), + Name: ptr.To[string]("def.com"), }, FilterType: v1beta1.FilterTypeInclude, }, { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("ghi.com"), + Name: ptr.To[string]("ghi.com"), }, FilterType: v1beta1.FilterTypeInclude, }, @@ -64,7 +64,7 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*)\.abc\.com`), + Pattern: ptr.To[string](`(.*)\.abc\.com`), }, FilterType: v1beta1.FilterTypeInclude, }, @@ -78,7 +78,7 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*]\.abc\.com`), + Pattern: ptr.To[string](`(.*]\.abc\.com`), }, FilterType: v1beta1.FilterTypeInclude, }, @@ -92,14 +92,14 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*)\.abc\.com`), + Pattern: ptr.To[string](`(.*)\.abc\.com`), }, FilterType: v1beta1.FilterTypeInclude, }, { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*)\.def\.com`), + Pattern: ptr.To[string](`(.*)\.def\.com`), }, FilterType: v1beta1.FilterTypeInclude, }, @@ -112,7 +112,7 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("abc.com"), + Name: ptr.To[string]("abc.com"), }, FilterType: v1beta1.FilterTypeExclude, }, @@ -125,21 +125,21 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("abc.com"), + Name: ptr.To[string]("abc.com"), }, FilterType: v1beta1.FilterTypeExclude, }, { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("def.com"), + Name: ptr.To[string]("def.com"), }, FilterType: v1beta1.FilterTypeExclude, }, { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("ghi.com"), + Name: ptr.To[string]("ghi.com"), }, FilterType: v1beta1.FilterTypeExclude, }, @@ -152,7 +152,7 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*)\.abc\.com`), + Pattern: ptr.To[string](`(.*)\.abc\.com`), }, FilterType: v1beta1.FilterTypeExclude, }, @@ -166,7 +166,7 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*]\.abc\.com`), + Pattern: ptr.To[string](`(.*]\.abc\.com`), }, FilterType: v1beta1.FilterTypeExclude, }, @@ -180,14 +180,14 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*)\.abc\.com`), + Pattern: ptr.To[string](`(.*)\.abc\.com`), }, FilterType: v1beta1.FilterTypeExclude, }, { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*)\.def\.com`), + Pattern: ptr.To[string](`(.*)\.def\.com`), }, FilterType: v1beta1.FilterTypeExclude, }, @@ -202,28 +202,28 @@ func TestDomainFilters(t *testing.T) { { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("abc.com"), + Name: ptr.To[string]("abc.com"), }, FilterType: v1beta1.FilterTypeInclude, }, { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeExact, - Name: pointer.String("def.com"), + Name: ptr.To[string]("def.com"), }, FilterType: v1beta1.FilterTypeExclude, }, { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*)\.ghi\.com`), + Pattern: ptr.To[string](`(.*)\.ghi\.com`), }, FilterType: v1beta1.FilterTypeInclude, }, { ExternalDNSDomainUnion: v1beta1.ExternalDNSDomainUnion{ MatchType: v1beta1.DomainMatchTypeRegex, - Pattern: pointer.String(`(.*)\.pqr\.com`), + Pattern: ptr.To[string](`(.*)\.pqr\.com`), }, FilterType: v1beta1.FilterTypeExclude, }, diff --git a/test/common/common.go b/test/common/common.go index bb01c2b8..b5e8c995 100644 --- a/test/common/common.go +++ b/test/common/common.go @@ -36,7 +36,7 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apiserver/pkg/storage/names" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) const ( @@ -252,9 +252,9 @@ func buildDigPod(name, namespace, address string, extraArgs ...string) *corev1.P Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{"ALL"}, }, - Privileged: pointer.Bool(false), - RunAsNonRoot: pointer.Bool(true), - AllowPrivilegeEscalation: pointer.Bool(false), + Privileged: ptr.To[bool](false), + RunAsNonRoot: ptr.To[bool](true), + AllowPrivilegeEscalation: ptr.To[bool](false), SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, diff --git a/test/e2e/util.go b/test/e2e/util.go index 4d73d4c2..4a463a2b 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -28,7 +28,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" operatorv1alpha1 "github.com/openshift/external-dns-operator/api/v1alpha1" operatorv1beta1 "github.com/openshift/external-dns-operator/api/v1beta1" @@ -229,7 +229,7 @@ func newHostNetworkController(name types.NamespacedName, domain string) *operato }, Spec: operatorv1.IngressControllerSpec{ Domain: domain, - Replicas: pointer.Int32(1), + Replicas: ptr.To[int32](1), EndpointPublishingStrategy: &operatorv1.EndpointPublishingStrategy{ Type: operatorv1.HostNetworkStrategyType, },