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

DATAGO-59401: Upgrading vault to 1.11.x #934

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a63dd55
Explain this fork in the README
j-setiawan Apr 2, 2020
ef468b6
Adding support for LoadBalancerIP field in ServiceSpec
Apr 10, 2020
90755ae
DATAGO-13861: Adding support for logrotate
hadielaham88 May 19, 2021
e62f072
DATAGO-13861: Adding audit log rotation and shipment to datdog
hadielaham88 May 26, 2021
09cdf52
Fixing minor typos and removing extra lines
hadielaham88 May 26, 2021
8efa410
Explain this fork in the README
j-setiawan Apr 2, 2020
b27ba0a
Adding support for LoadBalancerIP field in ServiceSpec
Apr 10, 2020
782a9ae
DATAGO-13861: Adding support for logrotate
hadielaham88 May 19, 2021
fd5c062
DATAGO-13861: Adding audit log rotation and shipment to datdog
hadielaham88 May 26, 2021
70eaeef
Fixing minor typos and removing extra lines
hadielaham88 May 26, 2021
e19dda3
feat(DATAGO-27002): Upgrade vault to version 1.7.9 (#12)
nagsubhrajitt Jun 1, 2022
a310025
fix: deploy_local.sh error with file
adhish2001 Jul 14, 2022
ac36a5c
minor changes
adhish2001 Jul 14, 2022
e16ec42
Adding support for LoadBalancerIP field in ServiceSpec
Apr 10, 2020
65c92c9
DATAGO-13861: Adding support for logrotate
hadielaham88 May 19, 2021
7474af1
DATAGO-13861: Adding audit log rotation and shipment to datdog
hadielaham88 May 26, 2021
32cc88e
Fixing minor typos and removing extra lines
hadielaham88 May 26, 2021
b829f33
DATAGO-13861: Adding support for logrotate
hadielaham88 May 19, 2021
f0e3fca
DATAGO-13861: Adding audit log rotation and shipment to datdog
hadielaham88 May 26, 2021
21ebe61
Fixing minor typos and removing extra lines
hadielaham88 May 26, 2021
b505aa3
feat(DATAGO-27002): Upgrade vault to version 1.7.9 (#12)
nagsubhrajitt Jun 1, 2022
cc8706d
Datago 30304/upgrading vault to 1.9.2 (#14)
adhish2001 Jul 27, 2022
b1a79ae
feat(DATAGO-30305): Upgrade vault server to 1.10.x (#16)
xiaocongji Mar 21, 2023
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
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# MaaS Vault

This is a forked version of HashiCorp's Vault Helm Chart. It is forked for business continuity (should the original be deleted) and to adhere to the MPL-2.0 license of public disclosure of source changes.
This repository is used as a submodule in other repositories that install and setup Vault.

# Vault Helm Chart

> :warning: **Please note**: We take Vault's security and our users' trust very seriously. If
Expand Down Expand Up @@ -37,7 +42,17 @@ $ helm repo add hashicorp https://helm.releases.hashicorp.com
$ helm install vault hashicorp/vault
```

Please see the many options supported in the `values.yaml` file. These are also
fully documented directly on the [Vault
website](https://www.vaultproject.io/docs/platform/k8s/helm) along with more
detailed installation instructions.
Please see the many options supported in the `values.yaml`
file. These are also fully documented directly on the
[Vault website](https://www.vaultproject.io/docs/platform/k8s/helm.html).


## Customizations

This Helm chart has been customized in the following ways:

### Support LoadBalancerIP Field

The Service spec in the **server-service.yaml** file now allows setting a
specific IP address when the Service type is set to `LoadBalancer` and a
**maas.lbAddress** value has been provided.
10 changes: 10 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ template logic.
{{- $_ := set . "mode" "external" -}}
{{- else if not .serverEnabled -}}
{{- $_ := set . "mode" "external" -}}
{{- else if not .serverEnabled -}}
{{- $_ := set . "mode" "external" -}}
{{- else if eq (.Values.server.dev.enabled | toString) "true" -}}
{{- $_ := set . "mode" "dev" -}}
{{- else if eq (.Values.server.ha.enabled | toString) "true" -}}
Expand Down Expand Up @@ -161,6 +163,14 @@ extra volumes the user may have specified (such as a secret with TLS).
configMap:
name: {{ template "vault.fullname" . }}-config
{{ end }}
{{- if .Values.server.logrotate.enabled }}
- name: {{ template "vault.fullname" . }}-logrotate-config
configMap:
name: {{ template "vault.fullname" . }}-logrotate-configmap
- name: {{ template "vault.fullname" . }}-datadog-config
configMap:
name: {{ template "vault.fullname" . }}-datadog-sidecar-configmap
{{- end}}
{{- range .Values.server.extraVolumes }}
- name: userconfig-{{ .name }}
{{ .type }}:
Expand Down
10 changes: 10 additions & 0 deletions templates/datadog-audit-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.server.logrotate.enabled}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "vault.fullname" . }}-datadog-sidecar-configmap
namespace: {{ .Release.Namespace }}
data:
conf.yaml: |-
{{ .Values.server.logrotate.datadogsidecar.config | indent 6 }}
{{ end }}
8 changes: 1 addition & 7 deletions templates/injector-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,11 @@ spec:
periodSeconds: 2
successThreshold: 1
timeoutSeconds: 5
{{- if .Values.injector.certs.secretName }}
volumeMounts:
- name: webhook-certs
mountPath: /etc/webhook/certs
readOnly: true
{{- end }}
{{- if .Values.injector.certs.secretName }}
volumes:
- name: webhook-certs
secret:
secretName: "{{ .Values.injector.certs.secretName }}"
{{- end }}
{{- include "imagePullSecrets" . | nindent 6 }}
{{ end }}
{{ end }}
10 changes: 10 additions & 0 deletions templates/logrotate-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.server.logrotate.enabled}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "vault.fullname" . }}-logrotate-configmap
namespace: {{ .Release.Namespace }}
data:
logrotate.conf: |-
{{ .Values.server.logrotate.config.logRotateConf | indent 6 }}
{{ end }}
2 changes: 1 addition & 1 deletion templates/server-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ subjects:
- kind: ServiceAccount
name: {{ template "vault.serviceAccount.name" . }}
namespace: {{ .Release.Namespace }}
{{ end }}
{{ end }}
3 changes: 3 additions & 0 deletions templates/server-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ spec:
clusterIP: {{ .Values.server.service.clusterIP }}
{{- end }}
{{- include "service.externalTrafficPolicy" .Values.server.service }}
{{- if and (.Values.maas.lbAddress) (eq (.Values.server.service.type | toString) "LoadBalancer") }}
loadBalancerIP: {{ .Values.maas.lbAddress }}
{{- end }}
# We want the servers to become available even if they're not ready
# since this DNS is also used for join operations.
publishNotReadyAddresses: {{ .Values.server.service.publishNotReadyAddresses }}
Expand Down
14 changes: 12 additions & 2 deletions test/acceptance/csi.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@

load _helpers

check_skip_csi() {
if [ ! -z ${SKIP_CSI} ]; then
skip "Skipping CSI tests"
fi
}

@test "csi: testing deployment" {
cd `chart_dir`
check_skip_csi

cd `chart_dir`
kubectl delete namespace acceptance --ignore-not-found=true
kubectl create namespace acceptance

# Install Secrets Store CSI driver
CSI_DRIVER_VERSION=1.0.0
helm install secrets-store-csi-driver https://kubernetes-sigs.github.io/secrets-store-csi-driver/charts/secrets-store-csi-driver-${CSI_DRIVER_VERSION}.tgz?raw=true \
helm install secrets-store-csi-driver secrets-store-csi-driver --repo https://kubernetes-sigs.github.io/secrets-store-csi-driver/charts \
--version="${CSI_DRIVER_VERSION}"
--wait --timeout=5m \
--namespace=acceptance \
--set linux.image.pullPolicy="IfNotPresent" \
Expand Down Expand Up @@ -50,6 +58,8 @@ load _helpers

# Clean up
teardown() {
check_skip_csi

if [[ ${CLEANUP:-true} == "true" ]]
then
echo "helm/pvc teardown"
Expand Down
23 changes: 23 additions & 0 deletions test/unit/csi-daemonset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,29 @@ load _helpers
[ "${actual}" = "true" ]
}

# priorityClassName

@test "csi/daemonset: priorityClassName not set by default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set "csi.enabled=true" \
. | tee /dev/stderr |
yq '.spec.template.spec | .priorityClassName? == null' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

@test "csi/daemonset: priorityClassName can be set" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set 'csi.priorityClassName=armaggeddon' \
--set "csi.enabled=true" \
. | tee /dev/stderr |
yq '.spec.template.spec | .priorityClassName == "armaggeddon"' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

# serviceAccountName reference name
@test "csi/daemonset: serviceAccountName reference name" {
cd `chart_dir`
Expand Down
1 change: 0 additions & 1 deletion test/unit/injector-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,6 @@ EOF
yq -r 'map(select(.name=="AGENT_INJECT_TEMPLATE_CONFIG_EXIT_ON_RETRY_FAILURE")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "false" ]
}

@test "injector/deployment: agent default template_config.static_secret_render_interval" {
cd `chart_dir`
local object=$(helm template \
Expand Down
2 changes: 1 addition & 1 deletion test/unit/injector-disruptionbudget.bats
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ load _helpers
. | tee /dev/stderr |
yq '.apiVersion == "policy/v1"' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
}
2 changes: 1 addition & 1 deletion test/unit/server-ha-disruptionbudget.bats
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ load _helpers
. | tee /dev/stderr |
yq '.apiVersion == "policy/v1"' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
}
38 changes: 38 additions & 0 deletions test/unit/server-route.bats
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,41 @@ load _helpers
yq -r '.spec.tls.insecureEdgeTerminationPolicy' | tee /dev/stderr)
[ "${actual}" = "Redirect" ]
}

@test "server/route: OpenShift - route termination mode set to default passthrough" {
cd `chart_dir`

local actual=$(helm template \
--show-only templates/server-route.yaml \
--set 'global.openshift=true' \
--set 'server.route.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.tls.termination' | tee /dev/stderr)
[ "${actual}" = "passthrough" ]
}

@test "server/route: OpenShift - route termination mode set to edge" {
cd `chart_dir`

local actual=$(helm template \
--show-only templates/server-route.yaml \
--set 'global.openshift=true' \
--set 'server.route.enabled=true' \
--set 'server.route.tls.termination=edge' \
. | tee /dev/stderr |
yq -r '.spec.tls.termination' | tee /dev/stderr)
[ "${actual}" = "edge" ]
}

@test "server/route: OpenShift - route custom tls entry" {
cd `chart_dir`

local actual=$(helm template \
--show-only templates/server-route.yaml \
--set 'global.openshift=true' \
--set 'server.route.enabled=true' \
--set 'server.route.tls.insecureEdgeTerminationPolicy=Redirect' \
. | tee /dev/stderr |
yq -r '.spec.tls.insecureEdgeTerminationPolicy' | tee /dev/stderr)
[ "${actual}" = "Redirect" ]
}
2 changes: 1 addition & 1 deletion test/unit/server-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1783,4 +1783,4 @@ load _helpers
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].securityContext.foo' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}
}
9 changes: 9 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
}
}
},
"priorityClassName": {
"type": "string"
},
"debug": {
"type": "boolean"
},
Expand Down Expand Up @@ -364,6 +367,9 @@
"podDisruptionBudget": {
"type": "object"
},
"podDisruptionBudget": {
"type": "object"
},
"port": {
"type": "integer"
},
Expand Down Expand Up @@ -860,6 +866,9 @@
"enabled": {
"type": "boolean"
},
"publishNotReadyAddresses": {
"type": "boolean"
},
"externalTrafficPolicy": {
"type": "string"
},
Expand Down
22 changes: 17 additions & 5 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ injector:
# for more details.
#
timeoutSeconds: 30

# namespaceSelector is the selector for restricting the webhook to only
# specific namespaces.
# See https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-namespaceselector
Expand Down Expand Up @@ -184,6 +183,17 @@ injector:
# vault-sidecar-injector: enabled
objectSelector: {}

# Deprecated: please use 'webhook.objectSelector' instead
# objectSelector is the selector for restricting the webhook to only
# specific labels.
# See https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requests-objectselector
# for more details.
# Example:
# objectSelector:
# matchLabels:
# vault-sidecar-injector: enabled
objectSelector: {}

# Deprecated: please use 'webhook.annotations' instead
# Extra annotations to attach to the webhook
webhookAnnotations: {}
Expand Down Expand Up @@ -356,7 +366,6 @@ server:
# limits:
# memory: 256Mi
# cpu: 250m

# Ingress allows ingress services to be created to allow external access
# from Kubernetes to access Vault pods.
# If deployment is on OpenShift, the following block is ignored.
Expand Down Expand Up @@ -604,8 +613,8 @@ server:
# load balancer.
# clusterIP: None

# Configures the service type for the main Vault service. Can be ClusterIP
# or NodePort.
# Configures the service type for the main Vault service. Can be ClusterIP,
# NodePort, or LoadBalancer.
#type: ClusterIP

# Do not wait for pods to be ready
Expand Down Expand Up @@ -851,13 +860,17 @@ server:
# YAML or a YAML-formatted multi-line templated string map of the
# annotations to apply to the serviceAccount.
annotations: {}
# A boolean flag to setup logrotate as a side car continer
logrotate: null

# Settings for the statefulSet used to run Vault.
statefulSet:
# Extra annotations for the statefulSet. This can either be YAML or a
# YAML-formatted multi-line templated string map of the annotations to apply
# to the statefulSet.
annotations: {}
# A boolean flag to setup logrotate as a side car continer
logrotate: null

# Set the pod and container security contexts.
# If not set, these will default to, and for *not* OpenShift:
Expand Down Expand Up @@ -989,7 +1002,6 @@ csi:
extraLabels: {}



# Priority class for csi pods
priorityClassName: ""

Expand Down