Create an app
This commit is contained in:
		
							
								
								
									
										0
									
								
								hooks/cleanup-pipelineruns.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								hooks/cleanup-pipelineruns.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										33
									
								
								hooks/install-application.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								hooks/install-application.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
# ---------------------------------------------------------------------
 | 
			
		||||
# This script should bootstrap a new environment, or update 
 | 
			
		||||
# existing ones
 | 
			
		||||
# Get the configmap name and namespace to prepare the 
 | 
			
		||||
# ---------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
if [[ $1 == "--config" ]] ; then
 | 
			
		||||
  cat <<EOF
 | 
			
		||||
configVersion: v1
 | 
			
		||||
kubernetes:
 | 
			
		||||
- name: Watch application configmaps getting created
 | 
			
		||||
  apiVersion: v1
 | 
			
		||||
  kind: ConfigMap
 | 
			
		||||
  executeHookOnSynchronization: false
 | 
			
		||||
  executeHookOnEvent: ["Added", "Modified"]
 | 
			
		||||
  jqFilter: ".data"
 | 
			
		||||
  labelSelector:
 | 
			
		||||
    matchExpressions:
 | 
			
		||||
    - key: "component"
 | 
			
		||||
      operator: "In"
 | 
			
		||||
      values: ["install"]
 | 
			
		||||
EOF
 | 
			
		||||
else
 | 
			
		||||
  export $(jq -r .[0].object.data.vars $BINDING_CONTEXT_PATH)
 | 
			
		||||
  export SP_CUSTOMER_ID=$(jq -r .[0].object.metadata.namespace $BINDING_CONTEXT_PATH)
 | 
			
		||||
  export SP_ENVIRONMENT=$(jq -r .[0].object.metadata.name $BINDING_CONTEXT_PATH)
 | 
			
		||||
  export SP_APPLICATION=$(jq -r .[0].object.data.values $BINDING_CONTEXT_PATH | base64 -d | yq '.helm.release')
 | 
			
		||||
  envsubst < /tpls/flux-create.yaml | kubectl create -f -
 | 
			
		||||
  kubectl patch configmap -n ${SP_CUSTOMER_ID} ${SP_ENVIRONMENT} \
 | 
			
		||||
    -p '{"metadata":{"finalizers":["softplayer.net/bootstrapped"]}}' --type=merge 
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user