Skip to content

Commit 3903485

Browse files
committed
rebase changes
Signed-off-by: Tommy Hughes <[email protected]>
1 parent c189a61 commit 3903485

26 files changed

+651
-2109
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ tmp/
4242

4343
# ready to work samples
4444
deploy/
45-
__debug_bin/

Makefile

+22-39
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ CONTAINER_ENGINE?=docker
99
# To re-generate a bundle for another specific version without changing the standard setup, you can:
1010
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
1111
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
12-
VERSION ?= 0.3.0
13-
14-
ifndef PRODUCT_VERSION
15-
PRODUCT_VERSION := $(shell git describe --tags --dirty --broken)
16-
endif
17-
18-
CONTAINER_ENGINE?=docker
12+
VERSION ?= $(shell git describe --tags --dirty --broken | cut -c 2-)
1913

2014
# CHANNELS define the bundle channels used in the bundle.
2115
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
@@ -48,19 +42,16 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
4842

4943
# Base registry for the operator, bundle, catalog images
5044
REGISTRY ?= quay.io/mongodb
51-
# Image URL to use all building/pushing image targets
52-
IMG ?= $(REGISTRY)/mongodb-atlas-kubernetes-dbaas
53-
OPERATOR_REGISTRY ?= $(IMG)
54-
55-
OPERATOR_IMG ?= $(IMG):$(VERSION)
56-
# OPERATOR_IMG ?= $(IMG):latest
57-
58-
BUNDLE_IMG ?= $(IMG)-bundle:$(VERSION)
59-
# BUNDLE_IMG ?= $(IMG)-bundle:latest
60-
61-
CATALOG_IMG ?= $(IMG)-catalog:$(VERSION)
62-
# CATALOG_IMG ?= ${IMG}-catalog:latest
63-
45+
# BUNDLE_IMG defines the image:tag used for the bundle.
46+
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
47+
BUNDLE_IMG ?= $(REGISTRY)/mongodb-atlas-kubernetes-operator-prerelease-bundle:$(VERSION)
48+
49+
#IMG ?= mongodb-atlas-kubernetes-operator:latest
50+
#BUNDLE_REGISTRY ?= $(REGISTRY)/mongodb-atlas-operator-bundle
51+
OPERATOR_REGISTRY ?= $(REGISTRY)/mongodb-atlas-kubernetes-operator-prerelease
52+
CATALOG_REGISTRY ?= $(REGISTRY)/mongodb-atlas-kubernetes-operator-prerelease-catalog
53+
OPERATOR_IMAGE ?= ${OPERATOR_REGISTRY}:${VERSION}
54+
CATALOG_IMAGE ?= ${CATALOG_REGISTRY}:${VERSION}
6455
TARGET_NAMESPACE ?= mongodb-atlas-operator-system-test
6556

6657
# Image URL to use all building/pushing image targets
@@ -185,46 +176,39 @@ rm -rf $$TMP_DIR ;\
185176
endef
186177

187178
.PHONY: bundle
188-
bundle: manifests kustomize ## Generate bundle manifests and metadata, update security context for OpenShift, then validate generated files.
179+
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
189180
@echo "Building bundle $(VERSION)"
190181
operator-sdk generate kustomize manifests -q --apis-dir=pkg/api
191-
cd config/manager && $(KUSTOMIZE) edit set image controller=$(OPERATOR_IMG)
192-
$(KUSTOMIZE) build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite --manifests --version $(VERSION) $(BUNDLE_METADATA_OPTS)
182+
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
183+
$(KUSTOMIZE) build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
193184
operator-sdk bundle validate ./bundle
194185

195186
.PHONY: image
196-
image: manager ## Build the operator image
197-
$(CONTAINER_ENGINE) build -t $(OPERATOR_IMG) .
198-
$(CONTAINER_ENGINE) push $(OPERATOR_IMG)
187+
image: ## Build the operator image
188+
$(CONTAINER_ENGINE) build --build-arg VERSION=$(VERSION) -t $(OPERATOR_IMAGE) .
189+
$(CONTAINER_ENGINE) push $(OPERATOR_IMAGE)
199190

200191
.PHONY: bundle-build
201192
bundle-build: ## Build the bundle image.
202193
$(CONTAINER_ENGINE) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
203194

204195
.PHONY: bundle-push
205-
bundle-push: ## Push the bundle image.
196+
bundle-push:
206197
$(CONTAINER_ENGINE) push $(BUNDLE_IMG)
207198

208-
# A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0).
209-
# These images MUST exist in a registry and be pull-able.
210-
BUNDLE_IMGS ?= $(BUNDLE_IMG)
211-
212199
.PHONY: catalog-build
213200
CATALOG_DIR ?= ./scripts/openshift/atlas-catalog
214-
#catalog-build: IMG=
215-
catalog-build: ## bundle bundle-push ## Build file-based bundle
216-
$(MAKE) image IMG=$(IMG)
201+
catalog-build: image
217202
CATALOG_DIR=$(CATALOG_DIR) \
218203
CHANNEL=$(DEFAULT_CHANNEL) \
219-
CATALOG_IMAGE=$(CATALOG_IMG) \
204+
CATALOG_IMAGE=$(CATALOG_IMAGE) \
220205
BUNDLE_IMAGE=$(BUNDLE_IMG) \
221206
VERSION=$(VERSION) \
222-
CONTAINER_ENGINE=$(CONTAINER_ENGINE) \
223207
./scripts/build_catalog.sh
224208

225209
.PHONY: catalog-push
226210
catalog-push:
227-
$(CONTAINER_ENGINE) push $(CATALOG_IMG)
211+
$(CONTAINER_ENGINE) push $(CATALOG_IMAGE)
228212

229213
.PHONY: build-subscription
230214
build-subscription:
@@ -242,7 +226,6 @@ build-catalogsource:
242226

243227
.PHONY: deploy-olm
244228
# Deploy atlas operator to the running openshift cluster with OLM
245-
deploy-olm: export IMG=$(OPERATOR_IMAGE)
246229
deploy-olm: bundle-build bundle-push catalog-build catalog-push build-catalogsource build-subscription
247230
oc -n openshift-marketplace delete catalogsource mongodb-atlas-kubernetes-local --ignore-not-found
248231
oc delete namespace $(TARGET_NAMESPACE) --ignore-not-found
@@ -258,7 +241,7 @@ deploy-olm: bundle-build bundle-push catalog-build catalog-push build-catalogsou
258241

259242
.PHONY: image-push
260243
image-push: ## Push the docker image
261-
$(CONTAINER_ENGINE) push ${OPERATOR_IMG}
244+
$(CONTAINER_ENGINE) push ${IMG}
262245

263246
# Additional make goals
264247
.PHONY: run-kind

bundle.Dockerfile

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
FROM scratch
22

3-
LABEL com.redhat.openshift.versions="v4.8"
4-
LABEL com.redhat.delivery.backport=true
5-
LABEL com.redhat.delivery.operator.bundle=true
6-
73
# Core bundle labels.
84
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
95
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
106
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
117
LABEL operators.operatorframework.io.bundle.package.v1=mongodb-atlas-kubernetes
12-
LABEL operators.operatorframework.io.bundle.channels.v1=stable
13-
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
14-
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.15.0+git
8+
LABEL operators.operatorframework.io.bundle.channels.v1=beta
9+
LABEL operators.operatorframework.io.bundle.channel.default.v1=beta
10+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.19.0+git
1511
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
1612
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
1713

bundle/manifests/atlas.mongodb.com_atlasprojects.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ spec:
265265
Currently only AWS is supported.
266266
type: string
267267
required:
268-
- iamAssumedRoleArn
269268
- providerName
270269
type: object
271270
type: array

bundle/manifests/dbaas.redhat.com_mongodbatlasconnections.yaml

+11-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.4.1
5+
controller-gen.kubebuilder.io/version: v0.9.2
66
creationTimestamp: null
77
labels:
88
app.kubernetes.io/component: controller
@@ -67,13 +67,12 @@ spec:
6767
description: "Condition contains details for one aspect of the current
6868
state of this API Resource. --- This struct is intended for direct
6969
use as an array at the field path .status.conditions. For example,
70-
type FooStatus struct{ // Represents the observations of a
71-
foo's current state. // Known .status.conditions.type are:
72-
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
73-
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
74-
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
75-
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
76-
\n // other fields }"
70+
\n type FooStatus struct{ // Represents the observations of a
71+
foo's current state. // Known .status.conditions.type are: \"Available\",
72+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
73+
// +listType=map // +listMapKey=type Conditions []metav1.Condition
74+
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
75+
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
7776
properties:
7877
lastTransitionTime:
7978
description: lastTransitionTime is the last time the condition
@@ -140,6 +139,7 @@ spec:
140139
TODO: Add other useful fields. apiVersion, kind, uid?'
141140
type: string
142141
type: object
142+
x-kubernetes-map-type: atomic
143143
credentialsRef:
144144
description: Secret holding the credentials needed for accessing the
145145
DB instance
@@ -149,6 +149,7 @@ spec:
149149
TODO: Add other useful fields. apiVersion, kind, uid?'
150150
type: string
151151
type: object
152+
x-kubernetes-map-type: atomic
152153
type: object
153154
type: object
154155
served: true
@@ -159,5 +160,5 @@ status:
159160
acceptedNames:
160161
kind: ""
161162
plural: ""
162-
conditions: []
163-
storedVersions: []
163+
conditions: null
164+
storedVersions: null

bundle/manifests/dbaas.redhat.com_mongodbatlasinstances.yaml

+9-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.4.1
5+
controller-gen.kubebuilder.io/version: v0.9.2
66
creationTimestamp: null
77
labels:
88
app.kubernetes.io/component: controller
@@ -79,13 +79,12 @@ spec:
7979
description: "Condition contains details for one aspect of the current
8080
state of this API Resource. --- This struct is intended for direct
8181
use as an array at the field path .status.conditions. For example,
82-
type FooStatus struct{ // Represents the observations of a
83-
foo's current state. // Known .status.conditions.type are:
84-
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
85-
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
86-
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
87-
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
88-
\n // other fields }"
82+
\n type FooStatus struct{ // Represents the observations of a
83+
foo's current state. // Known .status.conditions.type are: \"Available\",
84+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
85+
// +listType=map // +listMapKey=type Conditions []metav1.Condition
86+
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
87+
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
8988
properties:
9089
lastTransitionTime:
9190
description: lastTransitionTime is the last time the condition
@@ -184,5 +183,5 @@ status:
184183
acceptedNames:
185184
kind: ""
186185
plural: ""
187-
conditions: []
188-
storedVersions: []
186+
conditions: null
187+
storedVersions: null

bundle/manifests/dbaas.redhat.com_mongodbatlasinventories.yaml

+9-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.4.1
5+
controller-gen.kubebuilder.io/version: v0.9.2
66
creationTimestamp: null
77
labels:
88
app.kubernetes.io/component: controller
@@ -65,13 +65,12 @@ spec:
6565
description: "Condition contains details for one aspect of the current
6666
state of this API Resource. --- This struct is intended for direct
6767
use as an array at the field path .status.conditions. For example,
68-
type FooStatus struct{ // Represents the observations of a
69-
foo's current state. // Known .status.conditions.type are:
70-
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
71-
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
72-
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
73-
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
74-
\n // other fields }"
68+
\n type FooStatus struct{ // Represents the observations of a
69+
foo's current state. // Known .status.conditions.type are: \"Available\",
70+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
71+
// +listType=map // +listMapKey=type Conditions []metav1.Condition
72+
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
73+
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
7574
properties:
7675
lastTransitionTime:
7776
description: lastTransitionTime is the last time the condition
@@ -163,5 +162,5 @@ status:
163162
acceptedNames:
164163
kind: ""
165164
plural: ""
166-
conditions: []
167-
storedVersions: []
165+
conditions: null
166+
storedVersions: null

0 commit comments

Comments
 (0)