Skip to content

Commit

Permalink
Add "subPath" and "resourcePolicy"
Browse files Browse the repository at this point in the history
1. The "subPath" specifies the directory used inside PVC
2. The "resourcePolicy" is used to avoid removing PVCs during a helm delete operation

Signed-off-by: Wenkai Yin <yinw@vmware.com>
  • Loading branch information
ywk253100 authored and scottrigby committed Mar 7, 2019
1 parent e5ba606 commit e8066c9
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ The following tables lists the configurable parameters of the Harbor chart and t
| ----------------------- | ---------------------------------- | ----------------------- |
| **Harbor** |
| `persistence.enabled` | Persistent data | `true` |
| `persistence.resourcePolicy` | Setting it to "keep" to avoid removing PVCs during a helm delete operation. Leaving it empty will delete PVCs after the chart deleted | `keep` |
| `externalURL` | Ther external URL for Harbor core service | `https://core.harbor.domain` |
| `harborAdminPassword` | The password of system admin | `Harbor12345` |
| `secretkey` | The key used for encryption. Must be a string of 16 chars | `not-a-secure-key` |
Expand Down
1 change: 1 addition & 0 deletions templates/chartmuseum/chartmuseum-dpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ spec:
volumeMounts:
- name: chartmuseum-data
mountPath: /chart_storage
subPath: {{ .Values.chartmuseum.volumes.data.subPath }}
volumes:
- name: chartmuseum-data
persistentVolumeClaim:
Expand Down
4 changes: 4 additions & 0 deletions templates/chartmuseum/chartmuseum-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "harbor.fullname" . }}-chartmuseum
{{- if eq .Values.persistence.resourcePolicy "keep" }}
annotations:
helm.sh/resource-policy: keep
{{- end }}
labels:
{{ include "harbor.labels" . | indent 4 }}
component: chartmuseum
Expand Down
1 change: 1 addition & 0 deletions templates/database/database-ss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spec:
volumeMounts:
- name: database-data
mountPath: /var/lib/postgresql/data
subPath: {{ .Values.database.internal.volumes.data.subPath }}
{{- if not .Values.persistence.enabled }}
volumes:
- name: "database-data"
Expand Down
1 change: 1 addition & 0 deletions templates/jobservice/jobservice-dpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ spec:
subPath: config.yml
- name: job-logs
mountPath: /var/log/jobs
subPath: {{ .Values.jobservice.volumes.data.subPath }}
volumes:
- name: jobservice-config
configMap:
Expand Down
4 changes: 4 additions & 0 deletions templates/jobservice/jobservice-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "harbor.fullname" . }}-jobservice
{{- if eq .Values.persistence.resourcePolicy "keep" }}
annotations:
helm.sh/resource-policy: keep
{{- end }}
labels:
{{ include "harbor.labels" . | indent 4 }}
component: jobservice
Expand Down
1 change: 1 addition & 0 deletions templates/redis/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
volumeMounts:
- name: data
mountPath: /var/lib/redis
subPath: {{ .Values.redis.internal.volumes.data.subPath }}
{{- if not .Values.persistence.enabled }}
volumes:
- name: data
Expand Down
2 changes: 2 additions & 0 deletions templates/registry/registry-dpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ spec:
{{- if and .Values.persistence.enabled (eq .Values.storage.type "filesystem") }}
- name: registry-data
mountPath: {{ .Values.storage.filesystem.rootdirectory }}
subPath: {{ .Values.registry.volumes.data.subPath }}
{{- end }}
- name: registry-root-certificate
mountPath: /etc/registry/root.crt
Expand Down Expand Up @@ -67,6 +68,7 @@ spec:
{{- if and .Values.persistence.enabled (eq .Values.storage.type "filesystem") }}
- name: registry-data
mountPath: {{ .Values.storage.filesystem.rootdirectory }}
subPath: {{ .Values.registry.volumes.data.subPath }}
{{- end }}
- name: registry-config
mountPath: /etc/registry/config.yml
Expand Down
4 changes: 4 additions & 0 deletions templates/registry/registry-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "harbor.fullname" . }}-registry
{{- if eq .Values.persistence.resourcePolicy "keep" }}
annotations:
helm.sh/resource-policy: keep
{{- end }}
labels:
{{ include "harbor.labels" . | indent 4 }}
component: registry
Expand Down
10 changes: 9 additions & 1 deletion values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
persistence:
enabled: true
# Setting it to "keep" to avoid removing PVCs during a helm delete
# operation. Leaving it empty will delete PVCs after the chart deleted
resourcePolicy: keep
# Ther external URL for Harbor core service. It is used to
# 1) populate the docker/helm commands showed on portal
# 2) populate the token service URL returned to docker/notary client
Expand Down Expand Up @@ -116,6 +119,7 @@ jobservice:
data:
# existingClaim: ""
# storageClass: "-"
subPath: "jobservice"
accessMode: ReadWriteOnce
size: 1Gi
# resources:
Expand Down Expand Up @@ -153,6 +157,7 @@ database:
data:
# existingClaim: ""
# storageClass: "-"
subPath: "database"
accessMode: ReadWriteOnce
size: 1Gi
# resources:
Expand Down Expand Up @@ -189,6 +194,7 @@ registry:
data:
# existingClaim: ""
# storageClass: "-"
subPath: "registry"
accessMode: ReadWriteOnce
size: 5Gi
# resources:
Expand All @@ -209,6 +215,7 @@ chartmuseum:
data:
# existingClaim: ""
# storageClass: "-"
subPath: "chartmuseum"
accessMode: ReadWriteOnce
size: 5Gi
# resources:
Expand All @@ -227,7 +234,7 @@ storage:
# "oss" and fill the information needed in the corresponding section
type: filesystem
filesystem:
rootdirectory: /var/lib/registry
rootdirectory: /storage
#maxthreads: 100
azure:
accountname: accountname
Expand Down Expand Up @@ -314,6 +321,7 @@ redis:
data:
# existingClaim: ""
# storageClass: "-"
subPath: "redis"
accessMode: ReadWriteOnce
size: 1Gi
# resources:
Expand Down

0 comments on commit e8066c9

Please # to comment.