Skip to content

Commit acbf601

Browse files
benashztvoran
andauthored
Add support for linux/s390x and linux/arm64 (Red Hat) (#1152)
* Bump ubi10 to 10.1 * Update the build * Run dependabot daily for all types * Fix integration test make target * Add bats test for CSI driver securityContext * Rejig the build add arm64 support * Drop vestigial build-docker-ubi-redhat step * Add operator framework labels. Helm: - Add the ability set the securityContext for the CSI driver. Co-authored-by: Theron Voran <tvoran@users.noreply.github.com> --------- Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
1 parent be205fa commit acbf601

35 files changed

+688
-127
lines changed

.github/dependabot.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ updates:
1010
- package-ecosystem: "gomod"
1111
directory: "/"
1212
schedule:
13-
interval: "weekly"
13+
interval: "daily"
1414
groups:
1515
gomod-breaking:
1616
update-types:
@@ -22,7 +22,7 @@ updates:
2222
- package-ecosystem: "github-actions"
2323
directory: "/"
2424
schedule:
25-
interval: "weekly"
25+
interval: "daily"
2626
# Disable version updates and only check security updates for github
2727
# actions, since we can't bump the versions until they're on our allow-list
2828
open-pull-requests-limit: 0

.github/workflows/build.yaml

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
runs-on: ubuntu-latest
123123
strategy:
124124
matrix:
125-
arch: ["arm64", "amd64"]
125+
arch: ["arm64", "amd64", "s390x"]
126126
fail-fast: true
127127
steps:
128128
- name: Checkout
@@ -207,7 +207,7 @@ jobs:
207207
runs-on: ubuntu-latest
208208
strategy:
209209
matrix:
210-
arch: ["arm64", "amd64"]
210+
arch: ["arm64", "amd64", "s390x"]
211211
env:
212212
repo: ${{github.event.repository.name}}
213213
version: ${{needs.get-product-version.outputs.product-version}}
@@ -227,6 +227,7 @@ jobs:
227227
version: ${{env.version}}
228228
target: release-ubi
229229
arch: ${{matrix.arch}}
230+
redhat_tag: quay.io/redhat-isv-containers/64b072322e2773c28d30d988:${{env.image_tag}}
230231
tags: |
231232
docker.io/hashicorp/${{env.repo}}:${{env.image_tag}}
232233
public.ecr.aws/hashicorp/${{env.repo}}:${{env.image_tag}}
@@ -243,51 +244,6 @@ jobs:
243244
exit 1
244245
fi
245246
246-
build-docker-ubi-redhat:
247-
name: UBI ${{ matrix.arch }} RedHat build
248-
needs:
249-
- get-product-version
250-
- build-pre-checks
251-
- build
252-
runs-on: ubuntu-latest
253-
strategy:
254-
matrix:
255-
# Building only amd64 for the RedHat registry for now
256-
arch: ["amd64"]
257-
env:
258-
repo: ${{github.event.repository.name}}
259-
version: ${{needs.get-product-version.outputs.product-version}}
260-
image_tag: ${{needs.get-product-version.outputs.product-version}}-ubi
261-
steps:
262-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
263-
- name: Setup scripts directory
264-
shell: bash
265-
run: |
266-
make ci-build-scripts-dir GOARCH="${{ matrix.arch }}"
267-
- name: Docker Build (Action)
268-
uses: hashicorp/actions-docker-build@v2
269-
env:
270-
VERSION: ${{ needs.get-product-version.outputs.product-version }}
271-
GO_VERSION: ${{ needs.build-pre-checks.outputs.go-version }}
272-
with:
273-
version: ${{env.version}}
274-
target: release-ubi-redhat
275-
arch: ${{matrix.arch}}
276-
# The quay id here corresponds to the project id on RedHat's portal
277-
redhat_tag: quay.io/redhat-isv-containers/64b072322e2773c28d30d988:${{env.image_tag}}
278-
279-
- name: Check binary version in container
280-
shell: bash
281-
run: |
282-
version_output=$(docker run quay.io/redhat-isv-containers/64b072322e2773c28d30d988:${{env.image_tag}} --version --output=json)
283-
echo $version_output
284-
git_version=$(echo $version_output | jq -r .gitVersion)
285-
286-
if [ "$git_version" != "${{ env.version }}" ]; then
287-
echo "$gitVersion expected to be ${{ env.version }}"
288-
exit 1
289-
fi
290-
291247
chart-upgrade-tests:
292248
runs-on: ubuntu-latest
293249
needs:
@@ -312,6 +268,7 @@ jobs:
312268
- "0.9.1"
313269
- "0.10.0"
314270
- "1.0.0"
271+
- "1.0.1"
315272
steps:
316273
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
317274
with:
@@ -475,7 +432,6 @@ jobs:
475432
- build
476433
- build-docker
477434
- build-docker-ubi
478-
- build-docker-ubi-redhat
479435
- chart-upgrade-tests
480436
- unit-tests
481437
- latest-vault

.release/vault-secrets-operator-artifacts.hcl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ artifacts {
66
zip = [
77
"vault-secrets-operator_${version}_linux_amd64.zip",
88
"vault-secrets-operator_${version}_linux_arm64.zip",
9+
"vault-secrets-operator_${version}_linux_s390x.zip",
910
]
1011
container = [
1112
"vault-secrets-operator_release-default_linux_amd64_${version}_${commit_sha}.docker.tar",
1213
"vault-secrets-operator_release-default_linux_arm64_${version}_${commit_sha}.docker.tar",
13-
"vault-secrets-operator_release-ubi-redhat_linux_amd64_${version}_${commit_sha}.docker.redhat.tar",
14+
"vault-secrets-operator_release-default_linux_s390x_${version}_${commit_sha}.docker.tar",
15+
"vault-secrets-operator_release-ubi_linux_amd64_${version}_${commit_sha}.docker.redhat.tar",
16+
"vault-secrets-operator_release-ubi_linux_arm64_${version}_${commit_sha}.docker.redhat.tar",
17+
"vault-secrets-operator_release-ubi_linux_s390x_${version}_${commit_sha}.docker.redhat.tar",
1418
"vault-secrets-operator_release-ubi_linux_amd64_${version}_${commit_sha}.docker.tar",
1519
"vault-secrets-operator_release-ubi_linux_arm64_${version}_${commit_sha}.docker.tar",
20+
"vault-secrets-operator_release-ubi_linux_s390x_${version}_${commit_sha}.docker.tar",
1621
]
1722
}

chart/templates/csi-driver.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ spec:
6161
annotations:
6262
{{- include "vso.csi.annotations" . | nindent 8 }}
6363
spec:
64+
{{- with.Values.csi.securityContext }}
65+
securityContext:
66+
{{- toYaml . | nindent 8 }}
67+
{{- end }}
6468
serviceAccountName: {{ include "vso.chart.fullname" . }}-csi
6569
{{- with .Values.csi.hostAliases }}
6670
hostAliases:
67-
{{- toYaml . | nindent 8 }}
71+
{{ toYaml . | nindent 8 }}
6872
{{- end }}
6973
{{- if .Values.csi.affinity }}
7074
affinity:
@@ -130,8 +134,10 @@ spec:
130134
value: {{ .value }}
131135
{{- end }}
132136
imagePullPolicy: {{ .Values.csi.driver.image.pullPolicy }}
137+
{{- with .Values.csi.driver.securityContext }}
133138
securityContext:
134-
privileged: true
139+
{{- toYaml . | nindent 10 }}
140+
{{- end }}
135141
livenessProbe:
136142
failureThreshold: 5
137143
httpGet:

chart/values.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,12 @@ csi:
928928
# @type: boolean
929929
enabled: false
930930

931+
# Configures the Pod level security context
932+
# https://kubernetes.io/docs/tasks/configure-pod-container/security-context
933+
#
934+
# Note: the driver container security context can be configured below.
935+
securityContext: {}
936+
931937
# Host Aliases settings for the `vault-secrets-operator-csi` pods as
932938
# an array of PodSpec HostAlias maps.
933939
# ref: https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/
@@ -1006,6 +1012,16 @@ csi:
10061012
annotations: {}
10071013

10081014
driver:
1015+
# Configures the driver container's security context
1016+
# https://kubernetes.io/docs/tasks/configure-pod-container/security-context
1017+
#
1018+
# Note: the Pod level security can also be configured above.
1019+
#
1020+
# Note: when deploying to an OpenShift cluster you should set:
1021+
# privileged: true
1022+
#
1023+
securityContext: {}
1024+
10091025
# Image information for the CSI driver.
10101026
# ref: https://kubernetes.io/docs/concepts/containers/images/
10111027
image:

config/manifests/bases/vault-secrets-operator.clusterserviceversion.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ metadata:
7272
features.operators.openshift.io/token-auth-gcp: "false"
7373
repository: https://github.com/hashicorp/vault-secrets-operator
7474
support: HashiCorp
75+
labels:
76+
operatorframework.io/arch.amd64: supported
77+
operatorframework.io/arch.arm64: supported
78+
operatorframework.io/arch.s390x: supported
79+
operatorframework.io/os.linux: supported
7580
name: vault-secrets-operator.v0.0.0-dev
7681
namespace: placeholder
7782
spec:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: postgresql
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "18.0"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "postgresql.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "postgresql.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "postgresql.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "postgresql.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "postgresql.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "postgresql.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "postgresql.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "postgresql.labels" -}}
37+
helm.sh/chart: {{ include "postgresql.chart" . }}
38+
{{ include "postgresql.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "postgresql.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "postgresql.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "postgresql.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "postgresql.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}

0 commit comments

Comments
 (0)