Skip to content

Commit

Permalink
add s3gw token to all s3gw's resource names
Browse files Browse the repository at this point in the history
Fixes: https://github.com/aquarist-labs/s3gw/issues/630
Signed-off-by: Giuseppe Baccini <giuseppe.baccini@suse.com>
  • Loading branch information
Giuseppe Baccini committed Sep 1, 2023
1 parent 3cf5334 commit 03fbe7e
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 48 deletions.
18 changes: 9 additions & 9 deletions charts/s3gw/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Default Access Credentials
Backend service name
*/}}
{{- define "s3gw.serviceName" -}}
{{- $dsn := printf "%s-%s" .Release.Name .Release.Namespace }}
{{- $dsn := printf "%s-%s-s3gw" .Release.Name .Release.Namespace }}
{{- $name := default $dsn .Values.serviceName }}
{{- $name }}
{{- end }}
Expand All @@ -129,7 +129,7 @@ Backend service name
Frontend service name
*/}}
{{- define "s3gw.uiServiceName" -}}
{{- $dsn := printf "%s-%s-ui" .Release.Name .Release.Namespace }}
{{- $dsn := printf "%s-%s-ui-s3gw" .Release.Name .Release.Namespace }}
{{- $name := default $dsn .Values.ui.serviceName }}
{{- $name }}
{{- end }}
Expand All @@ -138,7 +138,7 @@ Frontend service name
User credentials secret for S3 backend service
*/}}
{{- define "s3gw.defaultUserCredentialsSecret" -}}
{{- $dsn := printf "%s-%s-creds" .Release.Name .Release.Namespace }}
{{- $dsn := printf "%s-%s-creds-s3gw" .Release.Name .Release.Namespace }}
{{- $name := default $dsn .Values.defaultUserCredentialsSecret }}
{{- $name }}
{{- end }}
Expand All @@ -147,7 +147,7 @@ User credentials secret for S3 backend service
Config map name
*/}}
{{- define "s3gw.configMap" -}}
{{- $dcmn := printf "%s-%s-config" .Release.Name .Release.Namespace }}
{{- $dcmn := printf "%s-%s-config-s3gw" .Release.Name .Release.Namespace }}
{{- $name := $dcmn }}
{{- $name }}
{{- end }}
Expand All @@ -156,7 +156,7 @@ Config map name
Traefik Middleware CORS name
*/}}
{{- define "s3gw.CORSMiddlewareName" -}}
{{- $dmcn := printf "%s-%s-cors-header" .Release.Name .Release.Namespace }}
{{- $dmcn := printf "%s-%s-cors-header-s3gw" .Release.Name .Release.Namespace }}
{{- $name := $dmcn }}
{{- $name }}
{{- end }}
Expand Down Expand Up @@ -198,7 +198,7 @@ COSI driver name
COSI service account name
*/}}
{{- define "s3gw-cosi.ServiceAccountName" -}}
{{- $dcsan := printf "%s-%s-objectstorage-provisioner-sa" .Release.Name .Release.Namespace }}
{{- $dcsan := printf "%s-%s-objectstorage-provisioner-sa-s3gw" .Release.Name .Release.Namespace }}
{{- $name := $dcsan }}
{{- $name }}
{{- end }}
Expand All @@ -207,7 +207,7 @@ COSI service account name
COSI driver secret name
*/}}
{{- define "s3gw-cosi.driverSecretName" -}}
{{- $ddsn := printf "%s-%s-objectstorage-provisioner" .Release.Name .Release.Namespace }}
{{- $ddsn := printf "%s-%s-objectstorage-provisioner-s3gw" .Release.Name .Release.Namespace }}
{{- $name := $ddsn }}
{{- $name }}
{{- end }}
Expand All @@ -216,7 +216,7 @@ COSI driver secret name
COSI cluster role name
*/}}
{{- define "s3gw-cosi.ClusterRoleName" -}}
{{- $dcrn := printf "%s-%s-objectstorage-provisioner-role" .Release.Name .Release.Namespace }}
{{- $dcrn := printf "%s-%s-objectstorage-provisioner-role-s3gw" .Release.Name .Release.Namespace }}
{{- $name := $dcrn }}
{{- $name }}
{{- end }}
Expand All @@ -225,7 +225,7 @@ COSI cluster role name
COSI cluster role binding name
*/}}
{{- define "s3gw-cosi.ClusterRoleBindingName" -}}
{{- $dcrn := printf "%s-%s-objectstorage-provisioner-role-binding" .Release.Name .Release.Namespace }}
{{- $dcrn := printf "%s-%s-objectstorage-provisioner-role-binding-s3gw" .Release.Name .Release.Namespace }}
{{- $name := $dcrn }}
{{- $name }}
{{- end }}
Expand Down
14 changes: 7 additions & 7 deletions charts/s3gw/templates/certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ .Release.Name }}-{{ .Release.Namespace }}-ca-cert
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-ca-cert
namespace: {{ .Values.certManagerNamespace }}
labels:
{{ include "s3gw.labels" . | indent 4}}
spec:
commonName: {{ .Release.Name }}-{{ .Release.Namespace }}-ca
commonName: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-ca
isCA: true
issuerRef:
kind: ClusterIssuer
name: {{ .Release.Name }}-{{ .Release.Namespace }}-self-signed-issuer
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-self-signed-issuer
privateKey:
algorithm: ECDSA
size: 256
secretName: {{ .Release.Name }}-{{ .Release.Namespace }}-ca-root
secretName: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-ca-root
---
# s3gw internal service certificate (private domain)
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ .Release.Name }}-{{ .Release.Namespace }}-cluster-ip-cert
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-cluster-ip-cert
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4}}
Expand All @@ -33,6 +33,6 @@ spec:
- '*.{{ include "s3gw.serviceName" . }}.{{ .Release.Namespace }}.{{ .Values.privateDomain }}'
issuerRef:
kind: ClusterIssuer
name: {{ .Release.Name }}-{{ .Release.Namespace }}-issuer
secretName: {{ .Release.Name }}-{{ .Release.Namespace }}-cluster-ip-tls
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-issuer
secretName: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-cluster-ip-tls
{{- end }}
2 changes: 1 addition & 1 deletion charts/s3gw/templates/cosi-driver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-objectstorage-provisioner
name: {{ .Release.Name }}-s3gw-objectstorage-provisioner
labels:
{{ include "s3gw.labels" . | indent 4}}
namespace: {{ .Release.Namespace }}
Expand Down
8 changes: 4 additions & 4 deletions charts/s3gw/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
name: {{ .Release.Name }}-s3gw
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand Down Expand Up @@ -79,17 +79,17 @@ spec:
volumes:
- name: s3gw-lh-store
persistentVolumeClaim:
claimName: {{ .Release.Name }}-pvc
claimName: {{ .Release.Name }}-s3gw-pvc
- name: s3gw-cluster-ip-tls
secret:
secretName: {{ .Release.Name }}-{{ .Release.Namespace }}-cluster-ip-tls
secretName: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-cluster-ip-tls
optional: false
{{- if .Values.ui.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: '{{ .Release.Name }}-ui'
name: '{{ .Release.Name }}-s3gw-ui'
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand Down
8 changes: 4 additions & 4 deletions charts/s3gw/templates/ingress-traefik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: '{{ .Release.Name }}'
name: '{{ .Release.Name }}-s3gw'
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand Down Expand Up @@ -45,7 +45,7 @@ spec:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: '{{ .Release.Name }}-no-tls'
name: '{{ .Release.Name }}-s3gw-no-tls'
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand Down Expand Up @@ -80,7 +80,7 @@ spec:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: '{{ .Release.Name }}-ui'
name: '{{ .Release.Name }}-s3gw-ui'
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand Down Expand Up @@ -110,7 +110,7 @@ spec:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: '{{ .Release.Name }}-ui-no-tls'
name: '{{ .Release.Name }}-s3gw-ui-no-tls'
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/s3gw/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ stringData:
apiVersion: v1
kind: Secret
metadata:
name: '{{ .Release.Name }}-image-pull-secret'
name: '{{ .Release.Name }}-s3gw-image-pull-secret'
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/s3gw/templates/storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: '{{ .Release.Name }}-pvc'
name: '{{ .Release.Name }}-s3gw-pvc'
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand Down Expand Up @@ -39,7 +39,7 @@ parameters:
apiVersion: v1
kind: PersistentVolume
metadata:
name: '{{ .Release.Name }}.{{ .Release.Namespace }}-local-pv'
name: '{{ .Release.Name }}.{{ .Release.Namespace }}-s3gw-local-pv'
labels:
{{ include "s3gw.labels" . | indent 4 }}
type: local
Expand Down
2 changes: 1 addition & 1 deletion charts/s3gw/templates/tests/smoke-bucket-create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: batch/v1
kind: Job
metadata:
name: 'smoke-{{ .Release.Name }}-bucket-create'
name: 'smoke-{{ .Release.Name }}-s3gw-bucket-create'
namespace: '{{ .Release.Namespace }}'
annotations:
helm.sh/hook: test
Expand Down
10 changes: 5 additions & 5 deletions charts/s3gw/templates/tls-issuer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: {{ .Release.Name }}-{{ .Release.Namespace }}-self-signed-issuer
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-self-signed-issuer
labels:
{{ include "s3gw.labels" . | indent 4}}
spec:
Expand All @@ -15,27 +15,27 @@ spec:
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: {{ .Release.Name }}-{{ .Release.Namespace }}-issuer
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-issuer
labels:
{{ include "s3gw.labels" . | indent 4}}
spec:
ca:
secretName: {{ .Release.Name }}-{{ .Release.Namespace }}-ca-root
secretName: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-ca-root
{{- else if eq .Values.tlsIssuer "s3gw-letsencrypt-issuer" }}
---
# Let's encrypt production issuer
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: {{ .Release.Name }}-{{ .Release.Namespace }}-letsencrypt-issuer
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-letsencrypt-issuer
labels:
{{ include "s3gw.labels" . | indent 4}}
spec:
acme:
email: {{ .Values.email }}
preferredChain: ""
privateKeySecretRef:
name: {{ .Release.Name }}-{{ .Release.Namespace }}-letsencrypt
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-letsencrypt
server: https://acme-v02.api.letsencrypt.org/directory
solvers:
- http01:
Expand Down
6 changes: 3 additions & 3 deletions charts/s3gw/templates/tls-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-{{ .Release.Namespace }}-ingress-tls
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-ingress-tls
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand All @@ -17,7 +17,7 @@ data:
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-{{ .Release.Namespace }}-cluster-ip-tls
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-cluster-ip-tls
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand All @@ -32,7 +32,7 @@ data:
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-{{ .Release.Namespace }}-ui-ingress-tls
name: {{ .Release.Name }}-{{ .Release.Namespace }}-s3gw-ui-ingress-tls
namespace: {{ .Release.Namespace }}
labels:
{{ include "s3gw.labels" . | indent 4 }}
Expand Down
12 changes: 6 additions & 6 deletions charts/s3gw/tests/cosi_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tests:
- containsDocument:
kind: Secret
apiVersion: v1
name: s3gw-name-s3gw-namespace-objectstorage-provisioner
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-s3gw
namespace: s3gw-namespace
template: cosi-driver-secret.yaml

Expand Down Expand Up @@ -99,7 +99,7 @@ tests:
- containsDocument:
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-role
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-role-s3gw
documentIndex: 0
template: cosi-rbac.yaml

Expand All @@ -111,7 +111,7 @@ tests:
- containsDocument:
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-role-binding
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-role-binding-s3gw
documentIndex: 1
template: cosi-rbac.yaml

Expand All @@ -122,7 +122,7 @@ tests:
- containsDocument:
kind: ServiceAccount
apiVersion: v1
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-sa
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-sa-s3gw
namespace: s3gw-namespace
template: cosi-sa.yaml

Expand All @@ -135,7 +135,7 @@ tests:
path: subjects
content:
kind: ServiceAccount
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-sa
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-sa-s3gw
namespace: s3gw-namespace
any: true
documentIndex: 1
Expand All @@ -146,7 +146,7 @@ tests:
content:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-role
name: s3gw-name-s3gw-namespace-objectstorage-provisioner-role-s3gw
any: true
documentIndex: 1
template: cosi-rbac.yaml
2 changes: 1 addition & 1 deletion charts/s3gw/tests/credentials_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tests:
- containsDocument:
kind: Secret
apiVersion: v1
name: s3gw-release-s3gw-system-creds
name: s3gw-release-s3gw-system-creds-s3gw
namespace: s3gw-system
documentIndex: 0
templates:
Expand Down
8 changes: 4 additions & 4 deletions charts/s3gw/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tests:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: s3gw-release
name: s3gw-release-s3gw
namespace: s3gw-namespace
documentIndex: 0
templates:
Expand All @@ -36,7 +36,7 @@ tests:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: s3gw-release-ui
name: s3gw-release-ui-s3gw
namespace: s3gw-namespace
documentIndex: 0
templates:
Expand All @@ -45,7 +45,7 @@ tests:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: s3gw-release-ui-ui
name: s3gw-release-ui-s3gw-ui
namespace: s3gw-namespace
documentIndex: 1
templates:
Expand All @@ -65,7 +65,7 @@ tests:
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: s3gw-release
name: s3gw-release-s3gw
namespace: s3gw-namespace
documentIndex: 0
templates:
Expand Down

0 comments on commit 03fbe7e

Please sign in to comment.