Skip to content

Commit

Permalink
feat: 📦 add separated chart for CRDs
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweaver87 committed Oct 14, 2024
1 parent 12fee7e commit b674cf7
Show file tree
Hide file tree
Showing 33 changed files with 208 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
1 change: 1 addition & 0 deletions hack/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

/usr/bin/helm unittest --color ./traefik;
/usr/bin/helm unittest --color ./traefik-crds;
23 changes: 23 additions & 0 deletions traefik-crds/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
23 changes: 23 additions & 0 deletions traefik-crds/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
- name: charlie-haley
email: [email protected]
- name: darkweaver87
email: [email protected]
- name: jnoordsij
icon: https://raw.githubusercontent.com/traefik/traefik/v2.3/docs/content/assets/img/traefik.logo.png
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions traefik-crds/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions traefik-crds/templates/crds.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
53 changes: 53 additions & 0 deletions traefik-crds/tests/crds_test.yaml
Original file line number Diff line number Diff line change
@@ -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)$
3 changes: 3 additions & 0 deletions traefik-crds/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
traefik: false
gateway_api: false
hub: false
6 changes: 6 additions & 0 deletions traefik/Chart.lock
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions traefik/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Binary file added traefik/charts/traefik-crds-0.0.1.tgz
Binary file not shown.
24 changes: 0 additions & 24 deletions traefik/crds/kustomization.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions traefik/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 8 additions & 0 deletions traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \"\" . }}

0 comments on commit b674cf7

Please sign in to comment.