Skip to content

Commit 00257e0

Browse files
authored
Merge pull request #478 from fluxcd/go-v1.17
Update Go to v1.17 and controller-runtime to v0.11
2 parents ab9c0e9 + 5466544 commit 00257e0

12 files changed

Lines changed: 1065 additions & 336 deletions

File tree

.github/workflows/e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup Go
4040
uses: actions/setup-go@v2
4141
with:
42-
go-version: 1.16.x
42+
go-version: 1.17.x
4343
- name: Setup Kubernetes
4444
uses: engineerd/setup-kind@v0.5.0
4545
with:

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
ARG XX_VERSION=1.0.0-rc.2
1+
ARG GO_VERSION=1.17
2+
ARG XX_VERSION=1.1.0
23

34
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
45

5-
FROM --platform=$BUILDPLATFORM golang:1.16-alpine as builder
6+
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine as builder
67

78
# Copy the build utilities.
89
COPY --from=xx / /
@@ -30,7 +31,7 @@ COPY internal/ internal/
3031
ENV CGO_ENABLED=0
3132
RUN xx-go build -a -o kustomize-controller main.go
3233

33-
FROM alpine:3.14
34+
FROM alpine:3.15
3435

3536
LABEL org.opencontainers.image.source="https://github.com/fluxcd/kustomize-controller"
3637

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
IMG ?= fluxcd/kustomize-controller:latest
33
# Produce CRDs that work back to Kubernetes 1.16
44
CRD_OPTIONS ?= crd:crdVersions=v1
5-
SOURCE_VER ?= v0.19.2
5+
SOURCE_VER ?= v0.20.0
66

77
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
88
ifeq (,$(shell go env GOBIN))
@@ -122,7 +122,7 @@ ifeq (, $(shell which controller-gen))
122122
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
123123
cd $$CONTROLLER_GEN_TMP_DIR ;\
124124
go mod init tmp ;\
125-
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0 ;\
125+
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0 ;\
126126
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
127127
}
128128
CONTROLLER_GEN=$(GOBIN)/controller-gen

api/go.mod

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
module github.com/fluxcd/kustomize-controller/api
22

3-
go 1.16
3+
go 1.17
44

55
require (
6-
github.com/fluxcd/pkg/apis/kustomize v0.3.0
7-
github.com/fluxcd/pkg/apis/meta v0.10.1
8-
github.com/fluxcd/pkg/runtime v0.12.2
9-
k8s.io/apiextensions-apiserver v0.22.2
10-
k8s.io/apimachinery v0.22.2
11-
sigs.k8s.io/controller-runtime v0.10.2
6+
github.com/fluxcd/pkg/apis/kustomize v0.3.1
7+
github.com/fluxcd/pkg/apis/meta v0.10.2
8+
github.com/fluxcd/pkg/runtime v0.12.3
9+
k8s.io/apiextensions-apiserver v0.23.1
10+
k8s.io/apimachinery v0.23.1
11+
sigs.k8s.io/controller-runtime v0.11.0
12+
)
13+
14+
require (
15+
github.com/go-logr/logr v1.2.2 // indirect
16+
github.com/gogo/protobuf v1.3.2 // indirect
17+
github.com/google/go-cmp v0.5.6 // indirect
18+
github.com/google/gofuzz v1.2.0 // indirect
19+
github.com/json-iterator/go v1.1.12 // indirect
20+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
21+
github.com/modern-go/reflect2 v1.0.2 // indirect
22+
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect
23+
golang.org/x/text v0.3.7 // indirect
24+
gopkg.in/inf.v0 v0.9.1 // indirect
25+
gopkg.in/yaml.v2 v2.4.0 // indirect
26+
k8s.io/klog/v2 v2.30.0 // indirect
27+
k8s.io/utils v0.0.0-20211208161948-7d6a63dca704 // indirect
28+
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
29+
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
30+
sigs.k8s.io/yaml v1.3.0 // indirect
1231
)

api/go.sum

Lines changed: 246 additions & 69 deletions
Large diffs are not rendered by default.

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml

Lines changed: 389 additions & 133 deletions
Large diffs are not rendered by default.

config/default/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
namespace: kustomize-system
44
resources:
5-
- https://github.com/fluxcd/source-controller/releases/download/v0.19.2/source-controller.crds.yaml
6-
- https://github.com/fluxcd/source-controller/releases/download/v0.19.2/source-controller.deployment.yaml
5+
- https://github.com/fluxcd/source-controller/releases/download/v0.20.0/source-controller.crds.yaml
6+
- https://github.com/fluxcd/source-controller/releases/download/v0.20.0/source-controller.deployment.yaml
77
- ../crd
88
- ../rbac
99
- ../manager

controllers/kustomization_controller.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"time"
3232

3333
securejoin "github.com/cyphar/filepath-securejoin"
34-
"github.com/go-logr/logr"
3534
"github.com/hashicorp/go-retryablehttp"
3635
apierrors "k8s.io/apimachinery/pkg/api/errors"
3736
apimeta "k8s.io/apimachinery/pkg/api/meta"
@@ -140,7 +139,7 @@ func (r *KustomizationReconciler) SetupWithManager(mgr ctrl.Manager, opts Kustom
140139
}
141140

142141
func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
143-
log := logr.FromContext(ctx)
142+
log := ctrl.LoggerFrom(ctx)
144143
reconcileStart := time.Now()
145144

146145
var kustomization kustomizev1.Kustomization
@@ -667,7 +666,7 @@ func (r *KustomizationReconciler) build(ctx context.Context, kustomization kusto
667666
}
668667

669668
func (r *KustomizationReconciler) apply(ctx context.Context, manager *ssa.ResourceManager, kustomization kustomizev1.Kustomization, revision string, objects []*unstructured.Unstructured) (bool, *ssa.ChangeSet, error) {
670-
log := logr.FromContext(ctx)
669+
log := ctrl.LoggerFrom(ctx)
671670

672671
if err := ssa.SetNativeKindsDefaults(objects); err != nil {
673672
return false, nil, err
@@ -819,7 +818,7 @@ func (r *KustomizationReconciler) prune(ctx context.Context, manager *ssa.Resour
819818
return false, nil
820819
}
821820

822-
log := logr.FromContext(ctx)
821+
log := ctrl.LoggerFrom(ctx)
823822

824823
opts := ssa.DeleteOptions{
825824
PropagationPolicy: metav1.DeletePropagationBackground,
@@ -846,7 +845,7 @@ func (r *KustomizationReconciler) prune(ctx context.Context, manager *ssa.Resour
846845
}
847846

848847
func (r *KustomizationReconciler) finalize(ctx context.Context, kustomization kustomizev1.Kustomization) (ctrl.Result, error) {
849-
log := logr.FromContext(ctx)
848+
log := ctrl.LoggerFrom(ctx)
850849
if kustomization.Spec.Prune &&
851850
!kustomization.Spec.Suspend &&
852851
kustomization.Status.Inventory != nil &&
@@ -902,7 +901,7 @@ func (r *KustomizationReconciler) finalize(ctx context.Context, kustomization ku
902901
}
903902

904903
func (r *KustomizationReconciler) event(ctx context.Context, kustomization kustomizev1.Kustomization, revision, severity, msg string, metadata map[string]string) {
905-
log := logr.FromContext(ctx)
904+
log := ctrl.LoggerFrom(ctx)
906905

907906
if r.EventRecorder != nil {
908907
annotations := map[string]string{
@@ -946,7 +945,7 @@ func (r *KustomizationReconciler) recordReadiness(ctx context.Context, kustomiza
946945
if r.MetricsRecorder == nil {
947946
return
948947
}
949-
log := logr.FromContext(ctx)
948+
log := ctrl.LoggerFrom(ctx)
950949

951950
objRef, err := reference.GetReference(r.Scheme, &kustomization)
952951
if err != nil {
@@ -967,7 +966,7 @@ func (r *KustomizationReconciler) recordSuspension(ctx context.Context, kustomiz
967966
if r.MetricsRecorder == nil {
968967
return
969968
}
970-
log := logr.FromContext(ctx)
969+
log := ctrl.LoggerFrom(ctx)
971970

972971
objRef, err := reference.GetReference(r.Scheme, &kustomization)
973972
if err != nil {

0 commit comments

Comments
 (0)