diff --git a/deploy_apps/tks-lma-federation-wftpl.yaml b/deploy_apps/tks-lma-federation-wftpl.yaml index 52fcbb64..8822719c 100644 --- a/deploy_apps/tks-lma-federation-wftpl.yaml +++ b/deploy_apps/tks-lma-federation-wftpl.yaml @@ -35,6 +35,15 @@ spec: templates: - name: deployLMA steps: + - - name: createNamespace + template: create-namespace + arguments: + parameters: + - name: target_namespace + value: lma + - name: kubeconfig_secret_name + value: "{{workflow.parameters.site_name}}-kubeconfig" + - - name: installApps templateRef: name: lma-federation @@ -106,6 +115,49 @@ spec: value: "{{steps.collectThanosScEndpoints.outputs.parameters.inwards_endpoint_map}}" ## {"querier.stores": ['endpointA', 'endpointB']} + - name: create-namespace + arguments: {} + inputs: + parameters: + - name: target_namespace + - name: kubeconfig_secret_name + outputs: {} + metadata: {} + container: + name: create-namespace + image: 'k8s.gcr.io/hyperkube:v1.18.6' + command: + - /bin/bash + - '-c' + - | + function log() { + level=$1 + msg=$2 + date=$(date '+%F %H:%M:%S') + echo "[$date] $level $msg" + } + + cat <<< "$KUBE_CONFIG" > /etc/kubeconfig + kubectl --kubeconfig=/etc/kubeconfig get ns ${TARGET_NAMESPACE} + if [[ $? =~ 1 ]]; then + kubectl --kubeconfig=/etc/kubeconfig create ns ${TARGET_NAMESPACE} + kubectl --kubeconfig=/etc/kubeconfig label ns ${TARGET_NAMESPACE} name=${TARGET_NAMESPACE} + kubectl --kubeconfig=/etc/kubeconfig label ns ${TARGET_NAMESPACE} taco-tls=enabled + log "INFO" "${TARGET_NAMESPACE} successfully created." + fi + env: + - name: TARGET_NAMESPACE + value: '{{inputs.parameters.target_namespace}}' + - name: KUBE_CONFIG + valueFrom: + secretKeyRef: + name: "{{ inputs.parameters.kubeconfig_secret_name }}" + key: value + resource: {} + activeDeadlineSeconds: 900 + retryStrategy: + limit: 2 + - name: collectThanosScEndpoints inputs: parameters: