From 0a736846ab354d589a3a2307bcd6d300adf2d677 Mon Sep 17 00:00:00 2001 From: Yoel Spotts Date: Thu, 23 Jan 2020 12:47:32 -0500 Subject: [PATCH] kong: add Helm3 CRD support From #10 --- charts/kong/Chart.yaml | 2 +- charts/kong/README.md | 5 + .../crds/custom-resource-definitions.yaml | 278 +++++++++++++++++ .../custom-resource-definitions.yaml | 290 +----------------- 4 files changed, 288 insertions(+), 287 deletions(-) create mode 100644 charts/kong/crds/custom-resource-definitions.yaml diff --git a/charts/kong/Chart.yaml b/charts/kong/Chart.yaml index 36ce10003..27ce21ec4 100644 --- a/charts/kong/Chart.yaml +++ b/charts/kong/Chart.yaml @@ -10,5 +10,5 @@ maintainers: email: harry@konghq.com name: kong sources: -version: 1.0.1 +version: 1.0.2 appVersion: 1.4 diff --git a/charts/kong/README.md b/charts/kong/README.md index 76146762d..b8b12d786 100644 --- a/charts/kong/README.md +++ b/charts/kong/README.md @@ -253,6 +253,7 @@ section of `values.yaml` file: | image.tag | Version of the ingress controller | 0.7.0 | | readinessProbe | Kong ingress controllers readiness probe | | | livenessProbe | Kong ingress controllers liveness probe | | +| installCRDs | Create CRDs. Regardless of value of this, Helm v3+ will install the CRDs if those are not present already. Use `--skip-crds` with `helm install` if you want to skip CRD creation. | true | | env | Specify Kong Ingress Controller configuration via environment variables | | | ingressClass | The ingress-class value for controller | kong | | admissionWebhook.enabled | Whether to enable the validating admission webhook | false | @@ -463,6 +464,10 @@ value is your SMTP password. ## Changelog +### 1.0.2 + +Helm 3 support: CRDs are declared in crds directory. Backward compatible support for helm 2. + ### 1.0.1 Fixed invalid namespace variable name causing ServiceAccount and Role to be generated in other namespace than desired. diff --git a/charts/kong/crds/custom-resource-definitions.yaml b/charts/kong/crds/custom-resource-definitions.yaml new file mode 100644 index 000000000..40b840da1 --- /dev/null +++ b/charts/kong/crds/custom-resource-definitions.yaml @@ -0,0 +1,278 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: kongconsumers.configuration.konghq.com +spec: + group: configuration.konghq.com + version: v1 + scope: Namespaced + names: + kind: KongConsumer + plural: kongconsumers + shortNames: + - kc + additionalPrinterColumns: + - name: Username + type: string + description: Username of a Kong Consumer + JSONPath: .username + - name: Age + type: date + description: Age + JSONPath: .metadata.creationTimestamp + validation: + openAPIV3Schema: + properties: + username: + type: string + custom_id: + type: string + credentials: + type: array + items: + type: string +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: kongcredentials.configuration.konghq.com +spec: + group: configuration.konghq.com + version: v1 + scope: Namespaced + names: + kind: KongCredential + plural: kongcredentials + additionalPrinterColumns: + - name: Credential-type + type: string + description: Type of credential + JSONPath: .type + - name: Age + type: date + description: Age + JSONPath: .metadata.creationTimestamp + - name: Consumer-Ref + type: string + description: Owner of the credential + JSONPath: .consumerRef + validation: + openAPIV3Schema: + required: + - consumerRef + - type + properties: + consumerRef: + type: string + type: + type: string +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: kongplugins.configuration.konghq.com +spec: + group: configuration.konghq.com + version: v1 + scope: Namespaced + names: + kind: KongPlugin + plural: kongplugins + shortNames: + - kp + additionalPrinterColumns: + - name: Plugin-Type + type: string + description: Name of the plugin + JSONPath: .plugin + - name: Age + type: date + description: Age + JSONPath: .metadata.creationTimestamp + - name: Disabled + type: boolean + description: Indicates if the plugin is disabled + JSONPath: .disabled + priority: 1 + - name: Config + type: string + description: Configuration of the plugin + JSONPath: .config + priority: 1 + validation: + openAPIV3Schema: + required: + - plugin + properties: + plugin: + type: string + disabled: + type: boolean + config: + type: object + run_on: + type: string + enum: + - first + - second + - all + protocols: + type: array + items: + type: string + enum: + - http + - https + - tcp + - tls + - grpc + - grpcs +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: kongingresses.configuration.konghq.com +spec: + group: configuration.konghq.com + version: v1 + scope: Namespaced + names: + kind: KongIngress + plural: kongingresses + shortNames: + - ki + validation: + openAPIV3Schema: + properties: + route: + properties: + methods: + type: array + items: + type: string + headers: + type: object + additionalProperties: + type: array + items: + type: string + regex_priority: + type: integer + strip_path: + type: boolean + preserve_host: + type: boolean + protocols: + type: array + items: + type: string + enum: + - http + - https + - grpc + - grpcs + https_redirect_status_code: + type: integer + proxy: + type: object + properties: + protocol: + type: string + enum: + - http + - https + - grpc + - grpcs + path: + type: string + pattern: ^/.*$ + retries: + type: integer + minimum: 0 + connect_timeout: + type: integer + minimum: 0 + read_timeout: + type: integer + minimum: 0 + write_timeout: + type: integer + minimum: 0 + upstream: + type: object + properties: + algorithm: + type: string + enum: + - "round-robin" + - "consistent-hashing" + - "least-connections" + host_header: + type: string + hash_on: + type: string + hash_on_cookie: + type: string + hash_on_cookie_path: + type: string + hash_on_header: + type: string + hash_fallback_header: + type: string + hash_fallback: + type: string + slots: + type: integer + minimum: 10 + healthchecks: + type: object + properties: + active: + type: object + properties: + concurrency: + type: integer + minimum: 1 + timeout: + type: integer + minimum: 0 + http_path: + type: string + pattern: ^/.*$ + healthy: &healthy + type: object + properties: + http_statuses: + type: array + items: + type: integer + interval: + type: integer + minimum: 0 + successes: + type: integer + minimum: 0 + unhealthy: &unhealthy + type: object + properties: + http_failures: + type: integer + minimum: 0 + http_statuses: + type: array + items: + type: integer + interval: + type: integer + minimum: 0 + tcp_failures: + type: integer + minimum: 0 + timeout: + type: integer + minimum: 0 + passive: + type: object + properties: + healthy: *healthy + unhealthy: *unhealthy diff --git a/charts/kong/templates/custom-resource-definitions.yaml b/charts/kong/templates/custom-resource-definitions.yaml index 5f20d41b9..3426ec808 100644 --- a/charts/kong/templates/custom-resource-definitions.yaml +++ b/charts/kong/templates/custom-resource-definitions.yaml @@ -1,288 +1,6 @@ {{- if and .Values.ingressController.enabled .Values.ingressController.installCRDs -}} -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: kongconsumers.configuration.konghq.com - labels: - {{- include "kong.metaLabels" . | nindent 4 }} -spec: - group: configuration.konghq.com - version: v1 - scope: Namespaced - names: - kind: KongConsumer - plural: kongconsumers - shortNames: - - kc - additionalPrinterColumns: - - name: Username - type: string - description: Username of a Kong Consumer - JSONPath: .username - - name: Age - type: date - description: Age - JSONPath: .metadata.creationTimestamp - validation: - openAPIV3Schema: - properties: - username: - type: string - custom_id: - type: string - credentials: - type: array - items: - type: string +{{- range $path, $bytes := .Files.Glob "crds/*.yaml" }} +{{ $.Files.Get $path }} --- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: kongcredentials.configuration.konghq.com - labels: - {{- include "kong.metaLabels" . | nindent 4 }} -spec: - group: configuration.konghq.com - version: v1 - scope: Namespaced - names: - kind: KongCredential - plural: kongcredentials - additionalPrinterColumns: - - name: Credential-type - type: string - description: Type of credential - JSONPath: .type - - name: Age - type: date - description: Age - JSONPath: .metadata.creationTimestamp - - name: Consumer-Ref - type: string - description: Owner of the credential - JSONPath: .consumerRef - validation: - openAPIV3Schema: - required: - - consumerRef - - type - properties: - consumerRef: - type: string - type: - type: string ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: kongplugins.configuration.konghq.com - labels: - {{- include "kong.metaLabels" . | nindent 4 }} -spec: - group: configuration.konghq.com - version: v1 - scope: Namespaced - names: - kind: KongPlugin - plural: kongplugins - shortNames: - - kp - additionalPrinterColumns: - - name: Plugin-Type - type: string - description: Name of the plugin - JSONPath: .plugin - - name: Age - type: date - description: Age - JSONPath: .metadata.creationTimestamp - - name: Disabled - type: boolean - description: Indicates if the plugin is disabled - JSONPath: .disabled - priority: 1 - - name: Config - type: string - description: Configuration of the plugin - JSONPath: .config - priority: 1 - validation: - openAPIV3Schema: - required: - - plugin - properties: - plugin: - type: string - disabled: - type: boolean - config: - type: object - run_on: - type: string - enum: - - first - - second - - all - protocols: - type: array - items: - type: string - enum: - - http - - https - - tcp - - tls - - grpc - - grpcs ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: kongingresses.configuration.konghq.com - labels: - {{- include "kong.metaLabels" . | nindent 4 }} -spec: - group: configuration.konghq.com - version: v1 - scope: Namespaced - names: - kind: KongIngress - plural: kongingresses - shortNames: - - ki - validation: - openAPIV3Schema: - properties: - route: - properties: - methods: - type: array - items: - type: string - headers: - type: object - additionalProperties: - type: array - items: - type: string - regex_priority: - type: integer - strip_path: - type: boolean - preserve_host: - type: boolean - protocols: - type: array - items: - type: string - enum: - - http - - https - - grpc - - grpcs - https_redirect_status_code: - type: integer - proxy: - type: object - properties: - protocol: - type: string - enum: - - http - - https - - grpc - - grpcs - path: - type: string - pattern: ^/.*$ - retries: - type: integer - minimum: 0 - connect_timeout: - type: integer - minimum: 0 - read_timeout: - type: integer - minimum: 0 - write_timeout: - type: integer - minimum: 0 - upstream: - type: object - properties: - algorithm: - type: string - enum: - - "round-robin" - - "consistent-hashing" - - "least-connections" - host_header: - type: string - hash_on: - type: string - hash_on_cookie: - type: string - hash_on_cookie_path: - type: string - hash_on_header: - type: string - hash_fallback_header: - type: string - hash_fallback: - type: string - slots: - type: integer - minimum: 10 - healthchecks: - type: object - properties: - active: - type: object - properties: - concurrency: - type: integer - minimum: 1 - timeout: - type: integer - minimum: 0 - http_path: - type: string - pattern: ^/.*$ - healthy: &healthy - type: object - properties: - http_statuses: - type: array - items: - type: integer - interval: - type: integer - minimum: 0 - successes: - type: integer - minimum: 0 - unhealthy: &unhealthy - type: object - properties: - http_failures: - type: integer - minimum: 0 - http_statuses: - type: array - items: - type: integer - interval: - type: integer - minimum: 0 - tcp_failures: - type: integer - minimum: 0 - timeout: - type: integer - minimum: 0 - passive: - type: object - properties: - healthy: *healthy - unhealthy: *unhealthy -{{- end -}} +{{- end }} +{{- end }}