@@ -11,7 +11,6 @@ YQ="go run ./vendor/github.com/mikefarah/yq/v3/"
11
11
CONTROLLER_GEN=" go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen"
12
12
HELM=" go run helm.sh/helm/v3/cmd/helm"
13
13
14
-
15
14
ver=${OLM_VERSION:- " 0.0.0-dev" }
16
15
tmpdir=" $( mktemp -p . -d 2> /dev/null || mktemp -d ./tmpdir.XXXXXXX) "
17
16
chartdir=" ${tmpdir} /chart"
@@ -496,3 +495,49 @@ find "${ROOT_DIR}/manifests" -type f -exec $SED -i "1{/---/d}" {} \;
496
495
# namespaces enforce restricted PSA policies, so warnings and audits labels are not neccessary.
497
496
${YQ} delete --inplace -d' *' manifests/0000_50_olm_00-namespace.yaml ' metadata.labels."pod-security.kubernetes.io/warn*"'
498
497
${YQ} delete --inplace -d' *' manifests/0000_50_olm_00-namespace.yaml ' metadata.labels."pod-security.kubernetes.io/audit*"'
498
+
499
+ # Let's copy all the manifests to a separate directory for microshift
500
+ mkdir -p " ${ROOT_DIR} /microshift-manifests/"
501
+ rm -rf " ${ROOT_DIR} /microshift-manifests/" *
502
+ cp " ${ROOT_DIR} " /manifests/* " ${ROOT_DIR} /microshift-manifests/"
503
+
504
+ # Let's generate the microshift-manifests.
505
+ # There are some differences that we need to take care of:
506
+ # - The manifests require a kustomization.yaml file
507
+ # - We don't need the specific ibm-cloud-managed manifests
508
+ # - We need to adapt some of the manifests to be compatible with microshift as there's no
509
+ # ClusterVersion or ClusterOperator in microshift
510
+
511
+ # Create the kustomization file
512
+ cat << EOF > "${ROOT_DIR} /microshift-manifests/kustomization.yaml"
513
+ apiVersion: kustomize.config.k8s.io/v1beta1
514
+ kind: Kustomization
515
+ resources:
516
+ EOF
517
+
518
+ # Now let's generate the kustomization.yaml file for microshift to pick up the manifests.
519
+ microshift_manifests_files=$( find " ${ROOT_DIR} /microshift-manifests" -type f -name " *.yaml" )
520
+ # Let's sort the files so that we can have a deterministic order
521
+ microshift_manifests_files=$( echo " ${microshift_manifests_files} " | sort)
522
+ # files to ignore, substring match.
523
+ files_to_ignore=(" ibm-cloud-managed.yaml" " kustomization.yaml" " psm-operator" )
524
+
525
+ # Add all the manifests files to the kustomization file while ignoring the files in the files_to_ignore list
526
+ for file in ${microshift_manifests_files} ; do
527
+ for file_to_ignore in ${files_to_ignore[@]} ; do
528
+ if [[ " ${file} " =~ " ${file_to_ignore} " ]]; then
529
+ continue 2
530
+ fi
531
+ done
532
+ echo " - $( realpath --relative-to " ${ROOT_DIR} /microshift-manifests" " ${file} " ) " >> " ${ROOT_DIR} /microshift-manifests/kustomization.yaml"
533
+ done
534
+
535
+ # Now we need to get rid of these args from the olm-operator deployment:
536
+ #
537
+ # - --writeStatusName
538
+ # - operator-lifecycle-manager
539
+ # - --writePackageServerStatusName
540
+ # - operator-lifecycle-manager-packageserver
541
+ #
542
+ ${SED} -i ' /- --writeStatusName/,+3d' ${ROOT_DIR} /microshift-manifests/0000_50_olm_07-olm-operator.deployment.yaml
543
+
0 commit comments