Generate longhorn.yaml based on chart
longhorn #3716 Signed-off-by: David Ko <dko@suse.com>
This commit is contained in:
parent
1b8111495a
commit
2fcba12f67
4285
deploy/longhorn.yaml
4285
deploy/longhorn.yaml
File diff suppressed because it is too large
Load Diff
30
scripts/generate-longhorm-yaml.sh
Executable file
30
scripts/generate-longhorm-yaml.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o xtrace
|
||||
|
||||
PRJ_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/.." 2>/dev/null || realpath "$(dirname "${BASH_SOURCE[0]}")/.." 2>/dev/null)
|
||||
CHART_DIR="$PRJ_DIR/chart"
|
||||
DEPLOY_YAML="$PRJ_DIR/deploy/longhorn.yaml"
|
||||
DEPLOY_YAML_TMP="$PRJ_DIR/deploy/longhorn.yaml.tmp"
|
||||
NAMESPACE=${NAMESPACE:-longhorn-system}
|
||||
|
||||
if ! command -v helm &> /dev/null || ! helm version --short | grep -q "v3"; then
|
||||
echo "Please install helm v3 first before generating $DEPLOY_YAML!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat <<EOD > "$DEPLOY_YAML"
|
||||
---
|
||||
# Builtin: "helm template" does not respect --create-namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: $NAMESPACE
|
||||
EOD
|
||||
|
||||
helm template longhorn "$CHART_DIR" --namespace "$NAMESPACE" --create-namespace --no-hooks >>"$DEPLOY_YAML"
|
||||
< "$DEPLOY_YAML" grep -v 'helm.sh\|app.kubernetes.io/managed-by: Helm' | grep -v "helm.sh/chart:" > "$DEPLOY_YAML_TMP"
|
||||
mv "$DEPLOY_YAML_TMP" "$DEPLOY_YAML"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user