Skip to content

Commit 40cbb4d

Browse files
aalexandruaalexandru
andauthored
Add chargebackBusinessUnit field; Remove k8sInfraRelease field (#74)
* Add chargebackBusinessUnit field; Remove k8sInfraRelease field * Fix go deps * go mod tidy * Updated controller-gen version * Fix go.sum imports * Bump go version to 1.21 * Refactor deprecated clientConfig * Refactor clientConfig webhook configuration * Fix G304 (CWE-22) * Add missing license * Update makefile K8S_VERSION to 1.25.0 * Update controller-gen crd options --------- Co-authored-by: aalexandru <[email protected]>
1 parent eeb8ef6 commit 40cbb4d

File tree

24 files changed

+924
-1750
lines changed

24 files changed

+924
-1750
lines changed

.github/env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
golang-version=1.19
1+
golang-version=1.21

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ lint-fix: golangci-lint
144144
$(GOLANGCI_LINT) run --fix
145145

146146
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
147-
GOLANGCI_LINT_VERSION = "v1.46.2"
147+
GOLANGCI_LINT_VERSION = "v1.54.2"
148148
golangci-lint:
149149
@[ -f $(GOLANGCI_LINT) ] || GOBIN=$(shell pwd)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION);
150150

@@ -168,7 +168,7 @@ go-vet:
168168
###########
169169

170170
KUBEBUILDER_ASSETS=$(shell pwd)/kubebuilder
171-
K8S_VERSION=1.21.2
171+
K8S_VERSION=1.25.0
172172

173173
.PHONY: test
174174
test:
@@ -205,12 +205,12 @@ test-performance: ## Outputs requests/s, average req time, 99.9th percentile req
205205
# Development #
206206
###############
207207

208-
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
208+
CRD_OPTIONS ?= "crd"
209209
MANAGER_ROLE ?= "cluster-registry"
210210

211211
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
212212
controller-gen: ## Download controller-gen locally if necessary.
213-
@[ -f $(CONTROLLER_GEN) ] || GOBIN=$(shell pwd)/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1
213+
@[ -f $(CONTROLLER_GEN) ] || GOBIN=$(shell pwd)/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0
214214

215215
KUSTOMIZE = $(shell pwd)/bin/kustomize
216216
kustomize: ## Download kustomize locally if necessary.

cmd/client/client.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func main() {
9696
}
9797

9898
if configFile != "" {
99-
options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile).OfKind(&clientConfig))
99+
options, clientConfig, err = apply(configFile)
100100
if err != nil {
101101
setupLog.Error(err, "unable to load the config file")
102102
os.Exit(1)
@@ -175,3 +175,18 @@ func main() {
175175
os.Exit(1)
176176
}
177177
}
178+
179+
func apply(configFile string) (ctrl.Options, configv1.ClientConfig, error) {
180+
options, cfg, err := configv1.Load(scheme, configFile)
181+
if err != nil {
182+
return options, cfg, err
183+
}
184+
185+
cfgStr, err := configv1.Encode(scheme, &cfg)
186+
if err != nil {
187+
return options, cfg, err
188+
}
189+
setupLog.Info("Successfully loaded configuration", "config", cfgStr)
190+
191+
return options, cfg, nil
192+
}

config/crd/bases/registry.ethos.adobe.com_clusters.yaml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
21
---
32
apiVersion: apiextensions.k8s.io/v1
43
kind: CustomResourceDefinition
54
metadata:
65
annotations:
7-
controller-gen.kubebuilder.io/version: v0.4.1
8-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.13.0
97
name: clusters.registry.ethos.adobe.com
108
spec:
119
group: registry.ethos.adobe.com
@@ -98,6 +96,9 @@ spec:
9896
- clusterProvisioning
9997
- lastUpdated
10098
type: object
99+
chargebackBusinessUnit:
100+
description: The BU responsible for paying for the cluster.
101+
type: string
101102
cloudProviderRegion:
102103
description: The cloud provider standard region
103104
type: string
@@ -149,23 +150,6 @@ spec:
149150
- domainName
150151
- lbEndpoints
151152
type: object
152-
k8sInfraRelease:
153-
description: K8s Infrastructure release information
154-
properties:
155-
gitSha:
156-
description: GitSha of the release
157-
type: string
158-
lastUpdated:
159-
description: When the release was applied on the cluster
160-
type: string
161-
release:
162-
description: Release name
163-
type: string
164-
required:
165-
- gitSha
166-
- lastUpdated
167-
- release
168-
type: object
169153
lastUpdated:
170154
description: Timestamp when cluster information was updated
171155
type: string
@@ -312,10 +296,10 @@ spec:
312296
- accountId
313297
- apiServer
314298
- businessUnit
299+
- chargebackBusinessUnit
315300
- cloudProviderRegion
316301
- cloudType
317302
- environment
318-
- k8sInfraRelease
319303
- lastUpdated
320304
- managingOrg
321305
- name
@@ -336,9 +320,3 @@ spec:
336320
storage: true
337321
subresources:
338322
status: {}
339-
status:
340-
acceptedNames:
341-
kind: ""
342-
plural: ""
343-
conditions: []
344-
storedVersions: []

go.mod

Lines changed: 76 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,138 @@
11
module github.com/adobe/cluster-registry
22

3-
go 1.19
3+
go 1.21
44

55
require (
6-
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11
7-
github.com/aws/aws-sdk-go v1.44.138
8-
github.com/coreos/go-oidc/v3 v3.4.0
9-
github.com/go-logr/logr v1.2.3
6+
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12
7+
github.com/aws/aws-sdk-go v1.44.332
8+
github.com/coreos/go-oidc/v3 v3.6.0
9+
github.com/go-logr/logr v1.2.4
1010
github.com/google/uuid v1.3.0
1111
github.com/gusaul/go-dynamock v0.0.0-20210107061312-3e989056e1e6
1212
github.com/jinzhu/gorm v1.9.16
13-
github.com/labstack/echo/v4 v4.9.1
13+
github.com/labstack/echo/v4 v4.11.1
1414
github.com/labstack/gommon v0.4.0
1515
github.com/onsi/ginkgo v1.16.5
16-
github.com/onsi/gomega v1.24.1
17-
github.com/prometheus/client_golang v1.14.0
18-
github.com/stretchr/testify v1.8.1
19-
github.com/swaggo/echo-swagger v1.3.5
20-
github.com/swaggo/swag v1.8.7
21-
github.com/testcontainers/testcontainers-go v0.15.0
22-
golang.org/x/net v0.2.0
16+
github.com/onsi/gomega v1.27.7
17+
github.com/prometheus/client_golang v1.15.1
18+
github.com/stretchr/testify v1.8.4
19+
github.com/swaggo/echo-swagger v1.4.0
20+
github.com/swaggo/swag v1.16.1
21+
github.com/testcontainers/testcontainers-go v0.23.0
22+
golang.org/x/net v0.12.0
2323
gopkg.in/go-playground/validator.v9 v9.31.0
2424
gopkg.in/square/go-jose.v2 v2.6.0
2525
gopkg.in/yaml.v2 v2.4.0
26-
k8s.io/api v0.25.4
27-
k8s.io/apimachinery v0.25.4
28-
k8s.io/client-go v0.25.4
29-
sigs.k8s.io/controller-runtime v0.13.1
26+
k8s.io/api v0.27.2
27+
k8s.io/apimachinery v0.27.2
28+
k8s.io/client-go v0.27.2
29+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
30+
sigs.k8s.io/controller-runtime v0.15.1
3031
sigs.k8s.io/yaml v1.3.0
3132
)
3233

3334
require (
34-
cloud.google.com/go/compute v1.7.0 // indirect
35+
dario.cat/mergo v1.0.0 // indirect
3536
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
3637
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
37-
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
38-
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
38+
github.com/Azure/go-autorest/autorest v0.11.24 // indirect
39+
github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect
3940
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
4041
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
4142
github.com/Azure/go-autorest/logger v0.2.1 // indirect
4243
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
4344
github.com/KyleBanks/depth v1.2.1 // indirect
44-
github.com/Microsoft/go-winio v0.5.2 // indirect
45-
github.com/Microsoft/hcsshim v0.9.4 // indirect
46-
github.com/PuerkitoBio/purell v1.1.1 // indirect
47-
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
45+
github.com/Microsoft/go-winio v0.6.1 // indirect
4846
github.com/beorn7/perks v1.0.1 // indirect
49-
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
50-
github.com/cespare/xxhash/v2 v2.1.2 // indirect
51-
github.com/containerd/cgroups v1.0.4 // indirect
52-
github.com/containerd/containerd v1.6.8 // indirect
47+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
48+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
49+
github.com/containerd/containerd v1.7.3 // indirect
50+
github.com/cpuguy83/dockercfg v0.3.1 // indirect
5351
github.com/davecgh/go-spew v1.1.1 // indirect
5452
github.com/dimchansky/utfbom v1.1.1 // indirect
55-
github.com/docker/distribution v2.8.1+incompatible // indirect
56-
github.com/docker/docker v20.10.17+incompatible // indirect
53+
github.com/docker/distribution v2.8.2+incompatible // indirect
54+
github.com/docker/docker v24.0.5+incompatible // indirect
5755
github.com/docker/go-connections v0.4.0 // indirect
5856
github.com/docker/go-units v0.5.0 // indirect
59-
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
57+
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
6058
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
6159
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
62-
github.com/fsnotify/fsnotify v1.5.4 // indirect
63-
github.com/go-logr/zapr v1.2.3 // indirect
64-
github.com/go-openapi/jsonpointer v0.19.5 // indirect
65-
github.com/go-openapi/jsonreference v0.19.6 // indirect
60+
github.com/fsnotify/fsnotify v1.6.0 // indirect
61+
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
62+
github.com/go-logr/zapr v1.2.4 // indirect
63+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
64+
github.com/go-openapi/jsonreference v0.20.1 // indirect
6665
github.com/go-openapi/spec v0.20.4 // indirect
67-
github.com/go-openapi/swag v0.19.15 // indirect
68-
github.com/go-playground/locales v0.14.0 // indirect
69-
github.com/go-playground/universal-translator v0.18.0 // indirect
66+
github.com/go-openapi/swag v0.22.3 // indirect
67+
github.com/go-playground/locales v0.14.1 // indirect
68+
github.com/go-playground/universal-translator v0.18.1 // indirect
7069
github.com/gogo/protobuf v1.3.2 // indirect
7170
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
72-
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
71+
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
7372
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
74-
github.com/golang/protobuf v1.5.2 // indirect
73+
github.com/golang/protobuf v1.5.3 // indirect
7574
github.com/google/gnostic v0.5.7-v3refs // indirect
7675
github.com/google/go-cmp v0.5.9 // indirect
7776
github.com/google/gofuzz v1.2.0 // indirect
78-
github.com/imdario/mergo v0.3.12 // indirect
77+
github.com/imdario/mergo v0.3.13 // indirect
7978
github.com/jmespath/go-jmespath v0.4.0 // indirect
8079
github.com/josharian/intern v1.0.0 // indirect
8180
github.com/json-iterator/go v1.1.12 // indirect
82-
github.com/kr/pretty v0.3.0 // indirect
83-
github.com/leodido/go-urn v1.2.1 // indirect
84-
github.com/magiconair/properties v1.8.6 // indirect
81+
github.com/klauspost/compress v1.16.0 // indirect
82+
github.com/leodido/go-urn v1.2.4 // indirect
83+
github.com/magiconair/properties v1.8.7 // indirect
8584
github.com/mailru/easyjson v0.7.7 // indirect
86-
github.com/mattn/go-colorable v0.1.12 // indirect
87-
github.com/mattn/go-isatty v0.0.14 // indirect
85+
github.com/mattn/go-colorable v0.1.13 // indirect
86+
github.com/mattn/go-isatty v0.0.19 // indirect
8887
github.com/mattn/go-sqlite3 v1.14.0 // indirect
89-
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
88+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
9089
github.com/mitchellh/go-homedir v1.1.0 // indirect
91-
github.com/moby/sys/mount v0.3.3 // indirect
92-
github.com/moby/sys/mountinfo v0.6.2 // indirect
93-
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
90+
github.com/moby/patternmatcher v0.5.0 // indirect
91+
github.com/moby/sys/sequential v0.5.0 // indirect
92+
github.com/moby/term v0.5.0 // indirect
9493
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
9594
github.com/modern-go/reflect2 v1.0.2 // indirect
9695
github.com/morikuni/aec v1.0.0 // indirect
9796
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
9897
github.com/nxadm/tail v1.4.8 // indirect
9998
github.com/opencontainers/go-digest v1.0.0 // indirect
100-
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect
101-
github.com/opencontainers/runc v1.1.3 // indirect
99+
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
100+
github.com/opencontainers/runc v1.1.5 // indirect
102101
github.com/pkg/errors v0.9.1 // indirect
103102
github.com/pmezard/go-difflib v1.0.0 // indirect
104-
github.com/prometheus/client_model v0.3.0 // indirect
105-
github.com/prometheus/common v0.37.0 // indirect
106-
github.com/prometheus/procfs v0.8.0 // indirect
107-
github.com/rogpeppe/go-internal v1.8.1 // indirect
108-
github.com/sirupsen/logrus v1.8.1 // indirect
103+
github.com/prometheus/client_model v0.4.0 // indirect
104+
github.com/prometheus/common v0.42.0 // indirect
105+
github.com/prometheus/procfs v0.9.0 // indirect
106+
github.com/sirupsen/logrus v1.9.0 // indirect
109107
github.com/spf13/pflag v1.0.5 // indirect
110-
github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a // indirect
108+
github.com/swaggo/files/v2 v2.0.0 // indirect
111109
github.com/valyala/bytebufferpool v1.0.0 // indirect
112-
github.com/valyala/fasttemplate v1.2.1 // indirect
113-
go.opencensus.io v0.23.0 // indirect
110+
github.com/valyala/fasttemplate v1.2.2 // indirect
114111
go.uber.org/atomic v1.7.0 // indirect
115112
go.uber.org/multierr v1.6.0 // indirect
116-
go.uber.org/zap v1.21.0 // indirect
117-
golang.org/x/crypto v0.1.0 // indirect
118-
golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 // indirect
119-
golang.org/x/sys v0.2.0 // indirect
120-
golang.org/x/term v0.2.0 // indirect
121-
golang.org/x/text v0.4.0 // indirect
122-
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
123-
golang.org/x/tools v0.2.0 // indirect
124-
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
113+
go.uber.org/zap v1.24.0 // indirect
114+
golang.org/x/crypto v0.11.0 // indirect
115+
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect
116+
golang.org/x/mod v0.10.0 // indirect
117+
golang.org/x/oauth2 v0.7.0 // indirect
118+
golang.org/x/sys v0.11.0 // indirect
119+
golang.org/x/term v0.10.0 // indirect
120+
golang.org/x/text v0.11.0 // indirect
121+
golang.org/x/time v0.3.0 // indirect
122+
golang.org/x/tools v0.9.1 // indirect
123+
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
125124
google.golang.org/appengine v1.6.7 // indirect
126-
google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad // indirect
127-
google.golang.org/grpc v1.47.0 // indirect
128-
google.golang.org/protobuf v1.28.1 // indirect
129-
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
125+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
126+
google.golang.org/grpc v1.57.0 // indirect
127+
google.golang.org/protobuf v1.30.0 // indirect
130128
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
131129
gopkg.in/inf.v0 v0.9.1 // indirect
132130
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
133131
gopkg.in/yaml.v3 v3.0.1 // indirect
134-
k8s.io/apiextensions-apiserver v0.25.0 // indirect
135-
k8s.io/component-base v0.25.0 // indirect
136-
k8s.io/klog/v2 v2.70.1 // indirect
137-
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
138-
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
139-
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
132+
k8s.io/apiextensions-apiserver v0.27.2 // indirect
133+
k8s.io/component-base v0.27.2 // indirect
134+
k8s.io/klog/v2 v2.90.1 // indirect
135+
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
136+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
140137
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
141138
)

0 commit comments

Comments
 (0)