-
Notifications
You must be signed in to change notification settings - Fork 7
Add Vault Helm charts for otcinfra2 production deployment #1547
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
Open
LukasCuperDT
wants to merge
2
commits into
main
Choose a base branch
from
Vault_migration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,3 +20,4 @@ test_inventory | |
| doc/source/_svg | ||
| data/backups | ||
| .vscode/ | ||
| .pre-commit-config.yaml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: v2 | ||
| name: vault-additional-manifests | ||
| description: A custom Helm chart with additional Vault manifests (NetworkPolicy, etc.) | ||
| type: application | ||
| version: 1.0.0 | ||
| appVersion: "1.0.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "vault-additional.name" -}} | ||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create chart name and version as used by the chart label. | ||
| */}} | ||
| {{- define "vault-additional.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "vault-additional.labels" -}} | ||
| helm.sh/chart: {{ include "vault-additional.chart" . }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} |
89 changes: 89 additions & 0 deletions
89
kubernetes/helm_charts/local/vault/templates/networkpolicy.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| {{- if .Values.networkPolicy.enabled }} | ||
| apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: vault-network-policy | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "vault-additional.labels" . | nindent 4 }} | ||
| spec: | ||
| podSelector: | ||
| {{- with .Values.networkPolicy.podSelector }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| policyTypes: | ||
| - Ingress | ||
| - Egress | ||
| ingress: | ||
| # Allow Vault-to-Vault communication (raft/cluster) | ||
| - from: | ||
| - podSelector: | ||
| {{- with .Values.networkPolicy.podSelector }} | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| ports: | ||
| - port: {{ .Values.networkPolicy.vaultPort }} | ||
| protocol: TCP | ||
| - port: {{ .Values.networkPolicy.clusterPort }} | ||
| protocol: TCP | ||
| # Allow from explicitly listed namespaces (with optional pod selector) | ||
| {{- range .Values.networkPolicy.allowedConsumers }} | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: {{ .namespace }} | ||
| {{- if .podSelector }} | ||
| podSelector: | ||
| matchLabels: | ||
| {{- toYaml .podSelector | nindent 14 }} | ||
| {{- end }} | ||
| ports: | ||
| - port: {{ $.Values.networkPolicy.vaultPort }} | ||
| protocol: TCP | ||
| {{- end }} | ||
| {{- if .Values.networkPolicy.allowIngress.enabled }} | ||
| # Allow ingress controller (for remote cluster vault-agent access via LB) | ||
| - from: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: {{ .Values.networkPolicy.allowIngress.namespace }} | ||
| podSelector: | ||
| matchLabels: | ||
| {{- toYaml .Values.networkPolicy.allowIngress.podSelector | nindent 14 }} | ||
| ports: | ||
| - port: {{ .Values.networkPolicy.vaultPort }} | ||
| protocol: TCP | ||
| {{- end }} | ||
| egress: | ||
| # Vault to Vault (raft replication) | ||
| - to: | ||
| - podSelector: | ||
| {{- with .Values.networkPolicy.podSelector }} | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| ports: | ||
| - port: {{ .Values.networkPolicy.vaultPort }} | ||
| protocol: TCP | ||
| - port: {{ .Values.networkPolicy.clusterPort }} | ||
| protocol: TCP | ||
| # DNS resolution | ||
| - to: | ||
| - namespaceSelector: {} | ||
| podSelector: | ||
| matchLabels: | ||
| k8s-app: coredns | ||
| ports: | ||
| - port: 53 | ||
| protocol: UDP | ||
| - port: 53 | ||
| protocol: TCP | ||
| # Allow egress to Kubernetes API (for K8s auth) | ||
| - to: | ||
| - ipBlock: | ||
| cidr: 0.0.0.0/0 | ||
| ports: | ||
| - port: 443 | ||
| protocol: TCP | ||
| - port: 6443 | ||
| protocol: TCP | ||
| {{- end }} |
31 changes: 31 additions & 0 deletions
31
kubernetes/helm_charts/local/vault/templates/unsealer-rbac.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| {{- if .Values.unsealer.enabled }} | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: {{ .Release.Name }}-unsealer-role | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "vault-additional.labels" . | nindent 4 }} | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: ["secrets"] | ||
| resourceNames: ["{{ .Values.unsealer.secretName }}"] | ||
| verbs: ["get"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: {{ .Release.Name }}-unsealer-rolebinding | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "vault-additional.labels" . | nindent 4 }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: {{ .Release.Name }}-unsealer-role | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ .Values.unsealer.serviceAccountName }} | ||
| namespace: {{ .Release.Namespace }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Vault additional manifests configuration for otcinfra2 (production) | ||
| # This chart provides supplementary resources not available in upstream Vault Helm chart | ||
| # | ||
| # NetworkPolicy: deny-all by default, only explicitly listed consumers can reach Vault. | ||
| # Remote clusters (otcinfra1, otcci) access Vault via ingress-nginx. | ||
|
|
||
| networkPolicy: | ||
| enabled: true | ||
|
|
||
| # Pod selector for Vault pods | ||
| podSelector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: vault | ||
|
|
||
| # Explicit list of namespaces/pods allowed to connect to Vault on port 8200. | ||
| # Each entry creates a separate ingress rule. All unlisted namespaces are denied. | ||
| allowedConsumers: | ||
| # ArgoCD repo-server — runs argocd-vault-plugin for secret injection | ||
| - namespace: argocd | ||
| podSelector: | ||
| app.kubernetes.io/name: argocd-repo-server | ||
|
|
||
| # Ingress controller — required for remote clusters to reach Vault via LB | ||
| # Remote consumers: | ||
| # otcinfra1: anubis, docsportal, swift-proxy, umami (auth/kubernetes_otcinfra1) | ||
| # otcci: zuul (auth/kubernetes_otcci) | ||
| allowIngress: | ||
| enabled: true | ||
| namespace: default | ||
| podSelector: | ||
| app.kubernetes.io/name: ingress-nginx | ||
|
|
||
| # Vault API port | ||
| vaultPort: 8200 | ||
|
|
||
| # Vault cluster port (for raft replication) | ||
| clusterPort: 8201 | ||
|
|
||
| # Auto-unseal configuration | ||
| # The unsealer sidecar watches for sealed state and auto-unseals using K8s secret | ||
| # | ||
| # Required secret format (vault-unseal-keys in vault namespace): | ||
| # Create the secret with unseal keys from 'vault operator init': | ||
| # | ||
| # kubectl -n vault create secret generic vault-unseal-keys \ | ||
| # --from-literal=vault-root=<root-token> \ | ||
| # --from-literal=vault-unseal-0=<key1> \ | ||
| # --from-literal=vault-unseal-1=<key2> \ | ||
| # --from-literal=vault-unseal-2=<key3> \ | ||
| # --from-literal=vault-unseal-3=<key4> \ | ||
| # --from-literal=vault-unseal-4=<key5> | ||
| # | ||
| # See: https://bank-vaults.dev/docs/unseal-keys/ | ||
|
|
||
| # Unsealer RBAC - grants access to the vault-unseal-keys secret | ||
| unsealer: | ||
| enabled: true | ||
| secretName: vault-unseal-keys | ||
| # The upstream vault chart creates ServiceAccount named after the release | ||
| serviceAccountName: vault |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| apiVersion: v2 | ||
| name: vault | ||
| description: HashiCorp Vault for OTC preprod environment | ||
| version: 0.1.0 | ||
| dependencies: | ||
| - name: vault | ||
| version: "0.30.0" | ||
| repository: "https://helm.releases.hashicorp.com" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prod?