Skip to content

Commit

Permalink
rebase changes
Browse files Browse the repository at this point in the history
Signed-off-by: Tommy Hughes <tohughes@redhat.com>
  • Loading branch information
tchughesiv committed Mar 20, 2023
1 parent c189a61 commit 3903485
Show file tree
Hide file tree
Showing 26 changed files with 651 additions and 2,109 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ tmp/

# ready to work samples
deploy/
__debug_bin/
61 changes: 22 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ CONTAINER_ENGINE?=docker
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.3.0

ifndef PRODUCT_VERSION
PRODUCT_VERSION := $(shell git describe --tags --dirty --broken)
endif

CONTAINER_ENGINE?=docker
VERSION ?= $(shell git describe --tags --dirty --broken | cut -c 2-)

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

# Base registry for the operator, bundle, catalog images
REGISTRY ?= quay.io/mongodb
# Image URL to use all building/pushing image targets
IMG ?= $(REGISTRY)/mongodb-atlas-kubernetes-dbaas
OPERATOR_REGISTRY ?= $(IMG)

OPERATOR_IMG ?= $(IMG):$(VERSION)
# OPERATOR_IMG ?= $(IMG):latest

BUNDLE_IMG ?= $(IMG)-bundle:$(VERSION)
# BUNDLE_IMG ?= $(IMG)-bundle:latest

CATALOG_IMG ?= $(IMG)-catalog:$(VERSION)
# CATALOG_IMG ?= ${IMG}-catalog:latest

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(REGISTRY)/mongodb-atlas-kubernetes-operator-prerelease-bundle:$(VERSION)

#IMG ?= mongodb-atlas-kubernetes-operator:latest
#BUNDLE_REGISTRY ?= $(REGISTRY)/mongodb-atlas-operator-bundle
OPERATOR_REGISTRY ?= $(REGISTRY)/mongodb-atlas-kubernetes-operator-prerelease
CATALOG_REGISTRY ?= $(REGISTRY)/mongodb-atlas-kubernetes-operator-prerelease-catalog
OPERATOR_IMAGE ?= ${OPERATOR_REGISTRY}:${VERSION}
CATALOG_IMAGE ?= ${CATALOG_REGISTRY}:${VERSION}
TARGET_NAMESPACE ?= mongodb-atlas-operator-system-test

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

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

.PHONY: image
image: manager ## Build the operator image
$(CONTAINER_ENGINE) build -t $(OPERATOR_IMG) .
$(CONTAINER_ENGINE) push $(OPERATOR_IMG)
image: ## Build the operator image
$(CONTAINER_ENGINE) build --build-arg VERSION=$(VERSION) -t $(OPERATOR_IMAGE) .
$(CONTAINER_ENGINE) push $(OPERATOR_IMAGE)

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

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
bundle-push:
$(CONTAINER_ENGINE) push $(BUNDLE_IMG)

# 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).
# These images MUST exist in a registry and be pull-able.
BUNDLE_IMGS ?= $(BUNDLE_IMG)

.PHONY: catalog-build
CATALOG_DIR ?= ./scripts/openshift/atlas-catalog
#catalog-build: IMG=
catalog-build: ## bundle bundle-push ## Build file-based bundle
$(MAKE) image IMG=$(IMG)
catalog-build: image
CATALOG_DIR=$(CATALOG_DIR) \
CHANNEL=$(DEFAULT_CHANNEL) \
CATALOG_IMAGE=$(CATALOG_IMG) \
CATALOG_IMAGE=$(CATALOG_IMAGE) \
BUNDLE_IMAGE=$(BUNDLE_IMG) \
VERSION=$(VERSION) \
CONTAINER_ENGINE=$(CONTAINER_ENGINE) \
./scripts/build_catalog.sh

.PHONY: catalog-push
catalog-push:
$(CONTAINER_ENGINE) push $(CATALOG_IMG)
$(CONTAINER_ENGINE) push $(CATALOG_IMAGE)

.PHONY: build-subscription
build-subscription:
Expand All @@ -242,7 +226,6 @@ build-catalogsource:

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

.PHONY: image-push
image-push: ## Push the docker image
$(CONTAINER_ENGINE) push ${OPERATOR_IMG}
$(CONTAINER_ENGINE) push ${IMG}

# Additional make goals
.PHONY: run-kind
Expand Down
10 changes: 3 additions & 7 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
FROM scratch

LABEL com.redhat.openshift.versions="v4.8"
LABEL com.redhat.delivery.backport=true
LABEL com.redhat.delivery.operator.bundle=true

# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=mongodb-atlas-kubernetes
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.15.0+git
LABEL operators.operatorframework.io.bundle.channels.v1=beta
LABEL operators.operatorframework.io.bundle.channel.default.v1=beta
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.19.0+git
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
1 change: 0 additions & 1 deletion bundle/manifests/atlas.mongodb.com_atlasprojects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ spec:
Currently only AWS is supported.
type: string
required:
- iamAssumedRoleArn
- providerName
type: object
type: array
Expand Down
21 changes: 11 additions & 10 deletions bundle/manifests/dbaas.redhat.com_mongodbatlasconnections.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
labels:
app.kubernetes.io/component: controller
Expand Down Expand Up @@ -67,13 +67,12 @@ spec:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
Expand Down Expand Up @@ -140,6 +139,7 @@ spec:
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
x-kubernetes-map-type: atomic
credentialsRef:
description: Secret holding the credentials needed for accessing the
DB instance
Expand All @@ -149,6 +149,7 @@ spec:
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
x-kubernetes-map-type: atomic
type: object
type: object
served: true
Expand All @@ -159,5 +160,5 @@ status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
conditions: null
storedVersions: null
19 changes: 9 additions & 10 deletions bundle/manifests/dbaas.redhat.com_mongodbatlasinstances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
labels:
app.kubernetes.io/component: controller
Expand Down Expand Up @@ -79,13 +79,12 @@ spec:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
Expand Down Expand Up @@ -184,5 +183,5 @@ status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
conditions: null
storedVersions: null
19 changes: 9 additions & 10 deletions bundle/manifests/dbaas.redhat.com_mongodbatlasinventories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
labels:
app.kubernetes.io/component: controller
Expand Down Expand Up @@ -65,13 +65,12 @@ spec:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
Expand Down Expand Up @@ -163,5 +162,5 @@ status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
conditions: null
storedVersions: null
Loading

0 comments on commit 3903485

Please sign in to comment.