This commit is contained in:
		
							
								
								
									
										67
									
								
								helm-charts/harbor/templates/portal/configmap.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								helm-charts/harbor/templates/portal/configmap.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| apiVersion: v1 | ||||
| kind: ConfigMap | ||||
| metadata: | ||||
|   name: "{{ template "harbor.portal" . }}" | ||||
|   labels: | ||||
| {{ include "harbor.labels" . | indent 4 }} | ||||
| data: | ||||
|   nginx.conf: |+ | ||||
|     worker_processes auto; | ||||
|     pid /tmp/nginx.pid; | ||||
|     events { | ||||
|         worker_connections  1024; | ||||
|     } | ||||
|     http { | ||||
|         client_body_temp_path /tmp/client_body_temp; | ||||
|         proxy_temp_path /tmp/proxy_temp; | ||||
|         fastcgi_temp_path /tmp/fastcgi_temp; | ||||
|         uwsgi_temp_path /tmp/uwsgi_temp; | ||||
|         scgi_temp_path /tmp/scgi_temp; | ||||
|         server { | ||||
|     {{- if .Values.internalTLS.enabled }} | ||||
|             {{- if .Values.ipFamily.ipv4.enabled}} | ||||
|             listen {{ template "harbor.portal.containerPort" . }} ssl; | ||||
|             {{- end }} | ||||
|             {{- if .Values.ipFamily.ipv6.enabled}} | ||||
|             listen [::]:{{ template "harbor.portal.containerPort" . }} ssl; | ||||
|             {{- end }} | ||||
|             # SSL | ||||
|             ssl_certificate /etc/harbor/ssl/portal/tls.crt; | ||||
|             ssl_certificate_key /etc/harbor/ssl/portal/tls.key; | ||||
|  | ||||
|             # Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html | ||||
|             ssl_protocols TLSv1.2 TLSv1.3; | ||||
|             {{- if .Values.internalTLS.strong_ssl_ciphers }} | ||||
|             ssl_ciphers ECDHE+AESGCM:DHE+AESGCM:ECDHE+RSA+SHA256:DHE+RSA+SHA256:!AES128; | ||||
|             {{ else }} | ||||
|             ssl_ciphers '!aNULL:kECDH+AESGCM:ECDH+AESGCM:RSA+AESGCM:kECDH+AES:ECDH+AES:RSA+AES:'; | ||||
|             {{- end }} | ||||
|             ssl_prefer_server_ciphers on; | ||||
|             ssl_session_cache shared:SSL:10m; | ||||
|     {{- else }} | ||||
|             {{- if .Values.ipFamily.ipv4.enabled }} | ||||
|             listen {{ template "harbor.portal.containerPort" . }}; | ||||
|             {{- end }} | ||||
|             {{- if .Values.ipFamily.ipv6.enabled}} | ||||
|             listen [::]:{{ template "harbor.portal.containerPort" . }}; | ||||
|             {{- end }} | ||||
|     {{- end }} | ||||
|             server_name  localhost; | ||||
|             root   /usr/share/nginx/html; | ||||
|             index  index.html index.htm; | ||||
|             include /etc/nginx/mime.types; | ||||
|             gzip on; | ||||
|             gzip_min_length 1000; | ||||
|             gzip_proxied expired no-cache no-store private auth; | ||||
|             gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; | ||||
|             location /devcenter-api-2.0 { | ||||
|                 try_files $uri $uri/ /swagger-ui-index.html; | ||||
|             } | ||||
|             location / { | ||||
|                 try_files $uri $uri/ /index.html; | ||||
|             } | ||||
|             location = /index.html { | ||||
|                 add_header Cache-Control "no-store, no-cache, must-revalidate"; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
							
								
								
									
										114
									
								
								helm-charts/harbor/templates/portal/deployment.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								helm-charts/harbor/templates/portal/deployment.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,114 @@ | ||||
| apiVersion: apps/v1 | ||||
| kind: Deployment | ||||
| metadata: | ||||
|   name: "{{ template "harbor.portal" . }}" | ||||
|   labels: | ||||
| {{ include "harbor.labels" . | indent 4 }} | ||||
|     component: portal | ||||
| spec: | ||||
|   replicas: {{ .Values.portal.replicas }} | ||||
|   revisionHistoryLimit: {{ .Values.portal.revisionHistoryLimit }} | ||||
|   selector: | ||||
|     matchLabels: | ||||
| {{ include "harbor.matchLabels" . | indent 6 }} | ||||
|       component: portal | ||||
|   template: | ||||
|     metadata: | ||||
|       labels: | ||||
| {{ include "harbor.matchLabels" . | indent 8 }} | ||||
|         component: portal | ||||
| {{- if .Values.portal.podLabels }} | ||||
| {{ toYaml .Values.portal.podLabels | indent 8 }} | ||||
| {{- end }} | ||||
|       annotations: | ||||
| {{- if and .Values.internalTLS.enabled (eq .Values.internalTLS.certSource "auto") }} | ||||
|         checksum/tls: {{ include (print $.Template.BasePath "/internal/auto-tls.yaml") . | sha256sum }} | ||||
| {{- else if and .Values.internalTLS.enabled (eq .Values.internalTLS.certSource "manual") }} | ||||
|         checksum/tls: {{ include (print $.Template.BasePath "/portal/tls.yaml") . | sha256sum }} | ||||
| {{- end }} | ||||
|         checksum/configmap: {{ include (print $.Template.BasePath "/portal/configmap.yaml") . | sha256sum }}   | ||||
| {{- if .Values.portal.podAnnotations }} | ||||
| {{ toYaml .Values.portal.podAnnotations | indent 8 }} | ||||
| {{- end }} | ||||
|     spec: | ||||
|       securityContext: | ||||
|         runAsUser: 10000 | ||||
|         fsGroup: 10000 | ||||
|       {{- with .Values.imagePullSecrets }} | ||||
|       imagePullSecrets: | ||||
|         {{- toYaml . | nindent 8 }} | ||||
|       {{- end }} | ||||
| {{- if .Values.portal.serviceAccountName }} | ||||
|       serviceAccountName: {{ .Values.portal.serviceAccountName }} | ||||
| {{- end }} | ||||
|       automountServiceAccountToken: {{ .Values.portal.automountServiceAccountToken | default false }} | ||||
| {{- with .Values.portal.topologySpreadConstraints}} | ||||
|       topologySpreadConstraints: | ||||
| {{- range . }} | ||||
|       - {{ . | toYaml | indent 8 | trim }} | ||||
|         labelSelector: | ||||
|           matchLabels: | ||||
| {{ include "harbor.matchLabels" $ | indent 12 }} | ||||
|             component: portal | ||||
| {{- end }} | ||||
| {{- end }} | ||||
|       containers: | ||||
|       - name: portal | ||||
|         image: {{ .Values.portal.image.repository }}:{{ .Values.portal.image.tag }} | ||||
|         imagePullPolicy: {{ .Values.imagePullPolicy }} | ||||
| {{- if .Values.portal.resources }} | ||||
|         resources: | ||||
| {{ toYaml .Values.portal.resources | indent 10 }} | ||||
| {{- end }} | ||||
| {{- with .Values.portal.extraEnvVars }} | ||||
|         env: | ||||
| {{- toYaml . | nindent 10 }} | ||||
| {{- end }} | ||||
|         livenessProbe: | ||||
|           httpGet: | ||||
|             path: / | ||||
|             scheme: {{ include "harbor.component.scheme" . | upper }} | ||||
|             port: {{ template "harbor.portal.containerPort" . }} | ||||
|           initialDelaySeconds: 300 | ||||
|           periodSeconds: 10 | ||||
|         readinessProbe: | ||||
|           httpGet: | ||||
|             path: / | ||||
|             scheme: {{ include "harbor.component.scheme" . | upper }} | ||||
|             port: {{ template "harbor.portal.containerPort" . }} | ||||
|           initialDelaySeconds: 1 | ||||
|           periodSeconds: 10 | ||||
|         ports: | ||||
|         - containerPort: {{ template "harbor.portal.containerPort" . }} | ||||
|         volumeMounts: | ||||
|         - name: portal-config | ||||
|           mountPath: /etc/nginx/nginx.conf | ||||
|           subPath: nginx.conf | ||||
|         {{- if .Values.internalTLS.enabled }} | ||||
|         - name: portal-internal-certs | ||||
|           mountPath: /etc/harbor/ssl/portal | ||||
|         {{- end }} | ||||
|       volumes: | ||||
|       - name: portal-config | ||||
|         configMap: | ||||
|           name: "{{ template "harbor.portal" . }}" | ||||
|       {{- if .Values.internalTLS.enabled }} | ||||
|       - name: portal-internal-certs | ||||
|         secret: | ||||
|           secretName: {{ template "harbor.internalTLS.portal.secretName" . }} | ||||
|       {{- end }} | ||||
|     {{- with .Values.portal.nodeSelector }} | ||||
|       nodeSelector: | ||||
| {{ toYaml . | indent 8 }} | ||||
|     {{- end }} | ||||
|     {{- with .Values.portal.affinity }} | ||||
|       affinity: | ||||
| {{ toYaml . | indent 8 }} | ||||
|     {{- end }} | ||||
|     {{- with .Values.portal.tolerations }} | ||||
|       tolerations: | ||||
| {{ toYaml . | indent 8 }} | ||||
|     {{- end }} | ||||
|     {{- if .Values.portal.priorityClassName }} | ||||
|       priorityClassName: {{ .Values.portal.priorityClassName }} | ||||
|     {{- end }} | ||||
							
								
								
									
										16
									
								
								helm-charts/harbor/templates/portal/service.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								helm-charts/harbor/templates/portal/service.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| apiVersion: v1 | ||||
| kind: Service | ||||
| metadata: | ||||
|   name: "{{ template "harbor.portal" . }}" | ||||
|   labels: | ||||
| {{ include "harbor.labels" . | indent 4 }} | ||||
| spec: | ||||
| {{- if or  (eq .Values.expose.ingress.controller "gce") (eq .Values.expose.ingress.controller "alb") (eq .Values.expose.ingress.controller "f5-bigip") }} | ||||
|   type: NodePort | ||||
| {{- end }} | ||||
|   ports: | ||||
|     - port: {{ template "harbor.portal.servicePort" . }} | ||||
|       targetPort: {{ template "harbor.portal.containerPort" . }} | ||||
|   selector: | ||||
| {{ include "harbor.matchLabels" . | indent 4 }} | ||||
|     component: portal | ||||
							
								
								
									
										15
									
								
								helm-charts/harbor/templates/portal/tls.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								helm-charts/harbor/templates/portal/tls.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| {{- if and .Values.internalTLS.enabled }} | ||||
| {{- if eq .Values.internalTLS.certSource "manual" }} | ||||
| apiVersion: v1 | ||||
| kind: Secret | ||||
| metadata: | ||||
|   name: "{{ template "harbor.internalTLS.portal.secretName" . }}" | ||||
|   labels: | ||||
| {{ include "harbor.labels" . | indent 4 }} | ||||
| type: kubernetes.io/tls | ||||
| data: | ||||
|   ca.crt: {{ (required "The \"internalTLS.trustCa\" is required!" .Values.internalTLS.trustCa) | b64enc | quote }} | ||||
|   tls.crt: {{ (required "The \"internalTLS.portal.crt\" is required!" .Values.internalTLS.portal.crt) | b64enc | quote }} | ||||
|   tls.key: {{ (required "The \"internalTLS.portal.key\" is required!" .Values.internalTLS.portal.key) | b64enc | quote }} | ||||
| {{- end }} | ||||
| {{- end }} | ||||
		Reference in New Issue
	
	Block a user