diff --git a/README.md b/README.md index cd963c199..160b8f4b7 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ helm repo update # See current Chart & Traefik version helm search repo traefik/traefik # Update CRDs (Traefik Proxy v3 CRDs) -kubectl apply --server-side --force-conflicts -k https://github.com/traefik/traefik-helm-chart/traefik/crds/ +kubectl apply --server-side --force-conflicts -k https://github.com/traefik/traefik-helm-chart/traefik-crds/ # Upgrade Traefik helm upgrade traefik traefik/traefik ``` diff --git a/hack/test.sh b/hack/test.sh index e71504fb1..49933bd06 100644 --- a/hack/test.sh +++ b/hack/test.sh @@ -1,3 +1,4 @@ #!/bin/bash /usr/bin/helm unittest --color ./traefik; +/usr/bin/helm unittest --color ./traefik-crds; diff --git a/traefik-crds/.helmignore b/traefik-crds/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/traefik-crds/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/traefik-crds/Chart.yaml b/traefik-crds/Chart.yaml new file mode 100644 index 000000000..ac4dc30f9 --- /dev/null +++ b/traefik-crds/Chart.yaml @@ -0,0 +1,23 @@ +apiVersion: v2 +name: traefik-crds +description: A Traefik based Kubernetes ingress controller +type: application +version: 0.0.1 +kubeVersion: ">=1.22.0-0" +keywords: + - traefik + - ingress + - networking +home: https://traefik.io/ +sources: + - https://github.com/traefik/traefik + - https://github.com/traefik/traefik-helm-chart +maintainers: + - name: mloiseleur + email: michel.loiseleur@traefik.io + - name: charlie-haley + email: charlie.haley@traefik.io + - name: darkweaver87 + email: remi.buisson@traefik.io + - name: jnoordsij +icon: https://raw.githubusercontent.com/traefik/traefik/v2.3/docs/content/assets/img/traefik.logo.png diff --git a/traefik/crds/gateway-standard-install-v1.1.0.yaml b/traefik-crds/crds-files/gateway/gateway-standard-install-v1.1.0.yaml similarity index 100% rename from traefik/crds/gateway-standard-install-v1.1.0.yaml rename to traefik-crds/crds-files/gateway/gateway-standard-install-v1.1.0.yaml diff --git a/traefik/crds/hub.traefik.io_accesscontrolpolicies.yaml b/traefik-crds/crds-files/hub/hub.traefik.io_accesscontrolpolicies.yaml similarity index 100% rename from traefik/crds/hub.traefik.io_accesscontrolpolicies.yaml rename to traefik-crds/crds-files/hub/hub.traefik.io_accesscontrolpolicies.yaml diff --git a/traefik/crds/hub.traefik.io_apiaccesses.yaml b/traefik-crds/crds-files/hub/hub.traefik.io_apiaccesses.yaml similarity index 100% rename from traefik/crds/hub.traefik.io_apiaccesses.yaml rename to traefik-crds/crds-files/hub/hub.traefik.io_apiaccesses.yaml diff --git a/traefik/crds/hub.traefik.io_apibundles.yaml b/traefik-crds/crds-files/hub/hub.traefik.io_apibundles.yaml similarity index 100% rename from traefik/crds/hub.traefik.io_apibundles.yaml rename to traefik-crds/crds-files/hub/hub.traefik.io_apibundles.yaml diff --git a/traefik/crds/hub.traefik.io_apiplans.yaml b/traefik-crds/crds-files/hub/hub.traefik.io_apiplans.yaml similarity index 100% rename from traefik/crds/hub.traefik.io_apiplans.yaml rename to traefik-crds/crds-files/hub/hub.traefik.io_apiplans.yaml diff --git a/traefik/crds/hub.traefik.io_apiportals.yaml b/traefik-crds/crds-files/hub/hub.traefik.io_apiportals.yaml similarity index 100% rename from traefik/crds/hub.traefik.io_apiportals.yaml rename to traefik-crds/crds-files/hub/hub.traefik.io_apiportals.yaml diff --git a/traefik/crds/hub.traefik.io_apiratelimits.yaml b/traefik-crds/crds-files/hub/hub.traefik.io_apiratelimits.yaml similarity index 100% rename from traefik/crds/hub.traefik.io_apiratelimits.yaml rename to traefik-crds/crds-files/hub/hub.traefik.io_apiratelimits.yaml diff --git a/traefik/crds/hub.traefik.io_apis.yaml b/traefik-crds/crds-files/hub/hub.traefik.io_apis.yaml similarity index 100% rename from traefik/crds/hub.traefik.io_apis.yaml rename to traefik-crds/crds-files/hub/hub.traefik.io_apis.yaml diff --git a/traefik/crds/hub.traefik.io_apiversions.yaml b/traefik-crds/crds-files/hub/hub.traefik.io_apiversions.yaml similarity index 100% rename from traefik/crds/hub.traefik.io_apiversions.yaml rename to traefik-crds/crds-files/hub/hub.traefik.io_apiversions.yaml diff --git a/traefik/crds/traefik.io_ingressroutes.yaml b/traefik-crds/crds-files/traefik/traefik.io_ingressroutes.yaml similarity index 100% rename from traefik/crds/traefik.io_ingressroutes.yaml rename to traefik-crds/crds-files/traefik/traefik.io_ingressroutes.yaml diff --git a/traefik/crds/traefik.io_ingressroutetcps.yaml b/traefik-crds/crds-files/traefik/traefik.io_ingressroutetcps.yaml similarity index 100% rename from traefik/crds/traefik.io_ingressroutetcps.yaml rename to traefik-crds/crds-files/traefik/traefik.io_ingressroutetcps.yaml diff --git a/traefik/crds/traefik.io_ingressrouteudps.yaml b/traefik-crds/crds-files/traefik/traefik.io_ingressrouteudps.yaml similarity index 100% rename from traefik/crds/traefik.io_ingressrouteudps.yaml rename to traefik-crds/crds-files/traefik/traefik.io_ingressrouteudps.yaml diff --git a/traefik/crds/traefik.io_middlewares.yaml b/traefik-crds/crds-files/traefik/traefik.io_middlewares.yaml similarity index 100% rename from traefik/crds/traefik.io_middlewares.yaml rename to traefik-crds/crds-files/traefik/traefik.io_middlewares.yaml diff --git a/traefik/crds/traefik.io_middlewaretcps.yaml b/traefik-crds/crds-files/traefik/traefik.io_middlewaretcps.yaml similarity index 100% rename from traefik/crds/traefik.io_middlewaretcps.yaml rename to traefik-crds/crds-files/traefik/traefik.io_middlewaretcps.yaml diff --git a/traefik/crds/traefik.io_serverstransports.yaml b/traefik-crds/crds-files/traefik/traefik.io_serverstransports.yaml similarity index 100% rename from traefik/crds/traefik.io_serverstransports.yaml rename to traefik-crds/crds-files/traefik/traefik.io_serverstransports.yaml diff --git a/traefik/crds/traefik.io_serverstransporttcps.yaml b/traefik-crds/crds-files/traefik/traefik.io_serverstransporttcps.yaml similarity index 100% rename from traefik/crds/traefik.io_serverstransporttcps.yaml rename to traefik-crds/crds-files/traefik/traefik.io_serverstransporttcps.yaml diff --git a/traefik/crds/traefik.io_tlsoptions.yaml b/traefik-crds/crds-files/traefik/traefik.io_tlsoptions.yaml similarity index 100% rename from traefik/crds/traefik.io_tlsoptions.yaml rename to traefik-crds/crds-files/traefik/traefik.io_tlsoptions.yaml diff --git a/traefik/crds/traefik.io_tlsstores.yaml b/traefik-crds/crds-files/traefik/traefik.io_tlsstores.yaml similarity index 100% rename from traefik/crds/traefik.io_tlsstores.yaml rename to traefik-crds/crds-files/traefik/traefik.io_tlsstores.yaml diff --git a/traefik/crds/traefik.io_traefikservices.yaml b/traefik-crds/crds-files/traefik/traefik.io_traefikservices.yaml similarity index 100% rename from traefik/crds/traefik.io_traefikservices.yaml rename to traefik-crds/crds-files/traefik/traefik.io_traefikservices.yaml diff --git a/traefik-crds/kustomization.yaml b/traefik-crds/kustomization.yaml new file mode 100644 index 000000000..d813194be --- /dev/null +++ b/traefik-crds/kustomization.yaml @@ -0,0 +1,24 @@ +--- +kind: Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +resources: + # curl -o gateway-standard-install-v1.1.0.yaml -L https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml + - crds-files/gateway/gateway-standard-install-v1.1.0.yaml + - crds-files/hub/hub.traefik.io_accesscontrolpolicies.yaml + - crds-files/hub/hub.traefik.io_apiaccesses.yaml + - crds-files/hub/hub.traefik.io_apiportals.yaml + - crds-files/hub/hub.traefik.io_apiratelimits.yaml + - crds-files/hub/hub.traefik.io_apis.yaml + - crds-files/hub/hub.traefik.io_apiversions.yaml + - crds-files/hub/hub.traefik.io_apiplans.yaml + - crds-files/hub/hub.traefik.io_apibundles.yaml + - crds-files/traefik/traefik.io_ingressroutes.yaml + - crds-files/traefik/traefik.io_ingressroutetcps.yaml + - crds-files/traefik/traefik.io_ingressrouteudps.yaml + - crds-files/traefik/traefik.io_middlewares.yaml + - crds-files/traefik/traefik.io_middlewaretcps.yaml + - crds-files/traefik/traefik.io_serverstransports.yaml + - crds-files/traefik/traefik.io_serverstransporttcps.yaml + - crds-files/traefik/traefik.io_tlsoptions.yaml + - crds-files/traefik/traefik.io_tlsstores.yaml + - crds-files/traefik/traefik.io_traefikservices.yaml diff --git a/traefik-crds/templates/crds.yaml b/traefik-crds/templates/crds.yaml new file mode 100644 index 000000000..84dcf5a01 --- /dev/null +++ b/traefik-crds/templates/crds.yaml @@ -0,0 +1,42 @@ +{{- if .Values.traefik -}} +{{- $files := .Files }} +{{- range tuple +"crds-files/traefik/traefik.io_ingressroutes.yaml" +"crds-files/traefik/traefik.io_ingressroutetcps.yaml" +"crds-files/traefik/traefik.io_ingressrouteudps.yaml" +"crds-files/traefik/traefik.io_middlewares.yaml" +"crds-files/traefik/traefik.io_middlewaretcps.yaml" +"crds-files/traefik/traefik.io_serverstransports.yaml" +"crds-files/traefik/traefik.io_serverstransporttcps.yaml" +"crds-files/traefik/traefik.io_tlsoptions.yaml" +"crds-files/traefik/traefik.io_tlsstores.yaml" +"crds-files/traefik/traefik.io_traefikservices.yaml" + }} +{{ $files.Get . }} +{{- end }} +{{- end }} + +{{- if .Values.hub -}} +{{- $files := .Files }} +{{- range tuple +"crds-files/hub/hub.traefik.io_accesscontrolpolicies.yaml" +"crds-files/hub/hub.traefik.io_apiaccesses.yaml" +"crds-files/hub/hub.traefik.io_apibundles.yaml" +"crds-files/hub/hub.traefik.io_apiplans.yaml" +"crds-files/hub/hub.traefik.io_apiportals.yaml" +"crds-files/hub/hub.traefik.io_apiratelimits.yaml" +"crds-files/hub/hub.traefik.io_apis.yaml" +"crds-files/hub/hub.traefik.io_apiversions.yaml" + }} +{{ $files.Get . }} +{{- end }} +{{- end }} + +{{- if .Values.gateway_api -}} +{{- $files := .Files }} +{{- range tuple +"crds-files/gateway/gateway-standard-install-v1.1.0.yaml" + }} +{{ $files.Get . }} +{{- end }} +{{- end }} diff --git a/traefik-crds/tests/crds_test.yaml b/traefik-crds/tests/crds_test.yaml new file mode 100644 index 000000000..deeef0b22 --- /dev/null +++ b/traefik-crds/tests/crds_test.yaml @@ -0,0 +1,53 @@ +suite: CRDs +templates: + - crds.yaml +tests: + - it: shouldn't have any crds by default + asserts: + - hasDocuments: + count: 0 + + - it: should have all Traefik crds + set: + traefik: true + asserts: + - hasDocuments: + count: 10 + - isKind: + of: CustomResourceDefinition + - equal: + path: spec.group + value: traefik.io + - matchRegex: + path: spec.names.kind + pattern: ^(IngressRoute|IngressRouteTCP|IngressRouteUDP|Middleware|MiddlewareTCP|ServersTransport|ServersTransportTCP|TLSOption|TLSStore|TraefikService)$ + + - it: should have all Traefik Hub crds + set: + hub: true + asserts: + - hasDocuments: + count: 8 + - isKind: + of: CustomResourceDefinition + - equal: + path: spec.group + value: hub.traefik.io + - matchRegex: + path: spec.names.kind + pattern: ^(AccessControlPolicy|APIAccess|APIBundle|APIPlan|APIPortal|APIRateLimit|API|APIVersion)$ + + - it: should have all Gateway API crds + set: + gateway_api: true + asserts: + - hasDocuments: + count: 5 + - isKind: + of: CustomResourceDefinition + - equal: + path: spec.group + value: gateway.networking.k8s.io + - matchRegex: + path: spec.names.kind + pattern: ^(GatewayClass|Gateway|GRPCRoute|HTTPRoute|ReferenceGrant)$ diff --git a/traefik-crds/values.yaml b/traefik-crds/values.yaml new file mode 100644 index 000000000..6daca116a --- /dev/null +++ b/traefik-crds/values.yaml @@ -0,0 +1,3 @@ +traefik: false +gateway_api: false +hub: false diff --git a/traefik/Chart.lock b/traefik/Chart.lock new file mode 100644 index 000000000..7a83ae7bb --- /dev/null +++ b/traefik/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: traefik-crds + repository: file://../traefik-crds + version: 0.0.1 +digest: sha256:03a8641bfa1d261b699d166dea5aaa21d9e27bfc2328d157dae3809375709260 +generated: "2024-10-11T17:04:46.473483814+02:00" diff --git a/traefik/Chart.yaml b/traefik/Chart.yaml index 6c217bc6f..8859228f8 100644 --- a/traefik/Chart.yaml +++ b/traefik/Chart.yaml @@ -29,3 +29,7 @@ annotations: - "feat(deps): update traefik docker tag to v3.1.5" - "feat(Traefik Proxy): update rbac following v3.2 migration guide" - "chore(release): 🚀 publish v32.1.0" +dependencies: + - name: traefik-crds + version: "0.0.1" + repository: "file://../traefik-crds" diff --git a/traefik/charts/traefik-crds-0.0.1.tgz b/traefik/charts/traefik-crds-0.0.1.tgz new file mode 100644 index 000000000..81b81708a Binary files /dev/null and b/traefik/charts/traefik-crds-0.0.1.tgz differ diff --git a/traefik/crds/kustomization.yaml b/traefik/crds/kustomization.yaml deleted file mode 100644 index 5a75eed6c..000000000 --- a/traefik/crds/kustomization.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -kind: Kustomization -apiVersion: kustomize.config.k8s.io/v1beta1 -resources: - # curl -o gateway-standard-install-v1.1.0.yaml -L https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.1.0/standard-install.yaml - - gateway-standard-install-v1.1.0.yaml - - hub.traefik.io_accesscontrolpolicies.yaml - - hub.traefik.io_apiaccesses.yaml - - hub.traefik.io_apiportals.yaml - - hub.traefik.io_apiratelimits.yaml - - hub.traefik.io_apis.yaml - - hub.traefik.io_apiversions.yaml - - hub.traefik.io_apiplans.yaml - - hub.traefik.io_apibundles.yaml - - traefik.io_ingressroutes.yaml - - traefik.io_ingressroutetcps.yaml - - traefik.io_ingressrouteudps.yaml - - traefik.io_middlewares.yaml - - traefik.io_middlewaretcps.yaml - - traefik.io_serverstransports.yaml - - traefik.io_serverstransporttcps.yaml - - traefik.io_tlsoptions.yaml - - traefik.io_tlsstores.yaml - - traefik.io_traefikservices.yaml diff --git a/traefik/values.schema.json b/traefik/values.schema.json index 8096cacae..db540946f 100644 --- a/traefik/values.schema.json +++ b/traefik/values.schema.json @@ -1607,6 +1607,26 @@ }, "type": "object" }, + "traefik-crds": { + "properties": { + "gateway_api": { + "type": [ + "boolean" + ] + }, + "hub": { + "type": [ + "boolean" + ] + }, + "traefik": { + "type": [ + "boolean" + ] + } + }, + "type": "object" + }, "updateStrategy": { "additionalProperties": false, "properties": { diff --git a/traefik/values.yaml b/traefik/values.yaml index 1e06245ea..0e7c30745 100644 --- a/traefik/values.yaml +++ b/traefik/values.yaml @@ -934,3 +934,11 @@ hub: insecureSkipVerify: false # Enable export of errors logs to the platform. Default: true. sendlogs: # @schema type:[boolean, null] + +traefik-crds: + # -- Set all the following to false if you want to manage CRDs your-self + traefik: true # @schema type:[boolean] + hub: | # @schema type:[boolean] + {{ tpl "ne .Values.hub.token \"\"' . }} + gateway_api: | # @schema type:[boolean] + {{ tpl "ne .Values.providers.kubernetesGateway.enabled \"\" . }}