Skip to content

Commit

Permalink
fix: remove dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweaver87 committed Jan 8, 2025
1 parent b280dd2 commit 4da2fa0
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 107 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ traefik/tests/__snapshot__:
test: traefik/tests/__snapshot__
docker run ${DOCKER_ARGS} --entrypoint /bin/sh --rm -v $(CURDIR):/charts -w /charts $(IMAGE_HELM_UNITTEST) /charts/hack/test.sh

deps:
helm dependency update traefik

lint:
docker run ${DOCKER_ARGS} --env GIT_SAFE_DIR="true" --entrypoint /bin/sh --rm -v $(CURDIR):/charts -w /charts $(IMAGE_CHART_TESTING) /charts/hack/ct.sh lint

Expand Down
34 changes: 23 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,38 @@ New major version indicates that there is an incompatible breaking change.

### Upgrade to 34.X

Starting from this release, the new traefik helm CRD management which works around [Helm caveats](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations) system is enabled by default:
Starting from this release, a new chart has been published to help users managing traefik CRD. It works around [Helm caveats](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations).
This chart is comes aside main traefik chart.

To install those two charts from scratch:

```bash
# Update repository
helm repo update
# See current Chart & Traefik version
helm search repo traefik/traefik
# Change CRDs ownership
kubectl get customresourcedefinitions.apiextensions.k8s.io -o name | grep traefik.io | xargs kubectl patch --type='json' -p='[{"op": "add", "path": "/metadata/labels", "value": {"app.kubernetes.io/managed-by":"Helm"}},{"op": "add", "path": "/metadata/annotations/meta.helm.sh~1release-name", "value":"traefik"},{"op": "add", "path": "/metadata/annotations/meta.helm.sh~1release-namespace", "value":"traefik"}]'
# If you use gateway API, you might also want to change Gateway API ownership
kubectl get customresourcedefinitions.apiextensions.k8s.io -o name | grep gateway.networking.k8s.io | xargs kubectl patch --type='json' -p='[{"op": "add", "path": "/metadata/labels", "value": {"app.kubernetes.io/managed-by":"Helm"}},{"op": "add", "path": "/metadata/annotations/meta.helm.sh~1release-name", "value":"traefik"},{"op": "add", "path": "/metadata/annotations/meta.helm.sh~1release-namespace", "value":"traefik"}]'
# Upgrade Traefik
helm upgrade traefik traefik/traefik
# Install traefik-crds chart
helm install traefik-crds traefik/traefik-crds -n traefik --create-namespace
# Install traefik but skip crds installation
helm install traefik traefik/traefik -n traefik --create-namespace --skip-crds

# Check that both charts are installed:
helm list -n traefik
# NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
# traefik traefik 1 2025-01-08 15:37:24.918465001 +0100 CET deployed traefik-33.2.1 v3.2.3
# traefik-crds traefik 1 2025-01-08 15:37:18.863333527 +0100 CET deployed traefik-crds-0.0.1
```

If you still want to manage CRDs your self, it can be opt-out:

To upgrade from an already installed chart:
```bash
# Upgrade Traefik and skip all CRDs installation
helm upgrade traefik traefik/traefik --set traefik-crds.enabled=true --set traefik-crds.traefik=false --set traefik-crds.hub=false --set traefik-crds.gatewayAPI=false
# Update repository
helm repo update
# Change CRDs ownership
kubectl get customresourcedefinitions.apiextensions.k8s.io -o name | grep traefik.io | xargs kubectl patch --type='json' -p='[{"op": "add", "path": "/metadata/labels", "value": {"app.kubernetes.io/managed-by":"Helm"}},{"op": "add", "path": "/metadata/annotations/meta.helm.sh~1release-name", "value":"traefik-crds"},{"op": "add", "path": "/metadata/annotations/meta.helm.sh~1release-namespace", "value":"traefik-crds"}]'
# If you use gateway API, you might also want to change Gateway API ownership
kubectl get customresourcedefinitions.apiextensions.k8s.io -o name | grep gateway.networking.k8s.io | xargs kubectl patch --type='json' -p='[{"op": "add", "path": "/metadata/labels", "value": {"app.kubernetes.io/managed-by":"Helm"}},{"op": "add", "path": "/metadata/annotations/meta.helm.sh~1release-name", "value":"traefik-crds"},{"op": "add", "path": "/metadata/annotations/meta.helm.sh~1release-namespace", "value":"traefik"}]'
# Upgrade Traefik
helm install traefik-crds traefik/traefik-crds -n traefik
```

### Upgrade up to 27.X
Expand Down
4 changes: 1 addition & 3 deletions traefik-crds/VALUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ Kubernetes: `>=1.22.0-0`
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| deleteOnUninstall | bool | `false` | |
| enabled | bool | `true` | |
| gatewayAPI | bool | `false` | |
| global | string | `nil` | |
| hub | bool | `false` | |
| traefik | bool | `false` | |
| traefik | bool | `true` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
28 changes: 6 additions & 22 deletions traefik-crds/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,19 @@
kind: Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
resources:
<<<<<<< HEAD
# curl -o crds-files/gateway_api/gateway-standard-install.yaml -L https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/standard-install.yaml
- crds-files/gateway_api/gateway-standard-install.yaml
- crds-files/hub.traefik.io_accesscontrolpolicies.yaml
- crds-files/hub.traefik.io_aiservices.yaml
- crds-files/hub.traefik.io_apiaccesses.yaml
- crds-files/hub.traefik.io_apibundles.yaml
- crds-files/hub.traefik.io_apicatalogitems.yaml
- crds-files/hub.traefik.io_apiplans.yaml
- crds-files/hub.traefik.io_apiportals.yaml
- crds-files/hub.traefik.io_apiratelimits.yaml
- crds-files/hub.traefik.io_apis.yaml
- crds-files/hub.traefik.io_apiversions.yaml
- crds-files/hub.traefik.io_managedsubscriptions.yaml
=======
# curl -o gateway-standard-install-v1.2.0.yaml -L https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml
- crds-files/gatewayAPI/gateway-standard-install-v1.2.0.yaml
# curl -o crds-files/gatewayAPI/gateway-standard-install.yaml -L https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/standard-install.yaml
- crds-files/gatewayAPI/gateway-standard-install.yaml
- crds-files/hub/hub.traefik.io_accesscontrolpolicies.yaml
- crds-files/hub/hub.traefik.io_aiservices.yaml
- crds-files/hub/hub.traefik.io_apiaccesses.yaml
- crds-files/hub/hub.traefik.io_apibundles.yaml
- crds-files/hub/hub.traefik.io_apicatalogitems.yaml
- crds-files/hub/hub.traefik.io_apiplans.yaml
- crds-files/hub/hub.traefik.io_managedsubscriptions.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_managedsubscriptions.yaml
>>>>>>> b296543 (fix: rename gateway api + add enabled flag)
- crds-files/hub/hub.traefik.io_apiplans.yaml
- crds-files/hub/hub.traefik.io_apibundles.yaml
- crds-files/hub/hub.traefik.io_aiservices.yaml
- crds-files/traefik/traefik.io_ingressroutes.yaml
- crds-files/traefik/traefik.io_ingressroutetcps.yaml
- crds-files/traefik/traefik.io_ingressrouteudps.yaml
Expand Down
10 changes: 4 additions & 6 deletions traefik-crds/tests/crds_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ suite: CRDs
templates:
- crds.yaml
tests:
- it: shouldn't have any crds by default
asserts:
- hasDocuments:
count: 0

- it: should have all Traefik crds
- it: should have all Traefik crds by default
set:
traefik: true
asserts:
Expand All @@ -27,6 +22,7 @@ tests:

- it: should have all Traefik Hub crds
set:
traefik: false
hub: true
asserts:
- hasDocuments:
Expand All @@ -45,6 +41,7 @@ tests:

- it: should have all Gateway API crds
set:
traefik: false
gatewayAPI: true
asserts:
- hasDocuments:
Expand All @@ -63,6 +60,7 @@ tests:

- it: should have all Gateway API crds without helm keep resource policy
set:
traefik: false
gatewayAPI: true
deleteOnUninstall: true
asserts:
Expand Down
10 changes: 0 additions & 10 deletions traefik-crds/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@
"deleteOnUninstall": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
},
"gatewayAPI": {
"default": false,
"type": [
"string",
"boolean"
]
},
"global": {
"additionalProperties": true,
"type": [
"object",
"null"
]
},
"hub": {
"default": false,
"type": [
Expand Down
4 changes: 1 addition & 3 deletions traefik-crds/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
global: # @schema type:[object, null]; additionalProperties: true
enabled: true
traefik: false
traefik: true
gatewayAPI: false # @schema type:[string, boolean]; default: false
hub: false # @schema type:[string, boolean]; default: false
deleteOnUninstall: false
5 changes: 0 additions & 5 deletions traefik/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,3 @@ annotations:
artifacthub.io/changes: |
- "fix(Gateway API): CRDs should only be defined once"
- "chore(release): 🚀 publish v33.2.1"
dependencies:
- name: traefik-crds
version: 0.0.1
repository: https://traefik.github.io/charts
condition: traefik-crds.enabled
8 changes: 0 additions & 8 deletions traefik/VALUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ A Traefik based Kubernetes ingress controller

Kubernetes: `>=1.22.0-0`

| Repository | Name | Version |
|------------|------|---------|
| https://traefik.github.io/charts | traefik-crds | 0.0.1 |

## Values

| Key | Type | Default | Description |
Expand Down Expand Up @@ -324,10 +320,6 @@ Kubernetes: `>=1.22.0-0`
| tracing.safeQueryParams | list | `[]` | By default, all query parameters are redacted. Defines the list of query parameters to not redact. |
| tracing.sampleRate | string | `nil` | The proportion of requests to trace, specified between 0.0 and 1.0. Default: 1.0. |
| tracing.serviceName | string | `nil` | Service name used in selected backend. Default: traefik. |
| traefik-crds.enabled | bool | `false` | Set it to true to opt-in CRD management |
| traefik-crds.gatewayAPI | string | `"{{- tpl \".Values.providers.kubernetesGateway.enabled\" . }}\n"` | |
| traefik-crds.hub | string | `"{{- tpl \"and .Values.hub.token .Values.hub.apimanagement.enabled\"' . }}\n"` | |
| traefik-crds.traefik | bool | `true` | Set all the following to false if you want to manage CRDs your-self |
| updateStrategy.rollingUpdate.maxSurge | int | `1` | |
| updateStrategy.rollingUpdate.maxUnavailable | int | `0` | |
| updateStrategy.type | string | `"RollingUpdate"` | Customize updateStrategy of Deployment or DaemonSet |
Expand Down
25 changes: 0 additions & 25 deletions traefik/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1672,31 +1672,6 @@
},
"type": "object"
},
"traefik-crds": {
"properties": {
"enabled": {
"type": "boolean"
},
"gatewayAPI": {
"default": false,
"type": [
"string",
"boolean"
]
},
"hub": {
"default": false,
"type": [
"string",
"boolean"
]
},
"traefik": {
"type": "boolean"
}
},
"type": "object"
},
"updateStrategy": {
"additionalProperties": false,
"properties": {
Expand Down
11 changes: 0 additions & 11 deletions traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -965,14 +965,3 @@ hub:
insecureSkipVerify: false
# Enable export of errors logs to the platform. Default: true.
sendlogs: # @schema type:[boolean, null]

traefik-crds:
# -- Set it to true to opt-in CRD management
enabled: false

# -- Set all the following to false if you want to manage CRDs your-self
traefik: true
hub: | # @schema type:[string, boolean]; default: false
{{- tpl "and .Values.hub.token .Values.hub.apimanagement.enabled"' . }}
gatewayAPI: | # @schema type:[string, boolean]; default: false
{{- tpl ".Values.providers.kubernetesGateway.enabled" . }}

0 comments on commit 4da2fa0

Please sign in to comment.