Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LMA namespace before deploy lma apps #14

Merged
merged 1 commit into from
Oct 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions deploy_apps/tks-lma-federation-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down