diff --git a/argocd/infra/app-of-apps/app.yaml b/argocd/infra/app-of-apps/app.yaml new file mode 100644 index 00000000..5a25ad76 --- /dev/null +++ b/argocd/infra/app-of-apps/app.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: app-of-apps-fase-infra + namespace: argocd +spec: + project: infrastructure-project + source: + path: argocd/infra + repoURL: https://github.com/isisbusapps/gitops + targetRevision: main + directory: + recurse: true + destination: + namespace: argocd + server: https://kubernetes.default.svc + syncPolicy: + automated: {} \ No newline at end of file diff --git a/argocd/infra/shared/vault-operator-configs/app.yml b/argocd/infra/shared/vault-operator-configs/app.yml new file mode 100644 index 00000000..c5e14271 --- /dev/null +++ b/argocd/infra/shared/vault-operator-configs/app.yml @@ -0,0 +1,34 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: infra-vault-operator-config + namespace: argocd +spec: + goTemplate: true + goTemplateOptions: ["missingkey=error"] + generators: + - list: + elements: + # Names of clusters to deploy the app to + - name: infra + path: infra + template: + metadata: + name: '{{.name}}-vault-operator-config' + annotations: + argocd.argoproj.io/sync-wave: "-1" + spec: + project: infrastructure-project + source: + path: components/infra/vault-operator-config-infra/{{.path}} + repoURL: 'https://github.com/isisbusapps/gitops' + targetRevision: main + destination: + namespace: lgtm + name: '{{.name}}' + syncPolicy: + automated: + selfHeal: true + syncOptions: + - CreateNamespace=true + - ServerSideApply=true \ No newline at end of file diff --git a/argocd/infra/shared/vault-operator/app.yml b/argocd/infra/shared/vault-operator/app.yml new file mode 100644 index 00000000..b9fa80bf --- /dev/null +++ b/argocd/infra/shared/vault-operator/app.yml @@ -0,0 +1,35 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: infra-vault-operator + namespace: argocd +spec: + goTemplate: true + goTemplateOptions: ["missingkey=error"] + generators: + - list: + elements: + # Names of clusters to deploy the app to + - name: infra + template: + metadata: + name: '{{.name}}-vault-operator' + annotations: + argocd.argoproj.io/sync-wave: "-10" + spec: + project: infrastructure-project + source: + repoURL: https://helm.releases.hashicorp.com + targetRevision: 0.10.0 + chart: vault-secrets-operator + helm: + releaseName: vault-operator + destination: + namespace: vault-operator + name: '{{.name}}' + syncPolicy: + automated: + selfHeal: true + syncOptions: + - CreateNamespace=true + - ServerSideApply=true diff --git a/argocd/prod/ua/vault-operator-configs/app.yaml b/argocd/prod/ua/vault-operator-configs/app.yaml index 22c4a603..e8421091 100644 --- a/argocd/prod/ua/vault-operator-configs/app.yaml +++ b/argocd/prod/ua/vault-operator-configs/app.yaml @@ -1,7 +1,7 @@ apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: - name: vault-operator-config + name: prod-vault-operator-config namespace: argocd spec: goTemplate: true diff --git a/argocd/prod/ua/vault-operator/app.yaml b/argocd/prod/ua/vault-operator/app.yaml index 78992b1d..74912914 100644 --- a/argocd/prod/ua/vault-operator/app.yaml +++ b/argocd/prod/ua/vault-operator/app.yaml @@ -1,7 +1,7 @@ apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: - name: vault-operator + name: prod-vault-operator namespace: argocd spec: goTemplate: true diff --git a/components/infra/vault-operator-config-infra/infra/vault-auth-service-account.yaml b/components/infra/vault-operator-config-infra/infra/vault-auth-service-account.yaml new file mode 100644 index 00000000..b61e7594 --- /dev/null +++ b/components/infra/vault-operator-config-infra/infra/vault-auth-service-account.yaml @@ -0,0 +1,48 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + namespace: lgtm + name: vault-op +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: service-account-read + namespace: lgtm +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: service-account-read +subjects: + - kind: ServiceAccount + name: vault-op + namespace: lgtm +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: service-account-read-lgtm +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:auth-delegator +subjects: + - kind: ServiceAccount + name: vault-op + namespace: lgtm +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: service-account-read + namespace: lgtm +rules: + - apiGroups: [""] + resources: ["serviceaccounts"] + verbs: ["get", "watch", "list"] + - apiGroups: ["authentication.k8s.io"] + resources: ["tokenreviews"] + verbs: ["create"] + - apiGroups: [ "authentication.k8s.io" ] + resources: [ "subjectaccessreviews" ] + verbs: [ "create" ] \ No newline at end of file diff --git a/components/infra/vault-operator-config-infra/infra/vault-auth.yaml b/components/infra/vault-operator-config-infra/infra/vault-auth.yaml new file mode 100644 index 00000000..ebd11d59 --- /dev/null +++ b/components/infra/vault-operator-config-infra/infra/vault-auth.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: secrets.hashicorp.com/v1beta1 +kind: VaultAuth +metadata: + name: static-auth + namespace: lgtm +spec: + vaultConnectionRef: secrets-isis-connection + method: kubernetes + mount: fase-infra + allowedNamespaces: + - "*" + kubernetes: + role: cluster + serviceAccount: vault-op + audiences: + - vault + - https://kubernetes.default.svc.cluster.local \ No newline at end of file diff --git a/components/infra/vault-operator-config-infra/infra/vault-connection.yaml b/components/infra/vault-operator-config-infra/infra/vault-connection.yaml new file mode 100644 index 00000000..690071b8 --- /dev/null +++ b/components/infra/vault-operator-config-infra/infra/vault-connection.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: secrets.hashicorp.com/v1beta1 +kind: VaultConnection +metadata: + namespace: lgtm + name: secrets-isis-connection +spec: + address: "https://secrets.isis.rl.ac.uk" \ No newline at end of file