Skip to content

Commit

Permalink
update clusterimportpolicy
Browse files Browse the repository at this point in the history
Signed-off-by: Yash Khare <yash2010118@akgec.ac.in>
  • Loading branch information
khareyash05 committed Nov 16, 2023
1 parent d00694c commit 8120e44
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions kustomize/clusterimportpolicy/argocd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,28 @@ metadata:
spec:
source:
group: ""
resource: clusters
selectorTemplate: ""
references:
- group: ""
resource: secrets
namespaceTemplate: "{{ .source.spec.authSecretRef.namespace }}"
nameTemplate: "{{ .source.spec.authSecretRef.name }}"
key: authSecret
nameTemplate: "argocd-{{ .source.metadata.name }}"
resource: secrets
selectorTemplate: |
{{ if hasPrefix "argo-" .source.metadata.name }}
{{ $ca := (get .source.data "certificate-authority") }}
{{ $clientca := (get .source.data "client-certificate") }}
{{ $clientkey := (get .source.data "client-key") }}
{{/* Use a specific data format tofilter out the argocd's secret */}}
{{ if and $ca $clientca $clientkey (hasKey .source.data "config") }}
{{ $kubeconfig := (b64dec .source.data.config) }}
{{ and
(contains $ca $kubeconfig)
(contains $clientca $kubeconfig)
(contains $clientkey $kubeconfig)
}}
{{ end }}
{{ end }}
nameTemplate: 'argo-{{ .source.metadata.namespace }}-{{ trimPrefix "argo-" .source.metadata.name }}'
template: |
spec:
apiserver: "{{ .source.spec.apiEndpoint }}"
caData: "{{ .references.authSecret.data.ca }}"
tokenData: "{{ .references.authSecret.data.token }}"
apiserver: 'https://{{ trimPrefix "argo-" .source.metadata.name }}.{{ .source.metadata.namespace }}.svc'
kubeconfig: '{{ .source.data.config }}'
syncResources:
- group: ""
resources:
Expand All @@ -29,13 +37,6 @@ spec:
- "namespaces"
- group: "apps"
resources:
- "*"
- "*"
syncResourcesRefName: ""
creationCondition: |
{{ if ne .source.spec.apiEndpoint "" }}
{{ range .source.status.conditions }}
{{ if eq .type "Ready" }}
{{ if eq .status "True" }} true {{ end }}
{{ end }}
{{ end }}
{{ end }}
creationCondition: "true"

0 comments on commit 8120e44

Please sign in to comment.