{{- if or .Values.addon .Values.bootstrap .Values.controlPlane .Values.infrastructure .Values.ipam }}
# Deploy core components if not specified
{{- if not .Values.core }}
---
apiVersion: v1
kind: Namespace
metadata:
  annotations:
    {{- if $.Values.enableHelmHook }}
    "helm.sh/hook": "post-install,post-upgrade"
    "helm.sh/hook-weight": "1"
    {{- end }}
    "argocd.argoproj.io/sync-wave": "1"
  name: capi-system
---
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: CoreProvider
metadata:
  name: cluster-api
  namespace: capi-system
  annotations:
    {{- if $.Values.enableHelmHook }}
    "helm.sh/hook": "post-install,post-upgrade"
    "helm.sh/hook-weight": "2"
    {{- end }}
    "argocd.argoproj.io/sync-wave": "2"
{{- with .Values.configSecret }}
spec:
  configSecret:
    name: {{ .name }}
    {{- if .namespace }}
    namespace: {{ .namespace }}
    {{- end }}
{{- end }}
{{- end }}
{{- end }}
