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

File tree

12 files changed

+1065
-336
lines changed

12 files changed

+1065
-336
lines changed

.github/workflows/e2e.yaml

+1-1
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/[email protected]
4545
with:

Dockerfile

+4-3
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

+2-2
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

+26-7
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

+246-69
Large diffs are not rendered by default.

api/v1beta1/zz_generated.deepcopy.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/zz_generated.deepcopy.go

+1
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

+389-133
Large diffs are not rendered by default.

config/default/kustomization.yaml

+2-2
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

+7-8
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 {

go.mod

+124-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/fluxcd/kustomize-controller
22

3-
go 1.16
3+
go 1.17
44

55
replace github.com/fluxcd/kustomize-controller/api => ./api
66

@@ -10,41 +10,142 @@ require (
1010
github.com/cyphar/filepath-securejoin v0.2.2
1111
github.com/drone/envsubst v1.0.3-0.20200804185402-58bc65f69603
1212
github.com/fluxcd/kustomize-controller/api v0.18.2
13-
github.com/fluxcd/pkg/apis/kustomize v0.3.0
14-
github.com/fluxcd/pkg/apis/meta v0.10.1
15-
github.com/fluxcd/pkg/runtime v0.12.2
16-
github.com/fluxcd/pkg/ssa v0.6.0
13+
github.com/fluxcd/pkg/apis/kustomize v0.3.1
14+
github.com/fluxcd/pkg/apis/meta v0.10.2
15+
github.com/fluxcd/pkg/runtime v0.12.3
16+
github.com/fluxcd/pkg/ssa v0.7.0
1717
github.com/fluxcd/pkg/testserver v0.1.0
1818
github.com/fluxcd/pkg/untar v0.1.0
19-
github.com/fluxcd/source-controller/api v0.19.2
20-
github.com/go-logr/logr v0.4.0
19+
github.com/fluxcd/source-controller/api v0.20.0
2120
github.com/hashicorp/go-retryablehttp v0.7.0
22-
github.com/onsi/gomega v1.15.0
21+
github.com/onsi/gomega v1.17.0
2322
github.com/spf13/pflag v1.0.5
2423
go.mozilla.org/sops/v3 v3.7.1
25-
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023
26-
golang.org/x/text v0.3.7 // indirect
24+
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
2725
google.golang.org/grpc v1.42.0
28-
k8s.io/api v0.22.2
29-
k8s.io/apiextensions-apiserver v0.22.2
30-
k8s.io/apimachinery v0.22.2
31-
k8s.io/client-go v0.22.2
32-
sigs.k8s.io/cli-utils v0.26.0
33-
sigs.k8s.io/controller-runtime v0.10.2
26+
k8s.io/api v0.23.1
27+
k8s.io/apiextensions-apiserver v0.23.1
28+
k8s.io/apimachinery v0.23.1
29+
k8s.io/client-go v0.23.1
30+
sigs.k8s.io/cli-utils v0.26.1
31+
sigs.k8s.io/controller-runtime v0.11.0
3432
sigs.k8s.io/kustomize/api v0.10.1
3533
sigs.k8s.io/kustomize/kyaml v0.13.0
3634
sigs.k8s.io/yaml v1.3.0
3735
)
3836

37+
require (
38+
cloud.google.com/go v0.81.0 // indirect
39+
github.com/Azure/azure-sdk-for-go v31.2.0+incompatible // indirect
40+
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
41+
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
42+
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
43+
github.com/Azure/go-autorest/autorest/azure/auth v0.1.0 // indirect
44+
github.com/Azure/go-autorest/autorest/azure/cli v0.1.0 // indirect
45+
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
46+
github.com/Azure/go-autorest/autorest/to v0.3.0 // indirect
47+
github.com/Azure/go-autorest/autorest/validation v0.2.0 // indirect
48+
github.com/Azure/go-autorest/logger v0.2.1 // indirect
49+
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
50+
github.com/PuerkitoBio/purell v1.1.1 // indirect
51+
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
52+
github.com/aws/aws-sdk-go v1.37.18 // indirect
53+
github.com/beorn7/perks v1.0.1 // indirect
54+
github.com/blang/semver v3.5.1+incompatible // indirect
55+
github.com/cespare/xxhash/v2 v2.1.1 // indirect
56+
github.com/davecgh/go-spew v1.1.1 // indirect
57+
github.com/dimchansky/utfbom v1.1.0 // indirect
58+
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
59+
github.com/fatih/color v1.7.0 // indirect
60+
github.com/fluxcd/pkg/apis/acl v0.0.3 // indirect
61+
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
62+
github.com/fsnotify/fsnotify v1.5.1 // indirect
63+
github.com/go-errors/errors v1.0.1 // indirect
64+
github.com/go-logr/logr v1.2.2 // indirect
65+
github.com/go-logr/zapr v1.2.0 // indirect
66+
github.com/go-openapi/jsonpointer v0.19.5 // indirect
67+
github.com/go-openapi/jsonreference v0.19.5 // indirect
68+
github.com/go-openapi/swag v0.19.14 // indirect
69+
github.com/gogo/protobuf v1.3.2 // indirect
70+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
71+
github.com/golang/protobuf v1.5.2 // indirect
72+
github.com/golang/snappy v0.0.1 // indirect
73+
github.com/google/go-cmp v0.5.6 // indirect
74+
github.com/google/gofuzz v1.2.0 // indirect
75+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
76+
github.com/google/uuid v1.2.0 // indirect
77+
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
78+
github.com/googleapis/gnostic v0.5.5 // indirect
79+
github.com/goware/prefixer v0.0.0-20160118172347-395022866408 // indirect
80+
github.com/hashicorp/errwrap v1.0.0 // indirect
81+
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
82+
github.com/hashicorp/go-multierror v1.0.0 // indirect
83+
github.com/hashicorp/go-rootcerts v1.0.1 // indirect
84+
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
85+
github.com/hashicorp/hcl v1.0.0 // indirect
86+
github.com/hashicorp/vault/api v1.0.4 // indirect
87+
github.com/hashicorp/vault/sdk v0.1.13 // indirect
88+
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c // indirect
89+
github.com/imdario/mergo v0.3.12 // indirect
90+
github.com/jmespath/go-jmespath v0.4.0 // indirect
91+
github.com/josharian/intern v1.0.0 // indirect
92+
github.com/json-iterator/go v1.1.12 // indirect
93+
github.com/lib/pq v1.2.0 // indirect
94+
github.com/mailru/easyjson v0.7.6 // indirect
95+
github.com/mattn/go-colorable v0.0.9 // indirect
96+
github.com/mattn/go-isatty v0.0.4 // indirect
97+
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
98+
github.com/mitchellh/go-homedir v1.1.0 // indirect
99+
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
100+
github.com/mitchellh/mapstructure v1.4.1 // indirect
101+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
102+
github.com/modern-go/reflect2 v1.0.2 // indirect
103+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
104+
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
105+
github.com/pkg/errors v0.9.1 // indirect
106+
github.com/pmezard/go-difflib v1.0.0 // indirect
107+
github.com/prometheus/client_golang v1.11.0 // indirect
108+
github.com/prometheus/client_model v0.2.0 // indirect
109+
github.com/prometheus/common v0.28.0 // indirect
110+
github.com/prometheus/procfs v0.6.0 // indirect
111+
github.com/ryanuber/go-glob v1.0.0 // indirect
112+
github.com/sirupsen/logrus v1.8.1 // indirect
113+
github.com/stretchr/testify v1.7.0 // indirect
114+
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
115+
go.mozilla.org/gopgagent v0.0.0-20170926210634-4d7ea76ff71a // indirect
116+
go.opencensus.io v0.23.0 // indirect
117+
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
118+
go.uber.org/atomic v1.7.0 // indirect
119+
go.uber.org/multierr v1.6.0 // indirect
120+
go.uber.org/zap v1.19.1 // indirect
121+
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
122+
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
123+
golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 // indirect
124+
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
125+
golang.org/x/text v0.3.7 // indirect
126+
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
127+
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
128+
google.golang.org/api v0.44.0 // indirect
129+
google.golang.org/appengine v1.6.7 // indirect
130+
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2 // indirect
131+
google.golang.org/protobuf v1.27.1 // indirect
132+
gopkg.in/inf.v0 v0.9.1 // indirect
133+
gopkg.in/ini.v1 v1.62.0 // indirect
134+
gopkg.in/square/go-jose.v2 v2.3.1 // indirect
135+
gopkg.in/urfave/cli.v1 v1.20.0 // indirect
136+
gopkg.in/yaml.v2 v2.4.0 // indirect
137+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
138+
k8s.io/cli-runtime v0.23.0 // indirect
139+
k8s.io/component-base v0.23.1 // indirect
140+
k8s.io/klog/v2 v2.30.0 // indirect
141+
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
142+
k8s.io/utils v0.0.0-20211208161948-7d6a63dca704 // indirect
143+
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
144+
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
145+
)
146+
39147
// pin kustomize to v4.4.1
40148
replace (
41149
sigs.k8s.io/kustomize/api => sigs.k8s.io/kustomize/api v0.10.1
42150
sigs.k8s.io/kustomize/kyaml => sigs.k8s.io/kustomize/kyaml v0.13.0
43151
)
44-
45-
// fix CVE-2021-30465
46-
// fix CVE-2021-43784
47-
replace github.com/opencontainers/runc => github.com/opencontainers/runc v1.0.3
48-
49-
// fix CVE-2021-41190
50-
replace github.com/opencontainers/image-spec => github.com/opencontainers/image-spec v1.0.2

0 commit comments

Comments
 (0)