Skip to content

Commit 2031ac6

Browse files
authored
Merge pull request #7 from rustrial/feature/k8s-1.29
Overhaul for Kubernetes v1.29
2 parents c19e6da + c68318f commit 2031ac6

13 files changed

+314
-363
lines changed

.github/install-cr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
version=v1.1.1
5+
version=v1.5.0
66
curl -sSLo /tmp/cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/$version/chart-releaser_${version#v}_linux_amd64.tar.gz"
77
tar -xzvf /tmp/cr.tar.gz -C "/tmp"
88
rm -f /tmp/cr.tar.gz

.github/workflows/build.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,29 @@ jobs:
2424
- name: Setup Go
2525
uses: actions/setup-go@v3
2626
with:
27-
go-version: 1.20.x
27+
go-version: 1.22.x
2828
- name: Setup Kubernetes
2929
uses: helm/[email protected]
3030
with:
31-
version: "v0.20.0" # https://github.com/kubernetes-sigs/kind/releases
32-
node_image: "kindest/node:v1.26.6"
31+
version: "v0.22.0" # https://github.com/kubernetes-sigs/kind/releases
32+
node_image: "kindest/node:v1.29.2"
3333
cluster_name: kind
3434
- name: Setup Helm
3535
uses: fluxcd/pkg/actions/helm@main
3636
with:
37-
version: "3.12.1"
37+
version: "v3.14.4"
3838
- name: Setup Kustomize
3939
uses: fluxcd/pkg/actions/kustomize@main
4040
with:
41-
version: "5.1.0"
41+
version: "5.3.0"
4242
- name: Setup Kubebuilder
4343
uses: RyanSiu1995/[email protected]
4444
with:
45-
version: "3.11.0"
45+
version: "3.14.2"
4646
- name: Setup Kubectl
4747
uses: fluxcd/pkg/actions/kubectl@main
4848
with:
49-
version: "1.26.6"
49+
version: "1.29.2"
5050
- name: Run tests
5151
run: make test
5252
env:

.github/workflows/publish.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@ jobs:
5252
strategy:
5353
matrix:
5454
k8s: # Must be available from https://github.com/kubernetes-sigs/kind/releases
55-
- v1.23.17
56-
- v1.24.15
57-
- v1.25.11
58-
- v1.26.6
59-
- v1.27.3
55+
- v1.26.14
56+
- v1.27.11
57+
- v1.28.7
58+
- v1.29.2
6059
steps:
6160
- name: Checkout
6261
uses: actions/checkout@v3
@@ -65,13 +64,13 @@ jobs:
6564
- name: Set up Helm
6665
uses: azure/setup-helm@v1
6766
with:
68-
version: "v3.12.1"
67+
version: "v3.14.4"
6968
- name: Run chart-testing (lint)
7069
run: (cd charts/k8s-gitops-secrets-controller && helm lint .)
7170
- name: Create kind ${{ matrix.k8s }} cluster
72-
uses: helm/kind-action@v1.5.0
71+
uses: helm/kind-action@v1.10.0
7372
with:
74-
version: "v0.20.0" # https://github.com/kubernetes-sigs/kind/releases
73+
version: "v0.22.0" # https://github.com/kubernetes-sigs/kind/releases
7574
node_image: kindest/node:${{ matrix.k8s }}
7675
- name: Install chart
7776
run: (cd charts/k8s-gitops-secrets-controller && helm install k8s-gitops-secrets-controller . -n k8s-gitops-secrets-system --create-namespace --wait --set fullnameOverride=k8s-gitops-secrets-controller-manager --set-string image.tag=${{env.VERSION}})
@@ -90,7 +89,7 @@ jobs:
9089
fetch-depth: 0
9190
- name: "✏️ Generate release changelog"
9291
id: generate-release-changelog
93-
uses: heinrichreimer/github-changelog-generator-action@v2.1.1
92+
uses: heinrichreimer/github-changelog-generator-action@v2.4
9493
with:
9594
token: ${{ secrets.GITHUB_TOKEN }}
9695
#onlyLastTag: "true"
@@ -106,7 +105,7 @@ jobs:
106105
- name: Setup Go
107106
uses: actions/setup-go@v3
108107
with:
109-
go-version: 1.20.x
108+
go-version: 1.22.x
110109
- name: Build seals CLI
111110
run: make cli
112111
- name: Extract TAG_NAME from GITHUB_REF
@@ -195,7 +194,7 @@ jobs:
195194
- name: Install Helm
196195
uses: azure/setup-helm@v1
197196
with:
198-
version: v3.12.1
197+
version: v3.14.4
199198
- name: Install CR
200199
run: .github/install-cr.sh
201200
- name: Update Helm Chart versions

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.20 as builder
2+
FROM golang:1.22 as builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Image URL to use all building/pushing image targets
33
IMG ?= controller:latest
44
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5-
ENVTEST_K8S_VERSION = 1.27.1
5+
ENVTEST_K8S_VERSION = 1.29.2
66

77
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
88
ifeq (,$(shell go env GOBIN))
@@ -152,8 +152,8 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
152152
ENVTEST ?= $(LOCALBIN)/setup-envtest
153153

154154
## Tool Versions
155-
KUSTOMIZE_VERSION ?= v5.0.1
156-
CONTROLLER_TOOLS_VERSION ?= v0.12.0
155+
KUSTOMIZE_VERSION ?= v5.3.0
156+
CONTROLLER_TOOLS_VERSION ?= v0.15.0
157157

158158
.PHONY: kustomize
159159
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.

api/secrets/v1beta1/zz_generated.deepcopy.go

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/main.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"context"
2121
"flag"
2222
"fmt"
23-
"io/ioutil"
2423
"os"
2524
"strings"
2625

@@ -40,6 +39,8 @@ import (
4039
secretscontroller "github.com/rustrial/k8s-gitops-secrets/internal/controller/secrets"
4140
"github.com/rustrial/k8s-gitops-secrets/internal/providers"
4241
awsProvider "github.com/rustrial/k8s-gitops-secrets/internal/providers/aws"
42+
"sigs.k8s.io/controller-runtime/pkg/cache"
43+
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
4344
//+kubebuilder:scaffold:imports
4445
)
4546

@@ -80,11 +81,17 @@ func main() {
8081
os.Exit(1)
8182
}
8283

84+
cacheConfig := cache.Options{}
85+
if namespace != "" {
86+
cacheConfig.DefaultNamespaces[namespace] = cache.Config{}
87+
}
88+
8389
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
84-
Scheme: scheme,
85-
Namespace: namespace,
86-
MetricsBindAddress: metricsAddr,
87-
Port: 9443,
90+
Scheme: scheme,
91+
Cache: cacheConfig,
92+
Metrics: metricsserver.Options{
93+
BindAddress: metricsAddr,
94+
},
8895
HealthProbeBindAddress: probeAddr,
8996
LeaderElection: enableLeaderElection,
9097
LeaderElectionID: "e6233917cd37-controller-secrets-rustrial-org",
@@ -156,12 +163,12 @@ func getControllerNamespace() (string, error) {
156163
return strings.TrimSpace(ns), nil
157164
}
158165
// Fall back to the namespace associated with the service account token, if available
159-
data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
166+
data, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
160167
if err != nil {
161168
return "", err
162169
}
163170
if ns := strings.TrimSpace(string(data)); len(ns) > 0 {
164171
return ns, nil
165172
}
166-
return "", fmt.Errorf("Failed to determine current namespace")
173+
return "", fmt.Errorf("failed to determine current namespace")
167174
}

cmd/seals/cmd/aws-kms.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"os"
99

1010
"github.com/aws/aws-sdk-go-v2/config"
@@ -37,7 +37,7 @@ var encrypt = &cobra.Command{
3737
os.Exit(1)
3838
}
3939
provider := awsProvider.NewKmsProvider(cfg)
40-
plainText, err := ioutil.ReadAll(os.Stdin)
40+
plainText, err := io.ReadAll(os.Stdin)
4141
if err != nil {
4242
fmt.Fprintf(os.Stderr, "Error while reading plain text data from STDIN: %s\n", err)
4343
os.Exit(1)
@@ -52,7 +52,7 @@ var encrypt = &cobra.Command{
5252
fmt.Fprintf(os.Stderr, "Error while decrypting plaintext data: %s\n", err)
5353
os.Exit(1)
5454
}
55-
if bytes.Compare(pt, plainText) != 0 {
55+
if !bytes.Equal(pt, plainText) {
5656
fmt.Fprintf(os.Stderr, "Decrypting plaintext does not match the input plaintext\n")
5757
os.Exit(1)
5858
}

config/crd/bases/secrets.rustrial.org_keyencryptionkeypolicies.yaml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.12.0
6+
controller-gen.kubebuilder.io/version: v0.15.0
77
name: keyencryptionkeypolicies.secrets.rustrial.org
88
spec:
99
group: secrets.rustrial.org
@@ -21,30 +21,40 @@ spec:
2121
API
2222
properties:
2323
apiVersion:
24-
description: 'APIVersion defines the versioned schema of this representation
25-
of an object. Servers should convert recognized schemas to the latest
26-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
24+
description: |-
25+
APIVersion defines the versioned schema of this representation of an object.
26+
Servers should convert recognized schemas to the latest internal value, and
27+
may reject unrecognized values.
28+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2729
type: string
2830
kind:
29-
description: 'Kind is a string value representing the REST resource this
30-
object represents. Servers may infer this from the endpoint the client
31-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
31+
description: |-
32+
Kind is a string value representing the REST resource this object represents.
33+
Servers may infer this from the endpoint the client submits requests to.
34+
Cannot be updated.
35+
In CamelCase.
36+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3237
type: string
3338
metadata:
3439
type: object
3540
spec:
3641
description: KeyEncryptionKeyPolicySpec defines the desired state of KeyEncryptionKeyPolicy
3742
properties:
3843
keyEncryptionKeyId:
39-
description: "KeyEncryptionKeyId is the provider specific unique ID
40-
of the Key Encryption Key (KEK) use to encrypt/decrypt the Data
41-
Encryption Key (DEK). \n This ID must uniquely identify the KEK
42-
and provider and is used in authorization rules to decide which
43-
namespaces can access which KEKs."
44+
description: |-
45+
KeyEncryptionKeyId is the provider specific unique ID of
46+
the Key Encryption Key (KEK) use to encrypt/decrypt the
47+
Data Encryption Key (DEK).
48+
49+
50+
This ID must uniquely identify the KEK and provider and
51+
is used in authorization rules to decide which namespaces
52+
can access which KEKs.
4453
type: string
4554
namespaces:
46-
description: White-list of namespaces, which are entitled to use this
47-
KEK to decrypt DataEncrpytionKeys.
55+
description: |-
56+
White-list of namespaces, which are entitled to use this KEK
57+
to decrypt DataEncrpytionKeys.
4858
items:
4959
type: string
5060
type: array

0 commit comments

Comments
 (0)