mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-14 11:57:59 +00:00
1da44c7fb0
* fix: add kustomization file to crds folder This will allow for the CRDs to be installed into a Kubernetes cluster from a Kustomization, for example: ```yaml --- apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - github.com/external-secrets/external-secrets//config/crds/bases?ref=v0.5.6 ``` * fix: generate script * fix: helm.generate Co-authored-by: Moritz Johner <beller.moritz@googlemail.com>
33 lines
No EOL
1.1 KiB
Bash
Executable file
33 lines
No EOL
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
BUNDLE_DIR="${1}"
|
|
HELM_DIR="${2}"
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
SEDPRG="gsed"
|
|
else
|
|
SEDPRG="sed"
|
|
fi
|
|
|
|
cd "${SCRIPT_DIR}"/../
|
|
|
|
# Split the generated bundle yaml file to inject control flags
|
|
yq e -Ns "\"${HELM_DIR}/templates/crds/\" + .spec.names.singular" ${BUNDLE_DIR}/bundle.yaml
|
|
|
|
# Add helm if statement for controlling the install of CRDs
|
|
for i in "${HELM_DIR}"/templates/crds/*.yml; do
|
|
export CRDS_FLAG_NAME="create$(yq e '.spec.names.kind' $i)"
|
|
cp "$i" "$i.bkp"
|
|
if [[ "$CRDS_FLAG_NAME" == *"Cluster"* ]]; then
|
|
echo "{{- if and (.Values.installCRDs) (.Values.crds.$CRDS_FLAG_NAME) }}" > "$i"
|
|
else
|
|
echo "{{- if .Values.installCRDs }}" > "$i"
|
|
fi
|
|
cat "$i.bkp" >> "$i"
|
|
echo "{{- end }}" >> "$i"
|
|
rm "$i.bkp"
|
|
$SEDPRG -i 's/name: kubernetes/name: {{ include "external-secrets.fullname" . }}-webhook/g' "$i"
|
|
$SEDPRG -i 's/namespace: default/namespace: {{ .Release.Namespace | quote }}/g' "$i"
|
|
mv "$i" "${i%.yml}.yaml"
|
|
done |