Skip to content

Commit e9bbec2

Browse files
some updates
1 parent 7a7fb2b commit e9bbec2

File tree

6 files changed

+330
-286
lines changed

6 files changed

+330
-286
lines changed

Makefile

+48-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
CHART_REPO_URL ?= http://example.com
22
HELM_REPO_DEST ?= /tmp/gh-pages
33
OPERATOR_NAME ?=$(shell basename -z `pwd`)
4-
HELM_VERSION ?= v3.8.0
5-
KIND_VERSION ?= v0.11.1
6-
KUBECTL_VERSION ?= v1.21.1
7-
VAULT_VERSION ?= 1.9.3
4+
HELM_VERSION ?= v3.11.0
5+
KIND_VERSION ?= v0.20.0
6+
KUBECTL_VERSION ?= v1.27.3
7+
K8S_MAJOR_VERSION ?= 1.27
8+
KUSTOMIZE_VERSION ?= v3.8.7
9+
CONTROLLER_TOOLS_VERSION ?= v0.11.1
10+
# Set the Operator SDK version to use. By default, what is installed on the system is used.
11+
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
12+
OPERATOR_SDK_VERSION ?= v1.31.0
13+
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
14+
ENVTEST_K8S_VERSION ?= 1.26.0
815

916
# VERSION defines the project version for the bundle.
1017
# Update this value when you upgrade the version of your project.
@@ -78,23 +85,28 @@ all: build
7885
# More info on the awk command:
7986
# http://linuxcommand.org/lc3_adv_awk.php
8087

88+
.PHONY: help
8189
help: ## Display this help.
8290
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
83-
8491
##@ Development
8592

93+
.PHONY: manifests
8694
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
87-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
95+
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
8896

97+
.PHONY: generate
8998
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
9099
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
91100

101+
.PHONY: fmt
92102
fmt: ## Run go fmt against code.
93103
go fmt ./...
94104

105+
.PHONY: vet
95106
vet: ## Run go vet against code.
96107
go vet ./...
97108

109+
.PHONY: test
98110
test: manifests generate fmt vet envtest ## Run tests.
99111
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
100112

@@ -143,24 +155,26 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
143155
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
144156
ENVTEST ?= $(LOCALBIN)/setup-envtest
145157

146-
KUSTOMIZE_VERSION ?= v3.8.7
147-
CONTROLLER_TOOLS_VERSION ?= v0.10.0
158+
148159

149160
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
150161
.PHONY: kustomize
162+
KUSTOMIZE ?= $(LOCALBIN)/kustomize
151163
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
152164
$(KUSTOMIZE): $(LOCALBIN)
153165
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
154166

155167
.PHONY: controller-gen
168+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
156169
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
157170
$(CONTROLLER_GEN): $(LOCALBIN)
158-
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
171+
test -s $(LOCALBIN)/controller-gen || echo "Downloading controller-gen to ${CONTROLLER_GEN}..." && GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
159172

160173
.PHONY: envtest
174+
ENVTEST ?= $(LOCALBIN)/setup-envtest
161175
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
162176
$(ENVTEST): $(LOCALBIN)
163-
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
177+
test -s $(LOCALBIN)/setup-envtest || echo "Downloading setup-envtest to ${ENVTEST}..." && GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
164178

165179
# go-get-tool will 'go get' any package $2 and install it to $1.
166180
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
@@ -177,11 +191,11 @@ rm -rf $$TMP_DIR ;\
177191
endef
178192

179193
.PHONY: bundle
180-
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
181-
operator-sdk generate kustomize manifests -q
194+
bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
195+
$(OPERATOR_SDK) generate kustomize manifests --interactive=false -q
182196
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
183-
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
184-
operator-sdk bundle validate ./bundle
197+
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
198+
$(OPERATOR_SDK) bundle validate ./bundle
185199

186200
.PHONY: bundle-build
187201
bundle-build: ## Build the bundle image.
@@ -192,15 +206,15 @@ bundle-push: ## Push the bundle image.
192206
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
193207

194208
.PHONY: opm
195-
OPM = ./bin/opm
209+
OPM ?= $(LOCALBIN)/opm
196210
opm: ## Download opm locally if necessary.
197211
ifeq (,$(wildcard $(OPM)))
198212
ifeq (,$(shell which opm 2>/dev/null))
199213
@{ \
200214
set -e ;\
201215
mkdir -p $(dir $(OPM)) ;\
202216
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
203-
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.1/$${OS}-$${ARCH}-opm ;\
217+
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$${OS}-$${ARCH}-opm ;\
204218
chmod +x $(OPM) ;\
205219
}
206220
else
@@ -323,3 +337,21 @@ else
323337
HELM = $(shell which helm)
324338
endif
325339
endif
340+
341+
.PHONY: operator-sdk
342+
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
343+
operator-sdk: ## Download operator-sdk locally if necessary.
344+
ifeq (,$(wildcard $(OPERATOR_SDK)))
345+
@{ \
346+
set -e ;\
347+
echo "Downloading operator-sdk to $(OPERATOR_SDK)..." ;\
348+
mkdir -p $(dir $(OPERATOR_SDK)) ;\
349+
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
350+
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
351+
chmod +x $(OPERATOR_SDK) ;\
352+
}
353+
endif
354+
355+
.PHONY: clean
356+
clean:
357+
rm -rf $(LOCALBIN) ./bundle ./bundle-* ./charts

config/crd/bases/redhatcop.redhat.io_groupconfigs.yaml

+93-89
Original file line numberDiff line numberDiff line change
@@ -1,10 +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
6+
controller-gen.kubebuilder.io/version: v0.10.0
87
creationTimestamp: null
98
name: groupconfigs.redhatcop.redhat.io
109
spec:
@@ -83,6 +82,7 @@ spec:
8382
are ANDed.
8483
type: object
8584
type: object
85+
x-kubernetes-map-type: atomic
8686
labelSelector:
8787
description: LabelSelector selects Groups by label.
8888
properties:
@@ -127,6 +127,7 @@ spec:
127127
are ANDed.
128128
type: object
129129
type: object
130+
x-kubernetes-map-type: atomic
130131
templates:
131132
description: Templates these are the templates of the resources to
132133
be created when a selected groups is created/updated
@@ -161,13 +162,12 @@ spec:
161162
description: "Condition contains details for one aspect of the current
162163
state of this API Resource. --- This struct is intended for direct
163164
use as an array at the field path .status.conditions. For example,
164-
type FooStatus struct{ // Represents the observations of a
165-
foo's current state. // Known .status.conditions.type are:
166-
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
167-
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
168-
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
169-
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
170-
\n // other fields }"
165+
\n type FooStatus struct{ // Represents the observations of a
166+
foo's current state. // Known .status.conditions.type are: \"Available\",
167+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
168+
// +listType=map // +listMapKey=type Conditions []metav1.Condition
169+
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
170+
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
171171
properties:
172172
lastTransitionTime:
173173
description: lastTransitionTime is the last time the condition
@@ -230,75 +230,82 @@ spec:
230230
x-kubernetes-list-type: map
231231
lockedPatchStatuses:
232232
additionalProperties:
233-
items:
234-
description: "Condition contains details for one aspect of the
235-
current state of this API Resource. --- This struct is intended
236-
for direct use as an array at the field path .status.conditions.
237-
\ For example, type FooStatus struct{ // Represents the
238-
observations of a foo's current state. // Known .status.conditions.type
239-
are: \"Available\", \"Progressing\", and \"Degraded\" //
240-
+patchMergeKey=type // +patchStrategy=merge // +listType=map
241-
\ // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\"
242-
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
243-
\n // other fields }"
244-
properties:
245-
lastTransitionTime:
246-
description: lastTransitionTime is the last time the condition
247-
transitioned from one status to another. This should be
248-
when the underlying condition changed. If that is not known,
249-
then using the time when the API field changed is acceptable.
250-
format: date-time
251-
type: string
252-
message:
253-
description: message is a human readable message indicating
254-
details about the transition. This may be an empty string.
255-
maxLength: 32768
256-
type: string
257-
observedGeneration:
258-
description: observedGeneration represents the .metadata.generation
259-
that the condition was set based upon. For instance, if
260-
.metadata.generation is currently 12, but the .status.conditions[x].observedGeneration
261-
is 9, the condition is out of date with respect to the current
262-
state of the instance.
263-
format: int64
264-
minimum: 0
265-
type: integer
266-
reason:
267-
description: reason contains a programmatic identifier indicating
268-
the reason for the condition's last transition. Producers
269-
of specific condition types may define expected values and
270-
meanings for this field, and whether the values are considered
271-
a guaranteed API. The value should be a CamelCase string.
272-
This field may not be empty.
273-
maxLength: 1024
274-
minLength: 1
275-
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
276-
type: string
277-
status:
278-
description: status of the condition, one of True, False,
279-
Unknown.
280-
enum:
281-
- "True"
282-
- "False"
283-
- Unknown
284-
type: string
285-
type:
286-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
287-
--- Many .condition.type values are consistent across resources
288-
like Available, but because arbitrary conditions can be
289-
useful (see .node.status.conditions), the ability to deconflict
290-
is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
291-
maxLength: 316
292-
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
293-
type: string
294-
required:
295-
- lastTransitionTime
296-
- message
297-
- reason
298-
- status
233+
additionalProperties:
234+
items:
235+
description: "Condition contains details for one aspect of the
236+
current state of this API Resource. --- This struct is intended
237+
for direct use as an array at the field path .status.conditions.
238+
\ For example, \n type FooStatus struct{ // Represents the
239+
observations of a foo's current state. // Known .status.conditions.type
240+
are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
241+
// +patchStrategy=merge // +listType=map // +listMapKey=type
242+
Conditions []metav1.Condition `json:\"conditions,omitempty\"
243+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
244+
\n // other fields }"
245+
properties:
246+
lastTransitionTime:
247+
description: lastTransitionTime is the last time the condition
248+
transitioned from one status to another. This should be
249+
when the underlying condition changed. If that is not
250+
known, then using the time when the API field changed
251+
is acceptable.
252+
format: date-time
253+
type: string
254+
message:
255+
description: message is a human readable message indicating
256+
details about the transition. This may be an empty string.
257+
maxLength: 32768
258+
type: string
259+
observedGeneration:
260+
description: observedGeneration represents the .metadata.generation
261+
that the condition was set based upon. For instance, if
262+
.metadata.generation is currently 12, but the .status.conditions[x].observedGeneration
263+
is 9, the condition is out of date with respect to the
264+
current state of the instance.
265+
format: int64
266+
minimum: 0
267+
type: integer
268+
reason:
269+
description: reason contains a programmatic identifier indicating
270+
the reason for the condition's last transition. Producers
271+
of specific condition types may define expected values
272+
and meanings for this field, and whether the values are
273+
considered a guaranteed API. The value should be a CamelCase
274+
string. This field may not be empty.
275+
maxLength: 1024
276+
minLength: 1
277+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
278+
type: string
279+
status:
280+
description: status of the condition, one of True, False,
281+
Unknown.
282+
enum:
283+
- "True"
284+
- "False"
285+
- Unknown
286+
type: string
287+
type:
288+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
289+
--- Many .condition.type values are consistent across
290+
resources like Available, but because arbitrary conditions
291+
can be useful (see .node.status.conditions), the ability
292+
to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
293+
maxLength: 316
294+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
295+
type: string
296+
required:
297+
- lastTransitionTime
298+
- message
299+
- reason
300+
- status
301+
- type
302+
type: object
303+
type: array
304+
x-kubernetes-list-map-keys:
299305
- type
300-
type: object
301-
type: array
306+
x-kubernetes-list-type: map
307+
type: object
308+
x-kubernetes-map-type: granular
302309
description: LockedResourceStatuses contains the reconcile status
303310
for each of the managed resources
304311
type: object
@@ -308,13 +315,13 @@ spec:
308315
description: "Condition contains details for one aspect of the
309316
current state of this API Resource. --- This struct is intended
310317
for direct use as an array at the field path .status.conditions.
311-
\ For example, type FooStatus struct{ // Represents the
312-
observations of a foo's current state. // Known .status.conditions.type
313-
are: \"Available\", \"Progressing\", and \"Degraded\" //
314-
+patchMergeKey=type // +patchStrategy=merge // +listType=map
315-
\ // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\"
318+
\ For example, \n type FooStatus struct{ // Represents the observations
319+
of a foo's current state. // Known .status.conditions.type are:
320+
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
321+
// +patchStrategy=merge // +listType=map // +listMapKey=type
322+
Conditions []metav1.Condition `json:\"conditions,omitempty\"
316323
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
317-
\n // other fields }"
324+
\n // other fields }"
318325
properties:
319326
lastTransitionTime:
320327
description: lastTransitionTime is the last time the condition
@@ -373,6 +380,9 @@ spec:
373380
- type
374381
type: object
375382
type: array
383+
x-kubernetes-list-map-keys:
384+
- type
385+
x-kubernetes-list-type: map
376386
description: LockedResourceStatuses contains the reconcile status
377387
for each of the managed resources
378388
type: object
@@ -382,9 +392,3 @@ spec:
382392
storage: true
383393
subresources:
384394
status: {}
385-
status:
386-
acceptedNames:
387-
kind: ""
388-
plural: ""
389-
conditions: []
390-
storedVersions: []

0 commit comments

Comments
 (0)