Skip to content

Commit b242296

Browse files
CLOUDP-112821: Added Openshift bundle to the release (#435)
* Fixed Openshift deployment build. OPERATOR_NAMESPACE will be updated during the Openshift release build
1 parent b0b7b48 commit b242296

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ target_dir="deploy"
66
clusterwide_dir="${target_dir}/clusterwide"
77
namespaced_dir="${target_dir}/namespaced"
88
crds_dir="${target_dir}/crds"
9-
openshift_namespaced="${target_dir}/openshift_namespaced"
9+
openshift="${target_dir}/openshift"
1010

1111
mkdir -p "${clusterwide_dir}"
1212
mkdir -p "${namespaced_dir}"
1313
mkdir -p "${crds_dir}"
14-
mkdir -p "${openshift_namespaced}"
14+
mkdir -p "${openshift}"
1515

1616
# Generate configuration and save it to `all-in-one`
1717
controller-gen crd:crdVersions=v1 rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
@@ -32,8 +32,8 @@ kustomize build "config/crd" > "${clusterwide_dir}/crds.yaml"
3232
echo "Created clusterwide config"
3333

3434
# base-openshift-namespace-scoped
35-
kustomize build --load-restrictor LoadRestrictionsNone "config/release/${INPUT_ENV}/namespaced" > "${openshift_namespaced}/clusterwide-config.yaml"
36-
kustomize build "config/crd" > "${openshift_namespaced}/crds.yaml"
35+
kustomize build --load-restrictor LoadRestrictionsNone "config/release/${INPUT_ENV}/openshift" > "${openshift}/openshift.yaml"
36+
kustomize build "config/crd" > "${openshift}/crds.yaml"
3737
echo "Created openshift namespaced config"
3838

3939
# namespaced
@@ -62,6 +62,8 @@ else
6262
# add replaces
6363
awk '!/replaces:/' bundle/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml > tmp && mv tmp bundle/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml
6464
echo " replaces: $current_version" >> bundle/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml
65+
# Add WATCH_NAMESPACE env parameter
66+
value="metadata.annotations['olm.targetNamespaces']" yq e -i '.spec.install.spec.deployments[0].spec.template.spec.containers[0].env[2] |= {"name": "WATCH_NAMESPACE", "valueFrom": {"fieldRef": {"fieldPath": env(value)}}}' bundle/manifests/mongodb-atlas-kubernetes.clusterserviceversion.yaml
6567
fi
6668

6769
# add additional LABELs to bundle.Docker file

config/release/base-openshift/namespaced/kustomization.yaml renamed to config/release/dev/openshift/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resources:
1313
- ../../../rbac/namespaced
1414

1515
patches:
16-
- path: manager_watched_namespace_patch.json
16+
- path: manager_watch_namespace_patch.json
1717
target:
1818
group: apps
1919
version: v1

config/release/base-openshift/namespaced/manager_watch_namespace_patch.json renamed to config/release/dev/openshift/manager_watch_namespace_patch.json

File renamed without changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace: mongodb-atlas-system
2+
3+
namePrefix: mongodb-atlas-
4+
5+
# Labels to add to all resources and selectors.
6+
commonLabels:
7+
app.kubernetes.io/component: controller
8+
app.kubernetes.io/name: mongodb-atlas-kubernetes-operator
9+
app.kubernetes.io/instance: mongodb-atlas-kubernetes-operator
10+
11+
resources:
12+
- ../../../manager
13+
- ../../../rbac/namespaced
14+
15+
patches:
16+
- path: ../manager_watch_namespace_patch.json
17+
target:
18+
group: apps
19+
version: v1
20+
kind: Deployment
21+
name: operator
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{"op": "add",
3+
"path": "/spec/template/spec/containers/0/env/0",
4+
"value": {
5+
"name": "WATCH_NAMESPACE",
6+
"valueFrom": {
7+
"fieldRef": {
8+
"fieldPath": "metadata.annotations['olm.targetNamespaces']"
9+
}
10+
}
11+
}
12+
}
13+
]

0 commit comments

Comments
 (0)