Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/actions/gen-install-scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ mkdir -p "${openshift}"

# Generate configuration and save it to `all-in-one`
controller-gen crd:crdVersions=v1,ignoreUnexportedFields=true rbac:roleName=manager-role webhook paths="./api/..." paths="./internal/controller/..." output:crd:artifacts:config=config/crd/bases
cd config/manager && kustomize edit set image controller="${INPUT_IMAGE_URL}"
cd config/manager
touch kustomization.yaml
kustomize edit add resource bases/
kustomize edit set image controller="${INPUT_IMAGE_URL}"
cd -
./scripts/split_roles_yaml.sh

Expand Down Expand Up @@ -63,7 +66,7 @@ echo "Created namespaced config"
cp config/crd/bases/* "${crds_dir}"

# CSV bundle
operator-sdk generate kustomize manifests -q --apis-dir=api
operator-sdk generate kustomize manifests --input-dir=config/manifests-template --interactive=false -q --apis-dir=api
# get the current version so we could put it into the "replaces:"
current_version="$(yq e '.metadata.name' bundle/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml)"

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,17 @@ jobs:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: '0'

- name: Install devbox
uses: jetify-com/[email protected]
with:
enable-cache: 'true'

- name: Generate kustomized all-in-one install configs
uses: ./.github/actions/gen-install-scripts
with:
ENV: dev
VERSION: dev
run: |
devbox run -- make bundle


- name: Extract k8s version/platform
id: extract
Expand All @@ -154,7 +154,7 @@ jobs:
run: devbox run -- kubectl version

- name: Apply CRDs
run: devbox run -- kubectl apply -f deploy/crds
run: devbox run -- make install-crds

- name: Run CI E2E tests
run: devbox run -- ./scripts/launch-ci-e2e.sh
Expand Down Expand Up @@ -191,18 +191,18 @@ jobs:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: '0'

- name: Install devbox
uses: jetify-com/[email protected]
with:
enable-cache: 'true'

- name: Generate kustomized all-in-one install configs with helm-based image
uses: ./.github/actions/gen-install-scripts
with:
ENV: dev
VERSION: dev
- name: Generate kustomized all-in-one install configs
env:
IMAGE_URL: ${{ needs.prepare-e2e-image.outputs.image_url }}
run: |
devbox run -- make bundle

- name: Extract k8s version/platform
id: extract
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tests-e2e2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ jobs:
- name: Install CRDs if needed
run: |
devbox run -- 'make install-crds'
devbox run -- 'make bundle'

- name: Run E2E2 test
env:
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,12 @@ tools/githubjobs/githubjobs
# ignore the ako.siging key local copy
ako.pem

config/crd/bases/*.yaml
config/rbac/clusterwide/role.yaml
config/rbac/namespaced/role.yaml
deploy/
bundle/
bundle.Dockerfile
config/manifests/bases/mongodb-atlas-kubernetes.clusterserviceversion.yaml
config/manifests/kustomization.yaml
config/manager/kustomization.yaml
29 changes: 18 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ unit-test: manifests
go test -race -cover $(GO_UNIT_TEST_FOLDERS) $(GO_TEST_FLAGS)

## Run integration tests. Sample with labels: `make test/int GINKGO_FILTER_LABEL=AtlasProject`
test/int: envtest
test/int: envtest manifests
AKO_INT_TEST=1 KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) $(GINKGO)

test/int/clusterwide: envtest
test/int/clusterwide: envtest manifests
AKO_INT_TEST=1 KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) $(GINKGO)

envtest: envtest-assets
Expand Down Expand Up @@ -248,8 +248,10 @@ deploy: generate manifests run-kind ## Deploy controller in the configured Kuber
.PHONY: manifests
# Produce CRDs that work back to Kubernetes 1.16 (so 'apiVersion: apiextensions.k8s.io/v1')
manifests: CRD_OPTIONS ?= "crd:crdVersions=v1,ignoreUnexportedFields=true"
manifests: fmt ## Generate manifests e.g. CRD, RBAC etc.
manifests: ## Generate manifests e.g. CRD, RBAC etc.
controller-gen $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./api/..." paths="./internal/controller/..." output:crd:artifacts:config=config/crd/bases
touch config/crd/bases/kustomization.yaml
sh -c 'cd config/crd/bases; $(KUSTOMIZE) edit add resource *.yaml kustomization.yaml'
@./scripts/split_roles_yaml.sh
ifdef EXPERIMENTAL
@if [ -d internal/next-crds ] && find internal/next-crds -maxdepth 1 -name '*.yaml' | grep -q .; then \
Expand Down Expand Up @@ -305,7 +307,7 @@ validate-manifests: generate manifests
$(MAKE) check-missing-files

.PHONE: sync-crds-chart
sync-crds-chart:
sync-crds-chart: bundle
@cp -r bundle/manifests/atlas.mongodb.com_* helm-charts/atlas-operator-crds/templates/

.PHONY: validate-crds-chart
Expand All @@ -323,11 +325,7 @@ validate-crds-chart: ## Validate the CRDs in the Helm chart

.PHONY: bundle
bundle: manifests ## Generate bundle manifests and metadata, then validate generated files.
@echo "Building bundle $(VERSION)"
operator-sdk generate $(KUSTOMIZE) manifests -q --apis-dir=api
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
INPUT_VERSION=$(VERSION) INPUT_ENV=prod INPUT_IMAGE_URL=$(IMG) sh ./.github/actions/gen-install-scripts/entrypoint.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we always want INPUT_ENV to be prod? gen-install-scripts has a check if this is dev. If we always want this to be prod then why set it at all?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script requires that arg. I would leave it as is for now, otherwise you also need to fix that script, and this change is big enough already.


.PHONY: image
image: ## Build an operator image for local development
Expand Down Expand Up @@ -430,6 +428,15 @@ x509-cert: ## Create X.509 cert at path tmp/x509/ (see docs/x509-user.md)

clean: ## Clean built binaries
rm -rf bin/*
rm -rf config/manifests/bases/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit or follow up: make rule clear-e2e-leftovers can also be removed now

rm -f config/crd/bases/*.yaml
rm -f config/rbac/clusterwide/role.yaml
rm -f config/rbac/namespaced/role.yaml
rm -f config/rbac/role.yaml
rm -rf deploy/
rm -rf bundle/
rm -f bundle.Dockerfile
rm -rf test/e2e/data/

.PHONY: all-platforms
all-platforms:
Expand Down Expand Up @@ -548,7 +555,7 @@ clear-e2e-leftovers: ## Clear the e2e test leftovers quickly
git submodule update helm-charts

.PHONY: install-crds
install-crds: ## Install CRDs in Kubernetes
install-crds: manifests ## Install CRDs in Kubernetes
kubectl apply -k config/crd
ifdef EXPERIMENTAL
@if [ -d internal/next-crds ] && find internal/next-crds -maxdepth 1 -name '*.yaml' | grep -q .; then \
Expand Down Expand Up @@ -667,7 +674,7 @@ bump-version-file:
@cat $(VERSION_FILE)

.PHONY: api-docs
api-docs:
api-docs: manifests
go tool -modfile=tools/toolbox/go.mod crdoc --resources config/crd/bases --output docs/api-docs.md

.PHONY: validate-api-docs
Expand Down
25 changes: 0 additions & 25 deletions bundle.Dockerfile

This file was deleted.

Loading