From b832ea9c800eb2444566fd0d2771723c9fa45903 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sat, 6 Nov 2021 16:38:54 +0100 Subject: [PATCH] feat(common): introduce simplePVC and simplyHP aliasses for persistence types (#1286) * feat(common): introduce simplePVC and simplyHP aliasses for persistence types * correct a mistake * more fixes --- .../ci/simple-persistence-values.yaml | 107 +++++++++ charts/library/common/Chart.yaml | 2 +- .../common/templates/lib/chart/_values.tpl | 14 +- charts/library/common/values.yaml | 4 +- templates/questions/persistenceList.yaml | 204 +++++++++--------- 5 files changed, 227 insertions(+), 104 deletions(-) create mode 100644 charts/library/common-test/ci/simple-persistence-values.yaml diff --git a/charts/library/common-test/ci/simple-persistence-values.yaml b/charts/library/common-test/ci/simple-persistence-values.yaml new file mode 100644 index 00000000000..ba4a9db6919 --- /dev/null +++ b/charts/library/common-test/ci/simple-persistence-values.yaml @@ -0,0 +1,107 @@ +image: + repository: traefik/whoami + pullPolicy: IfNotPresent + tag: v1.6.1@sha256:2c52bb2c848038a33e40415c300b655d7976bafaf033ecf4a6679cb9e1715917 + +service: + main: + ports: + main: + port: 8080 + +args: + - --port + - '8080' + +ingress: + main: + enabled: true + +probes: + liveness: + enabled: true + readiness: + enabled: true + startup: + enabled: true + + +persistence: + simple-pvc: + enabled: true + annotationsList: [] + annotations: {} + labelsList: [] + labels: {} + type: simplePVC + forceName: "" + mountPath: + readOnly: false + nameOverride: + storageClass: + existingClaim: + subPath: + accessMode: ReadWriteOnce + size: 1Gi + retain: false + simple-hostpath: + enabled: true + type: simpleHP + hostPath: /usr + mountPath: + hostPathType: "" + readOnly: false + +"ixCertificateAuthorities": {} +"ixCertificates": + "1": + "CA_type_existing": false + "CA_type_intermediate": false + "CA_type_internal": false + "CSR": "" + "DN": "/C=US/O=iXsystems/CN=localhost/emailAddress=info@ixsystems.com/ST=Tennessee/L=Maryville/subjectAltName=DNS:localhost" + "cert_type": "CERTIFICATE" + "cert_type_CSR": false + "cert_type_existing": true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3wey7ggzMS7KyNBOvx5QBJRw3PJGn\n+THfhXvdfkOyeUC6KWRGLgl+/zBFvgh6vFDq3jmv0NI4ehVBTBMCJn7r6577S16T\nwtgKMCooizII0Odu5HIF10gTieFIH3PQYm9JBji9iyemb9Ht3wn7fXQptfGadz/l\nWz/Dv9+a6IOr7JVJMHnqAIvPzpkav4efuVPOX1zbhjg4K5g+nRYfjr5F5upOd0Y3\nznWTUBUyI7CXRkpHtSDXfEqKgnk/8uv7GWw+hyKr\n-----END CERTIFICATE-----\n" + "certificate_path": "/etc/certificates/freenas_default.crt" + "chain": false + "chain_list": [ + "-----BEGIN CERTIFICATE-----\nMIIDqjCCApKgAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgDELMAkGA1UEBhMCVVMx\nEjAQBgNVBAoMCWlYc3lzdGVtczESMBAGA1UEAwwJbG9jYWxob3N0MSEwHwYJKoZI\nhvcNAQkBFhJpbmZvQGl4c3lzdGVtcy5jb20xEjAQBgNVBAgMCVRlbm5lc3NlZTES\nMBAGA1UEBwwJTWFyeXZpbGxlMB4XDTIwMDkyNTE0MDUzOFoXDTIyMTIyOTE0MDUz\nOFowgYAxCzAJBgNVBAYTAlVTMRIwEAYDVQQKDAlpWHN5c3RlbXMxEjAQBgNVBAMM\nCWxvY2FsaG9zdDEhMB8GCSqGSIb3DQEJARYSaW5mb0BpeHN5c3RlbXMuY29tMRIw\nEAYDVQQIDAlUZW5uZXNzZWUxEjAQBgNVBAcMCU1hcnl2aWxsZTCCASIwDQYJKoZI\nhvcNAQEBBQADggEPADCCAQoCggEBALpoGliii6X8DeoFdLcR7jjsfJIn3nC8f1pT\nLQ3RURHUOEyhPT3Z6TkhaHeHoj8D6kiXROhyJJq3kw5OeqGZisfpGQhkxjpxkfh9\nfAhlvhuLwCWHaMvSh1TaT+h9+eHfcx3un5CIaH8b1KYRBMH+jmKFpr7jkPNkBXLS\nMA7jKIIa8pD9R6lF4gAsbqJafCbT3R7bqkd9xp3n3j2YhqQzETU2lmu4fra3BPio\nofK47kSkguUC6mtk6VrDf2+QtCKlY0dtbF3e2ZBNWo1aj86sjCtoEmqOCMsPRLc/\nXwQcfEqHY4XfafXwqk0G0UxV2ce18xKoR/pN3MpLBZ65NzPnpn0CAwEAAaMtMCsw\nFAYDVR0RBA0wC4IJbG9jYWxob3N0MBMGA1UdJQQMMAoGCCsGAQUFBwMBMA0GCSqG\nSIb3DQEBCwUAA4IBAQBFW1R037y7wllg/gRk9p2T1stiG8iIXosblmL4Ak1YToTQ\n/0to5GY2ZYW29+rbA4SDTS5eeu2YqZ0A/fF3wey7ggzMS7KyNBOvx5QBJRw3PJGn\n+THfhXvdfkOyeUC6KWRGLgl+/zBFvgh6vFDq3jmv0NI4ehVBTBMCJn7r6577S16T\nwtgKMCooizII0Odu5HIF10gTieFIH3PQYm9JBji9iyemb9Ht3wn7fXQptfGadz/l\nWz/Dv9+a6IOr7JVJMHnqAIvPzpkav4efuVPOX1zbhjg4K5g+nRYfjr5F5upOd0Y3\nznWTUBUyI7CXRkpHtSDXfEqKgnk/8uv7GWw+hyKr\n-----END CERTIFICATE-----\n" + ] + "city": "Maryville" + "common": "localhost" + "country": "US" + "csr_path": "/etc/certificates/freenas_default.csr" + "digest_algorithm": "SHA256" + "email": "info@ixsystems.com" + "extensions": + "ExtendedKeyUsage": "TLS Web Server Authentication" + "SubjectAltName": "DNS:localhost" + "fingerprint": "9C:5A:1D:1B:E7:9E:0B:89:2B:37:F4:19:83:ED:3C:6B:D8:14:0D:9B" + "from": "Fri Sep 25 16:05:38 2020" + "id": 1 + "internal": "NO" + "issuer": "external" + "key_length": 2048 + "key_type": "RSA" + "lifetime": 825 + "name": "freenas_default" + "organization": "iXsystems" + "organizational_unit": "" + "parsed": true + "privatekey": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC6aBpYooul/A3q\nBXS3Ee447HySJ95wvH9aUy0N0VER1DhMoT092ek5IWh3h6I/A+p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xCtHNmGHK03mo9orwsdWXtRBmk69jJDpnT1F5VKZWMAe\n7MRNaEmXMZm+8CvALgIQx8qMp2mnUPsA6Ea+9gg6/MPTdeWe5UXZiC0pAoGAGtSt\nPJfBXBNrklruYjORo3DRo5GYThVHQRFjl2orNKltsVxfIwgCw1ortEgPBgOwY0mu\ndkwP2V+qPeTVk+PQAqUk+gF6yLXtiUzeDiYMWHpeB+y81VSH9jfM0oELA/m7T/03\naYnEmE+BI8kKC6dvMBlDeisKdneQJFZRP0hfrC8CgYEAgYIyCGwcydKpe2Nkj0Fz\nKTtCMC/k4DvJfd5Kb9AbmrPUfKgA9Xj4GT6yPG6uBMi8r5etvLCKJ2x2NtN024a8\nQJLATYPrSsaZkE+9zM0j5nYAgbKpxBhlDzDAzn//3ByVzfgJ25S80XhTI2lfbLH/\nU07ssxdZaQCo+WuD82OvNcg=\n-----END PRIVATE KEY-----\n" + "privatekey_path": "/etc/certificates/freenas_default.key" + "revoked": false + "revoked_date": "" + "root_path": "/etc/certificates" + "san": [ + "DNS:localhost" + ] + "serial": 1 + "signedby": "" + "state": "Tennessee" + "subject_name_hash": 3193428416 + "type": 8 + "until": "Thu Dec 29 15:05:38 2022" diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index e9c07ca9a8c..f7474d4ed9c 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 8.4.0 +version: 8.5.0 diff --git a/charts/library/common/templates/lib/chart/_values.tpl b/charts/library/common/templates/lib/chart/_values.tpl index 4adfba70f3f..20176464d18 100644 --- a/charts/library/common/templates/lib/chart/_values.tpl +++ b/charts/library/common/templates/lib/chart/_values.tpl @@ -90,7 +90,6 @@ {{- end }} {{- end }} - {{/* merge ingressList with ingress */}} {{- $ingDict := dict }} {{- range $index, $item := .Values.ingressList -}} @@ -248,9 +247,22 @@ {{- $_ := set .Values.securityContext.capabilities "add" $CapAdd -}} {{- end }} + {{- range .Values.persistence }} + {{- if .type }} + {{- if eq .type "simplePVC" }} + {{- $_ := set . "type" "pvc" }} + {{- end }} + {{- if eq .type "simpleHP" }} + {{- $_ := set . "type" "hostPath" }} + {{- end }} + {{- end }} + {{- end }} + {{- range .Values.service }} + {{- if .type }} {{- if eq .type "Simple" }} {{- $_ := set . "type" "LoadBalancer" }} {{- end }} {{- end }} + {{- end }} {{- end -}} diff --git a/charts/library/common/values.yaml b/charts/library/common/values.yaml index a8b6c8f0ede..eae4d1b2803 100644 --- a/charts/library/common/values.yaml +++ b/charts/library/common/values.yaml @@ -565,7 +565,7 @@ persistence: labels: {} # -- Sets the persistence type - # Valid options are pvc, emptyDir, hostPath or custom + # Valid options are: simplePVC, simpleHP, pvc, emptyDir, hostPath or custom type: pvc # -- force the complete PVC name @@ -602,7 +602,7 @@ persistence: accessMode: ReadWriteOnce # -- The amount of storage that is requested for the persistent volume. - size: 1Gi + size: 999Gi # - Set to true to retain the PVC upon `helm uninstall` retain: false diff --git a/templates/questions/persistenceList.yaml b/templates/questions/persistenceList.yaml index cbe44efa0b6..63c742bab3c 100644 --- a/templates/questions/persistenceList.yaml +++ b/templates/questions/persistenceList.yaml @@ -16,6 +16,110 @@ type: boolean default: true hidden: true + - variable: type + label: "Type of Storage" + description: "Sets the persistence type, Anything other than PVC could break rollback!"" + schema: + type: string + default: "simpleHP" + enum: + - value: "simplePVC" + description: "PVC (simple)" + - value: "simpleHP" + description: "HostPath (simple)" + - value: "emptyDir" + description: "emptyDir" + - value: "pvc" + description: "pvc" + - value: "hostPath" + description: "hostPath" + - variable: setPermissions + label: "Automatic Permissions" + description: "Automatically set permissions on install" + schema: + show_if: [["type", "=", "hostPath"],["type", "=", simpleHP]] + type: boolean + default: true + - variable: readOnly + label: "readOnly" + schema: + type: boolean + default: false + - variable: hostPath + label: "hostPath" + description: "Path inside the container the storage is mounted" + schema: + show_if: [["type", "=", "hostPath"],["type", "=", simpleHP]] + type: hostpath + - variable: mountPath + label: "mountPath" + description: "Path inside the container the storage is mounted" + schema: + type: string + default: "" + required: true + valid_chars: '^\/([a-zA-Z0-9._-]+\/?)+$' + - variable: medium + label: "EmptyDir Medium" + schema: + show_if: [["type", "=", "emptyDir"]] + type: string + default: "" + enum: + - value: "" + description: "Default" + - value: "Memory" + description: "Memory" + - variable: size + label: "Size quotum of storage" + schema: + show_if: [["type", "=", "pvc"],["type", "=", simplePVC]] + type: string + default: "100Gi" + - variable: hostPathType + label: "(Advanced) hostPath Type" + schema: + show_if: [["type", "=", "hostPath"]] + type: string + default: "" + enum: + - value: "" + description: "Default" + - value: "DirectoryOrCreate" + description: "DirectoryOrCreate" + - value: "Directory" + description: "Directory" + - value: "FileOrCreate" + description: "FileOrCreate" + - value: "File" + description: "File" + - value: "Socket" + description: "Socket" + - value: "CharDevice" + description: "CharDevice" + - value: "BlockDevice" + description: "BlockDevice" + - variable: storageClass + label: "(Advanced) storageClass" + description: "Warning: Anything other than SCALE-ZFS or empty will break rollback!" + schema: + show_if: [["type", "=", "pvc"]] + type: string + default: "SCALE-ZFS" + - variable: accessMode + label: "(Advanced) Access Mode" + description: "Allow or disallow multiple PVC's writhing to the same PV" + schema: + show_if: [["type", "=", "pvc"]] + type: string + default: "ReadWriteOnce" + enum: + - value: "ReadWriteOnce" + description: "ReadWriteOnce" + - value: "ReadOnlyMany" + description: "ReadOnlyMany" + - value: "ReadWriteMany" + description: "ReadWriteMany" - variable: advanced label: "Show Advanced Options" schema: @@ -61,103 +165,3 @@ label: "Value" schema: type: string - - variable: type - label: "(Advanced) Type of Storage" - description: "Sets the persistence type" - schema: - type: string - default: "hostPath" - enum: - - value: "pvc" - description: "pvc" - - value: "emptyDir" - description: "emptyDir" - - value: "hostPath" - description: "hostPath" - - variable: storageClass - label: "(Advanced) storageClass" - description: "Warning: Anything other than SCALE-ZFS will break rollback!" - schema: - show_if: [["type", "=", "pvc"]] - type: string - default: "SCALE-ZFS" - - variable: setPermissions - label: "Automatic Permissions" - description: "Automatically set permissions on install" - schema: - show_if: [["type", "=", "hostPath"]] - type: boolean - default: true - - variable: readOnly - label: "readOnly" - schema: - type: boolean - default: false - - variable: hostPath - label: "hostPath" - description: "Path inside the container the storage is mounted" - schema: - show_if: [["type", "=", "hostPath"]] - type: hostpath - - variable: hostPathType - label: "(Advanced) hostPath Type" - schema: - show_if: [["type", "=", "hostPath"]] - type: string - default: "" - enum: - - value: "" - description: "Default" - - value: "DirectoryOrCreate" - description: "DirectoryOrCreate" - - value: "Directory" - description: "Directory" - - value: "FileOrCreate" - description: "FileOrCreate" - - value: "File" - description: "File" - - value: "Socket" - description: "Socket" - - value: "CharDevice" - description: "CharDevice" - - value: "BlockDevice" - description: "BlockDevice" - - variable: mountPath - label: "mountPath" - description: "Path inside the container the storage is mounted" - schema: - type: string - default: "" - required: true - valid_chars: '^\/([a-zA-Z0-9._-]+\/?)+$' - - variable: medium - label: "EmptyDir Medium" - schema: - show_if: [["type", "=", "emptyDir"]] - type: string - default: "" - enum: - - value: "" - description: "Default" - - value: "Memory" - description: "Memory" - - variable: accessMode - label: "(Advanced) Access Mode" - description: "Allow or disallow multiple PVC's writhing to the same PV" - schema: - show_if: [["type", "=", "pvc"]] - type: string - default: "ReadWriteOnce" - enum: - - value: "ReadWriteOnce" - description: "ReadWriteOnce" - - value: "ReadOnlyMany" - description: "ReadOnlyMany" - - value: "ReadWriteMany" - description: "ReadWriteMany" - - variable: size - label: "Size quotum of storage" - schema: - show_if: [["type", "=", "pvc"]] - type: string - default: "100Gi"