Skip to content

Commit

Permalink
prefix all kind name with Release.Name
Browse files Browse the repository at this point in the history
  • Loading branch information
AmelieLoulergue committed Dec 13, 2024
1 parent eea4b8d commit cdccebf
Show file tree
Hide file tree
Showing 20 changed files with 125 additions and 104 deletions.
Binary file modified local/redis/dumps/dump.rdb
Binary file not shown.
11 changes: 11 additions & 0 deletions opensource/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- define "minioService" -}}
{{ .Release.Name }}-minio
{{- end -}}

{{- define "redisService" -}}
{{ .Release.Name }}-redis-service
{{- end -}}

{{- define "mediaService" -}}
http://{{ .Release.Name }}-media-service
{{- end -}}
2 changes: 1 addition & 1 deletion opensource/templates/backup-and-clean-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: backup-and-clean-cronjob-{{ .Values.version }}
name: {{ .Release.Name }}-backup-and-clean-cronjob-{{ .Values.version }}
spec:
schedule: '0 0 * * *'
jobTemplate:
Expand Down
20 changes: 10 additions & 10 deletions opensource/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: media
name: {{ .Release.Name }}-media
labels:
app: media
app: {{ .Release.Name }}-media
spec:
replicas: {{ .Values.hpa.replicaCountMin }}
selector:
matchLabels:
app: media
app: {{ .Release.Name }}-media
template:
metadata:
labels:
app: media
app: {{ .Release.Name }}-media
spec:
containers:
- name: media-api
- name: {{ .Release.Name }}-media-api
image: "{{ .Values.mediaProvider.imageName }}:{{ .Values.mediaProvider.imageVersion }}"
resources:
requests:
Expand Down Expand Up @@ -76,7 +76,7 @@ spec:
- name: NGINX_INGRESS
value: '{{.Values.protocol}}://{{.Values.env}}{{.Values.domain}}'
- name: IMAGE_SERVICE
value: "{{ default "http://media-service" .Values.mediaProvider.service }}"
value: "{{ include "mediaService" . }}"
- name: API_PREFIX
value: "{{ default "/palpatine" .Values.mediaProvider.apiPrefix }}"
- name: USE_STRIPMETADATA
Expand Down Expand Up @@ -104,11 +104,11 @@ spec:
value: "{{ default "true" .Values.dev }}"

- name: REDIS_SERVICE
value: "{{ default "redis-service" .Values.redis.service }}"
value: "{{ include "redisService" . }}"
- name: DELEGATED_STORAGE_METHOD
value: "{{ default "DISTANT_BACKEND" .Values.delegatedStorage.storageMethod }}"
- name: DELEGATED_STORAGE_HOST
value: "{{ default "http://minio:9000" .Values.delegatedStorage.host }}"
value: "http://{{ include "minioService" . }}:{{ .Values.s3.port}}"
- name: DELEGATED_STORAGE_READINESS_CHECK
value: "{{ default "/minio/health/live" .Values.delegatedStorage.routes.readinessCheck }}"
{{- if and (eq .Values.delegatedStorage.connect true) (eq .Values.delegatedStorage.storageMethod "DISTANT_BACKEND") }}
Expand All @@ -126,7 +126,7 @@ spec:
{{- if and (eq .Values.delegatedStorage.connect true) (eq .Values.delegatedStorage.storageMethod "S3") }}

- name: S3_ENDPOINT
value: "{{ default "minio" .Values.s3.endpoint }}"
value: {{ include "minioService" . }}
- name: S3_PORT
value: "{{ default "9000" .Values.s3.port }}"
- name: S3_ACCESS_KEY
Expand All @@ -139,6 +139,6 @@ spec:
volumes:
- name: redis-storage
persistentVolumeClaim:
claimName: redis-pv
claimName: {{ .Release.Name }}-redis-pv
- name: logs
emptyDir: { }
18 changes: 12 additions & 6 deletions opensource/templates/media-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api-ingress
name: {{ .Release.Name }}-api-ingress
annotations:
nginx.ingress.kubernetes.io/default-backend: ingress-nginx-controller
nginx.ingress.kubernetes.io/use-regex: 'true'
nginx.ingress.kubernetes.io/proxy-body-size: '50m'
{{- range $key, $value := .Values.ingress.api.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
ingressClassName: nginx
ingressClassName: {{ .Values.ingress.api.className }}
{{- if .Values.ingress.api.tls }}
tls:
- hosts:
- {{ .Values.env }}.api{{ .Values.domain }}
secretName: {{ .Release.Name }}-api-tls-certificate
{{- end }}
rules:
- host: '{{.Values.env}}.api{{.Values.domain}}'
http:
Expand All @@ -16,6 +22,6 @@ spec:
pathType: ImplementationSpecific
backend:
service:
name: media-service
name: {{ .Release.Name }}-media-service
port:
number: 80
28 changes: 14 additions & 14 deletions opensource/templates/minio-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: minio-deployment
name: {{ .Release.Name }}-minio-deployment
labels:
app: minio
app: {{ .Release.Name }}-minio
spec:
replicas: 1
selector:
matchLabels:
app: minio
app: {{ .Release.Name }}-minio
template:
metadata:
labels:
app: minio
app: {{ .Release.Name }}-minio
spec:
containers:
- name: minio
- name: {{ .Release.Name }}-minio
image: minio/minio
ports:
- containerPort: 9000
Expand All @@ -34,13 +34,13 @@ spec:
volumes:
- name: minio-storage
persistentVolumeClaim:
claimName: minio-pv-claim
claimName: {{ .Release.Name }}-minio-pv-claim

---
apiVersion: v1
kind: Service
metadata:
name: minio
name: {{ .Release.Name }}-minio
spec:
type: NodePort
ports:
Expand All @@ -53,13 +53,13 @@ spec:
protocol: TCP
name: console
selector:
app: minio
app: {{ .Release.Name }}-minio

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minio-ingress
name: {{ .Release.Name }}-minio-ingress
annotations:
kubernetes.io/ingress.class: nginx
spec:
Expand All @@ -72,16 +72,16 @@ spec:
pathType: Prefix
backend:
service:
name: minio
name: {{ .Release.Name }}-minio
port:
name: console
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: local-pv-minio
name: {{ .Release.Name }}-local-pv-minio
labels:
type: minio
type: {{ .Release.Name }}-minio
spec:
capacity:
storage: 5G
Expand All @@ -105,7 +105,7 @@ spec:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio-pv-claim
name: {{ .Release.Name }}-minio-pv-claim
spec:
accessModes:
- ReadWriteMany
Expand All @@ -115,5 +115,5 @@ spec:
storageClassName: "{{.Values.mediaProvider.storage.storageClassName}}"
selector:
matchLabels:
type: minio
type: {{ .Release.Name }}-minio
{{- end }}
10 changes: 5 additions & 5 deletions opensource/templates/nginx/nginx-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-configmap
name: {{ .Release.Name }}-nginx-configmap
data:
proxy-body-size: 10m
nginx.conf: |
Expand All @@ -26,7 +26,7 @@ data:
proxy_cache_path /opt/bitnami/nginx/cache levels=1:2 keys_zone=zone1:10m max_size=1g inactive=24h use_temp_path=off;
server {
listen 8080;
server_name nginx;
server_name {{ .Release.Name }}-nginx;
proxy_cache zone1;
proxy_cache_valid any 1m;
Expand All @@ -51,15 +51,15 @@ data:
deny all;
}
add_header X-Cache-Status $upstream_cache_status;
proxy_pass http://nginx-purge-service;
proxy_pass http://{{ .Release.Name }}-nginx-purge-service;
}
location ~ ^{{ if hasKey .Values.mediaProvider "apiPrefix" }}{{ .Values.mediaProvider.apiPrefix }}{{ .Values.mediaProvider.routes.files.get }}{{ else }}{{ .Values.mediaProvider.routes.files.get }}{{ end }} {
limit_except GET {
deny all;
}
add_header X-Cache-Status $upstream_cache_status;
proxy_pass http://nginx-purge-service;
proxy_pass http://{{ .Release.Name }}-nginx-purge-service;
}
location ~ /purge(/.*) {
limit_except GET {
Expand All @@ -68,7 +68,7 @@ data:
proxy_cache_valid 200 302 0s;
proxy_no_cache 1;
proxy_cache_bypass 1;
proxy_pass http://nginx-purge-service;
proxy_pass http://{{ .Release.Name }}-nginx-purge-service;
}
location / {
return 200;
Expand Down
12 changes: 6 additions & 6 deletions opensource/templates/nginx/nginx-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
name: {{ .Release.Name }}-nginx
labels:
app: nginx
app: {{ .Release.Name }}-nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
app: {{ .Release.Name }}-nginx
template:
metadata:
labels:
app: nginx
app: {{ .Release.Name }}-nginx
spec:
containers:
- name: nginx
- name: {{ .Release.Name }}-nginx
image: bitnami/nginx:latest
ports:
- containerPort: 8080
Expand All @@ -37,7 +37,7 @@ spec:
emptyDir: {}
- name: nginx-config-volume
configMap:
name: nginx-configmap
name: {{ .Release.Name }}-nginx-configmap
items:
- key: nginx.conf
path: nginx.conf
42 changes: 21 additions & 21 deletions opensource/templates/nginx/nginx-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
name: {{ .Release.Name }}-nginx-ingress
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{- range $key, $value := .Values.ingress.nginx.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.ingress.tls }}
ingressClassName: {{ .Values.ingress.nginx.className }}
{{- if .Values.ingress.nginx.tls }}
tls:
- hosts:
- {{ .Values.env }}{{ .Values.domain }}
secretName: {{ .Release.Name }}-tls-certificate
{{- end }}
rules:
- host: '{{ .Values.env }}{{ .Values.domain }}'
http:
paths:
- path: {{ if hasKey .Values.mediaProvider "apiPrefix" }}{{ .Values.mediaProvider.apiPrefix }}/assets/media{{ else }}/assets/media{{ end }}
pathType: ImplementationSpecific
backend:
service:
name: nginx
port:
number: 80
- path: {{ if hasKey .Values.mediaProvider "apiPrefix" }}{{ .Values.mediaProvider.apiPrefix }}/catalog{{ else }}/catalog{{ end }}
pathType: ImplementationSpecific
backend:
service:
name: nginx
port:
number: 80
- host: '{{ .Values.env }}{{ .Values.domain }}'
http:
paths:
- path: {{ if hasKey .Values.mediaProvider "apiPrefix" }}{{ .Values.mediaProvider.apiPrefix }}/assets/media{{ else }}/assets/media{{ end }}
pathType: ImplementationSpecific
backend:
service:
name: nginx
port:
number: 80
- path: {{ if hasKey .Values.mediaProvider "apiPrefix" }}{{ .Values.mediaProvider.apiPrefix }}/catalog{{ else }}/catalog{{ end }}
pathType: ImplementationSpecific
backend:
service:
name: nginx
port:
number: 80
8 changes: 4 additions & 4 deletions opensource/templates/nginx/nginx-purge-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-purge-configmap
name: {{ .Release.Name }}-nginx-purge-configmap
data:
proxy-body-size: 10m
nginx.conf: |
Expand All @@ -26,7 +26,7 @@ data:
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=zone2:10m max_size=1g inactive=24h use_temp_path=off;
server {
listen 8081;
server_name nginx-purge;
server_name {{ .Release.Name }}-nginx-purge;
proxy_cache zone2;
proxy_cache_key $request_uri;
Expand Down Expand Up @@ -55,15 +55,15 @@ data:
proxy_no_cache 1;
proxy_cache_bypass 1;
add_header X-Cache-Status $upstream_cache_status;
proxy_pass {{ .Values.mediaProvider.service }};
proxy_pass {{ include "mediaService" . }};
}
location ~ ^{{ if hasKey .Values.mediaProvider "apiPrefix" }}{{ .Values.mediaProvider.apiPrefix }}{{ .Values.mediaProvider.routes.files.get }}{{ else }}{{ .Values.mediaProvider.routes.files.get }}{{ end }} {
limit_except GET {
deny all;
}
add_header X-Cache-Status $upstream_cache_status;
proxy_pass {{ .Values.mediaProvider.service }};
proxy_pass {{ include "mediaService" . }};
}
location ~ /purge(/.*) {
limit_except GET {
Expand Down
Loading

0 comments on commit cdccebf

Please sign in to comment.