Skip to content

Commit ff1ee9d

Browse files
authored
CLOUDP-349340: transient build for generated manifests (#2764)
1 parent 5ba63c8 commit ff1ee9d

File tree

116 files changed

+89
-49882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+89
-49882
lines changed

.github/actions/gen-install-scripts/entrypoint.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ mkdir -p "${openshift}"
3333

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

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

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

.github/workflows/test-e2e.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,17 @@ jobs:
122122
- uses: actions/checkout@v5
123123
with:
124124
ref: ${{ github.event.pull_request.head.sha || github.sha }}
125+
fetch-depth: '0'
125126

126127
- name: Install devbox
127128
uses: jetify-com/[email protected]
128129
with:
129130
enable-cache: 'true'
130131

131132
- name: Generate kustomized all-in-one install configs
132-
uses: ./.github/actions/gen-install-scripts
133-
with:
134-
ENV: dev
135-
VERSION: dev
133+
run: |
134+
devbox run -- make bundle
135+
136136
137137
- name: Extract k8s version/platform
138138
id: extract
@@ -154,7 +154,7 @@ jobs:
154154
run: devbox run -- kubectl version
155155

156156
- name: Apply CRDs
157-
run: devbox run -- kubectl apply -f deploy/crds
157+
run: devbox run -- make install-crds
158158

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

195196
- name: Install devbox
196197
uses: jetify-com/[email protected]
197198
with:
198199
enable-cache: 'true'
199200

200-
- name: Generate kustomized all-in-one install configs with helm-based image
201-
uses: ./.github/actions/gen-install-scripts
202-
with:
203-
ENV: dev
204-
VERSION: dev
201+
- name: Generate kustomized all-in-one install configs
202+
env:
205203
IMAGE_URL: ${{ needs.prepare-e2e-image.outputs.image_url }}
204+
run: |
205+
devbox run -- make bundle
206206
207207
- name: Extract k8s version/platform
208208
id: extract

.github/workflows/tests-e2e2.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ jobs:
167167
- name: Install CRDs if needed
168168
run: |
169169
devbox run -- 'make install-crds'
170+
devbox run -- 'make bundle'
170171
171172
- name: Run E2E2 test
172173
env:

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,12 @@ tools/githubjobs/githubjobs
5151
# ignore the ako.siging key local copy
5252
ako.pem
5353

54+
config/crd/bases/*.yaml
55+
config/rbac/clusterwide/role.yaml
56+
config/rbac/namespaced/role.yaml
57+
deploy/
58+
bundle/
59+
bundle.Dockerfile
60+
config/manifests/bases/mongodb-atlas-kubernetes.clusterserviceversion.yaml
61+
config/manifests/kustomization.yaml
62+
config/manager/kustomization.yaml

Makefile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ unit-test: manifests
191191
go test -race -cover $(GO_UNIT_TEST_FOLDERS) $(GO_TEST_FLAGS)
192192

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

197-
test/int/clusterwide: envtest
197+
test/int/clusterwide: envtest manifests
198198
AKO_INT_TEST=1 KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) $(GINKGO)
199199

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

307309
.PHONE: sync-crds-chart
308-
sync-crds-chart:
310+
sync-crds-chart: bundle
309311
@cp -r bundle/manifests/atlas.mongodb.com_* helm-charts/atlas-operator-crds/templates/
310312

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

324326
.PHONY: bundle
325327
bundle: manifests ## Generate bundle manifests and metadata, then validate generated files.
326-
@echo "Building bundle $(VERSION)"
327-
operator-sdk generate $(KUSTOMIZE) manifests -q --apis-dir=api
328-
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
329-
$(KUSTOMIZE) build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
330-
operator-sdk bundle validate ./bundle
328+
INPUT_VERSION=$(VERSION) INPUT_ENV=prod INPUT_IMAGE_URL=$(IMG) sh ./.github/actions/gen-install-scripts/entrypoint.sh
331329

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

431429
clean: ## Clean built binaries
432430
rm -rf bin/*
431+
rm -rf config/manifests/bases/
432+
rm -f config/crd/bases/*.yaml
433+
rm -f config/rbac/clusterwide/role.yaml
434+
rm -f config/rbac/namespaced/role.yaml
435+
rm -f config/rbac/role.yaml
436+
rm -rf deploy/
437+
rm -rf bundle/
438+
rm -f bundle.Dockerfile
439+
rm -rf test/e2e/data/
433440

434441
.PHONY: all-platforms
435442
all-platforms:
@@ -548,7 +555,7 @@ clear-e2e-leftovers: ## Clear the e2e test leftovers quickly
548555
git submodule update helm-charts
549556

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

669676
.PHONY: api-docs
670-
api-docs:
677+
api-docs: manifests
671678
go tool -modfile=tools/toolbox/go.mod crdoc --resources config/crd/bases --output docs/api-docs.md
672679

673680
.PHONY: validate-api-docs

bundle.Dockerfile

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)