From d054299ed0b3f9fe219bdb566b5a118322f331f8 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Mon, 12 Jan 2026 17:52:04 +0100 Subject: [PATCH 01/13] Bump github.com/go-acme/lego/v4 to v4.31.0 --- go.mod | 54 ++++++++++++++-------------- go.sum | 111 ++++++++++++++++++++++++++++++--------------------------- 2 files changed, 86 insertions(+), 79 deletions(-) diff --git a/go.mod b/go.mod index 379cba5f7..6adae18ed 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/traefik/traefik/v3 go 1.24.0 require ( - github.com/BurntSushi/toml v1.5.0 + github.com/BurntSushi/toml v1.6.0 github.com/Masterminds/sprig/v3 v3.2.3 github.com/abbot/go-http-auth v0.0.0-00010101000000-000000000000 // No tag on the repo. github.com/andybalholm/brotli v1.1.1 @@ -23,7 +23,7 @@ require ( github.com/docker/go-connections v0.5.0 github.com/fatih/structs v1.1.0 github.com/fsnotify/fsnotify v1.9.0 - github.com/go-acme/lego/v4 v4.30.1 + github.com/go-acme/lego/v4 v4.31.0 github.com/go-kit/kit v0.13.0 github.com/go-kit/log v0.2.1 github.com/golang/protobuf v1.5.4 @@ -103,7 +103,7 @@ require ( golang.org/x/text v0.32.0 golang.org/x/time v0.14.0 golang.org/x/tools v0.40.0 - google.golang.org/grpc v1.77.0 + google.golang.org/grpc v1.78.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.34.1 @@ -120,7 +120,7 @@ require ( ) require ( - cloud.google.com/go/auth v0.17.0 // indirect + cloud.google.com/go/auth v0.18.0 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect cloud.google.com/go/compute/metadata v0.9.0 // indirect dario.cat/mergo v1.0.1 // indirect @@ -153,7 +153,7 @@ require ( github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.13 // indirect github.com/alibabacloud-go/debug v1.0.1 // indirect - github.com/alibabacloud-go/tea v1.3.14 // indirect + github.com/alibabacloud-go/tea v1.4.0 // indirect github.com/alibabacloud-go/tea-utils/v2 v2.0.7 // indirect github.com/aliyun/credentials-go v1.4.7 // indirect github.com/armon/go-metrics v0.4.1 // indirect @@ -170,7 +170,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.41.5 // indirect github.com/aziontech/azionapi-go-sdk v0.144.0 // indirect - github.com/baidubce/bce-sdk-go v0.9.254 // indirect + github.com/baidubce/bce-sdk-go v0.9.256 // indirect github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blendle/zapdriver v1.3.1 // indirect @@ -196,7 +196,7 @@ require ( github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/evanphx/json-patch/v5 v5.9.11 // indirect - github.com/exoscale/egoscale/v3 v3.1.31 // indirect + github.com/exoscale/egoscale/v3 v3.1.33 // indirect github.com/fatih/color v1.18.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect @@ -204,7 +204,8 @@ require ( github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-gonic/gin v1.9.1 // indirect github.com/go-acme/alidns-20150109/v4 v4.7.0 // indirect - github.com/go-acme/esa-20240910/v2 v2.40.3 // indirect + github.com/go-acme/esa-20240910/v2 v2.44.0 // indirect + github.com/go-acme/jdcloud-sdk-go v1.64.0 // indirect github.com/go-acme/tencentclouddnspod v1.1.25 // indirect github.com/go-acme/tencentedgdeone v1.1.48 // indirect github.com/go-errors/errors v1.0.1 // indirect @@ -221,22 +222,23 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.23.0 // indirect - github.com/go-resty/resty/v2 v2.17.0 // indirect + github.com/go-resty/resty/v2 v2.17.1 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/go-zookeeper/zk v1.0.3 // indirect github.com/goccy/go-yaml v1.18.0 // indirect github.com/gofrs/flock v0.13.0 // indirect + github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.2 // indirect github.com/golang-jwt/jwt/v5 v5.3.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/go-querystring v1.1.0 // indirect + github.com/google/go-querystring v1.2.0 // indirect github.com/google/s2a-go v0.1.9 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.7 // indirect - github.com/googleapis/gax-go/v2 v2.15.0 // indirect + github.com/googleapis/gax-go/v2 v2.16.0 // indirect github.com/gophercloud/gophercloud v1.14.1 // indirect github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56 // indirect github.com/gravitational/trace v1.1.16-0.20220114165159-14a9a7dd6aaf // indirect @@ -251,7 +253,7 @@ require ( github.com/hashicorp/hcl v1.0.1-vault-5 // indirect github.com/hashicorp/serf v0.10.1 // indirect github.com/huandu/xstrings v1.5.0 // indirect - github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.180 // indirect + github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.182 // indirect github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect @@ -266,7 +268,7 @@ require ( github.com/labbsr0x/bindman-dns-webhook v1.0.2 // indirect github.com/labbsr0x/goh v1.0.1 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/linode/linodego v1.62.0 // indirect + github.com/linode/linodego v1.64.0 // indirect github.com/liquidweb/liquidweb-cli v0.6.9 // indirect github.com/liquidweb/liquidweb-go v1.6.4 // indirect github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect @@ -306,8 +308,8 @@ require ( github.com/nrdcg/mailinabox v0.3.0 // indirect github.com/nrdcg/namesilo v0.5.0 // indirect github.com/nrdcg/nodion v0.1.0 // indirect - github.com/nrdcg/oci-go-sdk/common/v1065 v1065.105.1 // indirect - github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.105.1 // indirect + github.com/nrdcg/oci-go-sdk/common/v1065 v1065.105.2 // indirect + github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.105.2 // indirect github.com/nrdcg/porkbun v0.4.0 // indirect github.com/nrdcg/vegadns v0.3.0 // indirect github.com/nzdjb/go-metaname v1.0.0 // indirect @@ -334,7 +336,7 @@ require ( github.com/sacloud/packages-go v0.0.12 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35 // indirect + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36 // indirect github.com/selectel/domains-go v1.1.0 // indirect github.com/selectel/go-selvpcclient/v4 v4.1.0 // indirect github.com/shirou/gopsutil/v3 v3.24.4 // indirect @@ -350,7 +352,7 @@ require ( github.com/spf13/viper v1.18.2 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.12 // indirect + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.28 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tjfoc/gmsm v1.4.1 // indirect @@ -360,12 +362,12 @@ require ( github.com/ultradns/ultradns-go-sdk v1.8.1-20250722213956-faef419 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/vinyldns/go-vinyldns v0.9.17 // indirect - github.com/volcengine/volc-sdk-golang v1.0.230 // indirect - github.com/vultr/govultr/v3 v3.26.0 // indirect + github.com/volcengine/volc-sdk-golang v1.0.233 // indirect + github.com/vultr/govultr/v3 v3.26.1 // indirect github.com/x448/float16 v0.8.4 // indirect - github.com/yandex-cloud/go-genproto v0.41.0 // indirect - github.com/yandex-cloud/go-sdk/services/dns v0.0.23 // indirect - github.com/yandex-cloud/go-sdk/v2 v2.33.0 // indirect + github.com/yandex-cloud/go-genproto v0.43.0 // indirect + github.com/yandex-cloud/go-sdk/services/dns v0.0.25 // indirect + github.com/yandex-cloud/go-sdk/v2 v2.37.0 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.etcd.io/etcd/api/v3 v3.6.4 // indirect @@ -392,10 +394,10 @@ require ( golang.org/x/oauth2 v0.34.0 // indirect golang.org/x/term v0.38.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/api v0.257.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 // indirect - google.golang.org/protobuf v1.36.10 // indirect + google.golang.org/api v0.259.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index 3b07f0174..bd9b937fd 100644 --- a/go.sum +++ b/go.sum @@ -13,8 +13,8 @@ cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKV cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/auth v0.17.0 h1:74yCm7hCj2rUyyAocqnFzsAYXgJhrG26XCFimrc/Kz4= -cloud.google.com/go/auth v0.17.0/go.mod h1:6wv/t5/6rOPAX4fJiRjKkJCvswLwdet7G8+UGXt7nCQ= +cloud.google.com/go/auth v0.18.0 h1:wnqy5hrv7p3k7cShwAU/Br3nzod7fxoqG+k0VZ+/Pk0= +cloud.google.com/go/auth v0.18.0/go.mod h1:wwkPM1AgE1f2u6dG443MiWoD8C3BtOywNsUMcUTVDRo= cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -98,8 +98,8 @@ github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mo github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 h1:XRzhVemXdgvJqCH0sFfrBUTnUJSBrBf7++ypk+twtRs= github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= -github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= +github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= @@ -168,8 +168,8 @@ github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy github.com/alibabacloud-go/tea v1.1.20/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= github.com/alibabacloud-go/tea v1.2.2/go.mod h1:CF3vOzEMAG+bR4WOql8gc2G9H3EkH3ZLAQdpmpXMgwk= github.com/alibabacloud-go/tea v1.3.13/go.mod h1:A560v/JTQ1n5zklt2BEpurJzZTI8TUT+Psg2drWlxRg= -github.com/alibabacloud-go/tea v1.3.14 h1:/Uzj5ZCFPpbPR+Bs7jfzsyXkYIVsi5TOIuQNOWwc/9c= -github.com/alibabacloud-go/tea v1.3.14/go.mod h1:A560v/JTQ1n5zklt2BEpurJzZTI8TUT+Psg2drWlxRg= +github.com/alibabacloud-go/tea v1.4.0 h1:MSKhu/kWLPX7mplWMngki8nNt+CyUZ+kfkzaR5VpMhA= +github.com/alibabacloud-go/tea v1.4.0/go.mod h1:A560v/JTQ1n5zklt2BEpurJzZTI8TUT+Psg2drWlxRg= github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE= github.com/alibabacloud-go/tea-utils/v2 v2.0.5/go.mod h1:dL6vbUT35E4F4bFTHL845eUloqaerYBYPsdWR2/jhe4= github.com/alibabacloud-go/tea-utils/v2 v2.0.7 h1:WDx5qW3Xa5ZgJ1c8NfqJkF6w+AU5wB8835UdhPr6Ax0= @@ -240,8 +240,8 @@ github.com/aws/smithy-go v1.24.0 h1:LpilSUItNPFr1eY85RYgTIg5eIEPtvFbskaFcmmIUnk= github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= github.com/aziontech/azionapi-go-sdk v0.144.0 h1:T+/w18o+FCiZsk3Z0ACBVVe7c/5EGLG15S3P8JfuPfo= github.com/aziontech/azionapi-go-sdk v0.144.0/go.mod h1:OKxP/R0iVXnJJakYwMhh2BGAXnud8Ruy55Ak9ANuWoU= -github.com/baidubce/bce-sdk-go v0.9.254 h1:A7GtBOt7z2lnV7fqlZPZefhcBFg7z6iliUAhEOiIhoE= -github.com/baidubce/bce-sdk-go v0.9.254/go.mod h1:zbYJMQwE4IZuyrJiFO8tO8NbtYiKTFTbwh4eIsqjVdg= +github.com/baidubce/bce-sdk-go v0.9.256 h1:/6UwBzDp+dRFpKRIb5WsvxfSiG4SLOIOghvagOK/q4Y= +github.com/baidubce/bce-sdk-go v0.9.256/go.mod h1:zbYJMQwE4IZuyrJiFO8tO8NbtYiKTFTbwh4eIsqjVdg= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -383,8 +383,8 @@ github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lSh github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM= -github.com/exoscale/egoscale/v3 v3.1.31 h1:/dySEUSAxU+hlAS/eLxAoY8ZYmtOtaoL1P+lDwH7ojY= -github.com/exoscale/egoscale/v3 v3.1.31/go.mod h1:0iY8OxgHJCS5TKqDNhwOW95JBKCnBZl3YGU4Yt+NqkU= +github.com/exoscale/egoscale/v3 v3.1.33 h1:5Lk/pwZ+K0sjNu9obS0VYPfhZQffRkvvO0BpdPoir4o= +github.com/exoscale/egoscale/v3 v3.1.33/go.mod h1:0iY8OxgHJCS5TKqDNhwOW95JBKCnBZl3YGU4Yt+NqkU= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= @@ -424,10 +424,12 @@ github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= github.com/go-acme/alidns-20150109/v4 v4.7.0 h1:PqJ/wR0JTpL4v0Owu1uM7bPQ1Yww0eQLAuuSdLjjQaQ= github.com/go-acme/alidns-20150109/v4 v4.7.0/go.mod h1:btQvB6xZoN6ykKB74cPhiR+uvhrEE2AFVXm6RDmCHm0= -github.com/go-acme/esa-20240910/v2 v2.40.3 h1:xXOMRex148wKEHbv7Izn73/HdAxSmz5GOaF4HdnqN+M= -github.com/go-acme/esa-20240910/v2 v2.40.3/go.mod h1:ZYdN9EN9ikn26SNapxCVjZ65pHT/1qm4fzuJ7QGVX6g= -github.com/go-acme/lego/v4 v4.30.1 h1:tmb6U0lvy8Mc3lQbqKwTat7oAhE8FUYNJ3D0gSg6pJU= -github.com/go-acme/lego/v4 v4.30.1/go.mod h1:V7m/Ip+EeFkjOe028+zeH+SwWtESxw1LHelwMIfAjm4= +github.com/go-acme/esa-20240910/v2 v2.44.0 h1:ACi2uFb7ig4ousFs/YiFBR+aw3A4SHtOxvkMWB2Hbcs= +github.com/go-acme/esa-20240910/v2 v2.44.0/go.mod h1:ZYdN9EN9ikn26SNapxCVjZ65pHT/1qm4fzuJ7QGVX6g= +github.com/go-acme/jdcloud-sdk-go v1.64.0 h1:AW9j5khk8tRYbpBJPxKmqdwIqgLs2Fz3HUK3hn2YXjs= +github.com/go-acme/jdcloud-sdk-go v1.64.0/go.mod h1:qc/m8HNX1Zgd7GAv2DSEinup8fwy3Ted3/VVx7LB5bU= +github.com/go-acme/lego/v4 v4.31.0 h1:gd4oUYdfs83PR1/SflkNdit9xY1iul2I4EystnU8NXM= +github.com/go-acme/lego/v4 v4.31.0/go.mod h1:m6zcfX/zcbMYDa8s6AnCMnoORWNP8Epnei+6NBCTUGs= github.com/go-acme/tencentclouddnspod v1.1.25 h1:7H3ZKshkaHzCXfRpAHVB5nvxeDDl2XLeNZfrNHiZj/s= github.com/go-acme/tencentclouddnspod v1.1.25/go.mod h1:XXfzp0AYV7UAUsHKT6R0KAUJFhqAUXmWGF07Elpa5cE= github.com/go-acme/tencentedgdeone v1.1.48 h1:WLyLBsRVhSLFmtbEFXk0naLODSQn7X6J0Fc/qR8xVUk= @@ -490,8 +492,8 @@ github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o= github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/go-resty/resty/v2 v2.17.0 h1:pW9DeXcaL4Rrym4EZ8v7L19zZiIlWPg5YXAcVmt+gN0= -github.com/go-resty/resty/v2 v2.17.0/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA= +github.com/go-resty/resty/v2 v2.17.1 h1:x3aMpHK1YM9e4va/TMDRlusDDoZiQ+ViDu/WpA6xTM4= +github.com/go-resty/resty/v2 v2.17.1/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= @@ -519,6 +521,8 @@ github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7Lk github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= +github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= +github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -596,8 +600,9 @@ github.com/google/go-github/v28 v28.1.1 h1:kORf5ekX5qwXO2mGzXXOjMe/g6ap8ahVe0sBE github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM= github.com/google/go-github/v32 v32.1.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0= +github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -623,8 +628,8 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.7 h1:zrn2Ee/nWmHulBx5sAV github.com/googleapis/enterprise-certificate-proxy v0.3.7/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.15.0 h1:SyjDc1mGgZU5LncH8gimWo9lW1DtIfPibOG81vgd/bo= -github.com/googleapis/gax-go/v2 v2.15.0/go.mod h1:zVVkkxAQHa1RQpg9z2AUCMnKhi0Qld9rcmyfL1OZhoc= +github.com/googleapis/gax-go/v2 v2.16.0 h1:iHbQmKLLZrexmb0OSsNGTeSTS0HO4YvFOG8g5E4Zd0Y= +github.com/googleapis/gax-go/v2 v2.16.0/go.mod h1:o1vfQjjNZn4+dPnRdl/4ZD7S9414Y4xA+a/6Icj6l14= github.com/gophercloud/gophercloud v1.3.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM= github.com/gophercloud/gophercloud v1.14.1 h1:DTCNaTVGl8/cFu58O1JwWgis9gtISAFONqpMKNg/Vpw= github.com/gophercloud/gophercloud v1.14.1/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM= @@ -724,8 +729,8 @@ github.com/http-wasm/http-wasm-host-go v0.7.0/go.mod h1:adXKcLmL7yuavH/e0kBAp7b3 github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.180 h1:uia+R3K1izQRGpxTV+bS4q3/ueMW7ProAMWqM6OlqOU= -github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.180/go.mod h1:M+yna96Fx9o5GbIUnF3OvVvQGjgfVSyeJbV9Yb1z/wI= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.182 h1:B3W9acgpqu5XsN8v+W8SOTfqn/6n4JsjgoKBsm30HFY= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.182/go.mod h1:M+yna96Fx9o5GbIUnF3OvVvQGjgfVSyeJbV9Yb1z/wI= github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -840,8 +845,8 @@ github.com/lestrrat-go/httpcc v1.0.0/go.mod h1:tGS/u00Vh5N6FHNkExqGGNId8e0Big+++ github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= github.com/lestrrat-go/jwx v1.2.7/go.mod h1:bw24IXWbavc0R2RsOtpXL7RtMyP589yZ1+L7kd09ZGA= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/linode/linodego v1.62.0 h1:eCo1sepsIPGkI66Cz9IaCylWxKDD2aSc5UYq20iBMfw= -github.com/linode/linodego v1.62.0/go.mod h1:FoIEsuZMRlXiUt6RnuGcPTek5iAO3VfE6bjMpGlcQ2U= +github.com/linode/linodego v1.64.0 h1:If6pULIwHuQytgogtpQaBdVLX7z2TTHUF5u1tj2TPiY= +github.com/linode/linodego v1.64.0/go.mod h1:GoiwLVuLdBQcAebxAVKVL3mMYUgJZR/puOUSla04xBE= github.com/liquidweb/go-lwApi v0.0.0-20190605172801-52a4864d2738/go.mod h1:0sYF9rMXb0vlG+4SzdiGMXHheCZxjguMq+Zb4S2BfBs= github.com/liquidweb/liquidweb-cli v0.6.9 h1:acbIvdRauiwbxIsOCEMXGwF75aSJDbDiyAWPjVnwoYM= github.com/liquidweb/liquidweb-cli v0.6.9/go.mod h1:cE1uvQ+x24NGUL75D0QagOFCG8Wdvmwu8aL9TLmA/eQ= @@ -997,10 +1002,10 @@ github.com/nrdcg/namesilo v0.5.0 h1:6QNxT/XxE+f5B+7QlfWorthNzOzcGlBLRQxqi6YeBrE= github.com/nrdcg/namesilo v0.5.0/go.mod h1:4UkwlwQfDt74kSGmhLaDylnBrD94IfflnpoEaj6T2qw= github.com/nrdcg/nodion v0.1.0 h1:zLKaqTn2X0aDuBHHfyA1zFgeZfiCpmu/O9DM73okavw= github.com/nrdcg/nodion v0.1.0/go.mod h1:inbuh3neCtIWlMPZHtEpe43TmRXxHV6+hk97iCZicms= -github.com/nrdcg/oci-go-sdk/common/v1065 v1065.105.1 h1:yHD01L6wN7mhGikS08izrMuEp9PRtvingePXkjRHrSg= -github.com/nrdcg/oci-go-sdk/common/v1065 v1065.105.1/go.mod h1:Gcs8GCaZXL3FdiDWgdnMxlOLEdRprJJnPYB22TX1jw8= -github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.105.1 h1:9ApYlc4bjup9WnxOFmgvh00bDqd6KMqAbAR4klKzluA= -github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.105.1/go.mod h1:iOzhDeDcQGJZVgSDKrl5p3HUWexNo3LOlicf0D9ltgk= +github.com/nrdcg/oci-go-sdk/common/v1065 v1065.105.2 h1:l0tH15ACQADZAzC+LZ+mo2tIX4H6uZu0ulrVmG5Tqz0= +github.com/nrdcg/oci-go-sdk/common/v1065 v1065.105.2/go.mod h1:Gcs8GCaZXL3FdiDWgdnMxlOLEdRprJJnPYB22TX1jw8= +github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.105.2 h1:gzB4c6ztb38C/jYiqEaFC+mCGcWFHDji9e6jwymY9d4= +github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.105.2/go.mod h1:l1qIPIq2uRV5WTSvkbhbl/ndbeOu7OCb3UZ+0+2ZSb8= github.com/nrdcg/porkbun v0.4.0 h1:rWweKlwo1PToQ3H+tEO9gPRW0wzzgmI/Ob3n2Guticw= github.com/nrdcg/porkbun v0.4.0/go.mod h1:/QMskrHEIM0IhC/wY7iTCUgINsxdT2WcOphktJ9+Q54= github.com/nrdcg/vegadns v0.3.0 h1:11FQMw7xVIRUWO9o5+Z/5YZhmPWlm4oxUUH3F6EVqQU= @@ -1153,8 +1158,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35 h1:8xfn1RzeI9yoCUuEwDy08F+No6PcKZGEDOQ6hrRyLts= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35/go.mod h1:47B1d/YXmSAxlJxUJxClzHR6b3T4M1WyCvwENPQNBWc= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36 h1:ObX9hZmK+VmijreZO/8x9pQ8/P/ToHD/bdSb4Eg4tUo= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36/go.mod h1:LEsDu4BubxK7/cWhtlQWfuxwL4rf/2UEpxXz1o1EMtM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM= @@ -1254,8 +1259,8 @@ github.com/tailscale/tscert v0.0.0-20230806124524-28a91b69a046 h1:8rUlviSVOEe7TM github.com/tailscale/tscert v0.0.0-20230806124524-28a91b69a046/go.mod h1:kNGUQ3VESx3VZwRwA9MSCUegIl6+saPL8Noq82ozCaU= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.25/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.48/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.12 h1:/ABtv4x4FSGxGW0d6Sc88iQn6Up2LalWKwt/Tj7Dtz8= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.12/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.28 h1:Rj1WXXNPm9AsPf0PJhWCvlsqfcKPUYdyVnkmEc3O8sI= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.28/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/testcontainers/testcontainers-go v0.32.0 h1:ug1aK08L3gCHdhknlTTwWjPHPS+/alvLJU/DRxTD/ME= github.com/testcontainers/testcontainers-go v0.32.0/go.mod h1:CRHrzHLQhlXUsa5gXjTOfqIEJcrK5+xMDmBr/WMI88E= github.com/testcontainers/testcontainers-go/modules/k3s v0.32.0 h1:Z3DTMveNUqeGJZ+CXZhpvI7OF1BS71Ywi3SwoXLZ4Lc= @@ -1314,14 +1319,14 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/vinyldns/go-vinyldns v0.9.17 h1:hfPZfCaxcRBX6Gsgl42rLCeoal58/BH8kkvJShzjjdI= github.com/vinyldns/go-vinyldns v0.9.17/go.mod h1:pwWhE9K/leGDOIduVhRGvQ3ecVMHWRfEnKYUTEU3gB4= -github.com/volcengine/volc-sdk-golang v1.0.230 h1:84/MOF0zUPtAHt3e1+MsFq5qrnQRC+e3XzTUwIOzZxw= -github.com/volcengine/volc-sdk-golang v1.0.230/go.mod h1:zHJlaqiMbIB+0mcrsZPTwOb3FB7S/0MCfqlnO8R7hlM= +github.com/volcengine/volc-sdk-golang v1.0.233 h1:Hh2pzwu/Wq19rsZgNo3HdpjQB28D/F0+m6EjLVggmhM= +github.com/volcengine/volc-sdk-golang v1.0.233/go.mod h1:zHJlaqiMbIB+0mcrsZPTwOb3FB7S/0MCfqlnO8R7hlM= github.com/vulcand/oxy/v2 v2.0.3 h1:CPWVPfW4hVZXzwwiQzpFidbnJKpahjPHezM+7TkZRNw= github.com/vulcand/oxy/v2 v2.0.3/go.mod h1:k3t+xjyqmXVh88FdFDbYmUKMEvNpaejvBW14es6H70A= github.com/vulcand/predicate v1.2.0 h1:uFsW1gcnnR7R+QTID+FVcs0sSYlIGntoGOTb3rQJt50= github.com/vulcand/predicate v1.2.0/go.mod h1:VipoNYXny6c8N381zGUWkjuuNHiRbeAZhE7Qm9c+2GA= -github.com/vultr/govultr/v3 v3.26.0 h1:pm/GM+RZo9T1JLQzrUti5HiNAIFZFEHcPFMOWGvvNIY= -github.com/vultr/govultr/v3 v3.26.0/go.mod h1:9WwnWGCKnwDlNjHjtt+j+nP+0QWq6hQXzaHgddqrLWY= +github.com/vultr/govultr/v3 v3.26.1 h1:G/M0rMQKwVSmL+gb0UgETbW5mcQi0Vf/o/ZSGdBCxJw= +github.com/vultr/govultr/v3 v3.26.1/go.mod h1:9WwnWGCKnwDlNjHjtt+j+nP+0QWq6hQXzaHgddqrLWY= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= @@ -1332,12 +1337,12 @@ github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gi github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= -github.com/yandex-cloud/go-genproto v0.41.0 h1:l0HWC7S82XgfioqOQ+d2wx7PRB5Eo71KiUb4PiWbDXQ= -github.com/yandex-cloud/go-genproto v0.41.0/go.mod h1:0LDD/IZLIUIV4iPH+YcF+jysO3jkSvADFGm4dCAuwQo= -github.com/yandex-cloud/go-sdk/services/dns v0.0.23 h1:fR4tqSRKTpzh4RczXJbU7EOXh4+kJnp+dccRpL2PLPQ= -github.com/yandex-cloud/go-sdk/services/dns v0.0.23/go.mod h1:Lgly3dyKBGrAIpIo6nrkEpQOoSQYlnik1HLKMeZcA98= -github.com/yandex-cloud/go-sdk/v2 v2.33.0 h1:wuvpirhYcHSejLDXSxLGsNoZHqkjrXevzVxw7SrrN/0= -github.com/yandex-cloud/go-sdk/v2 v2.33.0/go.mod h1:OqkwauVaBxbrrfN+JOYBIuE8GrHz1g0Z42VIkbsGvPI= +github.com/yandex-cloud/go-genproto v0.43.0 h1:HjBesEmCN8ZOhjjh8gs605vvi9/MBJAW3P20OJ4iQnw= +github.com/yandex-cloud/go-genproto v0.43.0/go.mod h1:0LDD/IZLIUIV4iPH+YcF+jysO3jkSvADFGm4dCAuwQo= +github.com/yandex-cloud/go-sdk/services/dns v0.0.25 h1:BcGEuOnwq2X3LS2kvFC6BOdZkOq4Lc7XAYvzap/SJJY= +github.com/yandex-cloud/go-sdk/services/dns v0.0.25/go.mod h1:B4QHijALUHIjRxL3aqmOwDrHYUI2XdeeG4WKItth3jI= +github.com/yandex-cloud/go-sdk/v2 v2.37.0 h1:WvttW6p9xcWag9j+GQv+GJXPggggXGwOlIJNfkWmFWw= +github.com/yandex-cloud/go-sdk/v2 v2.37.0/go.mod h1:Dt4a81enjRsm4xMJyW5E1Y/vaUYwXJvUGRdDLuM2k6I= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM= github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI= @@ -1878,8 +1883,8 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.257.0 h1:8Y0lzvHlZps53PEaw+G29SsQIkuKrumGWs9puiexNAA= -google.golang.org/api v0.257.0/go.mod h1:4eJrr+vbVaZSqs7vovFd1Jb/A6ml6iw2e6FBYf3GAO4= +google.golang.org/api v0.259.0 h1:90TaGVIxScrh1Vn/XI2426kRpBqHwWIzVBzJsVZ5XrQ= +google.golang.org/api v0.259.0/go.mod h1:LC2ISWGWbRoyQVpxGntWwLWN/vLNxxKBK9KuJRI8Te4= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1918,12 +1923,12 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20250603155806-513f23925822 h1:rHWScKit0gvAPuOnu87KpaYtjK5zBMLcULh7gxkCXu4= -google.golang.org/genproto v0.0.0-20250603155806-513f23925822/go.mod h1:HubltRL7rMh0LfnQPkMH4NPDFEWp0jw3vixw7jEM53s= -google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 h1:mepRgnBZa07I4TRuomDE4sTIYieg/osKmzIf4USdWS4= -google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 h1:Wgl1rcDNThT+Zn47YyCXOXyX/COgMTIdhJ717F0l4xk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/genproto v0.0.0-20251202230838-ff82c1b0f217 h1:GvESR9BIyHUahIb0NcTum6itIWtdoglGX+rnGxm2934= +google.golang.org/genproto v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:yJ2HH4EHEDTd3JiLmhds6NkJ17ITVYOdV3m3VKOnws0= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b h1:Mv8VFug0MP9e5vUxfBcE3vUkV6CImK3cMNMIDFjmzxU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1941,8 +1946,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM= -google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig= +google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc= +google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1957,8 +1962,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From fc671859879eb7c2fcae34d771f158a5da920a36 Mon Sep 17 00:00:00 2001 From: Barbara Soraggi <108243062+bpsoraggi@users.noreply.github.com> Date: Tue, 13 Jan 2026 09:08:04 +0000 Subject: [PATCH 02/13] Replace markdown-include dependency with mkdocs-include-markdown-plugin --- docs/content/getting-started/concepts.md | 2 +- docs/content/getting-started/configuration-overview.md | 2 +- docs/content/getting-started/faq.md | 2 +- docs/content/getting-started/install-traefik.md | 2 +- docs/content/getting-started/quick-start-with-kubernetes.md | 2 +- docs/content/getting-started/quick-start.md | 2 +- docs/content/https/acme.md | 2 +- docs/content/https/overview.md | 2 +- docs/content/https/tls.md | 2 +- docs/content/middlewares/http/basicauth.md | 2 +- docs/content/middlewares/http/forwardauth.md | 2 +- docs/content/middlewares/http/headers.md | 2 +- docs/content/middlewares/http/overview.md | 2 +- docs/content/middlewares/http/redirectregex.md | 2 +- docs/content/middlewares/http/stripprefix.md | 2 +- docs/content/middlewares/overview.md | 2 +- docs/content/observability/access-logs.md | 2 +- docs/content/observability/logs.md | 2 +- docs/content/operations/api.md | 2 +- docs/content/operations/dashboard.md | 2 +- docs/content/plugins/index.md | 2 +- docs/content/providers/docker.md | 2 +- docs/content/providers/file.md | 2 +- docs/content/providers/kubernetes-crd.md | 2 +- docs/content/providers/kubernetes-gateway.md | 2 +- docs/content/providers/kubernetes-ingress.md | 2 +- docs/content/providers/overview.md | 2 +- .../reference/dynamic-configuration/kubernetes-crd.md | 2 +- .../reference/dynamic-configuration/kubernetes-gateway.md | 2 +- docs/content/routing/entrypoints.md | 2 +- docs/content/routing/overview.md | 2 +- docs/content/routing/providers/kubernetes-crd.md | 2 +- docs/content/routing/providers/kubernetes-gateway.md | 2 +- docs/content/routing/providers/kubernetes-ingress.md | 2 +- docs/content/routing/routers/index.md | 2 +- docs/content/routing/services/index.md | 2 +- docs/content/user-guides/docker-compose/acme-dns/index.md | 2 +- docs/content/user-guides/docker-compose/acme-tls/index.md | 2 +- .../user-guides/docker-compose/basic-example/index.md | 2 +- docs/mkdocs.yml | 5 ++--- docs/requirements.txt | 4 ++-- 41 files changed, 43 insertions(+), 44 deletions(-) diff --git a/docs/content/getting-started/concepts.md b/docs/content/getting-started/concepts.md index 21e1817f7..a2bd774f8 100644 --- a/docs/content/getting-started/concepts.md +++ b/docs/content/getting-started/concepts.md @@ -57,4 +57,4 @@ You no longer need to create and synchronize configuration files cluttered with Traefik is able to use your cluster API to discover the services and read the attached information. In Traefik, these connectors are called [providers](../providers/overview.md "Link to overview about Traefik providers") because they *provide* the configuration to Traefik. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/configuration-overview.md b/docs/content/getting-started/configuration-overview.md index 734e29871..fd7224bf5 100644 --- a/docs/content/getting-started/configuration-overview.md +++ b/docs/content/getting-started/configuration-overview.md @@ -94,4 +94,4 @@ All the configuration options are documented in their related section. You can browse the available features in the menu, the [providers](../providers/overview.md), or the [routing section](../routing/overview.md) to see them in action. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/faq.md b/docs/content/getting-started/faq.md index 66f2d4d04..9b6f69b57 100644 --- a/docs/content/getting-started/faq.md +++ b/docs/content/getting-started/faq.md @@ -252,4 +252,4 @@ In which case, you should make sure your infrastructure is properly set up for a LEGO_DISABLE_CNAME_SUPPORT=true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/install-traefik.md b/docs/content/getting-started/install-traefik.md index 705b335c1..f052460ca 100644 --- a/docs/content/getting-started/install-traefik.md +++ b/docs/content/getting-started/install-traefik.md @@ -144,4 +144,4 @@ And run it: All the details are available in the [Contributing Guide](../contributing/building-testing.md) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/quick-start-with-kubernetes.md b/docs/content/getting-started/quick-start-with-kubernetes.md index ba94918e9..5cb071461 100644 --- a/docs/content/getting-started/quick-start-with-kubernetes.md +++ b/docs/content/getting-started/quick-start-with-kubernetes.md @@ -334,4 +334,4 @@ curl -v http://localhost/ - Use [IngressRoute CRD](../providers/kubernetes-crd.md) - Protect [ingresses with TLS](../routing/providers/kubernetes-ingress.md#enabling-tls-via-annotations) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/quick-start.md b/docs/content/getting-started/quick-start.md index 90db5a165..99a356666 100644 --- a/docs/content/getting-started/quick-start.md +++ b/docs/content/getting-started/quick-start.md @@ -121,4 +121,4 @@ IP: 172.27.0.4 Now that you have a basic understanding of how Traefik can automatically create the routes to your services and load balance them, it is time to dive into [the user guides](../../user-guides/docker-compose/basic-example/ "Link to the user guides") and [the documentation](/ "Link to the docs landing page") and let Traefik work for you! -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/https/acme.md b/docs/content/https/acme.md index eb9245650..68fe584e5 100644 --- a/docs/content/https/acme.md +++ b/docs/content/https/acme.md @@ -797,4 +797,4 @@ If Let's Encrypt is not reachable, the following certificates will apply: !!! important For new (sub)domains which need Let's Encrypt authentication, the default Traefik certificate will be used until Traefik is restarted. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/https/overview.md b/docs/content/https/overview.md index 9261d0db8..ae07504d9 100644 --- a/docs/content/https/overview.md +++ b/docs/content/https/overview.md @@ -20,4 +20,4 @@ That is to say, how to obtain [TLS certificates](./tls.md#certificates-definitio either through a definition in the dynamic configuration, or through [Let's Encrypt](./acme.md) (ACME). And how to configure [TLS options](./tls.md#tls-options), and [certificates stores](./tls.md#certificates-stores). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/https/tls.md b/docs/content/https/tls.md index 2d8178e6d..4596095d7 100644 --- a/docs/content/https/tls.md +++ b/docs/content/https/tls.md @@ -561,4 +561,4 @@ spec: clientAuthType: RequireAndVerifyClientCert ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/basicauth.md b/docs/content/middlewares/http/basicauth.md index 9a6b3c579..08ab3dc42 100644 --- a/docs/content/middlewares/http/basicauth.md +++ b/docs/content/middlewares/http/basicauth.md @@ -404,4 +404,4 @@ http: [http.middlewares.test-auth.basicAuth] removeHeader = true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/forwardauth.md b/docs/content/middlewares/http/forwardauth.md index 8e8485c9e..1b2ae3eb2 100644 --- a/docs/content/middlewares/http/forwardauth.md +++ b/docs/content/middlewares/http/forwardauth.md @@ -637,4 +637,4 @@ http: [http.middlewares.test-auth.forwardAuth.tls] insecureSkipVerify: true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/headers.md b/docs/content/middlewares/http/headers.md index 3af8f36a7..b72ba9130 100644 --- a/docs/content/middlewares/http/headers.md +++ b/docs/content/middlewares/http/headers.md @@ -480,4 +480,4 @@ Set `isDevelopment` to `true` when developing to mitigate the unwanted effects o Usually testing takes place using HTTP, not HTTPS, and on `localhost`, not your production domain. If you would like your development environment to mimic production with complete Host blocking, SSL redirects, and STS headers, leave this as `false`. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/overview.md b/docs/content/middlewares/http/overview.md index 412f94760..3f7a63a04 100644 --- a/docs/content/middlewares/http/overview.md +++ b/docs/content/middlewares/http/overview.md @@ -158,4 +158,4 @@ http: Please take a look at the community-contributed plugins in the [plugin catalog](https://plugins.traefik.io/plugins). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/redirectregex.md b/docs/content/middlewares/http/redirectregex.md index e10af16fd..06d27e0bc 100644 --- a/docs/content/middlewares/http/redirectregex.md +++ b/docs/content/middlewares/http/redirectregex.md @@ -100,4 +100,4 @@ The `replacement` option defines how to modify the URL to have the new target UR Care should be taken when defining replacement expand variables: `$1x` is equivalent to `${1x}`, not `${1}x` (see [Regexp.Expand](https://golang.org/pkg/regexp/#Regexp.Expand)), so use `${1}` syntax. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/stripprefix.md b/docs/content/middlewares/http/stripprefix.md index 35bb527a9..185403dcf 100644 --- a/docs/content/middlewares/http/stripprefix.md +++ b/docs/content/middlewares/http/stripprefix.md @@ -171,4 +171,4 @@ http: forceSlash = false ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/overview.md b/docs/content/middlewares/overview.md index de799e842..5db9e6dc3 100644 --- a/docs/content/middlewares/overview.md +++ b/docs/content/middlewares/overview.md @@ -130,4 +130,4 @@ A list of HTTP middlewares can be found [here](http/overview.md). A list of TCP middlewares can be found [here](tcp/overview.md). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/observability/access-logs.md b/docs/content/observability/access-logs.md index fdac4550e..4bbd5df0f 100644 --- a/docs/content/observability/access-logs.md +++ b/docs/content/observability/access-logs.md @@ -281,4 +281,4 @@ services: - /var/run/docker.sock:/var/run/docker.sock ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/observability/logs.md b/docs/content/observability/logs.md index f350c5f67..77c1540d7 100644 --- a/docs/content/observability/logs.md +++ b/docs/content/observability/logs.md @@ -90,4 +90,4 @@ This allows the logs to be rotated and processed by an external program, such as !!! warning This does not work on Windows due to the lack of USR signals. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/operations/api.md b/docs/content/operations/api.md index 16717a8bc..f895a05c2 100644 --- a/docs/content/operations/api.md +++ b/docs/content/operations/api.md @@ -175,4 +175,4 @@ All the following endpoints must be accessed with a `GET` HTTP request. | `/debug/pprof/symbol` | See the [pprof Symbol](https://golang.org/pkg/net/http/pprof/#Symbol) Go documentation. | | `/debug/pprof/trace` | See the [pprof Trace](https://golang.org/pkg/net/http/pprof/#Trace) Go documentation. | -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/operations/dashboard.md b/docs/content/operations/dashboard.md index 353470cdf..ceae503d2 100644 --- a/docs/content/operations/dashboard.md +++ b/docs/content/operations/dashboard.md @@ -132,4 +132,4 @@ api: --api.dashboard=false ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/plugins/index.md b/docs/content/plugins/index.md index 9cd3662f8..b3172a9a8 100644 --- a/docs/content/plugins/index.md +++ b/docs/content/plugins/index.md @@ -31,4 +31,4 @@ The experience of implementing a Traefik plugin is comparable to writing a web b To learn more about Traefik plugin creation, please refer to the [developer documentation](https://plugins.traefik.io/create). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/docker.md b/docs/content/providers/docker.md index c1cadd86b..a06e3f111 100644 --- a/docs/content/providers/docker.md +++ b/docs/content/providers/docker.md @@ -764,4 +764,4 @@ providers: --providers.docker.allowEmptyServices=true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/file.md b/docs/content/providers/file.md index 8abce45d6..afffcc200 100644 --- a/docs/content/providers/file.md +++ b/docs/content/providers/file.md @@ -292,4 +292,4 @@ To illustrate, it is possible to easily define multiple routers, services, and T {{ end }} ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/kubernetes-crd.md b/docs/content/providers/kubernetes-crd.md index 9c9707ded..daa6fe554 100644 --- a/docs/content/providers/kubernetes-crd.md +++ b/docs/content/providers/kubernetes-crd.md @@ -345,4 +345,4 @@ providers: For additional information, refer to the [full example](../user-guides/crd-acme/index.md) with Let's Encrypt. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/kubernetes-gateway.md b/docs/content/providers/kubernetes-gateway.md index a435d563a..a2de88f5e 100644 --- a/docs/content/providers/kubernetes-gateway.md +++ b/docs/content/providers/kubernetes-gateway.md @@ -269,4 +269,4 @@ providers: --providers.kubernetesgateway.throttleDuration=10s ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/kubernetes-ingress.md b/docs/content/providers/kubernetes-ingress.md index f9fcd7e61..ab62b5725 100644 --- a/docs/content/providers/kubernetes-ingress.md +++ b/docs/content/providers/kubernetes-ingress.md @@ -504,4 +504,4 @@ providers: To learn more about the various aspects of the Ingress specification that Traefik supports, many examples of Ingresses definitions are located in the test [examples](https://github.com/traefik/traefik/tree/v2.11/pkg/provider/kubernetes/ingress/fixtures) of the Traefik repository. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/overview.md b/docs/content/providers/overview.md index ced9ff5ab..d5a20da8a 100644 --- a/docs/content/providers/overview.md +++ b/docs/content/providers/overview.md @@ -233,4 +233,4 @@ List of providers that support constraints: - [Kubernetes Ingress](./kubernetes-ingress.md#labelselector) - [Kubernetes Gateway](./kubernetes-gateway.md#labelselector) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/dynamic-configuration/kubernetes-crd.md b/docs/content/reference/dynamic-configuration/kubernetes-crd.md index c171ec5d3..bdfe5a6cc 100644 --- a/docs/content/reference/dynamic-configuration/kubernetes-crd.md +++ b/docs/content/reference/dynamic-configuration/kubernetes-crd.md @@ -36,4 +36,4 @@ Dynamic configuration with Kubernetes Custom Resource --8<-- "content/reference/dynamic-configuration/kubernetes-crd-rbac.yml" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/dynamic-configuration/kubernetes-gateway.md b/docs/content/reference/dynamic-configuration/kubernetes-gateway.md index 476dd2b47..7ec024bdd 100644 --- a/docs/content/reference/dynamic-configuration/kubernetes-gateway.md +++ b/docs/content/reference/dynamic-configuration/kubernetes-gateway.md @@ -30,4 +30,4 @@ Dynamic configuration with Kubernetes Gateway provider. --8<-- "content/reference/dynamic-configuration/kubernetes-gateway-rbac.yml" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/entrypoints.md b/docs/content/routing/entrypoints.md index 253d19100..02ad3d79d 100644 --- a/docs/content/routing/entrypoints.md +++ b/docs/content/routing/entrypoints.md @@ -1441,4 +1441,4 @@ entryPoints: --entryPoints.foo.udp.timeout=10s ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/overview.md b/docs/content/routing/overview.md index aceb335fe..540b87453 100644 --- a/docs/content/routing/overview.md +++ b/docs/content/routing/overview.md @@ -412,4 +412,4 @@ serversTransport: --serversTransport.forwardingTimeouts.idleConnTimeout=1s ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/providers/kubernetes-crd.md b/docs/content/routing/providers/kubernetes-crd.md index cf168ff91..aba8fa019 100644 --- a/docs/content/routing/providers/kubernetes-crd.md +++ b/docs/content/routing/providers/kubernetes-crd.md @@ -1904,4 +1904,4 @@ If the ServersTransport CRD is defined in another provider the cross-provider fo Also see the [full example](../../user-guides/crd-acme/index.md) with Let's Encrypt. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/providers/kubernetes-gateway.md b/docs/content/routing/providers/kubernetes-gateway.md index e07a347ed..af9900dd2 100644 --- a/docs/content/routing/providers/kubernetes-gateway.md +++ b/docs/content/routing/providers/kubernetes-gateway.md @@ -355,4 +355,4 @@ Kubernetes cluster before creating `TLSRoute` objects. | [11] | `group` | Group is the group of the referent. Only `traefik.io`, `traefik.containo.us` and `gateway.networking.k8s.io` values are supported. | | [12] | `kind` | Kind is kind of the referent. Only `TraefikService` and `Service` values are supported. | -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/providers/kubernetes-ingress.md b/docs/content/routing/providers/kubernetes-ingress.md index 57d38892d..85fa482a4 100644 --- a/docs/content/routing/providers/kubernetes-ingress.md +++ b/docs/content/routing/providers/kubernetes-ingress.md @@ -969,4 +969,4 @@ This will allow users to create a "default router" that will match all unmatched To do this, use the `traefik.ingress.kubernetes.io/router.priority` annotation (as seen in [Annotations on Ingress](#on-ingress)) on your ingresses accordingly. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index bec2ac632..6aec7a06a 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -1349,4 +1349,4 @@ Services are the target for the router. !!! important "UDP routers can only target UDP services (and not HTTP or TCP services)." -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/services/index.md b/docs/content/routing/services/index.md index 55e357282..3480b323b 100644 --- a/docs/content/routing/services/index.md +++ b/docs/content/routing/services/index.md @@ -1646,4 +1646,4 @@ udp: address = "private-ip-server-2:8080/" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/user-guides/docker-compose/acme-dns/index.md b/docs/content/user-guides/docker-compose/acme-dns/index.md index 78f25f8d4..eb6178d82 100644 --- a/docs/content/user-guides/docker-compose/acme-dns/index.md +++ b/docs/content/user-guides/docker-compose/acme-dns/index.md @@ -187,4 +187,4 @@ environment: - "OVH_CONSUMER_KEY_FILE=/run/secrets/ovh_consumer_key" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/user-guides/docker-compose/acme-tls/index.md b/docs/content/user-guides/docker-compose/acme-tls/index.md index 382244c62..ed4f7e6f6 100644 --- a/docs/content/user-guides/docker-compose/acme-tls/index.md +++ b/docs/content/user-guides/docker-compose/acme-tls/index.md @@ -83,4 +83,4 @@ labels: - "traefik.http.routers.whoami.tls.certresolver=myresolver" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/user-guides/docker-compose/basic-example/index.md b/docs/content/user-guides/docker-compose/basic-example/index.md index 4b5e33cd5..a95de4798 100644 --- a/docs/content/user-guides/docker-compose/basic-example/index.md +++ b/docs/content/user-guides/docker-compose/basic-example/index.md @@ -133,4 +133,4 @@ whoami: - "traefik.http.routers.whoami.entrypoints=web" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 9e6fe7d3c..71d83858f 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -39,6 +39,8 @@ plugins: - exclude: glob: - "**/include-*.md" + - include-markdown: + encoding: utf-8 # https://squidfunk.github.io/mkdocs-material/extensions/admonition/ # https://facelessuser.github.io/pymdown-extensions/ @@ -56,9 +58,6 @@ markdown_extensions: - pymdownx.tasklist - pymdownx.snippets: check_paths: true - - markdown_include.include: - base_path: content/includes/ - encoding: utf-8 - toc: permalink: true diff --git a/docs/requirements.txt b/docs/requirements.txt index 68126a411..1eef672df 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ -markdown-include==0.5.1 -mkdocs==1.2.4 +mkdocs==1.4.3 +mkdocs-include-markdown-plugin==7.2.0 mkdocs-exclude==1.0.2 mkdocs-traefiklabs>=100.0.7 From 5a9f3e6999eb12d184a1253c1d28ce9b775269fa Mon Sep 17 00:00:00 2001 From: Barbara Soraggi <108243062+bpsoraggi@users.noreply.github.com> Date: Tue, 13 Jan 2026 09:10:05 +0000 Subject: [PATCH 03/13] Replace markdown-include dependency with mkdocs-include-markdown-plugin --- docs/content/getting-started/concepts.md | 2 +- docs/content/getting-started/configuration-overview.md | 2 +- docs/content/getting-started/docker.md | 2 +- docs/content/getting-started/faq.md | 2 +- docs/content/getting-started/install-traefik.md | 2 +- docs/content/getting-started/kubernetes.md | 2 +- docs/content/https/acme.md | 2 +- docs/content/https/overview.md | 2 +- docs/content/https/tls.md | 2 +- docs/content/middlewares/http/basicauth.md | 2 +- docs/content/middlewares/http/forwardauth.md | 2 +- docs/content/middlewares/http/headers.md | 2 +- docs/content/middlewares/http/overview.md | 2 +- docs/content/middlewares/http/redirectregex.md | 2 +- docs/content/middlewares/http/stripprefix.md | 2 +- docs/content/middlewares/overview.md | 2 +- docs/content/migrate/v2-to-v3.md | 2 +- docs/content/observability/access-logs.md | 2 +- docs/content/observability/logs.md | 2 +- docs/content/observe/overview.md | 2 +- docs/content/operations/api.md | 2 +- docs/content/operations/dashboard.md | 2 +- docs/content/plugins/index.md | 2 +- docs/content/providers/docker.md | 2 +- docs/content/providers/file.md | 2 +- docs/content/providers/kubernetes-crd.md | 4 ++-- docs/content/providers/kubernetes-gateway.md | 4 ++-- docs/content/providers/kubernetes-ingress.md | 4 ++-- docs/content/providers/overview.md | 2 +- docs/content/providers/swarm.md | 2 +- .../reference/dynamic-configuration/kubernetes-crd.md | 2 +- .../content/reference/install-configuration/api-dashboard.md | 2 +- .../observability/logs-and-accesslogs.md | 2 +- .../reference/install-configuration/providers/docker.md | 2 +- .../install-configuration/providers/kubernetes/knative.md | 4 ++-- .../providers/kubernetes/kubernetes-crd.md | 2 +- .../providers/kubernetes/kubernetes-gateway.md | 4 ++-- .../providers/kubernetes/kubernetes-ingress-nginx.md | 2 +- .../providers/kubernetes/kubernetes-ingress.md | 2 +- .../reference/install-configuration/providers/others/file.md | 2 +- .../reference/install-configuration/providers/overview.md | 2 +- .../reference/install-configuration/providers/swarm.md | 2 +- .../install-configuration/tls/certificate-resolvers/acme.md | 2 +- .../tls/certificate-resolvers/overview.md | 2 +- .../routing-configuration/http/middlewares/apikey.md | 2 +- .../routing-configuration/http/middlewares/basicauth.md | 2 +- .../routing-configuration/http/middlewares/digestauth.md | 2 +- .../routing-configuration/http/middlewares/forwardauth.md | 2 +- .../routing-configuration/http/middlewares/headers.md | 2 +- .../reference/routing-configuration/http/middlewares/hmac.md | 2 +- .../reference/routing-configuration/http/middlewares/jwt.md | 2 +- .../reference/routing-configuration/http/middlewares/ldap.md | 2 +- .../http/middlewares/oauth2-client-credentials.md | 2 +- .../http/middlewares/oauth2-token-introspection.md | 2 +- .../reference/routing-configuration/http/middlewares/oidc.md | 2 +- .../reference/routing-configuration/http/middlewares/opa.md | 2 +- .../routing-configuration/http/middlewares/overview.md | 2 +- .../routing-configuration/http/middlewares/redirectregex.md | 2 +- .../routing-configuration/http/middlewares/stripprefix.md | 2 +- .../reference/routing-configuration/http/middlewares/waf.md | 2 +- .../http/routing/multi-layer-routing.md | 2 +- .../reference/routing-configuration/http/routing/router.md | 2 +- .../reference/routing-configuration/http/tls/overview.md | 2 +- .../routing-configuration/http/tls/tls-certificates.md | 2 +- .../reference/routing-configuration/http/tls/tls-options.md | 2 +- .../routing-configuration/kubernetes/gateway-api.md | 2 +- .../reference/routing-configuration/kubernetes/ingress.md | 2 +- .../reference/routing-configuration/kubernetes/knative.md | 2 +- .../reference/routing-configuration/tcp/routing/router.md | 2 +- docs/content/reference/routing-configuration/tcp/tls.md | 2 +- .../routing-configuration/udp/routing/rules-priority.md | 2 +- docs/content/reference/routing-configuration/udp/service.md | 2 +- docs/content/routing/entrypoints.md | 2 +- docs/content/routing/overview.md | 2 +- docs/content/routing/providers/kubernetes-crd.md | 2 +- docs/content/routing/providers/kubernetes-gateway.md | 2 +- docs/content/routing/providers/kubernetes-ingress.md | 2 +- docs/content/routing/routers/index.md | 2 +- docs/content/routing/services/index.md | 2 +- docs/content/secure/secure-api-access-with-jwt.md | 2 +- docs/content/secure/secure-api-access-with-oidc.md | 2 +- docs/content/secure/secure-api-access-with-waf.md | 2 +- docs/content/setup/docker.md | 2 +- docs/content/setup/kubernetes.md | 2 +- docs/content/setup/swarm.md | 2 +- docs/content/user-guides/cert-manager.md | 2 +- docs/content/user-guides/docker-compose/acme-dns/index.md | 2 +- docs/content/user-guides/docker-compose/acme-tls/index.md | 2 +- .../user-guides/docker-compose/basic-example/index.md | 2 +- docs/mkdocs.yml | 5 ++--- docs/requirements.txt | 4 ++-- 91 files changed, 98 insertions(+), 99 deletions(-) diff --git a/docs/content/getting-started/concepts.md b/docs/content/getting-started/concepts.md index 21e1817f7..a2bd774f8 100644 --- a/docs/content/getting-started/concepts.md +++ b/docs/content/getting-started/concepts.md @@ -57,4 +57,4 @@ You no longer need to create and synchronize configuration files cluttered with Traefik is able to use your cluster API to discover the services and read the attached information. In Traefik, these connectors are called [providers](../providers/overview.md "Link to overview about Traefik providers") because they *provide* the configuration to Traefik. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/configuration-overview.md b/docs/content/getting-started/configuration-overview.md index 34bf5d802..6aa4a7928 100644 --- a/docs/content/getting-started/configuration-overview.md +++ b/docs/content/getting-started/configuration-overview.md @@ -92,4 +92,4 @@ All the configuration options are documented in their related section. You can browse the available features in the menu, the [providers](../providers/overview.md), or the [routing section](../routing/overview.md) to see them in action. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/docker.md b/docs/content/getting-started/docker.md index 4abf0f3ea..028fb9670 100644 --- a/docs/content/getting-started/docker.md +++ b/docs/content/getting-started/docker.md @@ -159,4 +159,4 @@ That's it! You've successfully deployed Traefik and configured routing in Docker - [Enable Metrics](../reference/install-configuration/observability/metrics.md) - [Learn more about Docker provider](../reference/install-configuration/providers/docker.md) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/faq.md b/docs/content/getting-started/faq.md index a64e04186..e808c4211 100644 --- a/docs/content/getting-started/faq.md +++ b/docs/content/getting-started/faq.md @@ -252,4 +252,4 @@ In which case, you should make sure your infrastructure is properly set up for a LEGO_DISABLE_CNAME_SUPPORT=true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/install-traefik.md b/docs/content/getting-started/install-traefik.md index 724eb7ae7..54d3edad5 100644 --- a/docs/content/getting-started/install-traefik.md +++ b/docs/content/getting-started/install-traefik.md @@ -144,4 +144,4 @@ And run it: All the details are available in the [Contributing Guide](../contributing/building-testing.md) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/getting-started/kubernetes.md b/docs/content/getting-started/kubernetes.md index 1c85e6d12..882360547 100644 --- a/docs/content/getting-started/kubernetes.md +++ b/docs/content/getting-started/kubernetes.md @@ -331,4 +331,4 @@ That's it! You've successfully deployed Traefik and configured routing in a Kube - [Learn more about Kubernetes CRD provider](../reference/install-configuration/providers/kubernetes/kubernetes-crd.md) - [Learn more about Kubernetes Gateway API provider](../reference/install-configuration/providers/kubernetes/kubernetes-gateway.md) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/https/acme.md b/docs/content/https/acme.md index 97c00c06b..aa3b8ecec 100644 --- a/docs/content/https/acme.md +++ b/docs/content/https/acme.md @@ -1211,4 +1211,4 @@ If Let's Encrypt is not reachable, the following certificates will apply: !!! important For new (sub)domains which need Let's Encrypt authentication, the default Traefik certificate will be used until Traefik is restarted. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/https/overview.md b/docs/content/https/overview.md index 9261d0db8..ae07504d9 100644 --- a/docs/content/https/overview.md +++ b/docs/content/https/overview.md @@ -20,4 +20,4 @@ That is to say, how to obtain [TLS certificates](./tls.md#certificates-definitio either through a definition in the dynamic configuration, or through [Let's Encrypt](./acme.md) (ACME). And how to configure [TLS options](./tls.md#tls-options), and [certificates stores](./tls.md#certificates-stores). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/https/tls.md b/docs/content/https/tls.md index 6b48e8e46..abda2dd93 100644 --- a/docs/content/https/tls.md +++ b/docs/content/https/tls.md @@ -587,4 +587,4 @@ spec: disableSessionTickets: true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/basicauth.md b/docs/content/middlewares/http/basicauth.md index 75d3a9a0c..f7017842e 100644 --- a/docs/content/middlewares/http/basicauth.md +++ b/docs/content/middlewares/http/basicauth.md @@ -340,4 +340,4 @@ http: removeHeader = true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/forwardauth.md b/docs/content/middlewares/http/forwardauth.md index 5f60cd138..81bbcedd5 100644 --- a/docs/content/middlewares/http/forwardauth.md +++ b/docs/content/middlewares/http/forwardauth.md @@ -785,4 +785,4 @@ http: preserveRequestMethod = true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/headers.md b/docs/content/middlewares/http/headers.md index 419642391..a302d6231 100644 --- a/docs/content/middlewares/http/headers.md +++ b/docs/content/middlewares/http/headers.md @@ -422,4 +422,4 @@ Set `isDevelopment` to `true` when developing to mitigate the unwanted effects o Usually testing takes place using HTTP, not HTTPS, and on `localhost`, not your production domain. If you would like your development environment to mimic production with complete Host blocking, SSL redirects, and STS headers, leave this as `false`. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/overview.md b/docs/content/middlewares/http/overview.md index cb40c56b4..27f0d4fd2 100644 --- a/docs/content/middlewares/http/overview.md +++ b/docs/content/middlewares/http/overview.md @@ -127,4 +127,4 @@ http: Please take a look at the community-contributed plugins in the [plugin catalog](https://plugins.traefik.io/plugins). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/redirectregex.md b/docs/content/middlewares/http/redirectregex.md index 5488117db..a28fa0ada 100644 --- a/docs/content/middlewares/http/redirectregex.md +++ b/docs/content/middlewares/http/redirectregex.md @@ -85,4 +85,4 @@ The `replacement` option defines how to modify the URL to have the new target UR Care should be taken when defining replacement expand variables: `$1x` is equivalent to `${1x}`, not `${1}x` (see [Regexp.Expand](https://golang.org/pkg/regexp/#Regexp.Expand)), so use `${1}` syntax. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/http/stripprefix.md b/docs/content/middlewares/http/stripprefix.md index 5c985b243..a68e813fc 100644 --- a/docs/content/middlewares/http/stripprefix.md +++ b/docs/content/middlewares/http/stripprefix.md @@ -146,4 +146,4 @@ http: forceSlash = false ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/middlewares/overview.md b/docs/content/middlewares/overview.md index 92be4ecda..5a2971791 100644 --- a/docs/content/middlewares/overview.md +++ b/docs/content/middlewares/overview.md @@ -112,4 +112,4 @@ A list of HTTP middlewares can be found [here](http/overview.md). A list of TCP middlewares can be found [here](tcp/overview.md). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/migrate/v2-to-v3.md b/docs/content/migrate/v2-to-v3.md index 175f36921..2c09f86f9 100644 --- a/docs/content/migrate/v2-to-v3.md +++ b/docs/content/migrate/v2-to-v3.md @@ -158,4 +158,4 @@ core: - ✅ All applications functioning correctly - ✅ Performance metrics stable -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/observability/access-logs.md b/docs/content/observability/access-logs.md index 92f393afe..4b5ce0b36 100644 --- a/docs/content/observability/access-logs.md +++ b/docs/content/observability/access-logs.md @@ -780,4 +780,4 @@ accesslog: --accesslog.otlp.grpc.tls.insecureSkipVerify=true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/observability/logs.md b/docs/content/observability/logs.md index 8f82e9936..8c39edc04 100644 --- a/docs/content/observability/logs.md +++ b/docs/content/observability/logs.md @@ -644,4 +644,4 @@ log: --log.otlp.grpc.tls.insecureSkipVerify=true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/observe/overview.md b/docs/content/observe/overview.md index e5e822221..c7dc2279a 100644 --- a/docs/content/observe/overview.md +++ b/docs/content/observe/overview.md @@ -77,4 +77,4 @@ additionalArguments: !!! note A router with its own observability configuration will override the global default. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/operations/api.md b/docs/content/operations/api.md index 8e867bdad..f4fcb03e2 100644 --- a/docs/content/operations/api.md +++ b/docs/content/operations/api.md @@ -176,4 +176,4 @@ All the following endpoints must be accessed with a `GET` HTTP request. | `/debug/pprof/symbol` | See the [pprof Symbol](https://golang.org/pkg/net/http/pprof/#Symbol) Go documentation. | | `/debug/pprof/trace` | See the [pprof Trace](https://golang.org/pkg/net/http/pprof/#Trace) Go documentation. | -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/operations/dashboard.md b/docs/content/operations/dashboard.md index c3776a369..6b086a272 100644 --- a/docs/content/operations/dashboard.md +++ b/docs/content/operations/dashboard.md @@ -168,4 +168,4 @@ api: --api.dashboard=false ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/plugins/index.md b/docs/content/plugins/index.md index 9cd3662f8..b3172a9a8 100644 --- a/docs/content/plugins/index.md +++ b/docs/content/plugins/index.md @@ -31,4 +31,4 @@ The experience of implementing a Traefik plugin is comparable to writing a web b To learn more about Traefik plugin creation, please refer to the [developer documentation](https://plugins.traefik.io/create). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/docker.md b/docs/content/providers/docker.md index e49557a33..24136bd67 100644 --- a/docs/content/providers/docker.md +++ b/docs/content/providers/docker.md @@ -702,4 +702,4 @@ providers: --providers.docker.allowEmptyServices=true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/file.md b/docs/content/providers/file.md index c1f328e32..1fbab2b99 100644 --- a/docs/content/providers/file.md +++ b/docs/content/providers/file.md @@ -292,4 +292,4 @@ To illustrate, it is possible to easily define multiple routers, services, and T {{ end }} ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/kubernetes-crd.md b/docs/content/providers/kubernetes-crd.md index 855f2bcc2..18f56f039 100644 --- a/docs/content/providers/kubernetes-crd.md +++ b/docs/content/providers/kubernetes-crd.md @@ -16,7 +16,7 @@ the Traefik engineering team developed a [Custom Resource Definition](https://ku ## Requirements -{!kubernetes-requirements.md!} +{% include-markdown "includes/kubernetes-requirements.md" %} !!! tip "All Steps for a Successful Deployment" @@ -365,4 +365,4 @@ providers: For additional information, refer to the [full example](../user-guides/crd-acme/index.md) with Let's Encrypt. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/kubernetes-gateway.md b/docs/content/providers/kubernetes-gateway.md index a8615748a..7842bb721 100644 --- a/docs/content/providers/kubernetes-gateway.md +++ b/docs/content/providers/kubernetes-gateway.md @@ -16,7 +16,7 @@ For more details, check out the conformance [report](https://github.com/kubernet ## Requirements -{!kubernetes-requirements.md!} +{% include-markdown "includes/kubernetes-requirements.md" %} !!! info "Helm Chart" @@ -357,4 +357,4 @@ providers: --providers.kubernetesgateway.throttleDuration=10s ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/kubernetes-ingress.md b/docs/content/providers/kubernetes-ingress.md index 4811dd0f1..bf148867b 100644 --- a/docs/content/providers/kubernetes-ingress.md +++ b/docs/content/providers/kubernetes-ingress.md @@ -13,7 +13,7 @@ it manages access to cluster services by supporting the [Ingress](https://kubern ## Requirements -{!kubernetes-requirements.md!} +{% include-markdown "includes/kubernetes-requirements.md" %} ## Routing Configuration @@ -557,4 +557,4 @@ providers: To learn more about the various aspects of the Ingress specification that Traefik supports, many examples of Ingresses definitions are located in the test [examples](https://github.com/traefik/traefik/tree/v3.6/pkg/provider/kubernetes/ingress/fixtures) of the Traefik repository. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/overview.md b/docs/content/providers/overview.md index 7ee8ad75c..8723f58a7 100644 --- a/docs/content/providers/overview.md +++ b/docs/content/providers/overview.md @@ -227,4 +227,4 @@ List of providers that support constraints: - [Kubernetes Ingress](./kubernetes-ingress.md#labelselector) - [Kubernetes Gateway](./kubernetes-gateway.md#labelselector) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/providers/swarm.md b/docs/content/providers/swarm.md index e82e1d518..26a2c7e97 100644 --- a/docs/content/providers/swarm.md +++ b/docs/content/providers/swarm.md @@ -769,4 +769,4 @@ providers: --providers.swarm.allowEmptyServices=true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/dynamic-configuration/kubernetes-crd.md b/docs/content/reference/dynamic-configuration/kubernetes-crd.md index fb6ec6f72..aec00bee1 100644 --- a/docs/content/reference/dynamic-configuration/kubernetes-crd.md +++ b/docs/content/reference/dynamic-configuration/kubernetes-crd.md @@ -26,4 +26,4 @@ Dynamic configuration with Kubernetes Custom Resource --8<-- "content/reference/dynamic-configuration/kubernetes-crd-rbac.yml" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/api-dashboard.md b/docs/content/reference/install-configuration/api-dashboard.md index c5736a9df..42b954d01 100644 --- a/docs/content/reference/install-configuration/api-dashboard.md +++ b/docs/content/reference/install-configuration/api-dashboard.md @@ -255,4 +255,4 @@ rule = "PathPrefix(`/api`) || PathPrefix(`/dashboard`)" rule = "Host(`traefik.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/observability/logs-and-accesslogs.md b/docs/content/reference/install-configuration/observability/logs-and-accesslogs.md index bc4f81439..147826fc0 100644 --- a/docs/content/reference/install-configuration/observability/logs-and-accesslogs.md +++ b/docs/content/reference/install-configuration/observability/logs-and-accesslogs.md @@ -409,4 +409,4 @@ services: - /var/run/docker.sock:/var/run/docker.sock ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/providers/docker.md b/docs/content/reference/install-configuration/providers/docker.md index dfc3dbab2..47354ae91 100644 --- a/docs/content/reference/install-configuration/providers/docker.md +++ b/docs/content/reference/install-configuration/providers/docker.md @@ -427,4 +427,4 @@ You can specify which Docker API Endpoint to use with the directive [`endpoint`] - [Letting Traefik run on Worker Nodes](https://blog.mikesir87.io/2018/07/letting-traefik-run-on-worker-nodes/) - [Docker Socket Proxy from Tecnativa](https://github.com/Tecnativa/docker-socket-proxy) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/providers/kubernetes/knative.md b/docs/content/reference/install-configuration/providers/kubernetes/knative.md index ad2807f0c..810bf2335 100644 --- a/docs/content/reference/install-configuration/providers/kubernetes/knative.md +++ b/docs/content/reference/install-configuration/providers/kubernetes/knative.md @@ -15,7 +15,7 @@ enabling seamless integration between Traefik's networking capabilities and Knat ## Requirements -{!kubernetes-requirements.md!} +{% include-markdown "includes/kubernetes-requirements.md" %} 1. Install/update the Knative CRDs. @@ -139,4 +139,4 @@ providers: See the dedicated section in [routing](../../../routing-configuration/kubernetes/knative.md). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-crd.md b/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-crd.md index 9965dfebf..d89e28bd2 100644 --- a/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-crd.md +++ b/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-crd.md @@ -130,4 +130,4 @@ See the dedicated section in [routing](../../../../routing/providers/kubernetes- For additional information, refer to the [full example](../../../../user-guides/crd-acme/index.md) with Let's Encrypt. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-gateway.md b/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-gateway.md index 52284f80f..2a59a8300 100644 --- a/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-gateway.md +++ b/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-gateway.md @@ -21,7 +21,7 @@ For more details, check out the conformance [report](https://github.com/kubernet ## Requirements -{!kubernetes-requirements.md!} +{% include-markdown "includes/kubernetes-requirements.md" %} 1. Install/update the Kubernetes Gateway API CRDs. @@ -137,4 +137,4 @@ See the dedicated section in [routing](../../../../routing/providers/kubernetes- and the dedicated [routing section](../../../../routing/providers/kubernetes-gateway.md) in the Traefik documentation. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-ingress-nginx.md b/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-ingress-nginx.md index 7df3de59b..aa42c8acb 100644 --- a/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-ingress-nginx.md +++ b/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-ingress-nginx.md @@ -176,4 +176,4 @@ providers: See the dedicated section in [routing](../../../routing-configuration/kubernetes/ingress-nginx.md). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-ingress.md b/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-ingress.md index 67f36d820..b9df965b7 100644 --- a/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-ingress.md +++ b/docs/content/reference/install-configuration/providers/kubernetes/kubernetes-ingress.md @@ -149,4 +149,4 @@ many examples of Ingresses definitions are located in the test [examples](https://github.com/traefik/traefik/tree/v3.1/pkg/provider/kubernetes/ingress/fixtures) of the Traefik repository. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/providers/others/file.md b/docs/content/reference/install-configuration/providers/others/file.md index 737c7a65c..1f3304d84 100644 --- a/docs/content/reference/install-configuration/providers/others/file.md +++ b/docs/content/reference/install-configuration/providers/others/file.md @@ -121,4 +121,4 @@ http: As it is very difficult to listen to all file system notifications, Traefik uses [fsnotify](https://github.com/fsnotify/fsnotify). If using a directory with a mounted directory does not fix your issue, please check your file system compatibility with fsnotify. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/providers/overview.md b/docs/content/reference/install-configuration/providers/overview.md index 5253f57a0..cbdbffb4d 100644 --- a/docs/content/reference/install-configuration/providers/overview.md +++ b/docs/content/reference/install-configuration/providers/overview.md @@ -160,4 +160,4 @@ List of providers that support constraints: - [Consul Catalog](./hashicorp/consul-catalog.md#constraints) - [Nomad](./hashicorp/nomad.md#constraints) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/providers/swarm.md b/docs/content/reference/install-configuration/providers/swarm.md index 8f876dfd2..e1d57e14b 100644 --- a/docs/content/reference/install-configuration/providers/swarm.md +++ b/docs/content/reference/install-configuration/providers/swarm.md @@ -464,4 +464,4 @@ It allows different implementation levels of the [AAA (Authentication, Authoriza - [Letting Traefik run on Worker Nodes](https://blog.mikesir87.io/2018/07/letting-traefik-run-on-worker-nodes/) - [Docker Socket Proxy from Tecnativa](https://github.com/Tecnativa/docker-socket-proxy) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/tls/certificate-resolvers/acme.md b/docs/content/reference/install-configuration/tls/certificate-resolvers/acme.md index 407909818..dbb12e8a8 100644 --- a/docs/content/reference/install-configuration/tls/certificate-resolvers/acme.md +++ b/docs/content/reference/install-configuration/tls/certificate-resolvers/acme.md @@ -330,4 +330,4 @@ If Let's Encrypt is not reachable, the following certificates will apply: !!! important For new (sub)domains which need Let's Encrypt authentication, the default Traefik certificate will be used until Traefik is restarted. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/install-configuration/tls/certificate-resolvers/overview.md b/docs/content/reference/install-configuration/tls/certificate-resolvers/overview.md index 5652f0982..eccf4a66a 100644 --- a/docs/content/reference/install-configuration/tls/certificate-resolvers/overview.md +++ b/docs/content/reference/install-configuration/tls/certificate-resolvers/overview.md @@ -17,4 +17,4 @@ The Certificates resolvers are defined in the static configuration. Defining a certificate resolver does not imply that routers are going to use it automatically. Each router or entrypoint that is meant to use the resolver must explicitly reference it. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/apikey.md b/docs/content/reference/routing-configuration/http/middlewares/apikey.md index 454c141a1..a5b2c44b2 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/apikey.md +++ b/docs/content/reference/routing-configuration/http/middlewares/apikey.md @@ -53,4 +53,4 @@ stringData: | `secretNonBase64Encoded` | Defines whether the secret sent by the client is base64 encoded. | false | No | | `secretValues` | Contain the hash of the API keys.
Supported hashing algorithms are Bcrypt, SHA1 and MD5.
The hash should be generated using `htpasswd`.
Can reference a Kubernetes Secret using the URN format: `urn:k8s:secret:[name]:[valueKey]` | [] | Yes | -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/basicauth.md b/docs/content/reference/routing-configuration/http/middlewares/basicauth.md index be372250b..641170051 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/basicauth.md +++ b/docs/content/reference/routing-configuration/http/middlewares/basicauth.md @@ -92,4 +92,4 @@ The option `users` supports Kubernetes secrets. Please note that these keys are not hashed or encrypted in any way, and therefore is less secure than other methods. You can find more information on the [Kubernetes Basic Authentication Secret Documentation](https://kubernetes.io/docs/concepts/configuration/secret/#basic-authentication-secret) -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/digestauth.md b/docs/content/reference/routing-configuration/http/middlewares/digestauth.md index 974ef48ce..8e5354393 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/digestauth.md +++ b/docs/content/reference/routing-configuration/http/middlewares/digestauth.md @@ -82,4 +82,4 @@ On Kubernetes, you don’t use the `users` or `usersFile` fields. Instead, you r - `kubernetes.io/basic-auth secret`: This secret type contains two keys—`username` and `password`—but is generally suited for a smaller number of users. Please note that these keys are not hashed or encrypted in any way, and therefore is less secure than the other method. - Opaque secret with a users field: Here, the secret contains a single string field (often called `users`) where each line represents a user. This approach allows you to store multiple users in one secret. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/forwardauth.md b/docs/content/reference/routing-configuration/http/middlewares/forwardauth.md index 2b69b00ba..30bc78ec7 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/forwardauth.md +++ b/docs/content/reference/routing-configuration/http/middlewares/forwardauth.md @@ -127,4 +127,4 @@ The following request properties are provided to the forward-auth target endpoin | Request URI | `X-Forwarded-Uri` | | Source IP-Address | `X-Forwarded-For` | -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/headers.md b/docs/content/reference/routing-configuration/http/middlewares/headers.md index 5d468363e..f1774d85e 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/headers.md +++ b/docs/content/reference/routing-configuration/http/middlewares/headers.md @@ -323,4 +323,4 @@ It allows all origins that contain any match of a regular expression in the `acc When defining a regular expression within YAML, any escaped character needs to be escaped twice: `example\.com` needs to be written as `example\\.com`. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/hmac.md b/docs/content/reference/routing-configuration/http/middlewares/hmac.md index 2eabab306..0bc37da90 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/hmac.md +++ b/docs/content/reference/routing-configuration/http/middlewares/hmac.md @@ -204,4 +204,4 @@ Only SHA-256 and SHA-512 checksums are supported for checksum computation. To disable this feature and only perform authentication, set the `validateDigest` option to `false` in the middleware configuration. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/jwt.md b/docs/content/reference/routing-configuration/http/middlewares/jwt.md index 2aebcdf86..5dc9f5479 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/jwt.md +++ b/docs/content/reference/routing-configuration/http/middlewares/jwt.md @@ -230,4 +230,4 @@ The reference to a Kubernetes secret takes the form of a URN: urn:k8s:secret:[name]:[valueKey] ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/ldap.md b/docs/content/reference/routing-configuration/http/middlewares/ldap.md index 9a0efc6f2..027d6ee02 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/ldap.md +++ b/docs/content/reference/routing-configuration/http/middlewares/ldap.md @@ -102,4 +102,4 @@ and a `bindPassword`, then the middleware runs in search mode. In this mode, a s issued to the LDAP server before trying to bind. If result of this search returns only 1 record, it tries to issue a bind request with this record, otherwise it aborts a `401 Unauthorized` status code. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/oauth2-client-credentials.md b/docs/content/reference/routing-configuration/http/middlewares/oauth2-client-credentials.md index 80eecea88..40de4f315 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/oauth2-client-credentials.md +++ b/docs/content/reference/routing-configuration/http/middlewares/oauth2-client-credentials.md @@ -252,4 +252,4 @@ The following Redis modes are supported: For more information about Redis, we recommend the [official Redis documentation](https://redis.io/docs/ "Link to official Redis documentation"). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/oauth2-token-introspection.md b/docs/content/reference/routing-configuration/http/middlewares/oauth2-token-introspection.md index 8633abcbb..d98ad4e43 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/oauth2-token-introspection.md +++ b/docs/content/reference/routing-configuration/http/middlewares/oauth2-token-introspection.md @@ -206,4 +206,4 @@ stringData: -----END EC PRIVATE KEY----- ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/oidc.md b/docs/content/reference/routing-configuration/http/middlewares/oidc.md index 120e79bf9..0e0dfe1ea 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/oidc.md +++ b/docs/content/reference/routing-configuration/http/middlewares/oidc.md @@ -427,4 +427,4 @@ This means that a new CSRF token will be generated and sent to the client whenev When a request is sent and uses a non-safe method (see [RFC7231#section-4.2.1](https://datatracker.ietf.org/doc/html/rfc7231.html#section-4.2.1)), the CSRF token value (extracted from the cookie) have to be sent to the server in the header configured with the [headerName option](#configuration-options). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/opa.md b/docs/content/reference/routing-configuration/http/middlewares/opa.md index 4dabfe455..298c8ef04 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/opa.md +++ b/docs/content/reference/routing-configuration/http/middlewares/opa.md @@ -69,4 +69,4 @@ spec: | `allow` | The `allow` option sets the expression to evaluate that determines if the request should be authorized. | "" | No (one of `allow` or `forwardHeaders` must be set) | | `forwardHeaders` | The `forwardHeaders` option sets the HTTP headers to add to requests and populates them with the result of the given expression. | "" | No (one of `allow` or `forwardHeaders` must be set) | -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/overview.md b/docs/content/reference/routing-configuration/http/middlewares/overview.md index 40ddb6015..5a287c70b 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/overview.md +++ b/docs/content/reference/routing-configuration/http/middlewares/overview.md @@ -48,4 +48,4 @@ Middlewares that use the same protocol can be combined into chains to fit every Please take a look at the community-contributed plugins in the [plugin catalog](https://plugins.traefik.io/plugins). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/redirectregex.md b/docs/content/reference/routing-configuration/http/middlewares/redirectregex.md index 942f2e833..187cb0286 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/redirectregex.md +++ b/docs/content/reference/routing-configuration/http/middlewares/redirectregex.md @@ -85,4 +85,4 @@ The `replacement` option defines how to modify the URL to have the new target UR Care should be taken when defining replacement expand variables: `$1x` is equivalent to `${1x}`, not `${1}x` (see [Regexp.Expand](https://golang.org/pkg/regexp/#Regexp.Expand)), so use `${1}` syntax. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/stripprefix.md b/docs/content/reference/routing-configuration/http/middlewares/stripprefix.md index b3e6ebfd8..90590489c 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/stripprefix.md +++ b/docs/content/reference/routing-configuration/http/middlewares/stripprefix.md @@ -63,4 +63,4 @@ spec: |:-----------------------------|:--------------------------------------------------------------|:--------|:---------| | `prefixes` | List of prefixes to strip from the request URL.
If your backend is serving assets (for example, images or JavaScript files), it can use the `X-Forwarded-Prefix` header to construct relative URLs. | [] | No | -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/middlewares/waf.md b/docs/content/reference/routing-configuration/http/middlewares/waf.md index e5e864db7..33fe47b21 100644 --- a/docs/content/reference/routing-configuration/http/middlewares/waf.md +++ b/docs/content/reference/routing-configuration/http/middlewares/waf.md @@ -61,4 +61,4 @@ spec: | `directives` | List of WAF rules to enforce. | | Yes | | `crsEnabled` | Enable [CRS rulesets](https://github.com/corazawaf/coraza-coreruleset/tree/main/rules/%40owasp_crs).
Once the ruleset is enabled, it can be used in the middleware. | false | False | -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/routing/multi-layer-routing.md b/docs/content/reference/routing-configuration/http/routing/multi-layer-routing.md index 3e878fa63..7d6f9f01e 100644 --- a/docs/content/reference/routing-configuration/http/routing/multi-layer-routing.md +++ b/docs/content/reference/routing-configuration/http/routing/multi-layer-routing.md @@ -185,4 +185,4 @@ Request → EntryPoint → Parent Router → Middleware → Child Router A → S 4. If `X-User-Role: admin`, `api-admin` router matches and forwards to `admin-service` 5. If `X-User-Role: user`, `api-user` router matches and forwards to `user-service` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/routing/router.md b/docs/content/reference/routing-configuration/http/routing/router.md index da515f937..6d322e121 100644 --- a/docs/content/reference/routing-configuration/http/routing/router.md +++ b/docs/content/reference/routing-configuration/http/routing/router.md @@ -118,4 +118,4 @@ labels: - The character `@` is not authorized in the router name - In provider-specific configurations (Docker, Kubernetes), router names are often auto-generated based on service names and rules -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/tls/overview.md b/docs/content/reference/routing-configuration/http/tls/overview.md index c1e1a6892..7e05bf185 100644 --- a/docs/content/reference/routing-configuration/http/tls/overview.md +++ b/docs/content/reference/routing-configuration/http/tls/overview.md @@ -100,4 +100,4 @@ This provides fine-grained control over certificate generation and takes precede Every domain must have A/AAAA records pointing to Traefik. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/tls/tls-certificates.md b/docs/content/reference/routing-configuration/http/tls/tls-certificates.md index 155dd1e4c..cb2f1a4ce 100644 --- a/docs/content/reference/routing-configuration/http/tls/tls-certificates.md +++ b/docs/content/reference/routing-configuration/http/tls/tls-certificates.md @@ -155,4 +155,4 @@ labels: } ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/http/tls/tls-options.md b/docs/content/reference/routing-configuration/http/tls/tls-options.md index 939edf91e..0339ba70c 100644 --- a/docs/content/reference/routing-configuration/http/tls/tls-options.md +++ b/docs/content/reference/routing-configuration/http/tls/tls-options.md @@ -259,4 +259,4 @@ spec: disableSessionTickets: true ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/kubernetes/gateway-api.md b/docs/content/reference/routing-configuration/kubernetes/gateway-api.md index 8f5d27c40..675fa7a8d 100644 --- a/docs/content/reference/routing-configuration/kubernetes/gateway-api.md +++ b/docs/content/reference/routing-configuration/kubernetes/gateway-api.md @@ -763,4 +763,4 @@ spec: ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/kubernetes/ingress.md b/docs/content/reference/routing-configuration/kubernetes/ingress.md index 2538031fa..f614b80b9 100644 --- a/docs/content/reference/routing-configuration/kubernetes/ingress.md +++ b/docs/content/reference/routing-configuration/kubernetes/ingress.md @@ -619,4 +619,4 @@ This will allow users to create a "default router" that will match all unmatched To do this, use the `traefik.ingress.kubernetes.io/router.priority` annotation (as seen in [Annotations on Ingress](#on-ingress)) on your ingresses accordingly. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/kubernetes/knative.md b/docs/content/reference/routing-configuration/kubernetes/knative.md index 70d29a051..c4ac719a0 100644 --- a/docs/content/reference/routing-configuration/kubernetes/knative.md +++ b/docs/content/reference/routing-configuration/kubernetes/knative.md @@ -93,4 +93,4 @@ Use the default URL to access percentage-based routing: Check out the Knative documentation for [HTTP/HTTPS configuration](https://knative.dev/docs/serving/encryption/external-domain-tls/#configure-external-domain-encryption). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/tcp/routing/router.md b/docs/content/reference/routing-configuration/tcp/routing/router.md index 4761ebf5c..54eeb09d2 100644 --- a/docs/content/reference/routing-configuration/tcp/routing/router.md +++ b/docs/content/reference/routing-configuration/tcp/routing/router.md @@ -101,4 +101,4 @@ labels: - Router names should be descriptive and follow your naming conventions - In provider-specific configurations (Docker, Kubernetes), router names are often auto-generated based on service names and rules -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/tcp/tls.md b/docs/content/reference/routing-configuration/tcp/tls.md index ccaf54dfb..c4d45c79d 100644 --- a/docs/content/reference/routing-configuration/tcp/tls.md +++ b/docs/content/reference/routing-configuration/tcp/tls.md @@ -123,4 +123,4 @@ This provides fine-grained control over certificate generation and takes precede Every domain must have A/AAAA records pointing to Traefik. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/udp/routing/rules-priority.md b/docs/content/reference/routing-configuration/udp/routing/rules-priority.md index a43d3653e..54e5f4000 100644 --- a/docs/content/reference/routing-configuration/udp/routing/rules-priority.md +++ b/docs/content/reference/routing-configuration/udp/routing/rules-priority.md @@ -109,4 +109,4 @@ labels: There must be one (and only one) UDP [service](../service.md) referenced per UDP router. Services are the target for the router. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/reference/routing-configuration/udp/service.md b/docs/content/reference/routing-configuration/udp/service.md index f792d0b2c..671ce6283 100644 --- a/docs/content/reference/routing-configuration/udp/service.md +++ b/docs/content/reference/routing-configuration/udp/service.md @@ -41,4 +41,4 @@ udp: address = "xx.xx.xx.xx:xx" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/entrypoints.md b/docs/content/routing/entrypoints.md index d69eb0d28..bba202c0e 100644 --- a/docs/content/routing/entrypoints.md +++ b/docs/content/routing/entrypoints.md @@ -1722,4 +1722,4 @@ entryPoints: --entryPoints.foo.observability.tracing=false ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/overview.md b/docs/content/routing/overview.md index dd1d0342f..989a2704a 100644 --- a/docs/content/routing/overview.md +++ b/docs/content/routing/overview.md @@ -651,4 +651,4 @@ tcpServersTransport: --tcpServersTransport.spiffe.trustDomain=spiffe://trust-domain ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/providers/kubernetes-crd.md b/docs/content/routing/providers/kubernetes-crd.md index e9fa28b55..1fd5028ea 100644 --- a/docs/content/routing/providers/kubernetes-crd.md +++ b/docs/content/routing/providers/kubernetes-crd.md @@ -2039,4 +2039,4 @@ If the ServersTransportTCP CRD is defined in another provider the cross-provider Also see the [full example](../../user-guides/crd-acme/index.md) with Let's Encrypt. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/providers/kubernetes-gateway.md b/docs/content/routing/providers/kubernetes-gateway.md index 512f64784..4ff202e50 100644 --- a/docs/content/routing/providers/kubernetes-gateway.md +++ b/docs/content/routing/providers/kubernetes-gateway.md @@ -750,4 +750,4 @@ spec: [...] ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/providers/kubernetes-ingress.md b/docs/content/routing/providers/kubernetes-ingress.md index 99037868b..1d8f8e0ef 100644 --- a/docs/content/routing/providers/kubernetes-ingress.md +++ b/docs/content/routing/providers/kubernetes-ingress.md @@ -960,4 +960,4 @@ This will allow users to create a "default router" that will match all unmatched To do this, use the `traefik.ingress.kubernetes.io/router.priority` annotation (as seen in [Annotations on Ingress](#on-ingress)) on your ingresses accordingly. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index 06cd3f05b..9b0807f07 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -1790,4 +1790,4 @@ Services are the target for the router. !!! important "UDP routers can only target UDP services (and not HTTP or TCP services)." -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/routing/services/index.md b/docs/content/routing/services/index.md index 0c736b1b1..7ae01c5c1 100644 --- a/docs/content/routing/services/index.md +++ b/docs/content/routing/services/index.md @@ -2395,4 +2395,4 @@ udp: address = "private-ip-server-2:8080/" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/secure/secure-api-access-with-jwt.md b/docs/content/secure/secure-api-access-with-jwt.md index 5e853a637..4c9b8eb65 100644 --- a/docs/content/secure/secure-api-access-with-jwt.md +++ b/docs/content/secure/secure-api-access-with-jwt.md @@ -201,4 +201,4 @@ spec: For example, the metadata recovered from the Identity Provider can be used to restrict the access to the applications. To do so, you can use the `claims` option, more information in the [dedicated section](../reference/routing-configuration/http/middlewares/jwt.md#claims). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/secure/secure-api-access-with-oidc.md b/docs/content/secure/secure-api-access-with-oidc.md index f7b18def9..62347442c 100644 --- a/docs/content/secure/secure-api-access-with-oidc.md +++ b/docs/content/secure/secure-api-access-with-oidc.md @@ -107,4 +107,4 @@ spec: - Using a cookie ([Options `session`](../reference/routing-configuration/http/middlewares/oidc.md#configuration-options) (default behavior)) - Using a [Redis store](../reference/routing-configuration/http/middlewares/oidc.md#sessionstore). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/secure/secure-api-access-with-waf.md b/docs/content/secure/secure-api-access-with-waf.md index 455839b99..6ca34e39a 100644 --- a/docs/content/secure/secure-api-access-with-waf.md +++ b/docs/content/secure/secure-api-access-with-waf.md @@ -187,4 +187,4 @@ spec: The WAF middleware supports extensive customization through Coraza directives. You can create custom rules, tune detection thresholds, configure logging levels, and integrate with external threat intelligence feeds. For comprehensive rule writing guidance, consult the [Coraza documentation](https://coraza.io/docs/tutorials/introduction/) and [OWASP CRS documentation](https://coreruleset.org/docs/). -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/setup/docker.md b/docs/content/setup/docker.md index beaf29f9d..e270b318c 100644 --- a/docs/content/setup/docker.md +++ b/docs/content/setup/docker.md @@ -296,4 +296,4 @@ This enables access logs to the container's standard output (viewable via `docke You now have a basic Traefik setup in Docker with secure dashboard access and HTTP-to-HTTPS redirection. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/setup/kubernetes.md b/docs/content/setup/kubernetes.md index 024a48641..4cdd6def0 100644 --- a/docs/content/setup/kubernetes.md +++ b/docs/content/setup/kubernetes.md @@ -397,4 +397,4 @@ This enables OTel tracing and specifies the collector endpoint. Consult the [Tra This setup establishes Traefik with secure dashboard access and HTTPS redirection, along with pointers to enable observability & TLS. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/setup/swarm.md b/docs/content/setup/swarm.md index cb9af5965..1d3237153 100644 --- a/docs/content/setup/swarm.md +++ b/docs/content/setup/swarm.md @@ -327,4 +327,4 @@ command: You now have Traefik running on Docker Swarm with HTTPS, a secured dashboard, automatic HTTP → HTTPS redirects, and foundational observability. Expand this stack with Let’s Encrypt, additional middlewares, or multiple Traefik replicas as your Swarm grows. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/user-guides/cert-manager.md b/docs/content/user-guides/cert-manager.md index fbb90d918..c6edd855f 100644 --- a/docs/content/user-guides/cert-manager.md +++ b/docs/content/user-guides/cert-manager.md @@ -180,4 +180,4 @@ There are multiple event sources available to investigate when using cert-manage cert-manager documentation provides a [detailed guide](https://cert-manager.io/docs/troubleshooting/) on how to troubleshoot a certificate request. -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/user-guides/docker-compose/acme-dns/index.md b/docs/content/user-guides/docker-compose/acme-dns/index.md index 78f25f8d4..eb6178d82 100644 --- a/docs/content/user-guides/docker-compose/acme-dns/index.md +++ b/docs/content/user-guides/docker-compose/acme-dns/index.md @@ -187,4 +187,4 @@ environment: - "OVH_CONSUMER_KEY_FILE=/run/secrets/ovh_consumer_key" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/user-guides/docker-compose/acme-tls/index.md b/docs/content/user-guides/docker-compose/acme-tls/index.md index 942d17cc1..937664081 100644 --- a/docs/content/user-guides/docker-compose/acme-tls/index.md +++ b/docs/content/user-guides/docker-compose/acme-tls/index.md @@ -83,4 +83,4 @@ labels: - "traefik.http.routers.whoami.tls.certresolver=myresolver" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/content/user-guides/docker-compose/basic-example/index.md b/docs/content/user-guides/docker-compose/basic-example/index.md index 60a01516e..b29b84925 100644 --- a/docs/content/user-guides/docker-compose/basic-example/index.md +++ b/docs/content/user-guides/docker-compose/basic-example/index.md @@ -131,4 +131,4 @@ whoami: - "traefik.http.routers.whoami.entrypoints=web" ``` -{!traefik-for-business-applications.md!} +{% include-markdown "includes/traefik-for-business-applications.md" %} diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 9f26be973..77e5ce866 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -45,6 +45,8 @@ plugins: - exclude: glob: - "**/include-*.md" + - include-markdown: + encoding: utf-8 - redirects: redirect_maps: # Providers @@ -180,9 +182,6 @@ markdown_extensions: - pymdownx.tasklist - pymdownx.snippets: check_paths: true - - markdown_include.include: - base_path: content/includes/ - encoding: utf-8 - toc: permalink: true diff --git a/docs/requirements.txt b/docs/requirements.txt index d2dff6242..f0d99127c 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ -markdown-include==0.5.1 -mkdocs==1.2.4 +mkdocs==1.4.3 +mkdocs-include-markdown-plugin==7.2.0 mkdocs-exclude==1.0.2 mkdocs-traefiklabs>=100.0.7 mkdocs-redirects==1.2.2 From ee265a850921c90610beb36eb5704e85aeb2cd7c Mon Sep 17 00:00:00 2001 From: Sheddy Date: Tue, 13 Jan 2026 11:16:05 +0100 Subject: [PATCH 04/13] Add Scarf Analytics to documentation --- docs/content/assets/js/extra.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/content/assets/js/extra.js b/docs/content/assets/js/extra.js index eb0cc12ff..be5a62105 100644 --- a/docs/content/assets/js/extra.js +++ b/docs/content/assets/js/extra.js @@ -1,4 +1,14 @@ /* Highlight */ (function(hljs) { hljs.initHighlightingOnLoad(); -})(hljs); \ No newline at end of file +})(hljs); + +/* Scarf Analytics - cookieless, anonymous company-level intelligence */ +(function() { + var img = document.createElement('img'); + img.src = 'https://static.scarf.sh/a.png?x-pxid=1a49232a-b165-4015-8ed2-a1092f1f0d83'; + img.referrerPolicy = 'no-referrer-when-downgrade'; + img.loading = 'eager'; + img.style.cssText = 'visibility:hidden;position:absolute;width:1px;height:1px;'; + document.body.appendChild(img); +})(); \ No newline at end of file From 2e6dfbae57a843a161129a432842e1879d566660 Mon Sep 17 00:00:00 2001 From: LBF38 Date: Tue, 13 Jan 2026 11:38:05 +0100 Subject: [PATCH 05/13] Fix condition used for serving and fenced endpoints Co-authored-by: Kevin Pollet --- .../kubernetes/crd/kubernetes_http.go | 8 +- .../kubernetes/ingress-nginx/kubernetes.go | 8 +- pkg/provider/kubernetes/ingress/kubernetes.go | 7 +- pkg/provider/kubernetes/k8s/endpoint.go | 11 --- pkg/provider/kubernetes/k8s/endpoint_test.go | 75 ------------------- 5 files changed, 15 insertions(+), 94 deletions(-) delete mode 100644 pkg/provider/kubernetes/k8s/endpoint.go delete mode 100644 pkg/provider/kubernetes/k8s/endpoint_test.go diff --git a/pkg/provider/kubernetes/crd/kubernetes_http.go b/pkg/provider/kubernetes/crd/kubernetes_http.go index 26f8b1bfd..be9490ad6 100644 --- a/pkg/provider/kubernetes/crd/kubernetes_http.go +++ b/pkg/provider/kubernetes/crd/kubernetes_http.go @@ -14,7 +14,6 @@ import ( "github.com/traefik/traefik/v3/pkg/observability/logs" "github.com/traefik/traefik/v3/pkg/provider" traefikv1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "github.com/traefik/traefik/v3/pkg/provider/kubernetes/k8s" "github.com/traefik/traefik/v3/pkg/tls" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -642,7 +641,10 @@ func (c configBuilder) loadServers(parentNamespace string, svc traefikv1alpha1.L } for _, endpoint := range endpointSlice.Endpoints { - if !k8s.EndpointServing(endpoint) { + // The Serving condition allows to track if the Pod can receive traffic. + // It is set to true when the Pod is Ready or Terminating. + // From the go documentation, a nil value should be interpreted as "true". + if !ptr.Deref(endpoint.Conditions.Serving, true) { continue } @@ -654,7 +656,7 @@ func (c configBuilder) loadServers(parentNamespace string, svc traefikv1alpha1.L addresses[address] = struct{}{} servers = append(servers, dynamic.Server{ URL: fmt.Sprintf("%s://%s", protocol, net.JoinHostPort(address, strconv.Itoa(int(port)))), - Fenced: ptr.Deref(endpoint.Conditions.Terminating, false) && ptr.Deref(endpoint.Conditions.Serving, false), + Fenced: ptr.Deref(endpoint.Conditions.Terminating, false), }) } } diff --git a/pkg/provider/kubernetes/ingress-nginx/kubernetes.go b/pkg/provider/kubernetes/ingress-nginx/kubernetes.go index c44139916..268db6ef7 100644 --- a/pkg/provider/kubernetes/ingress-nginx/kubernetes.go +++ b/pkg/provider/kubernetes/ingress-nginx/kubernetes.go @@ -22,7 +22,6 @@ import ( "github.com/traefik/traefik/v3/pkg/job" "github.com/traefik/traefik/v3/pkg/observability/logs" "github.com/traefik/traefik/v3/pkg/provider" - "github.com/traefik/traefik/v3/pkg/provider/kubernetes/k8s" "github.com/traefik/traefik/v3/pkg/safe" "github.com/traefik/traefik/v3/pkg/tls" "github.com/traefik/traefik/v3/pkg/types" @@ -646,7 +645,10 @@ func (p *Provider) getBackendAddresses(namespace string, backend netv1.IngressBa } for _, endpoint := range endpointSlice.Endpoints { - if !k8s.EndpointServing(endpoint) { + // The Serving condition allows to track if the Pod can receive traffic. + // It is set to true when the Pod is Ready or Terminating. + // From the go documentation, a nil value should be interpreted as "true". + if !ptr.Deref(endpoint.Conditions.Serving, true) { continue } @@ -658,7 +660,7 @@ func (p *Provider) getBackendAddresses(namespace string, backend netv1.IngressBa uniqAddresses[address] = struct{}{} addresses = append(addresses, backendAddress{ Address: net.JoinHostPort(address, strconv.Itoa(int(port))), - Fenced: ptr.Deref(endpoint.Conditions.Terminating, false) && ptr.Deref(endpoint.Conditions.Serving, false), + Fenced: ptr.Deref(endpoint.Conditions.Terminating, false), }) } } diff --git a/pkg/provider/kubernetes/ingress/kubernetes.go b/pkg/provider/kubernetes/ingress/kubernetes.go index fa0afe5d5..55d2ec6db 100644 --- a/pkg/provider/kubernetes/ingress/kubernetes.go +++ b/pkg/provider/kubernetes/ingress/kubernetes.go @@ -662,7 +662,10 @@ func (p *Provider) loadService(client Client, namespace string, backend netv1.In protocol := getProtocol(portSpec, portName, svcConfig) for _, endpoint := range endpointSlice.Endpoints { - if !k8s.EndpointServing(endpoint) { + // The Serving condition allows to track if the Pod can receive traffic. + // It is set to true when the Pod is Ready or Terminating. + // From the go documentation, a nil value should be interpreted as "true". + if !ptr.Deref(endpoint.Conditions.Serving, true) { continue } @@ -674,7 +677,7 @@ func (p *Provider) loadService(client Client, namespace string, backend netv1.In addresses[address] = struct{}{} svc.LoadBalancer.Servers = append(svc.LoadBalancer.Servers, dynamic.Server{ URL: fmt.Sprintf("%s://%s", protocol, net.JoinHostPort(address, strconv.Itoa(int(port)))), - Fenced: ptr.Deref(endpoint.Conditions.Terminating, false) && ptr.Deref(endpoint.Conditions.Serving, false), + Fenced: ptr.Deref(endpoint.Conditions.Terminating, false), }) } } diff --git a/pkg/provider/kubernetes/k8s/endpoint.go b/pkg/provider/kubernetes/k8s/endpoint.go deleted file mode 100644 index 415613de3..000000000 --- a/pkg/provider/kubernetes/k8s/endpoint.go +++ /dev/null @@ -1,11 +0,0 @@ -package k8s - -import ( - v1 "k8s.io/api/discovery/v1" - "k8s.io/utils/ptr" -) - -// EndpointServing returns true if the endpoint is still serving the service. -func EndpointServing(endpoint v1.Endpoint) bool { - return ptr.Deref(endpoint.Conditions.Ready, false) || ptr.Deref(endpoint.Conditions.Serving, false) -} diff --git a/pkg/provider/kubernetes/k8s/endpoint_test.go b/pkg/provider/kubernetes/k8s/endpoint_test.go deleted file mode 100644 index 9eba33f3a..000000000 --- a/pkg/provider/kubernetes/k8s/endpoint_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package k8s - -import ( - "testing" - - "github.com/stretchr/testify/assert" - v1 "k8s.io/api/discovery/v1" -) - -func TestEndpointServing(t *testing.T) { - tests := []struct { - name string - endpoint v1.Endpoint - want bool - }{ - { - name: "no status", - endpoint: v1.Endpoint{ - Conditions: v1.EndpointConditions{ - Ready: nil, - Serving: nil, - }, - }, - want: false, - }, - { - name: "ready", - endpoint: v1.Endpoint{ - Conditions: v1.EndpointConditions{ - Ready: pointer(true), - Serving: nil, - }, - }, - want: true, - }, - { - name: "not ready", - endpoint: v1.Endpoint{ - Conditions: v1.EndpointConditions{ - Ready: pointer(false), - Serving: nil, - }, - }, - want: false, - }, - { - name: "not ready and serving", - endpoint: v1.Endpoint{ - Conditions: v1.EndpointConditions{ - Ready: pointer(false), - Serving: pointer(true), - }, - }, - want: true, - }, - { - name: "not ready and not serving", - endpoint: v1.Endpoint{ - Conditions: v1.EndpointConditions{ - Ready: pointer(false), - Serving: pointer(false), - }, - }, - want: false, - }, - } - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - got := EndpointServing(test.endpoint) - assert.Equal(t, test.want, got) - }) - } -} - -func pointer[T any](v T) *T { return &v } From 794916a183a64c213c6ec5b157dd7f2d5093eab2 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij <45041769+jnoordsij@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:34:05 +0100 Subject: [PATCH 06/13] Update code generator --- .../kubernetes-crd-definition-v1.yml | 20 +- .../traefik.io_ingressroutes.yaml | 2 +- .../traefik.io_ingressroutetcps.yaml | 2 +- .../traefik.io_ingressrouteudps.yaml | 2 +- .../traefik.io_middlewares.yaml | 2 +- .../traefik.io_middlewaretcps.yaml | 2 +- .../traefik.io_serverstransports.yaml | 2 +- .../traefik.io_serverstransporttcps.yaml | 2 +- .../traefik.io_tlsoptions.yaml | 2 +- .../traefik.io_tlsstores.yaml | 2 +- .../traefik.io_traefikservices.yaml | 2 +- go.mod | 10 +- go.sum | 20 +- integration/fixtures/k8s/01-traefik-crd.yml | 20 +- pkg/provider/kubernetes/crd/client_test.go | 4 +- .../applyconfiguration/internal/internal.go | 70 +++++ .../traefikio/v1alpha1/basicauth.go | 74 +++++ .../traefikio/v1alpha1/certificate.go | 47 +++ .../traefikio/v1alpha1/chain.go | 52 ++++ .../traefikio/v1alpha1/circuitbreaker.go | 87 ++++++ .../traefikio/v1alpha1/clientauth.go | 58 ++++ .../traefikio/v1alpha1/clienttls.go | 65 +++++ .../v1alpha1/clienttlswithcaoptional.go | 72 +++++ .../traefikio/v1alpha1/compress.go | 89 ++++++ .../traefikio/v1alpha1/digestauth.go | 74 +++++ .../traefikio/v1alpha1/errorpage.go | 82 ++++++ .../traefikio/v1alpha1/forwardauth.go | 152 ++++++++++ .../traefikio/v1alpha1/forwardingtimeouts.go | 87 ++++++ .../traefikio/v1alpha1/highestrandomweight.go | 52 ++++ .../traefikio/v1alpha1/ingressroute.go | 241 +++++++++++++++ .../traefikio/v1alpha1/ingressrouteref.go | 56 ++++ .../traefikio/v1alpha1/ingressroutespec.go | 86 ++++++ .../traefikio/v1alpha1/ingressroutetcp.go | 241 +++++++++++++++ .../traefikio/v1alpha1/ingressroutetcpspec.go | 72 +++++ .../traefikio/v1alpha1/ingressrouteudp.go | 241 +++++++++++++++ .../traefikio/v1alpha1/ingressrouteudpspec.go | 63 ++++ .../traefikio/v1alpha1/loadbalancerspec.go | 178 ++++++++++++ .../traefikio/v1alpha1/middleware.go | 241 +++++++++++++++ .../traefikio/v1alpha1/middlewareref.go | 56 ++++ .../traefikio/v1alpha1/middlewarespec.go | 274 ++++++++++++++++++ .../traefikio/v1alpha1/middlewaretcp.go | 241 +++++++++++++++ .../traefikio/v1alpha1/middlewaretcpspec.go | 69 +++++ .../traefikio/v1alpha1/mirroring.go | 196 +++++++++++++ .../traefikio/v1alpha1/mirrorservice.go | 173 +++++++++++ .../traefikio/v1alpha1/objectreference.go | 56 ++++ .../v1alpha1/passiveserverhealthcheck.go | 60 ++++ .../traefikio/v1alpha1/ratelimit.go | 88 ++++++ .../traefikio/v1alpha1/redis.go | 134 +++++++++ .../traefikio/v1alpha1/responseforwarding.go | 47 +++ .../traefikio/v1alpha1/retry.go | 60 ++++ .../traefikio/v1alpha1/rootca.go | 56 ++++ .../traefikio/v1alpha1/route.go | 115 ++++++++ .../traefikio/v1alpha1/routetcp.go | 93 ++++++ .../traefikio/v1alpha1/routeudp.go | 52 ++++ .../traefikio/v1alpha1/serverhealthcheck.go | 156 ++++++++++ .../traefikio/v1alpha1/serverstransport.go | 241 +++++++++++++++ .../v1alpha1/serverstransportspec.go | 141 +++++++++ .../traefikio/v1alpha1/serverstransporttcp.go | 241 +++++++++++++++ .../v1alpha1/serverstransporttcpspec.go | 88 ++++++ .../traefikio/v1alpha1/service.go | 164 +++++++++++ .../traefikio/v1alpha1/servicetcp.go | 133 +++++++++ .../traefikio/v1alpha1/serviceudp.go | 96 ++++++ .../traefikio/v1alpha1/tls.go | 89 ++++++ .../traefikio/v1alpha1/tlsclientconfig.go | 114 ++++++++ .../traefikio/v1alpha1/tlsoption.go | 241 +++++++++++++++ .../traefikio/v1alpha1/tlsoptionref.go | 56 ++++ .../traefikio/v1alpha1/tlsoptionspec.go | 125 ++++++++ .../traefikio/v1alpha1/tlsstore.go | 241 +++++++++++++++ .../traefikio/v1alpha1/tlsstoreref.go | 56 ++++ .../traefikio/v1alpha1/tlsstorespec.go | 74 +++++ .../traefikio/v1alpha1/tlstcp.go | 98 +++++++ .../traefikio/v1alpha1/traefikservice.go | 241 +++++++++++++++ .../traefikio/v1alpha1/traefikservicespec.go | 65 +++++ .../traefikio/v1alpha1/weightedroundrobin.go | 65 +++++ .../crd/generated/applyconfiguration/utils.go | 166 +++++++++++ .../clientset/versioned/clientset.go | 4 +- .../versioned/fake/clientset_generated.go | 50 +++- .../v1alpha1/fake/fake_ingressroute.go | 124 ++------ .../v1alpha1/fake/fake_ingressroutetcp.go | 124 ++------ .../v1alpha1/fake/fake_ingressrouteudp.go | 124 ++------ .../v1alpha1/fake/fake_middleware.go | 122 ++------ .../v1alpha1/fake/fake_middlewaretcp.go | 124 ++------ .../v1alpha1/fake/fake_serverstransport.go | 124 ++------ .../v1alpha1/fake/fake_serverstransporttcp.go | 124 ++------ .../traefikio/v1alpha1/fake/fake_tlsoption.go | 122 ++------ .../traefikio/v1alpha1/fake/fake_tlsstore.go | 122 ++------ .../v1alpha1/fake/fake_traefikio_client.go | 20 +- .../v1alpha1/fake/fake_traefikservice.go | 124 ++------ .../typed/traefikio/v1alpha1/ingressroute.go | 146 ++-------- .../traefikio/v1alpha1/ingressroutetcp.go | 146 ++-------- .../traefikio/v1alpha1/ingressrouteudp.go | 146 ++-------- .../typed/traefikio/v1alpha1/middleware.go | 146 ++-------- .../typed/traefikio/v1alpha1/middlewaretcp.go | 146 ++-------- .../traefikio/v1alpha1/serverstransport.go | 146 ++-------- .../traefikio/v1alpha1/serverstransporttcp.go | 146 ++-------- .../typed/traefikio/v1alpha1/tlsoption.go | 146 ++-------- .../typed/traefikio/v1alpha1/tlsstore.go | 146 ++-------- .../traefikio/v1alpha1/traefikio_client.go | 22 +- .../traefikio/v1alpha1/traefikservice.go | 146 ++-------- .../informers/externalversions/factory.go | 1 + .../informers/externalversions/generic.go | 2 +- .../traefikio/v1alpha1/ingressroute.go | 32 +- .../traefikio/v1alpha1/ingressroutetcp.go | 32 +- .../traefikio/v1alpha1/ingressrouteudp.go | 32 +- .../traefikio/v1alpha1/middleware.go | 32 +- .../traefikio/v1alpha1/middlewaretcp.go | 32 +- .../traefikio/v1alpha1/serverstransport.go | 32 +- .../traefikio/v1alpha1/serverstransporttcp.go | 32 +- .../traefikio/v1alpha1/tlsoption.go | 32 +- .../traefikio/v1alpha1/tlsstore.go | 32 +- .../traefikio/v1alpha1/traefikservice.go | 32 +- .../traefikio/v1alpha1/ingressroute.go | 51 +--- .../traefikio/v1alpha1/ingressroutetcp.go | 51 +--- .../traefikio/v1alpha1/ingressrouteudp.go | 51 +--- .../listers/traefikio/v1alpha1/middleware.go | 51 +--- .../traefikio/v1alpha1/middlewaretcp.go | 51 +--- .../traefikio/v1alpha1/serverstransport.go | 51 +--- .../traefikio/v1alpha1/serverstransporttcp.go | 51 +--- .../listers/traefikio/v1alpha1/tlsoption.go | 51 +--- .../listers/traefikio/v1alpha1/tlsstore.go | 51 +--- .../traefikio/v1alpha1/traefikservice.go | 51 +--- .../kubernetes/crd/kubernetes_test.go | 20 +- .../kubernetes/gateway/kubernetes_test.go | 22 +- .../kubernetes/ingress/client_test.go | 4 +- script/code-gen.sh | 5 +- 125 files changed, 8038 insertions(+), 2871 deletions(-) create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/internal/internal.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/basicauth.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/certificate.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/chain.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/circuitbreaker.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clientauth.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clienttls.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clienttlswithcaoptional.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/compress.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/digestauth.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/errorpage.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/forwardauth.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/forwardingtimeouts.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/highestrandomweight.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroute.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteref.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutespec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutetcp.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutetcpspec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteudp.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteudpspec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/loadbalancerspec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middleware.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewareref.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewarespec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewaretcp.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewaretcpspec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/mirroring.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/mirrorservice.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/objectreference.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/passiveserverhealthcheck.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ratelimit.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/redis.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/responseforwarding.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/retry.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/rootca.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/route.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/routetcp.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/routeudp.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverhealthcheck.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransport.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransportspec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransporttcp.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransporttcpspec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/service.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/servicetcp.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serviceudp.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tls.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsclientconfig.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoption.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoptionref.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoptionspec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstore.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstoreref.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstorespec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlstcp.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/traefikservice.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/traefikservicespec.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/weightedroundrobin.go create mode 100644 pkg/provider/kubernetes/crd/generated/applyconfiguration/utils.go diff --git a/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml b/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml index e374f71b0..763d981eb 100644 --- a/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml +++ b/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: ingressroutes.traefik.io spec: group: traefik.io @@ -464,7 +464,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: ingressroutetcps.traefik.io spec: group: traefik.io @@ -720,7 +720,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: ingressrouteudps.traefik.io spec: group: traefik.io @@ -832,7 +832,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: middlewares.traefik.io spec: group: traefik.io @@ -2146,7 +2146,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: middlewaretcps.traefik.io spec: group: traefik.io @@ -2234,7 +2234,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: serverstransports.traefik.io spec: group: traefik.io @@ -2403,7 +2403,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: serverstransporttcps.traefik.io spec: group: traefik.io @@ -2559,7 +2559,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: tlsoptions.traefik.io spec: group: traefik.io @@ -2677,7 +2677,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: tlsstores.traefik.io spec: group: traefik.io @@ -2774,7 +2774,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: traefikservices.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml index 9149b8607..3debb5926 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: ingressroutes.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml index 6bbfae936..c7006f6d0 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: ingressroutetcps.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml index 2b7e66887..d5e8d0857 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressrouteudps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: ingressrouteudps.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml index 7db8a0aed..f0999cf22 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: middlewares.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml index 9dbf04759..b2a19f9d5 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: middlewaretcps.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml b/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml index 3e22e0107..d5ec61903 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: serverstransports.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_serverstransporttcps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_serverstransporttcps.yaml index 23c39ebae..79469823b 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_serverstransporttcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_serverstransporttcps.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: serverstransporttcps.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml b/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml index 50df90027..5f37cb023 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: tlsoptions.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_tlsstores.yaml b/docs/content/reference/dynamic-configuration/traefik.io_tlsstores.yaml index 180f406da..7fbf65443 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_tlsstores.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_tlsstores.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: tlsstores.traefik.io spec: group: traefik.io diff --git a/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml b/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml index 965fb626a..a51ddc0a4 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: traefikservices.traefik.io spec: group: traefik.io diff --git a/go.mod b/go.mod index 6adae18ed..d3ceb8d09 100644 --- a/go.mod +++ b/go.mod @@ -106,16 +106,17 @@ require ( google.golang.org/grpc v1.78.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v3 v3.0.1 - k8s.io/api v0.34.1 - k8s.io/apiextensions-apiserver v0.34.1 - k8s.io/apimachinery v0.34.1 - k8s.io/client-go v0.34.1 + k8s.io/api v0.34.3 + k8s.io/apiextensions-apiserver v0.34.3 + k8s.io/apimachinery v0.34.3 + k8s.io/client-go v0.34.3 k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d // No tag on the repo. knative.dev/networking v0.0.0-20241022012959-60e29ff520dc knative.dev/pkg v0.0.0-20241021183759-9b9d535af5ad mvdan.cc/xurls/v2 v2.5.0 sigs.k8s.io/controller-runtime v0.22.1 sigs.k8s.io/gateway-api v1.4.0 + sigs.k8s.io/structured-merge-diff/v6 v6.3.1 sigs.k8s.io/yaml v1.6.0 ) @@ -408,7 +409,6 @@ require ( nhooyr.io/websocket v1.8.7 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect ) // Containous forks diff --git a/go.sum b/go.sum index bd9b937fd..a81ba3393 100644 --- a/go.sum +++ b/go.sum @@ -2015,14 +2015,14 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.34.1 h1:jC+153630BMdlFukegoEL8E/yT7aLyQkIVuwhmwDgJM= -k8s.io/api v0.34.1/go.mod h1:SB80FxFtXn5/gwzCoN6QCtPD7Vbu5w2n1S0J5gFfTYk= -k8s.io/apiextensions-apiserver v0.34.1 h1:NNPBva8FNAPt1iSVwIE0FsdrVriRXMsaWFMqJbII2CI= -k8s.io/apiextensions-apiserver v0.34.1/go.mod h1:hP9Rld3zF5Ay2Of3BeEpLAToP+l4s5UlxiHfqRaRcMc= -k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4= -k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= -k8s.io/client-go v0.34.1 h1:ZUPJKgXsnKwVwmKKdPfw4tB58+7/Ik3CrjOEhsiZ7mY= -k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8= +k8s.io/api v0.34.3 h1:D12sTP257/jSH2vHV2EDYrb16bS7ULlHpdNdNhEw2S4= +k8s.io/api v0.34.3/go.mod h1:PyVQBF886Q5RSQZOim7DybQjAbVs8g7gwJNhGtY5MBk= +k8s.io/apiextensions-apiserver v0.34.3 h1:p10fGlkDY09eWKOTeUSioxwLukJnm+KuDZdrW71y40g= +k8s.io/apiextensions-apiserver v0.34.3/go.mod h1:aujxvqGFRdb/cmXYfcRTeppN7S2XV/t7WMEc64zB5A0= +k8s.io/apimachinery v0.34.3 h1:/TB+SFEiQvN9HPldtlWOTp0hWbJ+fjU+wkxysf/aQnE= +k8s.io/apimachinery v0.34.3/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= +k8s.io/client-go v0.34.3 h1:wtYtpzy/OPNYf7WyNBTj3iUA0XaBHVqhv4Iv3tbrF5A= +k8s.io/client-go v0.34.3/go.mod h1:OxxeYagaP9Kdf78UrKLa3YZixMCfP6bgPwPwNBQBzpM= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20250814151709-d7b6acb124c3 h1:liMHz39T5dJO1aOKHLvwaCjDbf07wVh6yaUlTpunnkE= @@ -2050,8 +2050,8 @@ sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5E sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.3.1 h1:JrhdFMqOd/+3ByqlP2I45kTOZmTRLBUm5pvRjeheg7E= +sigs.k8s.io/structured-merge-diff/v6 v6.3.1/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/integration/fixtures/k8s/01-traefik-crd.yml b/integration/fixtures/k8s/01-traefik-crd.yml index ef7c35ea0..bbf30fb63 100644 --- a/integration/fixtures/k8s/01-traefik-crd.yml +++ b/integration/fixtures/k8s/01-traefik-crd.yml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: ingressroutes.traefik.io spec: group: traefik.io @@ -465,7 +465,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: ingressroutetcps.traefik.io spec: group: traefik.io @@ -721,7 +721,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: ingressrouteudps.traefik.io spec: group: traefik.io @@ -833,7 +833,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: middlewares.traefik.io spec: group: traefik.io @@ -2147,7 +2147,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: middlewaretcps.traefik.io spec: group: traefik.io @@ -2235,7 +2235,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: serverstransports.traefik.io spec: group: traefik.io @@ -2404,7 +2404,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: serverstransporttcps.traefik.io spec: group: traefik.io @@ -2560,7 +2560,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: tlsoptions.traefik.io spec: group: traefik.io @@ -2678,7 +2678,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: tlsstores.traefik.io spec: group: traefik.io @@ -2775,7 +2775,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.19.0 name: traefikservices.traefik.io spec: group: traefik.io diff --git a/pkg/provider/kubernetes/crd/client_test.go b/pkg/provider/kubernetes/crd/client_test.go index 5d71b6a78..5d1c9aba7 100644 --- a/pkg/provider/kubernetes/crd/client_test.go +++ b/pkg/provider/kubernetes/crd/client_test.go @@ -29,8 +29,8 @@ func TestClientIgnoresHelmOwnedSecrets(t *testing.T) { }, } - kubeClient := kubefake.NewSimpleClientset(helmSecret, secret) - crdClient := traefikcrdfake.NewSimpleClientset() + kubeClient := kubefake.NewClientset(helmSecret, secret) + crdClient := traefikcrdfake.NewClientset() client := newClientImpl(kubeClient, crdClient) diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/internal/internal.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/internal/internal.go new file mode 100644 index 000000000..945a4ae8e --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/internal/internal.go @@ -0,0 +1,70 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package internal + +import ( + fmt "fmt" + sync "sync" + + typed "sigs.k8s.io/structured-merge-diff/v6/typed" +) + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var parserOnce sync.Once +var parser *typed.Parser +var schemaYAML = typed.YAMLObject(`types: +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/basicauth.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/basicauth.go new file mode 100644 index 000000000..d903414dc --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/basicauth.go @@ -0,0 +1,74 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// BasicAuthApplyConfiguration represents a declarative configuration of the BasicAuth type for use +// with apply. +type BasicAuthApplyConfiguration struct { + Secret *string `json:"secret,omitempty"` + Realm *string `json:"realm,omitempty"` + RemoveHeader *bool `json:"removeHeader,omitempty"` + HeaderField *string `json:"headerField,omitempty"` +} + +// BasicAuthApplyConfiguration constructs a declarative configuration of the BasicAuth type for use with +// apply. +func BasicAuth() *BasicAuthApplyConfiguration { + return &BasicAuthApplyConfiguration{} +} + +// WithSecret sets the Secret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Secret field is set to the value of the last call. +func (b *BasicAuthApplyConfiguration) WithSecret(value string) *BasicAuthApplyConfiguration { + b.Secret = &value + return b +} + +// WithRealm sets the Realm field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Realm field is set to the value of the last call. +func (b *BasicAuthApplyConfiguration) WithRealm(value string) *BasicAuthApplyConfiguration { + b.Realm = &value + return b +} + +// WithRemoveHeader sets the RemoveHeader field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RemoveHeader field is set to the value of the last call. +func (b *BasicAuthApplyConfiguration) WithRemoveHeader(value bool) *BasicAuthApplyConfiguration { + b.RemoveHeader = &value + return b +} + +// WithHeaderField sets the HeaderField field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HeaderField field is set to the value of the last call. +func (b *BasicAuthApplyConfiguration) WithHeaderField(value string) *BasicAuthApplyConfiguration { + b.HeaderField = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/certificate.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/certificate.go new file mode 100644 index 000000000..33f85d146 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/certificate.go @@ -0,0 +1,47 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// CertificateApplyConfiguration represents a declarative configuration of the Certificate type for use +// with apply. +type CertificateApplyConfiguration struct { + SecretName *string `json:"secretName,omitempty"` +} + +// CertificateApplyConfiguration constructs a declarative configuration of the Certificate type for use with +// apply. +func Certificate() *CertificateApplyConfiguration { + return &CertificateApplyConfiguration{} +} + +// WithSecretName sets the SecretName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretName field is set to the value of the last call. +func (b *CertificateApplyConfiguration) WithSecretName(value string) *CertificateApplyConfiguration { + b.SecretName = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/chain.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/chain.go new file mode 100644 index 000000000..221da3315 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/chain.go @@ -0,0 +1,52 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ChainApplyConfiguration represents a declarative configuration of the Chain type for use +// with apply. +type ChainApplyConfiguration struct { + Middlewares []MiddlewareRefApplyConfiguration `json:"middlewares,omitempty"` +} + +// ChainApplyConfiguration constructs a declarative configuration of the Chain type for use with +// apply. +func Chain() *ChainApplyConfiguration { + return &ChainApplyConfiguration{} +} + +// WithMiddlewares adds the given value to the Middlewares field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Middlewares field. +func (b *ChainApplyConfiguration) WithMiddlewares(values ...*MiddlewareRefApplyConfiguration) *ChainApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMiddlewares") + } + b.Middlewares = append(b.Middlewares, *values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/circuitbreaker.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/circuitbreaker.go new file mode 100644 index 000000000..551041f0f --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/circuitbreaker.go @@ -0,0 +1,87 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// CircuitBreakerApplyConfiguration represents a declarative configuration of the CircuitBreaker type for use +// with apply. +type CircuitBreakerApplyConfiguration struct { + Expression *string `json:"expression,omitempty"` + CheckPeriod *intstr.IntOrString `json:"checkPeriod,omitempty"` + FallbackDuration *intstr.IntOrString `json:"fallbackDuration,omitempty"` + RecoveryDuration *intstr.IntOrString `json:"recoveryDuration,omitempty"` + ResponseCode *int `json:"responseCode,omitempty"` +} + +// CircuitBreakerApplyConfiguration constructs a declarative configuration of the CircuitBreaker type for use with +// apply. +func CircuitBreaker() *CircuitBreakerApplyConfiguration { + return &CircuitBreakerApplyConfiguration{} +} + +// WithExpression sets the Expression field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Expression field is set to the value of the last call. +func (b *CircuitBreakerApplyConfiguration) WithExpression(value string) *CircuitBreakerApplyConfiguration { + b.Expression = &value + return b +} + +// WithCheckPeriod sets the CheckPeriod field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CheckPeriod field is set to the value of the last call. +func (b *CircuitBreakerApplyConfiguration) WithCheckPeriod(value intstr.IntOrString) *CircuitBreakerApplyConfiguration { + b.CheckPeriod = &value + return b +} + +// WithFallbackDuration sets the FallbackDuration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FallbackDuration field is set to the value of the last call. +func (b *CircuitBreakerApplyConfiguration) WithFallbackDuration(value intstr.IntOrString) *CircuitBreakerApplyConfiguration { + b.FallbackDuration = &value + return b +} + +// WithRecoveryDuration sets the RecoveryDuration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RecoveryDuration field is set to the value of the last call. +func (b *CircuitBreakerApplyConfiguration) WithRecoveryDuration(value intstr.IntOrString) *CircuitBreakerApplyConfiguration { + b.RecoveryDuration = &value + return b +} + +// WithResponseCode sets the ResponseCode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResponseCode field is set to the value of the last call. +func (b *CircuitBreakerApplyConfiguration) WithResponseCode(value int) *CircuitBreakerApplyConfiguration { + b.ResponseCode = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clientauth.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clientauth.go new file mode 100644 index 000000000..6227ffdc7 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clientauth.go @@ -0,0 +1,58 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ClientAuthApplyConfiguration represents a declarative configuration of the ClientAuth type for use +// with apply. +type ClientAuthApplyConfiguration struct { + SecretNames []string `json:"secretNames,omitempty"` + ClientAuthType *string `json:"clientAuthType,omitempty"` +} + +// ClientAuthApplyConfiguration constructs a declarative configuration of the ClientAuth type for use with +// apply. +func ClientAuth() *ClientAuthApplyConfiguration { + return &ClientAuthApplyConfiguration{} +} + +// WithSecretNames adds the given value to the SecretNames field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SecretNames field. +func (b *ClientAuthApplyConfiguration) WithSecretNames(values ...string) *ClientAuthApplyConfiguration { + for i := range values { + b.SecretNames = append(b.SecretNames, values[i]) + } + return b +} + +// WithClientAuthType sets the ClientAuthType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClientAuthType field is set to the value of the last call. +func (b *ClientAuthApplyConfiguration) WithClientAuthType(value string) *ClientAuthApplyConfiguration { + b.ClientAuthType = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clienttls.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clienttls.go new file mode 100644 index 000000000..dd5f3c2bc --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clienttls.go @@ -0,0 +1,65 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ClientTLSApplyConfiguration represents a declarative configuration of the ClientTLS type for use +// with apply. +type ClientTLSApplyConfiguration struct { + CASecret *string `json:"caSecret,omitempty"` + CertSecret *string `json:"certSecret,omitempty"` + InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty"` +} + +// ClientTLSApplyConfiguration constructs a declarative configuration of the ClientTLS type for use with +// apply. +func ClientTLS() *ClientTLSApplyConfiguration { + return &ClientTLSApplyConfiguration{} +} + +// WithCASecret sets the CASecret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CASecret field is set to the value of the last call. +func (b *ClientTLSApplyConfiguration) WithCASecret(value string) *ClientTLSApplyConfiguration { + b.CASecret = &value + return b +} + +// WithCertSecret sets the CertSecret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CertSecret field is set to the value of the last call. +func (b *ClientTLSApplyConfiguration) WithCertSecret(value string) *ClientTLSApplyConfiguration { + b.CertSecret = &value + return b +} + +// WithInsecureSkipVerify sets the InsecureSkipVerify field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InsecureSkipVerify field is set to the value of the last call. +func (b *ClientTLSApplyConfiguration) WithInsecureSkipVerify(value bool) *ClientTLSApplyConfiguration { + b.InsecureSkipVerify = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clienttlswithcaoptional.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clienttlswithcaoptional.go new file mode 100644 index 000000000..d5e4e90ef --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/clienttlswithcaoptional.go @@ -0,0 +1,72 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ClientTLSWithCAOptionalApplyConfiguration represents a declarative configuration of the ClientTLSWithCAOptional type for use +// with apply. +type ClientTLSWithCAOptionalApplyConfiguration struct { + ClientTLSApplyConfiguration `json:",inline"` + CAOptional *bool `json:"caOptional,omitempty"` +} + +// ClientTLSWithCAOptionalApplyConfiguration constructs a declarative configuration of the ClientTLSWithCAOptional type for use with +// apply. +func ClientTLSWithCAOptional() *ClientTLSWithCAOptionalApplyConfiguration { + return &ClientTLSWithCAOptionalApplyConfiguration{} +} + +// WithCASecret sets the CASecret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CASecret field is set to the value of the last call. +func (b *ClientTLSWithCAOptionalApplyConfiguration) WithCASecret(value string) *ClientTLSWithCAOptionalApplyConfiguration { + b.ClientTLSApplyConfiguration.CASecret = &value + return b +} + +// WithCertSecret sets the CertSecret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CertSecret field is set to the value of the last call. +func (b *ClientTLSWithCAOptionalApplyConfiguration) WithCertSecret(value string) *ClientTLSWithCAOptionalApplyConfiguration { + b.ClientTLSApplyConfiguration.CertSecret = &value + return b +} + +// WithInsecureSkipVerify sets the InsecureSkipVerify field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InsecureSkipVerify field is set to the value of the last call. +func (b *ClientTLSWithCAOptionalApplyConfiguration) WithInsecureSkipVerify(value bool) *ClientTLSWithCAOptionalApplyConfiguration { + b.ClientTLSApplyConfiguration.InsecureSkipVerify = &value + return b +} + +// WithCAOptional sets the CAOptional field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CAOptional field is set to the value of the last call. +func (b *ClientTLSWithCAOptionalApplyConfiguration) WithCAOptional(value bool) *ClientTLSWithCAOptionalApplyConfiguration { + b.CAOptional = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/compress.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/compress.go new file mode 100644 index 000000000..5e5eea00c --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/compress.go @@ -0,0 +1,89 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// CompressApplyConfiguration represents a declarative configuration of the Compress type for use +// with apply. +type CompressApplyConfiguration struct { + ExcludedContentTypes []string `json:"excludedContentTypes,omitempty"` + IncludedContentTypes []string `json:"includedContentTypes,omitempty"` + MinResponseBodyBytes *int `json:"minResponseBodyBytes,omitempty"` + Encodings []string `json:"encodings,omitempty"` + DefaultEncoding *string `json:"defaultEncoding,omitempty"` +} + +// CompressApplyConfiguration constructs a declarative configuration of the Compress type for use with +// apply. +func Compress() *CompressApplyConfiguration { + return &CompressApplyConfiguration{} +} + +// WithExcludedContentTypes adds the given value to the ExcludedContentTypes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ExcludedContentTypes field. +func (b *CompressApplyConfiguration) WithExcludedContentTypes(values ...string) *CompressApplyConfiguration { + for i := range values { + b.ExcludedContentTypes = append(b.ExcludedContentTypes, values[i]) + } + return b +} + +// WithIncludedContentTypes adds the given value to the IncludedContentTypes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IncludedContentTypes field. +func (b *CompressApplyConfiguration) WithIncludedContentTypes(values ...string) *CompressApplyConfiguration { + for i := range values { + b.IncludedContentTypes = append(b.IncludedContentTypes, values[i]) + } + return b +} + +// WithMinResponseBodyBytes sets the MinResponseBodyBytes field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinResponseBodyBytes field is set to the value of the last call. +func (b *CompressApplyConfiguration) WithMinResponseBodyBytes(value int) *CompressApplyConfiguration { + b.MinResponseBodyBytes = &value + return b +} + +// WithEncodings adds the given value to the Encodings field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Encodings field. +func (b *CompressApplyConfiguration) WithEncodings(values ...string) *CompressApplyConfiguration { + for i := range values { + b.Encodings = append(b.Encodings, values[i]) + } + return b +} + +// WithDefaultEncoding sets the DefaultEncoding field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefaultEncoding field is set to the value of the last call. +func (b *CompressApplyConfiguration) WithDefaultEncoding(value string) *CompressApplyConfiguration { + b.DefaultEncoding = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/digestauth.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/digestauth.go new file mode 100644 index 000000000..70bf9b3b9 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/digestauth.go @@ -0,0 +1,74 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// DigestAuthApplyConfiguration represents a declarative configuration of the DigestAuth type for use +// with apply. +type DigestAuthApplyConfiguration struct { + Secret *string `json:"secret,omitempty"` + RemoveHeader *bool `json:"removeHeader,omitempty"` + Realm *string `json:"realm,omitempty"` + HeaderField *string `json:"headerField,omitempty"` +} + +// DigestAuthApplyConfiguration constructs a declarative configuration of the DigestAuth type for use with +// apply. +func DigestAuth() *DigestAuthApplyConfiguration { + return &DigestAuthApplyConfiguration{} +} + +// WithSecret sets the Secret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Secret field is set to the value of the last call. +func (b *DigestAuthApplyConfiguration) WithSecret(value string) *DigestAuthApplyConfiguration { + b.Secret = &value + return b +} + +// WithRemoveHeader sets the RemoveHeader field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RemoveHeader field is set to the value of the last call. +func (b *DigestAuthApplyConfiguration) WithRemoveHeader(value bool) *DigestAuthApplyConfiguration { + b.RemoveHeader = &value + return b +} + +// WithRealm sets the Realm field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Realm field is set to the value of the last call. +func (b *DigestAuthApplyConfiguration) WithRealm(value string) *DigestAuthApplyConfiguration { + b.Realm = &value + return b +} + +// WithHeaderField sets the HeaderField field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HeaderField field is set to the value of the last call. +func (b *DigestAuthApplyConfiguration) WithHeaderField(value string) *DigestAuthApplyConfiguration { + b.HeaderField = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/errorpage.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/errorpage.go new file mode 100644 index 000000000..3273eb655 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/errorpage.go @@ -0,0 +1,82 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ErrorPageApplyConfiguration represents a declarative configuration of the ErrorPage type for use +// with apply. +type ErrorPageApplyConfiguration struct { + Status []string `json:"status,omitempty"` + StatusRewrites map[string]int `json:"statusRewrites,omitempty"` + Service *ServiceApplyConfiguration `json:"service,omitempty"` + Query *string `json:"query,omitempty"` +} + +// ErrorPageApplyConfiguration constructs a declarative configuration of the ErrorPage type for use with +// apply. +func ErrorPage() *ErrorPageApplyConfiguration { + return &ErrorPageApplyConfiguration{} +} + +// WithStatus adds the given value to the Status field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Status field. +func (b *ErrorPageApplyConfiguration) WithStatus(values ...string) *ErrorPageApplyConfiguration { + for i := range values { + b.Status = append(b.Status, values[i]) + } + return b +} + +// WithStatusRewrites puts the entries into the StatusRewrites field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the StatusRewrites field, +// overwriting an existing map entries in StatusRewrites field with the same key. +func (b *ErrorPageApplyConfiguration) WithStatusRewrites(entries map[string]int) *ErrorPageApplyConfiguration { + if b.StatusRewrites == nil && len(entries) > 0 { + b.StatusRewrites = make(map[string]int, len(entries)) + } + for k, v := range entries { + b.StatusRewrites[k] = v + } + return b +} + +// WithService sets the Service field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Service field is set to the value of the last call. +func (b *ErrorPageApplyConfiguration) WithService(value *ServiceApplyConfiguration) *ErrorPageApplyConfiguration { + b.Service = value + return b +} + +// WithQuery sets the Query field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Query field is set to the value of the last call. +func (b *ErrorPageApplyConfiguration) WithQuery(value string) *ErrorPageApplyConfiguration { + b.Query = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/forwardauth.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/forwardauth.go new file mode 100644 index 000000000..ab9d603b3 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/forwardauth.go @@ -0,0 +1,152 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ForwardAuthApplyConfiguration represents a declarative configuration of the ForwardAuth type for use +// with apply. +type ForwardAuthApplyConfiguration struct { + Address *string `json:"address,omitempty"` + TrustForwardHeader *bool `json:"trustForwardHeader,omitempty"` + AuthResponseHeaders []string `json:"authResponseHeaders,omitempty"` + AuthResponseHeadersRegex *string `json:"authResponseHeadersRegex,omitempty"` + AuthRequestHeaders []string `json:"authRequestHeaders,omitempty"` + TLS *ClientTLSWithCAOptionalApplyConfiguration `json:"tls,omitempty"` + AddAuthCookiesToResponse []string `json:"addAuthCookiesToResponse,omitempty"` + HeaderField *string `json:"headerField,omitempty"` + ForwardBody *bool `json:"forwardBody,omitempty"` + MaxBodySize *int64 `json:"maxBodySize,omitempty"` + PreserveLocationHeader *bool `json:"preserveLocationHeader,omitempty"` + PreserveRequestMethod *bool `json:"preserveRequestMethod,omitempty"` +} + +// ForwardAuthApplyConfiguration constructs a declarative configuration of the ForwardAuth type for use with +// apply. +func ForwardAuth() *ForwardAuthApplyConfiguration { + return &ForwardAuthApplyConfiguration{} +} + +// WithAddress sets the Address field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Address field is set to the value of the last call. +func (b *ForwardAuthApplyConfiguration) WithAddress(value string) *ForwardAuthApplyConfiguration { + b.Address = &value + return b +} + +// WithTrustForwardHeader sets the TrustForwardHeader field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TrustForwardHeader field is set to the value of the last call. +func (b *ForwardAuthApplyConfiguration) WithTrustForwardHeader(value bool) *ForwardAuthApplyConfiguration { + b.TrustForwardHeader = &value + return b +} + +// WithAuthResponseHeaders adds the given value to the AuthResponseHeaders field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AuthResponseHeaders field. +func (b *ForwardAuthApplyConfiguration) WithAuthResponseHeaders(values ...string) *ForwardAuthApplyConfiguration { + for i := range values { + b.AuthResponseHeaders = append(b.AuthResponseHeaders, values[i]) + } + return b +} + +// WithAuthResponseHeadersRegex sets the AuthResponseHeadersRegex field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AuthResponseHeadersRegex field is set to the value of the last call. +func (b *ForwardAuthApplyConfiguration) WithAuthResponseHeadersRegex(value string) *ForwardAuthApplyConfiguration { + b.AuthResponseHeadersRegex = &value + return b +} + +// WithAuthRequestHeaders adds the given value to the AuthRequestHeaders field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AuthRequestHeaders field. +func (b *ForwardAuthApplyConfiguration) WithAuthRequestHeaders(values ...string) *ForwardAuthApplyConfiguration { + for i := range values { + b.AuthRequestHeaders = append(b.AuthRequestHeaders, values[i]) + } + return b +} + +// WithTLS sets the TLS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TLS field is set to the value of the last call. +func (b *ForwardAuthApplyConfiguration) WithTLS(value *ClientTLSWithCAOptionalApplyConfiguration) *ForwardAuthApplyConfiguration { + b.TLS = value + return b +} + +// WithAddAuthCookiesToResponse adds the given value to the AddAuthCookiesToResponse field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AddAuthCookiesToResponse field. +func (b *ForwardAuthApplyConfiguration) WithAddAuthCookiesToResponse(values ...string) *ForwardAuthApplyConfiguration { + for i := range values { + b.AddAuthCookiesToResponse = append(b.AddAuthCookiesToResponse, values[i]) + } + return b +} + +// WithHeaderField sets the HeaderField field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HeaderField field is set to the value of the last call. +func (b *ForwardAuthApplyConfiguration) WithHeaderField(value string) *ForwardAuthApplyConfiguration { + b.HeaderField = &value + return b +} + +// WithForwardBody sets the ForwardBody field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ForwardBody field is set to the value of the last call. +func (b *ForwardAuthApplyConfiguration) WithForwardBody(value bool) *ForwardAuthApplyConfiguration { + b.ForwardBody = &value + return b +} + +// WithMaxBodySize sets the MaxBodySize field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxBodySize field is set to the value of the last call. +func (b *ForwardAuthApplyConfiguration) WithMaxBodySize(value int64) *ForwardAuthApplyConfiguration { + b.MaxBodySize = &value + return b +} + +// WithPreserveLocationHeader sets the PreserveLocationHeader field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreserveLocationHeader field is set to the value of the last call. +func (b *ForwardAuthApplyConfiguration) WithPreserveLocationHeader(value bool) *ForwardAuthApplyConfiguration { + b.PreserveLocationHeader = &value + return b +} + +// WithPreserveRequestMethod sets the PreserveRequestMethod field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreserveRequestMethod field is set to the value of the last call. +func (b *ForwardAuthApplyConfiguration) WithPreserveRequestMethod(value bool) *ForwardAuthApplyConfiguration { + b.PreserveRequestMethod = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/forwardingtimeouts.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/forwardingtimeouts.go new file mode 100644 index 000000000..b24bb3501 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/forwardingtimeouts.go @@ -0,0 +1,87 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// ForwardingTimeoutsApplyConfiguration represents a declarative configuration of the ForwardingTimeouts type for use +// with apply. +type ForwardingTimeoutsApplyConfiguration struct { + DialTimeout *intstr.IntOrString `json:"dialTimeout,omitempty"` + ResponseHeaderTimeout *intstr.IntOrString `json:"responseHeaderTimeout,omitempty"` + IdleConnTimeout *intstr.IntOrString `json:"idleConnTimeout,omitempty"` + ReadIdleTimeout *intstr.IntOrString `json:"readIdleTimeout,omitempty"` + PingTimeout *intstr.IntOrString `json:"pingTimeout,omitempty"` +} + +// ForwardingTimeoutsApplyConfiguration constructs a declarative configuration of the ForwardingTimeouts type for use with +// apply. +func ForwardingTimeouts() *ForwardingTimeoutsApplyConfiguration { + return &ForwardingTimeoutsApplyConfiguration{} +} + +// WithDialTimeout sets the DialTimeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DialTimeout field is set to the value of the last call. +func (b *ForwardingTimeoutsApplyConfiguration) WithDialTimeout(value intstr.IntOrString) *ForwardingTimeoutsApplyConfiguration { + b.DialTimeout = &value + return b +} + +// WithResponseHeaderTimeout sets the ResponseHeaderTimeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResponseHeaderTimeout field is set to the value of the last call. +func (b *ForwardingTimeoutsApplyConfiguration) WithResponseHeaderTimeout(value intstr.IntOrString) *ForwardingTimeoutsApplyConfiguration { + b.ResponseHeaderTimeout = &value + return b +} + +// WithIdleConnTimeout sets the IdleConnTimeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IdleConnTimeout field is set to the value of the last call. +func (b *ForwardingTimeoutsApplyConfiguration) WithIdleConnTimeout(value intstr.IntOrString) *ForwardingTimeoutsApplyConfiguration { + b.IdleConnTimeout = &value + return b +} + +// WithReadIdleTimeout sets the ReadIdleTimeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadIdleTimeout field is set to the value of the last call. +func (b *ForwardingTimeoutsApplyConfiguration) WithReadIdleTimeout(value intstr.IntOrString) *ForwardingTimeoutsApplyConfiguration { + b.ReadIdleTimeout = &value + return b +} + +// WithPingTimeout sets the PingTimeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PingTimeout field is set to the value of the last call. +func (b *ForwardingTimeoutsApplyConfiguration) WithPingTimeout(value intstr.IntOrString) *ForwardingTimeoutsApplyConfiguration { + b.PingTimeout = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/highestrandomweight.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/highestrandomweight.go new file mode 100644 index 000000000..f96acf722 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/highestrandomweight.go @@ -0,0 +1,52 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// HighestRandomWeightApplyConfiguration represents a declarative configuration of the HighestRandomWeight type for use +// with apply. +type HighestRandomWeightApplyConfiguration struct { + Services []ServiceApplyConfiguration `json:"services,omitempty"` +} + +// HighestRandomWeightApplyConfiguration constructs a declarative configuration of the HighestRandomWeight type for use with +// apply. +func HighestRandomWeight() *HighestRandomWeightApplyConfiguration { + return &HighestRandomWeightApplyConfiguration{} +} + +// WithServices adds the given value to the Services field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Services field. +func (b *HighestRandomWeightApplyConfiguration) WithServices(values ...*ServiceApplyConfiguration) *HighestRandomWeightApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithServices") + } + b.Services = append(b.Services, *values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroute.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroute.go new file mode 100644 index 000000000..500cb6192 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroute.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// IngressRouteApplyConfiguration represents a declarative configuration of the IngressRoute type for use +// with apply. +type IngressRouteApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *IngressRouteSpecApplyConfiguration `json:"spec,omitempty"` +} + +// IngressRoute constructs a declarative configuration of the IngressRoute type for use with +// apply. +func IngressRoute(name, namespace string) *IngressRouteApplyConfiguration { + b := &IngressRouteApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("IngressRoute") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b IngressRouteApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithKind(value string) *IngressRouteApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithAPIVersion(value string) *IngressRouteApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithName(value string) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithGenerateName(value string) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithNamespace(value string) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithUID(value types.UID) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithResourceVersion(value string) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithGeneration(value int64) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithCreationTimestamp(value metav1.Time) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *IngressRouteApplyConfiguration) WithLabels(entries map[string]string) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *IngressRouteApplyConfiguration) WithAnnotations(entries map[string]string) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *IngressRouteApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *IngressRouteApplyConfiguration) WithFinalizers(values ...string) *IngressRouteApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *IngressRouteApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *IngressRouteApplyConfiguration) WithSpec(value *IngressRouteSpecApplyConfiguration) *IngressRouteApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *IngressRouteApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *IngressRouteApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *IngressRouteApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *IngressRouteApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteref.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteref.go new file mode 100644 index 000000000..aba2dac46 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteref.go @@ -0,0 +1,56 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// IngressRouteRefApplyConfiguration represents a declarative configuration of the IngressRouteRef type for use +// with apply. +type IngressRouteRefApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// IngressRouteRefApplyConfiguration constructs a declarative configuration of the IngressRouteRef type for use with +// apply. +func IngressRouteRef() *IngressRouteRefApplyConfiguration { + return &IngressRouteRefApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *IngressRouteRefApplyConfiguration) WithName(value string) *IngressRouteRefApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *IngressRouteRefApplyConfiguration) WithNamespace(value string) *IngressRouteRefApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutespec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutespec.go new file mode 100644 index 000000000..04b0b3e76 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutespec.go @@ -0,0 +1,86 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// IngressRouteSpecApplyConfiguration represents a declarative configuration of the IngressRouteSpec type for use +// with apply. +type IngressRouteSpecApplyConfiguration struct { + Routes []RouteApplyConfiguration `json:"routes,omitempty"` + EntryPoints []string `json:"entryPoints,omitempty"` + TLS *TLSApplyConfiguration `json:"tls,omitempty"` + ParentRefs []IngressRouteRefApplyConfiguration `json:"parentRefs,omitempty"` +} + +// IngressRouteSpecApplyConfiguration constructs a declarative configuration of the IngressRouteSpec type for use with +// apply. +func IngressRouteSpec() *IngressRouteSpecApplyConfiguration { + return &IngressRouteSpecApplyConfiguration{} +} + +// WithRoutes adds the given value to the Routes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Routes field. +func (b *IngressRouteSpecApplyConfiguration) WithRoutes(values ...*RouteApplyConfiguration) *IngressRouteSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRoutes") + } + b.Routes = append(b.Routes, *values[i]) + } + return b +} + +// WithEntryPoints adds the given value to the EntryPoints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EntryPoints field. +func (b *IngressRouteSpecApplyConfiguration) WithEntryPoints(values ...string) *IngressRouteSpecApplyConfiguration { + for i := range values { + b.EntryPoints = append(b.EntryPoints, values[i]) + } + return b +} + +// WithTLS sets the TLS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TLS field is set to the value of the last call. +func (b *IngressRouteSpecApplyConfiguration) WithTLS(value *TLSApplyConfiguration) *IngressRouteSpecApplyConfiguration { + b.TLS = value + return b +} + +// WithParentRefs adds the given value to the ParentRefs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ParentRefs field. +func (b *IngressRouteSpecApplyConfiguration) WithParentRefs(values ...*IngressRouteRefApplyConfiguration) *IngressRouteSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithParentRefs") + } + b.ParentRefs = append(b.ParentRefs, *values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutetcp.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutetcp.go new file mode 100644 index 000000000..7a07a2d40 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutetcp.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// IngressRouteTCPApplyConfiguration represents a declarative configuration of the IngressRouteTCP type for use +// with apply. +type IngressRouteTCPApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *IngressRouteTCPSpecApplyConfiguration `json:"spec,omitempty"` +} + +// IngressRouteTCP constructs a declarative configuration of the IngressRouteTCP type for use with +// apply. +func IngressRouteTCP(name, namespace string) *IngressRouteTCPApplyConfiguration { + b := &IngressRouteTCPApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("IngressRouteTCP") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b IngressRouteTCPApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithKind(value string) *IngressRouteTCPApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithAPIVersion(value string) *IngressRouteTCPApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithName(value string) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithGenerateName(value string) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithNamespace(value string) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithUID(value types.UID) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithResourceVersion(value string) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithGeneration(value int64) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithCreationTimestamp(value metav1.Time) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *IngressRouteTCPApplyConfiguration) WithLabels(entries map[string]string) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *IngressRouteTCPApplyConfiguration) WithAnnotations(entries map[string]string) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *IngressRouteTCPApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *IngressRouteTCPApplyConfiguration) WithFinalizers(values ...string) *IngressRouteTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *IngressRouteTCPApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *IngressRouteTCPApplyConfiguration) WithSpec(value *IngressRouteTCPSpecApplyConfiguration) *IngressRouteTCPApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *IngressRouteTCPApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *IngressRouteTCPApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *IngressRouteTCPApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *IngressRouteTCPApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutetcpspec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutetcpspec.go new file mode 100644 index 000000000..545452619 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressroutetcpspec.go @@ -0,0 +1,72 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// IngressRouteTCPSpecApplyConfiguration represents a declarative configuration of the IngressRouteTCPSpec type for use +// with apply. +type IngressRouteTCPSpecApplyConfiguration struct { + Routes []RouteTCPApplyConfiguration `json:"routes,omitempty"` + EntryPoints []string `json:"entryPoints,omitempty"` + TLS *TLSTCPApplyConfiguration `json:"tls,omitempty"` +} + +// IngressRouteTCPSpecApplyConfiguration constructs a declarative configuration of the IngressRouteTCPSpec type for use with +// apply. +func IngressRouteTCPSpec() *IngressRouteTCPSpecApplyConfiguration { + return &IngressRouteTCPSpecApplyConfiguration{} +} + +// WithRoutes adds the given value to the Routes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Routes field. +func (b *IngressRouteTCPSpecApplyConfiguration) WithRoutes(values ...*RouteTCPApplyConfiguration) *IngressRouteTCPSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRoutes") + } + b.Routes = append(b.Routes, *values[i]) + } + return b +} + +// WithEntryPoints adds the given value to the EntryPoints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EntryPoints field. +func (b *IngressRouteTCPSpecApplyConfiguration) WithEntryPoints(values ...string) *IngressRouteTCPSpecApplyConfiguration { + for i := range values { + b.EntryPoints = append(b.EntryPoints, values[i]) + } + return b +} + +// WithTLS sets the TLS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TLS field is set to the value of the last call. +func (b *IngressRouteTCPSpecApplyConfiguration) WithTLS(value *TLSTCPApplyConfiguration) *IngressRouteTCPSpecApplyConfiguration { + b.TLS = value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteudp.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteudp.go new file mode 100644 index 000000000..487e9c87a --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteudp.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// IngressRouteUDPApplyConfiguration represents a declarative configuration of the IngressRouteUDP type for use +// with apply. +type IngressRouteUDPApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *IngressRouteUDPSpecApplyConfiguration `json:"spec,omitempty"` +} + +// IngressRouteUDP constructs a declarative configuration of the IngressRouteUDP type for use with +// apply. +func IngressRouteUDP(name, namespace string) *IngressRouteUDPApplyConfiguration { + b := &IngressRouteUDPApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("IngressRouteUDP") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b IngressRouteUDPApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithKind(value string) *IngressRouteUDPApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithAPIVersion(value string) *IngressRouteUDPApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithName(value string) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithGenerateName(value string) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithNamespace(value string) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithUID(value types.UID) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithResourceVersion(value string) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithGeneration(value int64) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithCreationTimestamp(value metav1.Time) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *IngressRouteUDPApplyConfiguration) WithLabels(entries map[string]string) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *IngressRouteUDPApplyConfiguration) WithAnnotations(entries map[string]string) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *IngressRouteUDPApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *IngressRouteUDPApplyConfiguration) WithFinalizers(values ...string) *IngressRouteUDPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *IngressRouteUDPApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *IngressRouteUDPApplyConfiguration) WithSpec(value *IngressRouteUDPSpecApplyConfiguration) *IngressRouteUDPApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *IngressRouteUDPApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *IngressRouteUDPApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *IngressRouteUDPApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *IngressRouteUDPApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteudpspec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteudpspec.go new file mode 100644 index 000000000..96b317fed --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ingressrouteudpspec.go @@ -0,0 +1,63 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// IngressRouteUDPSpecApplyConfiguration represents a declarative configuration of the IngressRouteUDPSpec type for use +// with apply. +type IngressRouteUDPSpecApplyConfiguration struct { + Routes []RouteUDPApplyConfiguration `json:"routes,omitempty"` + EntryPoints []string `json:"entryPoints,omitempty"` +} + +// IngressRouteUDPSpecApplyConfiguration constructs a declarative configuration of the IngressRouteUDPSpec type for use with +// apply. +func IngressRouteUDPSpec() *IngressRouteUDPSpecApplyConfiguration { + return &IngressRouteUDPSpecApplyConfiguration{} +} + +// WithRoutes adds the given value to the Routes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Routes field. +func (b *IngressRouteUDPSpecApplyConfiguration) WithRoutes(values ...*RouteUDPApplyConfiguration) *IngressRouteUDPSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRoutes") + } + b.Routes = append(b.Routes, *values[i]) + } + return b +} + +// WithEntryPoints adds the given value to the EntryPoints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EntryPoints field. +func (b *IngressRouteUDPSpecApplyConfiguration) WithEntryPoints(values ...string) *IngressRouteUDPSpecApplyConfiguration { + for i := range values { + b.EntryPoints = append(b.EntryPoints, values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/loadbalancerspec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/loadbalancerspec.go new file mode 100644 index 000000000..726f425a2 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/loadbalancerspec.go @@ -0,0 +1,178 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// LoadBalancerSpecApplyConfiguration represents a declarative configuration of the LoadBalancerSpec type for use +// with apply. +type LoadBalancerSpecApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Sticky *dynamic.Sticky `json:"sticky,omitempty"` + Port *intstr.IntOrString `json:"port,omitempty"` + Scheme *string `json:"scheme,omitempty"` + Strategy *dynamic.BalancerStrategy `json:"strategy,omitempty"` + PassHostHeader *bool `json:"passHostHeader,omitempty"` + ResponseForwarding *ResponseForwardingApplyConfiguration `json:"responseForwarding,omitempty"` + ServersTransport *string `json:"serversTransport,omitempty"` + Weight *int `json:"weight,omitempty"` + NativeLB *bool `json:"nativeLB,omitempty"` + NodePortLB *bool `json:"nodePortLB,omitempty"` + HealthCheck *ServerHealthCheckApplyConfiguration `json:"healthCheck,omitempty"` + PassiveHealthCheck *PassiveServerHealthCheckApplyConfiguration `json:"passiveHealthCheck,omitempty"` +} + +// LoadBalancerSpecApplyConfiguration constructs a declarative configuration of the LoadBalancerSpec type for use with +// apply. +func LoadBalancerSpec() *LoadBalancerSpecApplyConfiguration { + return &LoadBalancerSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithName(value string) *LoadBalancerSpecApplyConfiguration { + b.Name = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithKind(value string) *LoadBalancerSpecApplyConfiguration { + b.Kind = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithNamespace(value string) *LoadBalancerSpecApplyConfiguration { + b.Namespace = &value + return b +} + +// WithSticky sets the Sticky field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Sticky field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithSticky(value dynamic.Sticky) *LoadBalancerSpecApplyConfiguration { + b.Sticky = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithPort(value intstr.IntOrString) *LoadBalancerSpecApplyConfiguration { + b.Port = &value + return b +} + +// WithScheme sets the Scheme field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scheme field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithScheme(value string) *LoadBalancerSpecApplyConfiguration { + b.Scheme = &value + return b +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithStrategy(value dynamic.BalancerStrategy) *LoadBalancerSpecApplyConfiguration { + b.Strategy = &value + return b +} + +// WithPassHostHeader sets the PassHostHeader field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PassHostHeader field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithPassHostHeader(value bool) *LoadBalancerSpecApplyConfiguration { + b.PassHostHeader = &value + return b +} + +// WithResponseForwarding sets the ResponseForwarding field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResponseForwarding field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithResponseForwarding(value *ResponseForwardingApplyConfiguration) *LoadBalancerSpecApplyConfiguration { + b.ResponseForwarding = value + return b +} + +// WithServersTransport sets the ServersTransport field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServersTransport field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithServersTransport(value string) *LoadBalancerSpecApplyConfiguration { + b.ServersTransport = &value + return b +} + +// WithWeight sets the Weight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weight field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithWeight(value int) *LoadBalancerSpecApplyConfiguration { + b.Weight = &value + return b +} + +// WithNativeLB sets the NativeLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NativeLB field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithNativeLB(value bool) *LoadBalancerSpecApplyConfiguration { + b.NativeLB = &value + return b +} + +// WithNodePortLB sets the NodePortLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodePortLB field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithNodePortLB(value bool) *LoadBalancerSpecApplyConfiguration { + b.NodePortLB = &value + return b +} + +// WithHealthCheck sets the HealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HealthCheck field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithHealthCheck(value *ServerHealthCheckApplyConfiguration) *LoadBalancerSpecApplyConfiguration { + b.HealthCheck = value + return b +} + +// WithPassiveHealthCheck sets the PassiveHealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PassiveHealthCheck field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithPassiveHealthCheck(value *PassiveServerHealthCheckApplyConfiguration) *LoadBalancerSpecApplyConfiguration { + b.PassiveHealthCheck = value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middleware.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middleware.go new file mode 100644 index 000000000..98cbf2853 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middleware.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MiddlewareApplyConfiguration represents a declarative configuration of the Middleware type for use +// with apply. +type MiddlewareApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *MiddlewareSpecApplyConfiguration `json:"spec,omitempty"` +} + +// Middleware constructs a declarative configuration of the Middleware type for use with +// apply. +func Middleware(name, namespace string) *MiddlewareApplyConfiguration { + b := &MiddlewareApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Middleware") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b MiddlewareApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithKind(value string) *MiddlewareApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithAPIVersion(value string) *MiddlewareApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithName(value string) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithGenerateName(value string) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithNamespace(value string) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithUID(value types.UID) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithResourceVersion(value string) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithGeneration(value int64) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MiddlewareApplyConfiguration) WithLabels(entries map[string]string) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MiddlewareApplyConfiguration) WithAnnotations(entries map[string]string) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MiddlewareApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MiddlewareApplyConfiguration) WithFinalizers(values ...string) *MiddlewareApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MiddlewareApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MiddlewareApplyConfiguration) WithSpec(value *MiddlewareSpecApplyConfiguration) *MiddlewareApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MiddlewareApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MiddlewareApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MiddlewareApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MiddlewareApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewareref.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewareref.go new file mode 100644 index 000000000..393a71232 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewareref.go @@ -0,0 +1,56 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// MiddlewareRefApplyConfiguration represents a declarative configuration of the MiddlewareRef type for use +// with apply. +type MiddlewareRefApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// MiddlewareRefApplyConfiguration constructs a declarative configuration of the MiddlewareRef type for use with +// apply. +func MiddlewareRef() *MiddlewareRefApplyConfiguration { + return &MiddlewareRefApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MiddlewareRefApplyConfiguration) WithName(value string) *MiddlewareRefApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MiddlewareRefApplyConfiguration) WithNamespace(value string) *MiddlewareRefApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewarespec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewarespec.go new file mode 100644 index 000000000..4e4a4c063 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewarespec.go @@ -0,0 +1,274 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// MiddlewareSpecApplyConfiguration represents a declarative configuration of the MiddlewareSpec type for use +// with apply. +type MiddlewareSpecApplyConfiguration struct { + AddPrefix *dynamic.AddPrefix `json:"addPrefix,omitempty"` + StripPrefix *dynamic.StripPrefix `json:"stripPrefix,omitempty"` + StripPrefixRegex *dynamic.StripPrefixRegex `json:"stripPrefixRegex,omitempty"` + ReplacePath *dynamic.ReplacePath `json:"replacePath,omitempty"` + ReplacePathRegex *dynamic.ReplacePathRegex `json:"replacePathRegex,omitempty"` + Chain *ChainApplyConfiguration `json:"chain,omitempty"` + IPWhiteList *dynamic.IPWhiteList `json:"ipWhiteList,omitempty"` + IPAllowList *dynamic.IPAllowList `json:"ipAllowList,omitempty"` + Headers *dynamic.Headers `json:"headers,omitempty"` + Errors *ErrorPageApplyConfiguration `json:"errors,omitempty"` + RateLimit *RateLimitApplyConfiguration `json:"rateLimit,omitempty"` + RedirectRegex *dynamic.RedirectRegex `json:"redirectRegex,omitempty"` + RedirectScheme *dynamic.RedirectScheme `json:"redirectScheme,omitempty"` + BasicAuth *BasicAuthApplyConfiguration `json:"basicAuth,omitempty"` + DigestAuth *DigestAuthApplyConfiguration `json:"digestAuth,omitempty"` + ForwardAuth *ForwardAuthApplyConfiguration `json:"forwardAuth,omitempty"` + InFlightReq *dynamic.InFlightReq `json:"inFlightReq,omitempty"` + Buffering *dynamic.Buffering `json:"buffering,omitempty"` + CircuitBreaker *CircuitBreakerApplyConfiguration `json:"circuitBreaker,omitempty"` + Compress *CompressApplyConfiguration `json:"compress,omitempty"` + PassTLSClientCert *dynamic.PassTLSClientCert `json:"passTLSClientCert,omitempty"` + Retry *RetryApplyConfiguration `json:"retry,omitempty"` + ContentType *dynamic.ContentType `json:"contentType,omitempty"` + GrpcWeb *dynamic.GrpcWeb `json:"grpcWeb,omitempty"` + Plugin map[string]v1.JSON `json:"plugin,omitempty"` +} + +// MiddlewareSpecApplyConfiguration constructs a declarative configuration of the MiddlewareSpec type for use with +// apply. +func MiddlewareSpec() *MiddlewareSpecApplyConfiguration { + return &MiddlewareSpecApplyConfiguration{} +} + +// WithAddPrefix sets the AddPrefix field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AddPrefix field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithAddPrefix(value dynamic.AddPrefix) *MiddlewareSpecApplyConfiguration { + b.AddPrefix = &value + return b +} + +// WithStripPrefix sets the StripPrefix field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StripPrefix field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithStripPrefix(value dynamic.StripPrefix) *MiddlewareSpecApplyConfiguration { + b.StripPrefix = &value + return b +} + +// WithStripPrefixRegex sets the StripPrefixRegex field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StripPrefixRegex field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithStripPrefixRegex(value dynamic.StripPrefixRegex) *MiddlewareSpecApplyConfiguration { + b.StripPrefixRegex = &value + return b +} + +// WithReplacePath sets the ReplacePath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReplacePath field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithReplacePath(value dynamic.ReplacePath) *MiddlewareSpecApplyConfiguration { + b.ReplacePath = &value + return b +} + +// WithReplacePathRegex sets the ReplacePathRegex field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReplacePathRegex field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithReplacePathRegex(value dynamic.ReplacePathRegex) *MiddlewareSpecApplyConfiguration { + b.ReplacePathRegex = &value + return b +} + +// WithChain sets the Chain field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Chain field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithChain(value *ChainApplyConfiguration) *MiddlewareSpecApplyConfiguration { + b.Chain = value + return b +} + +// WithIPWhiteList sets the IPWhiteList field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPWhiteList field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithIPWhiteList(value dynamic.IPWhiteList) *MiddlewareSpecApplyConfiguration { + b.IPWhiteList = &value + return b +} + +// WithIPAllowList sets the IPAllowList field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPAllowList field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithIPAllowList(value dynamic.IPAllowList) *MiddlewareSpecApplyConfiguration { + b.IPAllowList = &value + return b +} + +// WithHeaders sets the Headers field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Headers field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithHeaders(value dynamic.Headers) *MiddlewareSpecApplyConfiguration { + b.Headers = &value + return b +} + +// WithErrors sets the Errors field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Errors field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithErrors(value *ErrorPageApplyConfiguration) *MiddlewareSpecApplyConfiguration { + b.Errors = value + return b +} + +// WithRateLimit sets the RateLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RateLimit field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithRateLimit(value *RateLimitApplyConfiguration) *MiddlewareSpecApplyConfiguration { + b.RateLimit = value + return b +} + +// WithRedirectRegex sets the RedirectRegex field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RedirectRegex field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithRedirectRegex(value dynamic.RedirectRegex) *MiddlewareSpecApplyConfiguration { + b.RedirectRegex = &value + return b +} + +// WithRedirectScheme sets the RedirectScheme field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RedirectScheme field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithRedirectScheme(value dynamic.RedirectScheme) *MiddlewareSpecApplyConfiguration { + b.RedirectScheme = &value + return b +} + +// WithBasicAuth sets the BasicAuth field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BasicAuth field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithBasicAuth(value *BasicAuthApplyConfiguration) *MiddlewareSpecApplyConfiguration { + b.BasicAuth = value + return b +} + +// WithDigestAuth sets the DigestAuth field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DigestAuth field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithDigestAuth(value *DigestAuthApplyConfiguration) *MiddlewareSpecApplyConfiguration { + b.DigestAuth = value + return b +} + +// WithForwardAuth sets the ForwardAuth field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ForwardAuth field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithForwardAuth(value *ForwardAuthApplyConfiguration) *MiddlewareSpecApplyConfiguration { + b.ForwardAuth = value + return b +} + +// WithInFlightReq sets the InFlightReq field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InFlightReq field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithInFlightReq(value dynamic.InFlightReq) *MiddlewareSpecApplyConfiguration { + b.InFlightReq = &value + return b +} + +// WithBuffering sets the Buffering field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Buffering field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithBuffering(value dynamic.Buffering) *MiddlewareSpecApplyConfiguration { + b.Buffering = &value + return b +} + +// WithCircuitBreaker sets the CircuitBreaker field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CircuitBreaker field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithCircuitBreaker(value *CircuitBreakerApplyConfiguration) *MiddlewareSpecApplyConfiguration { + b.CircuitBreaker = value + return b +} + +// WithCompress sets the Compress field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Compress field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithCompress(value *CompressApplyConfiguration) *MiddlewareSpecApplyConfiguration { + b.Compress = value + return b +} + +// WithPassTLSClientCert sets the PassTLSClientCert field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PassTLSClientCert field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithPassTLSClientCert(value dynamic.PassTLSClientCert) *MiddlewareSpecApplyConfiguration { + b.PassTLSClientCert = &value + return b +} + +// WithRetry sets the Retry field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Retry field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithRetry(value *RetryApplyConfiguration) *MiddlewareSpecApplyConfiguration { + b.Retry = value + return b +} + +// WithContentType sets the ContentType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ContentType field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithContentType(value dynamic.ContentType) *MiddlewareSpecApplyConfiguration { + b.ContentType = &value + return b +} + +// WithGrpcWeb sets the GrpcWeb field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GrpcWeb field is set to the value of the last call. +func (b *MiddlewareSpecApplyConfiguration) WithGrpcWeb(value dynamic.GrpcWeb) *MiddlewareSpecApplyConfiguration { + b.GrpcWeb = &value + return b +} + +// WithPlugin puts the entries into the Plugin field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Plugin field, +// overwriting an existing map entries in Plugin field with the same key. +func (b *MiddlewareSpecApplyConfiguration) WithPlugin(entries map[string]v1.JSON) *MiddlewareSpecApplyConfiguration { + if b.Plugin == nil && len(entries) > 0 { + b.Plugin = make(map[string]v1.JSON, len(entries)) + } + for k, v := range entries { + b.Plugin[k] = v + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewaretcp.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewaretcp.go new file mode 100644 index 000000000..7a8b92f55 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewaretcp.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MiddlewareTCPApplyConfiguration represents a declarative configuration of the MiddlewareTCP type for use +// with apply. +type MiddlewareTCPApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *MiddlewareTCPSpecApplyConfiguration `json:"spec,omitempty"` +} + +// MiddlewareTCP constructs a declarative configuration of the MiddlewareTCP type for use with +// apply. +func MiddlewareTCP(name, namespace string) *MiddlewareTCPApplyConfiguration { + b := &MiddlewareTCPApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("MiddlewareTCP") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b MiddlewareTCPApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithKind(value string) *MiddlewareTCPApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithAPIVersion(value string) *MiddlewareTCPApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithName(value string) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithGenerateName(value string) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithNamespace(value string) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithUID(value types.UID) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithResourceVersion(value string) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithGeneration(value int64) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MiddlewareTCPApplyConfiguration) WithLabels(entries map[string]string) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MiddlewareTCPApplyConfiguration) WithAnnotations(entries map[string]string) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MiddlewareTCPApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MiddlewareTCPApplyConfiguration) WithFinalizers(values ...string) *MiddlewareTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MiddlewareTCPApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MiddlewareTCPApplyConfiguration) WithSpec(value *MiddlewareTCPSpecApplyConfiguration) *MiddlewareTCPApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MiddlewareTCPApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MiddlewareTCPApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MiddlewareTCPApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MiddlewareTCPApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewaretcpspec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewaretcpspec.go new file mode 100644 index 000000000..81e751c57 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/middlewaretcpspec.go @@ -0,0 +1,69 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" +) + +// MiddlewareTCPSpecApplyConfiguration represents a declarative configuration of the MiddlewareTCPSpec type for use +// with apply. +type MiddlewareTCPSpecApplyConfiguration struct { + InFlightConn *dynamic.TCPInFlightConn `json:"inFlightConn,omitempty"` + IPWhiteList *dynamic.TCPIPWhiteList `json:"ipWhiteList,omitempty"` + IPAllowList *dynamic.TCPIPAllowList `json:"ipAllowList,omitempty"` +} + +// MiddlewareTCPSpecApplyConfiguration constructs a declarative configuration of the MiddlewareTCPSpec type for use with +// apply. +func MiddlewareTCPSpec() *MiddlewareTCPSpecApplyConfiguration { + return &MiddlewareTCPSpecApplyConfiguration{} +} + +// WithInFlightConn sets the InFlightConn field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InFlightConn field is set to the value of the last call. +func (b *MiddlewareTCPSpecApplyConfiguration) WithInFlightConn(value dynamic.TCPInFlightConn) *MiddlewareTCPSpecApplyConfiguration { + b.InFlightConn = &value + return b +} + +// WithIPWhiteList sets the IPWhiteList field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPWhiteList field is set to the value of the last call. +func (b *MiddlewareTCPSpecApplyConfiguration) WithIPWhiteList(value dynamic.TCPIPWhiteList) *MiddlewareTCPSpecApplyConfiguration { + b.IPWhiteList = &value + return b +} + +// WithIPAllowList sets the IPAllowList field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPAllowList field is set to the value of the last call. +func (b *MiddlewareTCPSpecApplyConfiguration) WithIPAllowList(value dynamic.TCPIPAllowList) *MiddlewareTCPSpecApplyConfiguration { + b.IPAllowList = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/mirroring.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/mirroring.go new file mode 100644 index 000000000..7140f1c37 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/mirroring.go @@ -0,0 +1,196 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MirroringApplyConfiguration represents a declarative configuration of the Mirroring type for use +// with apply. +type MirroringApplyConfiguration struct { + LoadBalancerSpecApplyConfiguration `json:",inline"` + MirrorBody *bool `json:"mirrorBody,omitempty"` + MaxBodySize *int64 `json:"maxBodySize,omitempty"` + Mirrors []MirrorServiceApplyConfiguration `json:"mirrors,omitempty"` +} + +// MirroringApplyConfiguration constructs a declarative configuration of the Mirroring type for use with +// apply. +func Mirroring() *MirroringApplyConfiguration { + return &MirroringApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithName(value string) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Name = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithKind(value string) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Kind = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithNamespace(value string) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Namespace = &value + return b +} + +// WithSticky sets the Sticky field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Sticky field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithSticky(value dynamic.Sticky) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Sticky = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithPort(value intstr.IntOrString) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Port = &value + return b +} + +// WithScheme sets the Scheme field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scheme field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithScheme(value string) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Scheme = &value + return b +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithStrategy(value dynamic.BalancerStrategy) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Strategy = &value + return b +} + +// WithPassHostHeader sets the PassHostHeader field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PassHostHeader field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithPassHostHeader(value bool) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.PassHostHeader = &value + return b +} + +// WithResponseForwarding sets the ResponseForwarding field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResponseForwarding field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithResponseForwarding(value *ResponseForwardingApplyConfiguration) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.ResponseForwarding = value + return b +} + +// WithServersTransport sets the ServersTransport field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServersTransport field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithServersTransport(value string) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.ServersTransport = &value + return b +} + +// WithWeight sets the Weight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weight field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithWeight(value int) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Weight = &value + return b +} + +// WithNativeLB sets the NativeLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NativeLB field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithNativeLB(value bool) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.NativeLB = &value + return b +} + +// WithNodePortLB sets the NodePortLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodePortLB field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithNodePortLB(value bool) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.NodePortLB = &value + return b +} + +// WithHealthCheck sets the HealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HealthCheck field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithHealthCheck(value *ServerHealthCheckApplyConfiguration) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.HealthCheck = value + return b +} + +// WithPassiveHealthCheck sets the PassiveHealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PassiveHealthCheck field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithPassiveHealthCheck(value *PassiveServerHealthCheckApplyConfiguration) *MirroringApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.PassiveHealthCheck = value + return b +} + +// WithMirrorBody sets the MirrorBody field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MirrorBody field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithMirrorBody(value bool) *MirroringApplyConfiguration { + b.MirrorBody = &value + return b +} + +// WithMaxBodySize sets the MaxBodySize field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxBodySize field is set to the value of the last call. +func (b *MirroringApplyConfiguration) WithMaxBodySize(value int64) *MirroringApplyConfiguration { + b.MaxBodySize = &value + return b +} + +// WithMirrors adds the given value to the Mirrors field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Mirrors field. +func (b *MirroringApplyConfiguration) WithMirrors(values ...*MirrorServiceApplyConfiguration) *MirroringApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMirrors") + } + b.Mirrors = append(b.Mirrors, *values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/mirrorservice.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/mirrorservice.go new file mode 100644 index 000000000..f7fde8d3d --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/mirrorservice.go @@ -0,0 +1,173 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// MirrorServiceApplyConfiguration represents a declarative configuration of the MirrorService type for use +// with apply. +type MirrorServiceApplyConfiguration struct { + LoadBalancerSpecApplyConfiguration `json:",inline"` + Percent *int `json:"percent,omitempty"` +} + +// MirrorServiceApplyConfiguration constructs a declarative configuration of the MirrorService type for use with +// apply. +func MirrorService() *MirrorServiceApplyConfiguration { + return &MirrorServiceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithName(value string) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Name = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithKind(value string) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Kind = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithNamespace(value string) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Namespace = &value + return b +} + +// WithSticky sets the Sticky field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Sticky field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithSticky(value dynamic.Sticky) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Sticky = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithPort(value intstr.IntOrString) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Port = &value + return b +} + +// WithScheme sets the Scheme field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scheme field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithScheme(value string) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Scheme = &value + return b +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithStrategy(value dynamic.BalancerStrategy) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Strategy = &value + return b +} + +// WithPassHostHeader sets the PassHostHeader field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PassHostHeader field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithPassHostHeader(value bool) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.PassHostHeader = &value + return b +} + +// WithResponseForwarding sets the ResponseForwarding field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResponseForwarding field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithResponseForwarding(value *ResponseForwardingApplyConfiguration) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.ResponseForwarding = value + return b +} + +// WithServersTransport sets the ServersTransport field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServersTransport field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithServersTransport(value string) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.ServersTransport = &value + return b +} + +// WithWeight sets the Weight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weight field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithWeight(value int) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Weight = &value + return b +} + +// WithNativeLB sets the NativeLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NativeLB field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithNativeLB(value bool) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.NativeLB = &value + return b +} + +// WithNodePortLB sets the NodePortLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodePortLB field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithNodePortLB(value bool) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.NodePortLB = &value + return b +} + +// WithHealthCheck sets the HealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HealthCheck field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithHealthCheck(value *ServerHealthCheckApplyConfiguration) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.HealthCheck = value + return b +} + +// WithPassiveHealthCheck sets the PassiveHealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PassiveHealthCheck field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithPassiveHealthCheck(value *PassiveServerHealthCheckApplyConfiguration) *MirrorServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.PassiveHealthCheck = value + return b +} + +// WithPercent sets the Percent field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Percent field is set to the value of the last call. +func (b *MirrorServiceApplyConfiguration) WithPercent(value int) *MirrorServiceApplyConfiguration { + b.Percent = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/objectreference.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/objectreference.go new file mode 100644 index 000000000..bf48afb3e --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/objectreference.go @@ -0,0 +1,56 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ObjectReferenceApplyConfiguration represents a declarative configuration of the ObjectReference type for use +// with apply. +type ObjectReferenceApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// ObjectReferenceApplyConfiguration constructs a declarative configuration of the ObjectReference type for use with +// apply. +func ObjectReference() *ObjectReferenceApplyConfiguration { + return &ObjectReferenceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithName(value string) *ObjectReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ObjectReferenceApplyConfiguration) WithNamespace(value string) *ObjectReferenceApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/passiveserverhealthcheck.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/passiveserverhealthcheck.go new file mode 100644 index 000000000..f584e214c --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/passiveserverhealthcheck.go @@ -0,0 +1,60 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// PassiveServerHealthCheckApplyConfiguration represents a declarative configuration of the PassiveServerHealthCheck type for use +// with apply. +type PassiveServerHealthCheckApplyConfiguration struct { + FailureWindow *intstr.IntOrString `json:"failureWindow,omitempty"` + MaxFailedAttempts *int `json:"maxFailedAttempts,omitempty"` +} + +// PassiveServerHealthCheckApplyConfiguration constructs a declarative configuration of the PassiveServerHealthCheck type for use with +// apply. +func PassiveServerHealthCheck() *PassiveServerHealthCheckApplyConfiguration { + return &PassiveServerHealthCheckApplyConfiguration{} +} + +// WithFailureWindow sets the FailureWindow field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureWindow field is set to the value of the last call. +func (b *PassiveServerHealthCheckApplyConfiguration) WithFailureWindow(value intstr.IntOrString) *PassiveServerHealthCheckApplyConfiguration { + b.FailureWindow = &value + return b +} + +// WithMaxFailedAttempts sets the MaxFailedAttempts field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxFailedAttempts field is set to the value of the last call. +func (b *PassiveServerHealthCheckApplyConfiguration) WithMaxFailedAttempts(value int) *PassiveServerHealthCheckApplyConfiguration { + b.MaxFailedAttempts = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ratelimit.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ratelimit.go new file mode 100644 index 000000000..8af058d67 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/ratelimit.go @@ -0,0 +1,88 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// RateLimitApplyConfiguration represents a declarative configuration of the RateLimit type for use +// with apply. +type RateLimitApplyConfiguration struct { + Average *int64 `json:"average,omitempty"` + Period *intstr.IntOrString `json:"period,omitempty"` + Burst *int64 `json:"burst,omitempty"` + SourceCriterion *dynamic.SourceCriterion `json:"sourceCriterion,omitempty"` + Redis *RedisApplyConfiguration `json:"redis,omitempty"` +} + +// RateLimitApplyConfiguration constructs a declarative configuration of the RateLimit type for use with +// apply. +func RateLimit() *RateLimitApplyConfiguration { + return &RateLimitApplyConfiguration{} +} + +// WithAverage sets the Average field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Average field is set to the value of the last call. +func (b *RateLimitApplyConfiguration) WithAverage(value int64) *RateLimitApplyConfiguration { + b.Average = &value + return b +} + +// WithPeriod sets the Period field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Period field is set to the value of the last call. +func (b *RateLimitApplyConfiguration) WithPeriod(value intstr.IntOrString) *RateLimitApplyConfiguration { + b.Period = &value + return b +} + +// WithBurst sets the Burst field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Burst field is set to the value of the last call. +func (b *RateLimitApplyConfiguration) WithBurst(value int64) *RateLimitApplyConfiguration { + b.Burst = &value + return b +} + +// WithSourceCriterion sets the SourceCriterion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SourceCriterion field is set to the value of the last call. +func (b *RateLimitApplyConfiguration) WithSourceCriterion(value dynamic.SourceCriterion) *RateLimitApplyConfiguration { + b.SourceCriterion = &value + return b +} + +// WithRedis sets the Redis field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Redis field is set to the value of the last call. +func (b *RateLimitApplyConfiguration) WithRedis(value *RedisApplyConfiguration) *RateLimitApplyConfiguration { + b.Redis = value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/redis.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/redis.go new file mode 100644 index 000000000..f402ac375 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/redis.go @@ -0,0 +1,134 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// RedisApplyConfiguration represents a declarative configuration of the Redis type for use +// with apply. +type RedisApplyConfiguration struct { + Endpoints []string `json:"endpoints,omitempty"` + TLS *ClientTLSApplyConfiguration `json:"tls,omitempty"` + Secret *string `json:"secret,omitempty"` + DB *int `json:"db,omitempty"` + PoolSize *int `json:"poolSize,omitempty"` + MinIdleConns *int `json:"minIdleConns,omitempty"` + MaxActiveConns *int `json:"maxActiveConns,omitempty"` + ReadTimeout *intstr.IntOrString `json:"readTimeout,omitempty"` + WriteTimeout *intstr.IntOrString `json:"writeTimeout,omitempty"` + DialTimeout *intstr.IntOrString `json:"dialTimeout,omitempty"` +} + +// RedisApplyConfiguration constructs a declarative configuration of the Redis type for use with +// apply. +func Redis() *RedisApplyConfiguration { + return &RedisApplyConfiguration{} +} + +// WithEndpoints adds the given value to the Endpoints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Endpoints field. +func (b *RedisApplyConfiguration) WithEndpoints(values ...string) *RedisApplyConfiguration { + for i := range values { + b.Endpoints = append(b.Endpoints, values[i]) + } + return b +} + +// WithTLS sets the TLS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TLS field is set to the value of the last call. +func (b *RedisApplyConfiguration) WithTLS(value *ClientTLSApplyConfiguration) *RedisApplyConfiguration { + b.TLS = value + return b +} + +// WithSecret sets the Secret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Secret field is set to the value of the last call. +func (b *RedisApplyConfiguration) WithSecret(value string) *RedisApplyConfiguration { + b.Secret = &value + return b +} + +// WithDB sets the DB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DB field is set to the value of the last call. +func (b *RedisApplyConfiguration) WithDB(value int) *RedisApplyConfiguration { + b.DB = &value + return b +} + +// WithPoolSize sets the PoolSize field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PoolSize field is set to the value of the last call. +func (b *RedisApplyConfiguration) WithPoolSize(value int) *RedisApplyConfiguration { + b.PoolSize = &value + return b +} + +// WithMinIdleConns sets the MinIdleConns field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinIdleConns field is set to the value of the last call. +func (b *RedisApplyConfiguration) WithMinIdleConns(value int) *RedisApplyConfiguration { + b.MinIdleConns = &value + return b +} + +// WithMaxActiveConns sets the MaxActiveConns field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxActiveConns field is set to the value of the last call. +func (b *RedisApplyConfiguration) WithMaxActiveConns(value int) *RedisApplyConfiguration { + b.MaxActiveConns = &value + return b +} + +// WithReadTimeout sets the ReadTimeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadTimeout field is set to the value of the last call. +func (b *RedisApplyConfiguration) WithReadTimeout(value intstr.IntOrString) *RedisApplyConfiguration { + b.ReadTimeout = &value + return b +} + +// WithWriteTimeout sets the WriteTimeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WriteTimeout field is set to the value of the last call. +func (b *RedisApplyConfiguration) WithWriteTimeout(value intstr.IntOrString) *RedisApplyConfiguration { + b.WriteTimeout = &value + return b +} + +// WithDialTimeout sets the DialTimeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DialTimeout field is set to the value of the last call. +func (b *RedisApplyConfiguration) WithDialTimeout(value intstr.IntOrString) *RedisApplyConfiguration { + b.DialTimeout = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/responseforwarding.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/responseforwarding.go new file mode 100644 index 000000000..73b5936f6 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/responseforwarding.go @@ -0,0 +1,47 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ResponseForwardingApplyConfiguration represents a declarative configuration of the ResponseForwarding type for use +// with apply. +type ResponseForwardingApplyConfiguration struct { + FlushInterval *string `json:"flushInterval,omitempty"` +} + +// ResponseForwardingApplyConfiguration constructs a declarative configuration of the ResponseForwarding type for use with +// apply. +func ResponseForwarding() *ResponseForwardingApplyConfiguration { + return &ResponseForwardingApplyConfiguration{} +} + +// WithFlushInterval sets the FlushInterval field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FlushInterval field is set to the value of the last call. +func (b *ResponseForwardingApplyConfiguration) WithFlushInterval(value string) *ResponseForwardingApplyConfiguration { + b.FlushInterval = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/retry.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/retry.go new file mode 100644 index 000000000..93c06a0f9 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/retry.go @@ -0,0 +1,60 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// RetryApplyConfiguration represents a declarative configuration of the Retry type for use +// with apply. +type RetryApplyConfiguration struct { + Attempts *int `json:"attempts,omitempty"` + InitialInterval *intstr.IntOrString `json:"initialInterval,omitempty"` +} + +// RetryApplyConfiguration constructs a declarative configuration of the Retry type for use with +// apply. +func Retry() *RetryApplyConfiguration { + return &RetryApplyConfiguration{} +} + +// WithAttempts sets the Attempts field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Attempts field is set to the value of the last call. +func (b *RetryApplyConfiguration) WithAttempts(value int) *RetryApplyConfiguration { + b.Attempts = &value + return b +} + +// WithInitialInterval sets the InitialInterval field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InitialInterval field is set to the value of the last call. +func (b *RetryApplyConfiguration) WithInitialInterval(value intstr.IntOrString) *RetryApplyConfiguration { + b.InitialInterval = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/rootca.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/rootca.go new file mode 100644 index 000000000..04df7315a --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/rootca.go @@ -0,0 +1,56 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RootCAApplyConfiguration represents a declarative configuration of the RootCA type for use +// with apply. +type RootCAApplyConfiguration struct { + Secret *string `json:"secret,omitempty"` + ConfigMap *string `json:"configMap,omitempty"` +} + +// RootCAApplyConfiguration constructs a declarative configuration of the RootCA type for use with +// apply. +func RootCA() *RootCAApplyConfiguration { + return &RootCAApplyConfiguration{} +} + +// WithSecret sets the Secret field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Secret field is set to the value of the last call. +func (b *RootCAApplyConfiguration) WithSecret(value string) *RootCAApplyConfiguration { + b.Secret = &value + return b +} + +// WithConfigMap sets the ConfigMap field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ConfigMap field is set to the value of the last call. +func (b *RootCAApplyConfiguration) WithConfigMap(value string) *RootCAApplyConfiguration { + b.ConfigMap = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/route.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/route.go new file mode 100644 index 000000000..ef9703108 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/route.go @@ -0,0 +1,115 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" +) + +// RouteApplyConfiguration represents a declarative configuration of the Route type for use +// with apply. +type RouteApplyConfiguration struct { + Match *string `json:"match,omitempty"` + Kind *string `json:"kind,omitempty"` + Priority *int `json:"priority,omitempty"` + Syntax *string `json:"syntax,omitempty"` + Services []ServiceApplyConfiguration `json:"services,omitempty"` + Middlewares []MiddlewareRefApplyConfiguration `json:"middlewares,omitempty"` + Observability *dynamic.RouterObservabilityConfig `json:"observability,omitempty"` +} + +// RouteApplyConfiguration constructs a declarative configuration of the Route type for use with +// apply. +func Route() *RouteApplyConfiguration { + return &RouteApplyConfiguration{} +} + +// WithMatch sets the Match field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Match field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithMatch(value string) *RouteApplyConfiguration { + b.Match = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithKind(value string) *RouteApplyConfiguration { + b.Kind = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithPriority(value int) *RouteApplyConfiguration { + b.Priority = &value + return b +} + +// WithSyntax sets the Syntax field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Syntax field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithSyntax(value string) *RouteApplyConfiguration { + b.Syntax = &value + return b +} + +// WithServices adds the given value to the Services field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Services field. +func (b *RouteApplyConfiguration) WithServices(values ...*ServiceApplyConfiguration) *RouteApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithServices") + } + b.Services = append(b.Services, *values[i]) + } + return b +} + +// WithMiddlewares adds the given value to the Middlewares field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Middlewares field. +func (b *RouteApplyConfiguration) WithMiddlewares(values ...*MiddlewareRefApplyConfiguration) *RouteApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMiddlewares") + } + b.Middlewares = append(b.Middlewares, *values[i]) + } + return b +} + +// WithObservability sets the Observability field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Observability field is set to the value of the last call. +func (b *RouteApplyConfiguration) WithObservability(value dynamic.RouterObservabilityConfig) *RouteApplyConfiguration { + b.Observability = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/routetcp.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/routetcp.go new file mode 100644 index 000000000..a6e7c263e --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/routetcp.go @@ -0,0 +1,93 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RouteTCPApplyConfiguration represents a declarative configuration of the RouteTCP type for use +// with apply. +type RouteTCPApplyConfiguration struct { + Match *string `json:"match,omitempty"` + Priority *int `json:"priority,omitempty"` + Syntax *string `json:"syntax,omitempty"` + Services []ServiceTCPApplyConfiguration `json:"services,omitempty"` + Middlewares []ObjectReferenceApplyConfiguration `json:"middlewares,omitempty"` +} + +// RouteTCPApplyConfiguration constructs a declarative configuration of the RouteTCP type for use with +// apply. +func RouteTCP() *RouteTCPApplyConfiguration { + return &RouteTCPApplyConfiguration{} +} + +// WithMatch sets the Match field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Match field is set to the value of the last call. +func (b *RouteTCPApplyConfiguration) WithMatch(value string) *RouteTCPApplyConfiguration { + b.Match = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *RouteTCPApplyConfiguration) WithPriority(value int) *RouteTCPApplyConfiguration { + b.Priority = &value + return b +} + +// WithSyntax sets the Syntax field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Syntax field is set to the value of the last call. +func (b *RouteTCPApplyConfiguration) WithSyntax(value string) *RouteTCPApplyConfiguration { + b.Syntax = &value + return b +} + +// WithServices adds the given value to the Services field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Services field. +func (b *RouteTCPApplyConfiguration) WithServices(values ...*ServiceTCPApplyConfiguration) *RouteTCPApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithServices") + } + b.Services = append(b.Services, *values[i]) + } + return b +} + +// WithMiddlewares adds the given value to the Middlewares field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Middlewares field. +func (b *RouteTCPApplyConfiguration) WithMiddlewares(values ...*ObjectReferenceApplyConfiguration) *RouteTCPApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMiddlewares") + } + b.Middlewares = append(b.Middlewares, *values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/routeudp.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/routeudp.go new file mode 100644 index 000000000..13a49e2ed --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/routeudp.go @@ -0,0 +1,52 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// RouteUDPApplyConfiguration represents a declarative configuration of the RouteUDP type for use +// with apply. +type RouteUDPApplyConfiguration struct { + Services []ServiceUDPApplyConfiguration `json:"services,omitempty"` +} + +// RouteUDPApplyConfiguration constructs a declarative configuration of the RouteUDP type for use with +// apply. +func RouteUDP() *RouteUDPApplyConfiguration { + return &RouteUDPApplyConfiguration{} +} + +// WithServices adds the given value to the Services field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Services field. +func (b *RouteUDPApplyConfiguration) WithServices(values ...*ServiceUDPApplyConfiguration) *RouteUDPApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithServices") + } + b.Services = append(b.Services, *values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverhealthcheck.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverhealthcheck.go new file mode 100644 index 000000000..c39a2ac05 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverhealthcheck.go @@ -0,0 +1,156 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// ServerHealthCheckApplyConfiguration represents a declarative configuration of the ServerHealthCheck type for use +// with apply. +type ServerHealthCheckApplyConfiguration struct { + Scheme *string `json:"scheme,omitempty"` + Mode *string `json:"mode,omitempty"` + Path *string `json:"path,omitempty"` + Method *string `json:"method,omitempty"` + Status *int `json:"status,omitempty"` + Port *int `json:"port,omitempty"` + Interval *intstr.IntOrString `json:"interval,omitempty"` + UnhealthyInterval *intstr.IntOrString `json:"unhealthyInterval,omitempty"` + Timeout *intstr.IntOrString `json:"timeout,omitempty"` + Hostname *string `json:"hostname,omitempty"` + FollowRedirects *bool `json:"followRedirects,omitempty"` + Headers map[string]string `json:"headers,omitempty"` +} + +// ServerHealthCheckApplyConfiguration constructs a declarative configuration of the ServerHealthCheck type for use with +// apply. +func ServerHealthCheck() *ServerHealthCheckApplyConfiguration { + return &ServerHealthCheckApplyConfiguration{} +} + +// WithScheme sets the Scheme field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scheme field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithScheme(value string) *ServerHealthCheckApplyConfiguration { + b.Scheme = &value + return b +} + +// WithMode sets the Mode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Mode field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithMode(value string) *ServerHealthCheckApplyConfiguration { + b.Mode = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithPath(value string) *ServerHealthCheckApplyConfiguration { + b.Path = &value + return b +} + +// WithMethod sets the Method field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Method field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithMethod(value string) *ServerHealthCheckApplyConfiguration { + b.Method = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithStatus(value int) *ServerHealthCheckApplyConfiguration { + b.Status = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithPort(value int) *ServerHealthCheckApplyConfiguration { + b.Port = &value + return b +} + +// WithInterval sets the Interval field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Interval field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithInterval(value intstr.IntOrString) *ServerHealthCheckApplyConfiguration { + b.Interval = &value + return b +} + +// WithUnhealthyInterval sets the UnhealthyInterval field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnhealthyInterval field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithUnhealthyInterval(value intstr.IntOrString) *ServerHealthCheckApplyConfiguration { + b.UnhealthyInterval = &value + return b +} + +// WithTimeout sets the Timeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Timeout field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithTimeout(value intstr.IntOrString) *ServerHealthCheckApplyConfiguration { + b.Timeout = &value + return b +} + +// WithHostname sets the Hostname field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hostname field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithHostname(value string) *ServerHealthCheckApplyConfiguration { + b.Hostname = &value + return b +} + +// WithFollowRedirects sets the FollowRedirects field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FollowRedirects field is set to the value of the last call. +func (b *ServerHealthCheckApplyConfiguration) WithFollowRedirects(value bool) *ServerHealthCheckApplyConfiguration { + b.FollowRedirects = &value + return b +} + +// WithHeaders puts the entries into the Headers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Headers field, +// overwriting an existing map entries in Headers field with the same key. +func (b *ServerHealthCheckApplyConfiguration) WithHeaders(entries map[string]string) *ServerHealthCheckApplyConfiguration { + if b.Headers == nil && len(entries) > 0 { + b.Headers = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Headers[k] = v + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransport.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransport.go new file mode 100644 index 000000000..95cd7848e --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransport.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ServersTransportApplyConfiguration represents a declarative configuration of the ServersTransport type for use +// with apply. +type ServersTransportApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ServersTransportSpecApplyConfiguration `json:"spec,omitempty"` +} + +// ServersTransport constructs a declarative configuration of the ServersTransport type for use with +// apply. +func ServersTransport(name, namespace string) *ServersTransportApplyConfiguration { + b := &ServersTransportApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ServersTransport") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b ServersTransportApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithKind(value string) *ServersTransportApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithAPIVersion(value string) *ServersTransportApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithName(value string) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithGenerateName(value string) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithNamespace(value string) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithUID(value types.UID) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithResourceVersion(value string) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithGeneration(value int64) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ServersTransportApplyConfiguration) WithLabels(entries map[string]string) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ServersTransportApplyConfiguration) WithAnnotations(entries map[string]string) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ServersTransportApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ServersTransportApplyConfiguration) WithFinalizers(values ...string) *ServersTransportApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *ServersTransportApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ServersTransportApplyConfiguration) WithSpec(value *ServersTransportSpecApplyConfiguration) *ServersTransportApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *ServersTransportApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *ServersTransportApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ServersTransportApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *ServersTransportApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransportspec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransportspec.go new file mode 100644 index 000000000..a2507cdb2 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransportspec.go @@ -0,0 +1,141 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" +) + +// ServersTransportSpecApplyConfiguration represents a declarative configuration of the ServersTransportSpec type for use +// with apply. +type ServersTransportSpecApplyConfiguration struct { + ServerName *string `json:"serverName,omitempty"` + InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty"` + RootCAs []RootCAApplyConfiguration `json:"rootCAs,omitempty"` + RootCAsSecrets []string `json:"rootCAsSecrets,omitempty"` + CertificatesSecrets []string `json:"certificatesSecrets,omitempty"` + MaxIdleConnsPerHost *int `json:"maxIdleConnsPerHost,omitempty"` + ForwardingTimeouts *ForwardingTimeoutsApplyConfiguration `json:"forwardingTimeouts,omitempty"` + DisableHTTP2 *bool `json:"disableHTTP2,omitempty"` + PeerCertURI *string `json:"peerCertURI,omitempty"` + Spiffe *dynamic.Spiffe `json:"spiffe,omitempty"` +} + +// ServersTransportSpecApplyConfiguration constructs a declarative configuration of the ServersTransportSpec type for use with +// apply. +func ServersTransportSpec() *ServersTransportSpecApplyConfiguration { + return &ServersTransportSpecApplyConfiguration{} +} + +// WithServerName sets the ServerName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServerName field is set to the value of the last call. +func (b *ServersTransportSpecApplyConfiguration) WithServerName(value string) *ServersTransportSpecApplyConfiguration { + b.ServerName = &value + return b +} + +// WithInsecureSkipVerify sets the InsecureSkipVerify field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InsecureSkipVerify field is set to the value of the last call. +func (b *ServersTransportSpecApplyConfiguration) WithInsecureSkipVerify(value bool) *ServersTransportSpecApplyConfiguration { + b.InsecureSkipVerify = &value + return b +} + +// WithRootCAs adds the given value to the RootCAs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the RootCAs field. +func (b *ServersTransportSpecApplyConfiguration) WithRootCAs(values ...*RootCAApplyConfiguration) *ServersTransportSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRootCAs") + } + b.RootCAs = append(b.RootCAs, *values[i]) + } + return b +} + +// WithRootCAsSecrets adds the given value to the RootCAsSecrets field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the RootCAsSecrets field. +func (b *ServersTransportSpecApplyConfiguration) WithRootCAsSecrets(values ...string) *ServersTransportSpecApplyConfiguration { + for i := range values { + b.RootCAsSecrets = append(b.RootCAsSecrets, values[i]) + } + return b +} + +// WithCertificatesSecrets adds the given value to the CertificatesSecrets field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CertificatesSecrets field. +func (b *ServersTransportSpecApplyConfiguration) WithCertificatesSecrets(values ...string) *ServersTransportSpecApplyConfiguration { + for i := range values { + b.CertificatesSecrets = append(b.CertificatesSecrets, values[i]) + } + return b +} + +// WithMaxIdleConnsPerHost sets the MaxIdleConnsPerHost field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxIdleConnsPerHost field is set to the value of the last call. +func (b *ServersTransportSpecApplyConfiguration) WithMaxIdleConnsPerHost(value int) *ServersTransportSpecApplyConfiguration { + b.MaxIdleConnsPerHost = &value + return b +} + +// WithForwardingTimeouts sets the ForwardingTimeouts field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ForwardingTimeouts field is set to the value of the last call. +func (b *ServersTransportSpecApplyConfiguration) WithForwardingTimeouts(value *ForwardingTimeoutsApplyConfiguration) *ServersTransportSpecApplyConfiguration { + b.ForwardingTimeouts = value + return b +} + +// WithDisableHTTP2 sets the DisableHTTP2 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DisableHTTP2 field is set to the value of the last call. +func (b *ServersTransportSpecApplyConfiguration) WithDisableHTTP2(value bool) *ServersTransportSpecApplyConfiguration { + b.DisableHTTP2 = &value + return b +} + +// WithPeerCertURI sets the PeerCertURI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PeerCertURI field is set to the value of the last call. +func (b *ServersTransportSpecApplyConfiguration) WithPeerCertURI(value string) *ServersTransportSpecApplyConfiguration { + b.PeerCertURI = &value + return b +} + +// WithSpiffe sets the Spiffe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spiffe field is set to the value of the last call. +func (b *ServersTransportSpecApplyConfiguration) WithSpiffe(value dynamic.Spiffe) *ServersTransportSpecApplyConfiguration { + b.Spiffe = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransporttcp.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransporttcp.go new file mode 100644 index 000000000..46b9ac7a1 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransporttcp.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ServersTransportTCPApplyConfiguration represents a declarative configuration of the ServersTransportTCP type for use +// with apply. +type ServersTransportTCPApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ServersTransportTCPSpecApplyConfiguration `json:"spec,omitempty"` +} + +// ServersTransportTCP constructs a declarative configuration of the ServersTransportTCP type for use with +// apply. +func ServersTransportTCP(name, namespace string) *ServersTransportTCPApplyConfiguration { + b := &ServersTransportTCPApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ServersTransportTCP") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b ServersTransportTCPApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithKind(value string) *ServersTransportTCPApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithAPIVersion(value string) *ServersTransportTCPApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithName(value string) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithGenerateName(value string) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithNamespace(value string) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithUID(value types.UID) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithResourceVersion(value string) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithGeneration(value int64) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ServersTransportTCPApplyConfiguration) WithLabels(entries map[string]string) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ServersTransportTCPApplyConfiguration) WithAnnotations(entries map[string]string) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ServersTransportTCPApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ServersTransportTCPApplyConfiguration) WithFinalizers(values ...string) *ServersTransportTCPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *ServersTransportTCPApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ServersTransportTCPApplyConfiguration) WithSpec(value *ServersTransportTCPSpecApplyConfiguration) *ServersTransportTCPApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *ServersTransportTCPApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *ServersTransportTCPApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ServersTransportTCPApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *ServersTransportTCPApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransporttcpspec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransporttcpspec.go new file mode 100644 index 000000000..157012eac --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serverstransporttcpspec.go @@ -0,0 +1,88 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// ServersTransportTCPSpecApplyConfiguration represents a declarative configuration of the ServersTransportTCPSpec type for use +// with apply. +type ServersTransportTCPSpecApplyConfiguration struct { + DialTimeout *intstr.IntOrString `json:"dialTimeout,omitempty"` + DialKeepAlive *intstr.IntOrString `json:"dialKeepAlive,omitempty"` + ProxyProtocol *dynamic.ProxyProtocol `json:"proxyProtocol,omitempty"` + TerminationDelay *intstr.IntOrString `json:"terminationDelay,omitempty"` + TLS *TLSClientConfigApplyConfiguration `json:"tls,omitempty"` +} + +// ServersTransportTCPSpecApplyConfiguration constructs a declarative configuration of the ServersTransportTCPSpec type for use with +// apply. +func ServersTransportTCPSpec() *ServersTransportTCPSpecApplyConfiguration { + return &ServersTransportTCPSpecApplyConfiguration{} +} + +// WithDialTimeout sets the DialTimeout field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DialTimeout field is set to the value of the last call. +func (b *ServersTransportTCPSpecApplyConfiguration) WithDialTimeout(value intstr.IntOrString) *ServersTransportTCPSpecApplyConfiguration { + b.DialTimeout = &value + return b +} + +// WithDialKeepAlive sets the DialKeepAlive field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DialKeepAlive field is set to the value of the last call. +func (b *ServersTransportTCPSpecApplyConfiguration) WithDialKeepAlive(value intstr.IntOrString) *ServersTransportTCPSpecApplyConfiguration { + b.DialKeepAlive = &value + return b +} + +// WithProxyProtocol sets the ProxyProtocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProxyProtocol field is set to the value of the last call. +func (b *ServersTransportTCPSpecApplyConfiguration) WithProxyProtocol(value dynamic.ProxyProtocol) *ServersTransportTCPSpecApplyConfiguration { + b.ProxyProtocol = &value + return b +} + +// WithTerminationDelay sets the TerminationDelay field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationDelay field is set to the value of the last call. +func (b *ServersTransportTCPSpecApplyConfiguration) WithTerminationDelay(value intstr.IntOrString) *ServersTransportTCPSpecApplyConfiguration { + b.TerminationDelay = &value + return b +} + +// WithTLS sets the TLS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TLS field is set to the value of the last call. +func (b *ServersTransportTCPSpecApplyConfiguration) WithTLS(value *TLSClientConfigApplyConfiguration) *ServersTransportTCPSpecApplyConfiguration { + b.TLS = value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/service.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/service.go new file mode 100644 index 000000000..d0b8342c1 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/service.go @@ -0,0 +1,164 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// ServiceApplyConfiguration represents a declarative configuration of the Service type for use +// with apply. +type ServiceApplyConfiguration struct { + LoadBalancerSpecApplyConfiguration `json:",inline"` +} + +// ServiceApplyConfiguration constructs a declarative configuration of the Service type for use with +// apply. +func Service() *ServiceApplyConfiguration { + return &ServiceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithName(value string) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Name = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithKind(value string) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Kind = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithNamespace(value string) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Namespace = &value + return b +} + +// WithSticky sets the Sticky field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Sticky field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithSticky(value dynamic.Sticky) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Sticky = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithPort(value intstr.IntOrString) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Port = &value + return b +} + +// WithScheme sets the Scheme field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scheme field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithScheme(value string) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Scheme = &value + return b +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithStrategy(value dynamic.BalancerStrategy) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Strategy = &value + return b +} + +// WithPassHostHeader sets the PassHostHeader field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PassHostHeader field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithPassHostHeader(value bool) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.PassHostHeader = &value + return b +} + +// WithResponseForwarding sets the ResponseForwarding field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResponseForwarding field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithResponseForwarding(value *ResponseForwardingApplyConfiguration) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.ResponseForwarding = value + return b +} + +// WithServersTransport sets the ServersTransport field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServersTransport field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithServersTransport(value string) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.ServersTransport = &value + return b +} + +// WithWeight sets the Weight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weight field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithWeight(value int) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.Weight = &value + return b +} + +// WithNativeLB sets the NativeLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NativeLB field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithNativeLB(value bool) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.NativeLB = &value + return b +} + +// WithNodePortLB sets the NodePortLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodePortLB field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithNodePortLB(value bool) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.NodePortLB = &value + return b +} + +// WithHealthCheck sets the HealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HealthCheck field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithHealthCheck(value *ServerHealthCheckApplyConfiguration) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.HealthCheck = value + return b +} + +// WithPassiveHealthCheck sets the PassiveHealthCheck field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PassiveHealthCheck field is set to the value of the last call. +func (b *ServiceApplyConfiguration) WithPassiveHealthCheck(value *PassiveServerHealthCheckApplyConfiguration) *ServiceApplyConfiguration { + b.LoadBalancerSpecApplyConfiguration.PassiveHealthCheck = value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/servicetcp.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/servicetcp.go new file mode 100644 index 000000000..b5bdc0833 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/servicetcp.go @@ -0,0 +1,133 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// ServiceTCPApplyConfiguration represents a declarative configuration of the ServiceTCP type for use +// with apply. +type ServiceTCPApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Port *intstr.IntOrString `json:"port,omitempty"` + Weight *int `json:"weight,omitempty"` + TerminationDelay *int `json:"terminationDelay,omitempty"` + ProxyProtocol *dynamic.ProxyProtocol `json:"proxyProtocol,omitempty"` + ServersTransport *string `json:"serversTransport,omitempty"` + TLS *bool `json:"tls,omitempty"` + NativeLB *bool `json:"nativeLB,omitempty"` + NodePortLB *bool `json:"nodePortLB,omitempty"` +} + +// ServiceTCPApplyConfiguration constructs a declarative configuration of the ServiceTCP type for use with +// apply. +func ServiceTCP() *ServiceTCPApplyConfiguration { + return &ServiceTCPApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithName(value string) *ServiceTCPApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithNamespace(value string) *ServiceTCPApplyConfiguration { + b.Namespace = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithPort(value intstr.IntOrString) *ServiceTCPApplyConfiguration { + b.Port = &value + return b +} + +// WithWeight sets the Weight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weight field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithWeight(value int) *ServiceTCPApplyConfiguration { + b.Weight = &value + return b +} + +// WithTerminationDelay sets the TerminationDelay field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TerminationDelay field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithTerminationDelay(value int) *ServiceTCPApplyConfiguration { + b.TerminationDelay = &value + return b +} + +// WithProxyProtocol sets the ProxyProtocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProxyProtocol field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithProxyProtocol(value dynamic.ProxyProtocol) *ServiceTCPApplyConfiguration { + b.ProxyProtocol = &value + return b +} + +// WithServersTransport sets the ServersTransport field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServersTransport field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithServersTransport(value string) *ServiceTCPApplyConfiguration { + b.ServersTransport = &value + return b +} + +// WithTLS sets the TLS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TLS field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithTLS(value bool) *ServiceTCPApplyConfiguration { + b.TLS = &value + return b +} + +// WithNativeLB sets the NativeLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NativeLB field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithNativeLB(value bool) *ServiceTCPApplyConfiguration { + b.NativeLB = &value + return b +} + +// WithNodePortLB sets the NodePortLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodePortLB field is set to the value of the last call. +func (b *ServiceTCPApplyConfiguration) WithNodePortLB(value bool) *ServiceTCPApplyConfiguration { + b.NodePortLB = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serviceudp.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serviceudp.go new file mode 100644 index 000000000..325b83c33 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/serviceudp.go @@ -0,0 +1,96 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + intstr "k8s.io/apimachinery/pkg/util/intstr" +) + +// ServiceUDPApplyConfiguration represents a declarative configuration of the ServiceUDP type for use +// with apply. +type ServiceUDPApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Port *intstr.IntOrString `json:"port,omitempty"` + Weight *int `json:"weight,omitempty"` + NativeLB *bool `json:"nativeLB,omitempty"` + NodePortLB *bool `json:"nodePortLB,omitempty"` +} + +// ServiceUDPApplyConfiguration constructs a declarative configuration of the ServiceUDP type for use with +// apply. +func ServiceUDP() *ServiceUDPApplyConfiguration { + return &ServiceUDPApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceUDPApplyConfiguration) WithName(value string) *ServiceUDPApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceUDPApplyConfiguration) WithNamespace(value string) *ServiceUDPApplyConfiguration { + b.Namespace = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServiceUDPApplyConfiguration) WithPort(value intstr.IntOrString) *ServiceUDPApplyConfiguration { + b.Port = &value + return b +} + +// WithWeight sets the Weight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weight field is set to the value of the last call. +func (b *ServiceUDPApplyConfiguration) WithWeight(value int) *ServiceUDPApplyConfiguration { + b.Weight = &value + return b +} + +// WithNativeLB sets the NativeLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NativeLB field is set to the value of the last call. +func (b *ServiceUDPApplyConfiguration) WithNativeLB(value bool) *ServiceUDPApplyConfiguration { + b.NativeLB = &value + return b +} + +// WithNodePortLB sets the NodePortLB field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodePortLB field is set to the value of the last call. +func (b *ServiceUDPApplyConfiguration) WithNodePortLB(value bool) *ServiceUDPApplyConfiguration { + b.NodePortLB = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tls.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tls.go new file mode 100644 index 000000000..9e628535b --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tls.go @@ -0,0 +1,89 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + types "github.com/traefik/traefik/v3/pkg/types" +) + +// TLSApplyConfiguration represents a declarative configuration of the TLS type for use +// with apply. +type TLSApplyConfiguration struct { + SecretName *string `json:"secretName,omitempty"` + Options *TLSOptionRefApplyConfiguration `json:"options,omitempty"` + Store *TLSStoreRefApplyConfiguration `json:"store,omitempty"` + CertResolver *string `json:"certResolver,omitempty"` + Domains []types.Domain `json:"domains,omitempty"` +} + +// TLSApplyConfiguration constructs a declarative configuration of the TLS type for use with +// apply. +func TLS() *TLSApplyConfiguration { + return &TLSApplyConfiguration{} +} + +// WithSecretName sets the SecretName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretName field is set to the value of the last call. +func (b *TLSApplyConfiguration) WithSecretName(value string) *TLSApplyConfiguration { + b.SecretName = &value + return b +} + +// WithOptions sets the Options field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Options field is set to the value of the last call. +func (b *TLSApplyConfiguration) WithOptions(value *TLSOptionRefApplyConfiguration) *TLSApplyConfiguration { + b.Options = value + return b +} + +// WithStore sets the Store field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Store field is set to the value of the last call. +func (b *TLSApplyConfiguration) WithStore(value *TLSStoreRefApplyConfiguration) *TLSApplyConfiguration { + b.Store = value + return b +} + +// WithCertResolver sets the CertResolver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CertResolver field is set to the value of the last call. +func (b *TLSApplyConfiguration) WithCertResolver(value string) *TLSApplyConfiguration { + b.CertResolver = &value + return b +} + +// WithDomains adds the given value to the Domains field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Domains field. +func (b *TLSApplyConfiguration) WithDomains(values ...types.Domain) *TLSApplyConfiguration { + for i := range values { + b.Domains = append(b.Domains, values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsclientconfig.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsclientconfig.go new file mode 100644 index 000000000..db409216d --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsclientconfig.go @@ -0,0 +1,114 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" +) + +// TLSClientConfigApplyConfiguration represents a declarative configuration of the TLSClientConfig type for use +// with apply. +type TLSClientConfigApplyConfiguration struct { + ServerName *string `json:"serverName,omitempty"` + InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty"` + RootCAs []RootCAApplyConfiguration `json:"rootCAs,omitempty"` + RootCAsSecrets []string `json:"rootCAsSecrets,omitempty"` + CertificatesSecrets []string `json:"certificatesSecrets,omitempty"` + PeerCertURI *string `json:"peerCertURI,omitempty"` + Spiffe *dynamic.Spiffe `json:"spiffe,omitempty"` +} + +// TLSClientConfigApplyConfiguration constructs a declarative configuration of the TLSClientConfig type for use with +// apply. +func TLSClientConfig() *TLSClientConfigApplyConfiguration { + return &TLSClientConfigApplyConfiguration{} +} + +// WithServerName sets the ServerName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ServerName field is set to the value of the last call. +func (b *TLSClientConfigApplyConfiguration) WithServerName(value string) *TLSClientConfigApplyConfiguration { + b.ServerName = &value + return b +} + +// WithInsecureSkipVerify sets the InsecureSkipVerify field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InsecureSkipVerify field is set to the value of the last call. +func (b *TLSClientConfigApplyConfiguration) WithInsecureSkipVerify(value bool) *TLSClientConfigApplyConfiguration { + b.InsecureSkipVerify = &value + return b +} + +// WithRootCAs adds the given value to the RootCAs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the RootCAs field. +func (b *TLSClientConfigApplyConfiguration) WithRootCAs(values ...*RootCAApplyConfiguration) *TLSClientConfigApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithRootCAs") + } + b.RootCAs = append(b.RootCAs, *values[i]) + } + return b +} + +// WithRootCAsSecrets adds the given value to the RootCAsSecrets field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the RootCAsSecrets field. +func (b *TLSClientConfigApplyConfiguration) WithRootCAsSecrets(values ...string) *TLSClientConfigApplyConfiguration { + for i := range values { + b.RootCAsSecrets = append(b.RootCAsSecrets, values[i]) + } + return b +} + +// WithCertificatesSecrets adds the given value to the CertificatesSecrets field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CertificatesSecrets field. +func (b *TLSClientConfigApplyConfiguration) WithCertificatesSecrets(values ...string) *TLSClientConfigApplyConfiguration { + for i := range values { + b.CertificatesSecrets = append(b.CertificatesSecrets, values[i]) + } + return b +} + +// WithPeerCertURI sets the PeerCertURI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PeerCertURI field is set to the value of the last call. +func (b *TLSClientConfigApplyConfiguration) WithPeerCertURI(value string) *TLSClientConfigApplyConfiguration { + b.PeerCertURI = &value + return b +} + +// WithSpiffe sets the Spiffe field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spiffe field is set to the value of the last call. +func (b *TLSClientConfigApplyConfiguration) WithSpiffe(value dynamic.Spiffe) *TLSClientConfigApplyConfiguration { + b.Spiffe = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoption.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoption.go new file mode 100644 index 000000000..e391978ec --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoption.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TLSOptionApplyConfiguration represents a declarative configuration of the TLSOption type for use +// with apply. +type TLSOptionApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *TLSOptionSpecApplyConfiguration `json:"spec,omitempty"` +} + +// TLSOption constructs a declarative configuration of the TLSOption type for use with +// apply. +func TLSOption(name, namespace string) *TLSOptionApplyConfiguration { + b := &TLSOptionApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("TLSOption") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b TLSOptionApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithKind(value string) *TLSOptionApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithAPIVersion(value string) *TLSOptionApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithName(value string) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithGenerateName(value string) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithNamespace(value string) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithUID(value types.UID) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithResourceVersion(value string) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithGeneration(value int64) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TLSOptionApplyConfiguration) WithLabels(entries map[string]string) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TLSOptionApplyConfiguration) WithAnnotations(entries map[string]string) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *TLSOptionApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *TLSOptionApplyConfiguration) WithFinalizers(values ...string) *TLSOptionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *TLSOptionApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *TLSOptionApplyConfiguration) WithSpec(value *TLSOptionSpecApplyConfiguration) *TLSOptionApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *TLSOptionApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *TLSOptionApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TLSOptionApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *TLSOptionApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoptionref.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoptionref.go new file mode 100644 index 000000000..a3abfd27a --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoptionref.go @@ -0,0 +1,56 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// TLSOptionRefApplyConfiguration represents a declarative configuration of the TLSOptionRef type for use +// with apply. +type TLSOptionRefApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// TLSOptionRefApplyConfiguration constructs a declarative configuration of the TLSOptionRef type for use with +// apply. +func TLSOptionRef() *TLSOptionRefApplyConfiguration { + return &TLSOptionRefApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TLSOptionRefApplyConfiguration) WithName(value string) *TLSOptionRefApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TLSOptionRefApplyConfiguration) WithNamespace(value string) *TLSOptionRefApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoptionspec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoptionspec.go new file mode 100644 index 000000000..adf256b6e --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsoptionspec.go @@ -0,0 +1,125 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// TLSOptionSpecApplyConfiguration represents a declarative configuration of the TLSOptionSpec type for use +// with apply. +type TLSOptionSpecApplyConfiguration struct { + MinVersion *string `json:"minVersion,omitempty"` + MaxVersion *string `json:"maxVersion,omitempty"` + CipherSuites []string `json:"cipherSuites,omitempty"` + CurvePreferences []string `json:"curvePreferences,omitempty"` + ClientAuth *ClientAuthApplyConfiguration `json:"clientAuth,omitempty"` + SniStrict *bool `json:"sniStrict,omitempty"` + ALPNProtocols []string `json:"alpnProtocols,omitempty"` + DisableSessionTickets *bool `json:"disableSessionTickets,omitempty"` + PreferServerCipherSuites *bool `json:"preferServerCipherSuites,omitempty"` +} + +// TLSOptionSpecApplyConfiguration constructs a declarative configuration of the TLSOptionSpec type for use with +// apply. +func TLSOptionSpec() *TLSOptionSpecApplyConfiguration { + return &TLSOptionSpecApplyConfiguration{} +} + +// WithMinVersion sets the MinVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinVersion field is set to the value of the last call. +func (b *TLSOptionSpecApplyConfiguration) WithMinVersion(value string) *TLSOptionSpecApplyConfiguration { + b.MinVersion = &value + return b +} + +// WithMaxVersion sets the MaxVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxVersion field is set to the value of the last call. +func (b *TLSOptionSpecApplyConfiguration) WithMaxVersion(value string) *TLSOptionSpecApplyConfiguration { + b.MaxVersion = &value + return b +} + +// WithCipherSuites adds the given value to the CipherSuites field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CipherSuites field. +func (b *TLSOptionSpecApplyConfiguration) WithCipherSuites(values ...string) *TLSOptionSpecApplyConfiguration { + for i := range values { + b.CipherSuites = append(b.CipherSuites, values[i]) + } + return b +} + +// WithCurvePreferences adds the given value to the CurvePreferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CurvePreferences field. +func (b *TLSOptionSpecApplyConfiguration) WithCurvePreferences(values ...string) *TLSOptionSpecApplyConfiguration { + for i := range values { + b.CurvePreferences = append(b.CurvePreferences, values[i]) + } + return b +} + +// WithClientAuth sets the ClientAuth field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClientAuth field is set to the value of the last call. +func (b *TLSOptionSpecApplyConfiguration) WithClientAuth(value *ClientAuthApplyConfiguration) *TLSOptionSpecApplyConfiguration { + b.ClientAuth = value + return b +} + +// WithSniStrict sets the SniStrict field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SniStrict field is set to the value of the last call. +func (b *TLSOptionSpecApplyConfiguration) WithSniStrict(value bool) *TLSOptionSpecApplyConfiguration { + b.SniStrict = &value + return b +} + +// WithALPNProtocols adds the given value to the ALPNProtocols field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ALPNProtocols field. +func (b *TLSOptionSpecApplyConfiguration) WithALPNProtocols(values ...string) *TLSOptionSpecApplyConfiguration { + for i := range values { + b.ALPNProtocols = append(b.ALPNProtocols, values[i]) + } + return b +} + +// WithDisableSessionTickets sets the DisableSessionTickets field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DisableSessionTickets field is set to the value of the last call. +func (b *TLSOptionSpecApplyConfiguration) WithDisableSessionTickets(value bool) *TLSOptionSpecApplyConfiguration { + b.DisableSessionTickets = &value + return b +} + +// WithPreferServerCipherSuites sets the PreferServerCipherSuites field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreferServerCipherSuites field is set to the value of the last call. +func (b *TLSOptionSpecApplyConfiguration) WithPreferServerCipherSuites(value bool) *TLSOptionSpecApplyConfiguration { + b.PreferServerCipherSuites = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstore.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstore.go new file mode 100644 index 000000000..1f0a2858d --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstore.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TLSStoreApplyConfiguration represents a declarative configuration of the TLSStore type for use +// with apply. +type TLSStoreApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *TLSStoreSpecApplyConfiguration `json:"spec,omitempty"` +} + +// TLSStore constructs a declarative configuration of the TLSStore type for use with +// apply. +func TLSStore(name, namespace string) *TLSStoreApplyConfiguration { + b := &TLSStoreApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("TLSStore") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b TLSStoreApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithKind(value string) *TLSStoreApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithAPIVersion(value string) *TLSStoreApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithName(value string) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithGenerateName(value string) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithNamespace(value string) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithUID(value types.UID) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithResourceVersion(value string) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithGeneration(value int64) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TLSStoreApplyConfiguration) WithLabels(entries map[string]string) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TLSStoreApplyConfiguration) WithAnnotations(entries map[string]string) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *TLSStoreApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *TLSStoreApplyConfiguration) WithFinalizers(values ...string) *TLSStoreApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *TLSStoreApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *TLSStoreApplyConfiguration) WithSpec(value *TLSStoreSpecApplyConfiguration) *TLSStoreApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *TLSStoreApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *TLSStoreApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TLSStoreApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *TLSStoreApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstoreref.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstoreref.go new file mode 100644 index 000000000..ac89490c8 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstoreref.go @@ -0,0 +1,56 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// TLSStoreRefApplyConfiguration represents a declarative configuration of the TLSStoreRef type for use +// with apply. +type TLSStoreRefApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Namespace *string `json:"namespace,omitempty"` +} + +// TLSStoreRefApplyConfiguration constructs a declarative configuration of the TLSStoreRef type for use with +// apply. +func TLSStoreRef() *TLSStoreRefApplyConfiguration { + return &TLSStoreRefApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TLSStoreRefApplyConfiguration) WithName(value string) *TLSStoreRefApplyConfiguration { + b.Name = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TLSStoreRefApplyConfiguration) WithNamespace(value string) *TLSStoreRefApplyConfiguration { + b.Namespace = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstorespec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstorespec.go new file mode 100644 index 000000000..344ef8104 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlsstorespec.go @@ -0,0 +1,74 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + tls "github.com/traefik/traefik/v3/pkg/tls" +) + +// TLSStoreSpecApplyConfiguration represents a declarative configuration of the TLSStoreSpec type for use +// with apply. +type TLSStoreSpecApplyConfiguration struct { + DefaultCertificate *CertificateApplyConfiguration `json:"defaultCertificate,omitempty"` + DefaultGeneratedCert *tls.GeneratedCert `json:"defaultGeneratedCert,omitempty"` + Certificates []CertificateApplyConfiguration `json:"certificates,omitempty"` +} + +// TLSStoreSpecApplyConfiguration constructs a declarative configuration of the TLSStoreSpec type for use with +// apply. +func TLSStoreSpec() *TLSStoreSpecApplyConfiguration { + return &TLSStoreSpecApplyConfiguration{} +} + +// WithDefaultCertificate sets the DefaultCertificate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefaultCertificate field is set to the value of the last call. +func (b *TLSStoreSpecApplyConfiguration) WithDefaultCertificate(value *CertificateApplyConfiguration) *TLSStoreSpecApplyConfiguration { + b.DefaultCertificate = value + return b +} + +// WithDefaultGeneratedCert sets the DefaultGeneratedCert field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefaultGeneratedCert field is set to the value of the last call. +func (b *TLSStoreSpecApplyConfiguration) WithDefaultGeneratedCert(value tls.GeneratedCert) *TLSStoreSpecApplyConfiguration { + b.DefaultGeneratedCert = &value + return b +} + +// WithCertificates adds the given value to the Certificates field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Certificates field. +func (b *TLSStoreSpecApplyConfiguration) WithCertificates(values ...*CertificateApplyConfiguration) *TLSStoreSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithCertificates") + } + b.Certificates = append(b.Certificates, *values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlstcp.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlstcp.go new file mode 100644 index 000000000..8728fbd2a --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/tlstcp.go @@ -0,0 +1,98 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + types "github.com/traefik/traefik/v3/pkg/types" +) + +// TLSTCPApplyConfiguration represents a declarative configuration of the TLSTCP type for use +// with apply. +type TLSTCPApplyConfiguration struct { + SecretName *string `json:"secretName,omitempty"` + Passthrough *bool `json:"passthrough,omitempty"` + Options *ObjectReferenceApplyConfiguration `json:"options,omitempty"` + Store *ObjectReferenceApplyConfiguration `json:"store,omitempty"` + CertResolver *string `json:"certResolver,omitempty"` + Domains []types.Domain `json:"domains,omitempty"` +} + +// TLSTCPApplyConfiguration constructs a declarative configuration of the TLSTCP type for use with +// apply. +func TLSTCP() *TLSTCPApplyConfiguration { + return &TLSTCPApplyConfiguration{} +} + +// WithSecretName sets the SecretName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretName field is set to the value of the last call. +func (b *TLSTCPApplyConfiguration) WithSecretName(value string) *TLSTCPApplyConfiguration { + b.SecretName = &value + return b +} + +// WithPassthrough sets the Passthrough field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Passthrough field is set to the value of the last call. +func (b *TLSTCPApplyConfiguration) WithPassthrough(value bool) *TLSTCPApplyConfiguration { + b.Passthrough = &value + return b +} + +// WithOptions sets the Options field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Options field is set to the value of the last call. +func (b *TLSTCPApplyConfiguration) WithOptions(value *ObjectReferenceApplyConfiguration) *TLSTCPApplyConfiguration { + b.Options = value + return b +} + +// WithStore sets the Store field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Store field is set to the value of the last call. +func (b *TLSTCPApplyConfiguration) WithStore(value *ObjectReferenceApplyConfiguration) *TLSTCPApplyConfiguration { + b.Store = value + return b +} + +// WithCertResolver sets the CertResolver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CertResolver field is set to the value of the last call. +func (b *TLSTCPApplyConfiguration) WithCertResolver(value string) *TLSTCPApplyConfiguration { + b.CertResolver = &value + return b +} + +// WithDomains adds the given value to the Domains field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Domains field. +func (b *TLSTCPApplyConfiguration) WithDomains(values ...types.Domain) *TLSTCPApplyConfiguration { + for i := range values { + b.Domains = append(b.Domains, values[i]) + } + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/traefikservice.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/traefikservice.go new file mode 100644 index 000000000..908418aae --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/traefikservice.go @@ -0,0 +1,241 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// TraefikServiceApplyConfiguration represents a declarative configuration of the TraefikService type for use +// with apply. +type TraefikServiceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *TraefikServiceSpecApplyConfiguration `json:"spec,omitempty"` +} + +// TraefikService constructs a declarative configuration of the TraefikService type for use with +// apply. +func TraefikService(name, namespace string) *TraefikServiceApplyConfiguration { + b := &TraefikServiceApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("TraefikService") + b.WithAPIVersion("traefik.io/v1alpha1") + return b +} +func (b TraefikServiceApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithKind(value string) *TraefikServiceApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithAPIVersion(value string) *TraefikServiceApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithName(value string) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithGenerateName(value string) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithNamespace(value string) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithUID(value types.UID) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithResourceVersion(value string) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithGeneration(value int64) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *TraefikServiceApplyConfiguration) WithLabels(entries map[string]string) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *TraefikServiceApplyConfiguration) WithAnnotations(entries map[string]string) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *TraefikServiceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *TraefikServiceApplyConfiguration) WithFinalizers(values ...string) *TraefikServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *TraefikServiceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *TraefikServiceApplyConfiguration) WithSpec(value *TraefikServiceSpecApplyConfiguration) *TraefikServiceApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *TraefikServiceApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *TraefikServiceApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TraefikServiceApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *TraefikServiceApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/traefikservicespec.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/traefikservicespec.go new file mode 100644 index 000000000..7ddaac9e6 --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/traefikservicespec.go @@ -0,0 +1,65 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// TraefikServiceSpecApplyConfiguration represents a declarative configuration of the TraefikServiceSpec type for use +// with apply. +type TraefikServiceSpecApplyConfiguration struct { + Weighted *WeightedRoundRobinApplyConfiguration `json:"weighted,omitempty"` + Mirroring *MirroringApplyConfiguration `json:"mirroring,omitempty"` + HighestRandomWeight *HighestRandomWeightApplyConfiguration `json:"highestRandomWeight,omitempty"` +} + +// TraefikServiceSpecApplyConfiguration constructs a declarative configuration of the TraefikServiceSpec type for use with +// apply. +func TraefikServiceSpec() *TraefikServiceSpecApplyConfiguration { + return &TraefikServiceSpecApplyConfiguration{} +} + +// WithWeighted sets the Weighted field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Weighted field is set to the value of the last call. +func (b *TraefikServiceSpecApplyConfiguration) WithWeighted(value *WeightedRoundRobinApplyConfiguration) *TraefikServiceSpecApplyConfiguration { + b.Weighted = value + return b +} + +// WithMirroring sets the Mirroring field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Mirroring field is set to the value of the last call. +func (b *TraefikServiceSpecApplyConfiguration) WithMirroring(value *MirroringApplyConfiguration) *TraefikServiceSpecApplyConfiguration { + b.Mirroring = value + return b +} + +// WithHighestRandomWeight sets the HighestRandomWeight field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HighestRandomWeight field is set to the value of the last call. +func (b *TraefikServiceSpecApplyConfiguration) WithHighestRandomWeight(value *HighestRandomWeightApplyConfiguration) *TraefikServiceSpecApplyConfiguration { + b.HighestRandomWeight = value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/weightedroundrobin.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/weightedroundrobin.go new file mode 100644 index 000000000..691e9d09e --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1/weightedroundrobin.go @@ -0,0 +1,65 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + dynamic "github.com/traefik/traefik/v3/pkg/config/dynamic" +) + +// WeightedRoundRobinApplyConfiguration represents a declarative configuration of the WeightedRoundRobin type for use +// with apply. +type WeightedRoundRobinApplyConfiguration struct { + Services []ServiceApplyConfiguration `json:"services,omitempty"` + Sticky *dynamic.Sticky `json:"sticky,omitempty"` +} + +// WeightedRoundRobinApplyConfiguration constructs a declarative configuration of the WeightedRoundRobin type for use with +// apply. +func WeightedRoundRobin() *WeightedRoundRobinApplyConfiguration { + return &WeightedRoundRobinApplyConfiguration{} +} + +// WithServices adds the given value to the Services field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Services field. +func (b *WeightedRoundRobinApplyConfiguration) WithServices(values ...*ServiceApplyConfiguration) *WeightedRoundRobinApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithServices") + } + b.Services = append(b.Services, *values[i]) + } + return b +} + +// WithSticky sets the Sticky field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Sticky field is set to the value of the last call. +func (b *WeightedRoundRobinApplyConfiguration) WithSticky(value dynamic.Sticky) *WeightedRoundRobinApplyConfiguration { + b.Sticky = &value + return b +} diff --git a/pkg/provider/kubernetes/crd/generated/applyconfiguration/utils.go b/pkg/provider/kubernetes/crd/generated/applyconfiguration/utils.go new file mode 100644 index 000000000..aa7141acc --- /dev/null +++ b/pkg/provider/kubernetes/crd/generated/applyconfiguration/utils.go @@ -0,0 +1,166 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016-2020 Containous SAS; 2020-2026 Traefik Labs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package applyconfiguration + +import ( + internal "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/internal" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=traefik.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithKind("BasicAuth"): + return &traefikiov1alpha1.BasicAuthApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Certificate"): + return &traefikiov1alpha1.CertificateApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Chain"): + return &traefikiov1alpha1.ChainApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("CircuitBreaker"): + return &traefikiov1alpha1.CircuitBreakerApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ClientAuth"): + return &traefikiov1alpha1.ClientAuthApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ClientTLS"): + return &traefikiov1alpha1.ClientTLSApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ClientTLSWithCAOptional"): + return &traefikiov1alpha1.ClientTLSWithCAOptionalApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Compress"): + return &traefikiov1alpha1.CompressApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("DigestAuth"): + return &traefikiov1alpha1.DigestAuthApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ErrorPage"): + return &traefikiov1alpha1.ErrorPageApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ForwardAuth"): + return &traefikiov1alpha1.ForwardAuthApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ForwardingTimeouts"): + return &traefikiov1alpha1.ForwardingTimeoutsApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("HighestRandomWeight"): + return &traefikiov1alpha1.HighestRandomWeightApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("IngressRoute"): + return &traefikiov1alpha1.IngressRouteApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("IngressRouteRef"): + return &traefikiov1alpha1.IngressRouteRefApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("IngressRouteSpec"): + return &traefikiov1alpha1.IngressRouteSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("IngressRouteTCP"): + return &traefikiov1alpha1.IngressRouteTCPApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("IngressRouteTCPSpec"): + return &traefikiov1alpha1.IngressRouteTCPSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("IngressRouteUDP"): + return &traefikiov1alpha1.IngressRouteUDPApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("IngressRouteUDPSpec"): + return &traefikiov1alpha1.IngressRouteUDPSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("LoadBalancerSpec"): + return &traefikiov1alpha1.LoadBalancerSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Middleware"): + return &traefikiov1alpha1.MiddlewareApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("MiddlewareRef"): + return &traefikiov1alpha1.MiddlewareRefApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("MiddlewareSpec"): + return &traefikiov1alpha1.MiddlewareSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("MiddlewareTCP"): + return &traefikiov1alpha1.MiddlewareTCPApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("MiddlewareTCPSpec"): + return &traefikiov1alpha1.MiddlewareTCPSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Mirroring"): + return &traefikiov1alpha1.MirroringApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("MirrorService"): + return &traefikiov1alpha1.MirrorServiceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ObjectReference"): + return &traefikiov1alpha1.ObjectReferenceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("PassiveServerHealthCheck"): + return &traefikiov1alpha1.PassiveServerHealthCheckApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("RateLimit"): + return &traefikiov1alpha1.RateLimitApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Redis"): + return &traefikiov1alpha1.RedisApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ResponseForwarding"): + return &traefikiov1alpha1.ResponseForwardingApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Retry"): + return &traefikiov1alpha1.RetryApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("RootCA"): + return &traefikiov1alpha1.RootCAApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Route"): + return &traefikiov1alpha1.RouteApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("RouteTCP"): + return &traefikiov1alpha1.RouteTCPApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("RouteUDP"): + return &traefikiov1alpha1.RouteUDPApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ServerHealthCheck"): + return &traefikiov1alpha1.ServerHealthCheckApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ServersTransport"): + return &traefikiov1alpha1.ServersTransportApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ServersTransportSpec"): + return &traefikiov1alpha1.ServersTransportSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ServersTransportTCP"): + return &traefikiov1alpha1.ServersTransportTCPApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ServersTransportTCPSpec"): + return &traefikiov1alpha1.ServersTransportTCPSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Service"): + return &traefikiov1alpha1.ServiceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ServiceTCP"): + return &traefikiov1alpha1.ServiceTCPApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("ServiceUDP"): + return &traefikiov1alpha1.ServiceUDPApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TLS"): + return &traefikiov1alpha1.TLSApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TLSClientConfig"): + return &traefikiov1alpha1.TLSClientConfigApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TLSOption"): + return &traefikiov1alpha1.TLSOptionApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TLSOptionRef"): + return &traefikiov1alpha1.TLSOptionRefApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TLSOptionSpec"): + return &traefikiov1alpha1.TLSOptionSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TLSStore"): + return &traefikiov1alpha1.TLSStoreApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TLSStoreRef"): + return &traefikiov1alpha1.TLSStoreRefApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TLSStoreSpec"): + return &traefikiov1alpha1.TLSStoreSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TLSTCP"): + return &traefikiov1alpha1.TLSTCPApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TraefikService"): + return &traefikiov1alpha1.TraefikServiceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("TraefikServiceSpec"): + return &traefikiov1alpha1.TraefikServiceSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("WeightedRoundRobin"): + return &traefikiov1alpha1.WeightedRoundRobinApplyConfiguration{} + + } + return nil +} + +func NewTypeConverter(scheme *runtime.Scheme) managedfields.TypeConverter { + return managedfields.NewSchemeTypeConverter(scheme, internal.Parser()) +} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/clientset.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/clientset.go index 5e5b5cfef..e99337aba 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/clientset.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/clientset.go @@ -27,8 +27,8 @@ THE SOFTWARE. package versioned import ( - "fmt" - "net/http" + fmt "fmt" + http "net/http" traefikv1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" discovery "k8s.io/client-go/discovery" diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/fake/clientset_generated.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/fake/clientset_generated.go index 6409b98ed..b8091758d 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/fake/clientset_generated.go @@ -27,9 +27,11 @@ THE SOFTWARE. package fake import ( + applyconfiguration "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration" clientset "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" traefikv1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" faketraefikv1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -39,8 +41,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { @@ -53,9 +59,13 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset { cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} cs.AddReactor("*", "*", testing.ObjectReaction(o)) cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + var opts metav1.ListOptions + if watchActcion, ok := action.(testing.WatchActionImpl); ok { + opts = watchActcion.ListOptions + } gvr := action.GetResource() ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) + watch, err := o.Watch(gvr, ns, opts) if err != nil { return false, nil, err } @@ -82,6 +92,42 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } +// NewClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewClientset(objects ...runtime.Object) *Clientset { + o := testing.NewFieldManagedObjectTracker( + scheme, + codecs.UniversalDecoder(), + applyconfiguration.NewTypeConverter(scheme), + ) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + var opts metav1.ListOptions + if watchAction, ok := action.(testing.WatchActionImpl); ok { + opts = watchAction.ListOptions + } + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns, opts) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + var ( _ clientset.Interface = &Clientset{} _ testing.FakeClient = &Clientset{} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressroute.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressroute.go index 333e57787..7d23ec9fd 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressroute.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressroute.go @@ -27,111 +27,35 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeIngressRoutes implements IngressRouteInterface -type FakeIngressRoutes struct { +// fakeIngressRoutes implements IngressRouteInterface +type fakeIngressRoutes struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.IngressRoute, *v1alpha1.IngressRouteList, *traefikiov1alpha1.IngressRouteApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var ingressroutesResource = v1alpha1.SchemeGroupVersion.WithResource("ingressroutes") - -var ingressroutesKind = v1alpha1.SchemeGroupVersion.WithKind("IngressRoute") - -// Get takes name of the ingressRoute, and returns the corresponding ingressRoute object, and an error if there is any. -func (c *FakeIngressRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IngressRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ingressroutesResource, c.ns, name), &v1alpha1.IngressRoute{}) - - if obj == nil { - return nil, err +func newFakeIngressRoutes(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.IngressRouteInterface { + return &fakeIngressRoutes{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.IngressRoute, *v1alpha1.IngressRouteList, *traefikiov1alpha1.IngressRouteApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("ingressroutes"), + v1alpha1.SchemeGroupVersion.WithKind("IngressRoute"), + func() *v1alpha1.IngressRoute { return &v1alpha1.IngressRoute{} }, + func() *v1alpha1.IngressRouteList { return &v1alpha1.IngressRouteList{} }, + func(dst, src *v1alpha1.IngressRouteList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.IngressRouteList) []*v1alpha1.IngressRoute { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.IngressRouteList, items []*v1alpha1.IngressRoute) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.IngressRoute), err -} - -// List takes label and field selectors, and returns the list of IngressRoutes that match those selectors. -func (c *FakeIngressRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IngressRouteList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ingressroutesResource, ingressroutesKind, c.ns, opts), &v1alpha1.IngressRouteList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.IngressRouteList{ListMeta: obj.(*v1alpha1.IngressRouteList).ListMeta} - for _, item := range obj.(*v1alpha1.IngressRouteList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ingressRoutes. -func (c *FakeIngressRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ingressroutesResource, c.ns, opts)) - -} - -// Create takes the representation of a ingressRoute and creates it. Returns the server's representation of the ingressRoute, and an error, if there is any. -func (c *FakeIngressRoutes) Create(ctx context.Context, ingressRoute *v1alpha1.IngressRoute, opts v1.CreateOptions) (result *v1alpha1.IngressRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ingressroutesResource, c.ns, ingressRoute), &v1alpha1.IngressRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IngressRoute), err -} - -// Update takes the representation of a ingressRoute and updates it. Returns the server's representation of the ingressRoute, and an error, if there is any. -func (c *FakeIngressRoutes) Update(ctx context.Context, ingressRoute *v1alpha1.IngressRoute, opts v1.UpdateOptions) (result *v1alpha1.IngressRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ingressroutesResource, c.ns, ingressRoute), &v1alpha1.IngressRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IngressRoute), err -} - -// Delete takes name of the ingressRoute and deletes it. Returns an error if one occurs. -func (c *FakeIngressRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ingressroutesResource, c.ns, name, opts), &v1alpha1.IngressRoute{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIngressRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ingressroutesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.IngressRouteList{}) - return err -} - -// Patch applies the patch and returns the patched ingressRoute. -func (c *FakeIngressRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IngressRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ingressroutesResource, c.ns, name, pt, data, subresources...), &v1alpha1.IngressRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IngressRoute), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressroutetcp.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressroutetcp.go index 78ab016ab..5b8e0fdd4 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressroutetcp.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressroutetcp.go @@ -27,111 +27,35 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeIngressRouteTCPs implements IngressRouteTCPInterface -type FakeIngressRouteTCPs struct { +// fakeIngressRouteTCPs implements IngressRouteTCPInterface +type fakeIngressRouteTCPs struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.IngressRouteTCP, *v1alpha1.IngressRouteTCPList, *traefikiov1alpha1.IngressRouteTCPApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var ingressroutetcpsResource = v1alpha1.SchemeGroupVersion.WithResource("ingressroutetcps") - -var ingressroutetcpsKind = v1alpha1.SchemeGroupVersion.WithKind("IngressRouteTCP") - -// Get takes name of the ingressRouteTCP, and returns the corresponding ingressRouteTCP object, and an error if there is any. -func (c *FakeIngressRouteTCPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IngressRouteTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ingressroutetcpsResource, c.ns, name), &v1alpha1.IngressRouteTCP{}) - - if obj == nil { - return nil, err +func newFakeIngressRouteTCPs(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.IngressRouteTCPInterface { + return &fakeIngressRouteTCPs{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.IngressRouteTCP, *v1alpha1.IngressRouteTCPList, *traefikiov1alpha1.IngressRouteTCPApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("ingressroutetcps"), + v1alpha1.SchemeGroupVersion.WithKind("IngressRouteTCP"), + func() *v1alpha1.IngressRouteTCP { return &v1alpha1.IngressRouteTCP{} }, + func() *v1alpha1.IngressRouteTCPList { return &v1alpha1.IngressRouteTCPList{} }, + func(dst, src *v1alpha1.IngressRouteTCPList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.IngressRouteTCPList) []*v1alpha1.IngressRouteTCP { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.IngressRouteTCPList, items []*v1alpha1.IngressRouteTCP) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.IngressRouteTCP), err -} - -// List takes label and field selectors, and returns the list of IngressRouteTCPs that match those selectors. -func (c *FakeIngressRouteTCPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IngressRouteTCPList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ingressroutetcpsResource, ingressroutetcpsKind, c.ns, opts), &v1alpha1.IngressRouteTCPList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.IngressRouteTCPList{ListMeta: obj.(*v1alpha1.IngressRouteTCPList).ListMeta} - for _, item := range obj.(*v1alpha1.IngressRouteTCPList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ingressRouteTCPs. -func (c *FakeIngressRouteTCPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ingressroutetcpsResource, c.ns, opts)) - -} - -// Create takes the representation of a ingressRouteTCP and creates it. Returns the server's representation of the ingressRouteTCP, and an error, if there is any. -func (c *FakeIngressRouteTCPs) Create(ctx context.Context, ingressRouteTCP *v1alpha1.IngressRouteTCP, opts v1.CreateOptions) (result *v1alpha1.IngressRouteTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ingressroutetcpsResource, c.ns, ingressRouteTCP), &v1alpha1.IngressRouteTCP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IngressRouteTCP), err -} - -// Update takes the representation of a ingressRouteTCP and updates it. Returns the server's representation of the ingressRouteTCP, and an error, if there is any. -func (c *FakeIngressRouteTCPs) Update(ctx context.Context, ingressRouteTCP *v1alpha1.IngressRouteTCP, opts v1.UpdateOptions) (result *v1alpha1.IngressRouteTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ingressroutetcpsResource, c.ns, ingressRouteTCP), &v1alpha1.IngressRouteTCP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IngressRouteTCP), err -} - -// Delete takes name of the ingressRouteTCP and deletes it. Returns an error if one occurs. -func (c *FakeIngressRouteTCPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ingressroutetcpsResource, c.ns, name, opts), &v1alpha1.IngressRouteTCP{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIngressRouteTCPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ingressroutetcpsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.IngressRouteTCPList{}) - return err -} - -// Patch applies the patch and returns the patched ingressRouteTCP. -func (c *FakeIngressRouteTCPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IngressRouteTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ingressroutetcpsResource, c.ns, name, pt, data, subresources...), &v1alpha1.IngressRouteTCP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IngressRouteTCP), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressrouteudp.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressrouteudp.go index b602f294d..1523cce6a 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressrouteudp.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_ingressrouteudp.go @@ -27,111 +27,35 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeIngressRouteUDPs implements IngressRouteUDPInterface -type FakeIngressRouteUDPs struct { +// fakeIngressRouteUDPs implements IngressRouteUDPInterface +type fakeIngressRouteUDPs struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.IngressRouteUDP, *v1alpha1.IngressRouteUDPList, *traefikiov1alpha1.IngressRouteUDPApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var ingressrouteudpsResource = v1alpha1.SchemeGroupVersion.WithResource("ingressrouteudps") - -var ingressrouteudpsKind = v1alpha1.SchemeGroupVersion.WithKind("IngressRouteUDP") - -// Get takes name of the ingressRouteUDP, and returns the corresponding ingressRouteUDP object, and an error if there is any. -func (c *FakeIngressRouteUDPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IngressRouteUDP, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(ingressrouteudpsResource, c.ns, name), &v1alpha1.IngressRouteUDP{}) - - if obj == nil { - return nil, err +func newFakeIngressRouteUDPs(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.IngressRouteUDPInterface { + return &fakeIngressRouteUDPs{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.IngressRouteUDP, *v1alpha1.IngressRouteUDPList, *traefikiov1alpha1.IngressRouteUDPApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("ingressrouteudps"), + v1alpha1.SchemeGroupVersion.WithKind("IngressRouteUDP"), + func() *v1alpha1.IngressRouteUDP { return &v1alpha1.IngressRouteUDP{} }, + func() *v1alpha1.IngressRouteUDPList { return &v1alpha1.IngressRouteUDPList{} }, + func(dst, src *v1alpha1.IngressRouteUDPList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.IngressRouteUDPList) []*v1alpha1.IngressRouteUDP { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.IngressRouteUDPList, items []*v1alpha1.IngressRouteUDP) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.IngressRouteUDP), err -} - -// List takes label and field selectors, and returns the list of IngressRouteUDPs that match those selectors. -func (c *FakeIngressRouteUDPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IngressRouteUDPList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(ingressrouteudpsResource, ingressrouteudpsKind, c.ns, opts), &v1alpha1.IngressRouteUDPList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.IngressRouteUDPList{ListMeta: obj.(*v1alpha1.IngressRouteUDPList).ListMeta} - for _, item := range obj.(*v1alpha1.IngressRouteUDPList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested ingressRouteUDPs. -func (c *FakeIngressRouteUDPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(ingressrouteudpsResource, c.ns, opts)) - -} - -// Create takes the representation of a ingressRouteUDP and creates it. Returns the server's representation of the ingressRouteUDP, and an error, if there is any. -func (c *FakeIngressRouteUDPs) Create(ctx context.Context, ingressRouteUDP *v1alpha1.IngressRouteUDP, opts v1.CreateOptions) (result *v1alpha1.IngressRouteUDP, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(ingressrouteudpsResource, c.ns, ingressRouteUDP), &v1alpha1.IngressRouteUDP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IngressRouteUDP), err -} - -// Update takes the representation of a ingressRouteUDP and updates it. Returns the server's representation of the ingressRouteUDP, and an error, if there is any. -func (c *FakeIngressRouteUDPs) Update(ctx context.Context, ingressRouteUDP *v1alpha1.IngressRouteUDP, opts v1.UpdateOptions) (result *v1alpha1.IngressRouteUDP, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(ingressrouteudpsResource, c.ns, ingressRouteUDP), &v1alpha1.IngressRouteUDP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IngressRouteUDP), err -} - -// Delete takes name of the ingressRouteUDP and deletes it. Returns an error if one occurs. -func (c *FakeIngressRouteUDPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(ingressrouteudpsResource, c.ns, name, opts), &v1alpha1.IngressRouteUDP{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeIngressRouteUDPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(ingressrouteudpsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.IngressRouteUDPList{}) - return err -} - -// Patch applies the patch and returns the patched ingressRouteUDP. -func (c *FakeIngressRouteUDPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IngressRouteUDP, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(ingressrouteudpsResource, c.ns, name, pt, data, subresources...), &v1alpha1.IngressRouteUDP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.IngressRouteUDP), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_middleware.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_middleware.go index b8aa7fb76..2d336991a 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_middleware.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_middleware.go @@ -27,111 +27,33 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeMiddlewares implements MiddlewareInterface -type FakeMiddlewares struct { +// fakeMiddlewares implements MiddlewareInterface +type fakeMiddlewares struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.Middleware, *v1alpha1.MiddlewareList, *traefikiov1alpha1.MiddlewareApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var middlewaresResource = v1alpha1.SchemeGroupVersion.WithResource("middlewares") - -var middlewaresKind = v1alpha1.SchemeGroupVersion.WithKind("Middleware") - -// Get takes name of the middleware, and returns the corresponding middleware object, and an error if there is any. -func (c *FakeMiddlewares) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Middleware, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(middlewaresResource, c.ns, name), &v1alpha1.Middleware{}) - - if obj == nil { - return nil, err +func newFakeMiddlewares(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.MiddlewareInterface { + return &fakeMiddlewares{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.Middleware, *v1alpha1.MiddlewareList, *traefikiov1alpha1.MiddlewareApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("middlewares"), + v1alpha1.SchemeGroupVersion.WithKind("Middleware"), + func() *v1alpha1.Middleware { return &v1alpha1.Middleware{} }, + func() *v1alpha1.MiddlewareList { return &v1alpha1.MiddlewareList{} }, + func(dst, src *v1alpha1.MiddlewareList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.MiddlewareList) []*v1alpha1.Middleware { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha1.MiddlewareList, items []*v1alpha1.Middleware) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.Middleware), err -} - -// List takes label and field selectors, and returns the list of Middlewares that match those selectors. -func (c *FakeMiddlewares) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MiddlewareList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(middlewaresResource, middlewaresKind, c.ns, opts), &v1alpha1.MiddlewareList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.MiddlewareList{ListMeta: obj.(*v1alpha1.MiddlewareList).ListMeta} - for _, item := range obj.(*v1alpha1.MiddlewareList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested middlewares. -func (c *FakeMiddlewares) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(middlewaresResource, c.ns, opts)) - -} - -// Create takes the representation of a middleware and creates it. Returns the server's representation of the middleware, and an error, if there is any. -func (c *FakeMiddlewares) Create(ctx context.Context, middleware *v1alpha1.Middleware, opts v1.CreateOptions) (result *v1alpha1.Middleware, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(middlewaresResource, c.ns, middleware), &v1alpha1.Middleware{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Middleware), err -} - -// Update takes the representation of a middleware and updates it. Returns the server's representation of the middleware, and an error, if there is any. -func (c *FakeMiddlewares) Update(ctx context.Context, middleware *v1alpha1.Middleware, opts v1.UpdateOptions) (result *v1alpha1.Middleware, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(middlewaresResource, c.ns, middleware), &v1alpha1.Middleware{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Middleware), err -} - -// Delete takes name of the middleware and deletes it. Returns an error if one occurs. -func (c *FakeMiddlewares) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(middlewaresResource, c.ns, name, opts), &v1alpha1.Middleware{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeMiddlewares) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(middlewaresResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.MiddlewareList{}) - return err -} - -// Patch applies the patch and returns the patched middleware. -func (c *FakeMiddlewares) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Middleware, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(middlewaresResource, c.ns, name, pt, data, subresources...), &v1alpha1.Middleware{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Middleware), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_middlewaretcp.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_middlewaretcp.go index 0852700df..db27a281d 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_middlewaretcp.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_middlewaretcp.go @@ -27,111 +27,35 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeMiddlewareTCPs implements MiddlewareTCPInterface -type FakeMiddlewareTCPs struct { +// fakeMiddlewareTCPs implements MiddlewareTCPInterface +type fakeMiddlewareTCPs struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.MiddlewareTCP, *v1alpha1.MiddlewareTCPList, *traefikiov1alpha1.MiddlewareTCPApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var middlewaretcpsResource = v1alpha1.SchemeGroupVersion.WithResource("middlewaretcps") - -var middlewaretcpsKind = v1alpha1.SchemeGroupVersion.WithKind("MiddlewareTCP") - -// Get takes name of the middlewareTCP, and returns the corresponding middlewareTCP object, and an error if there is any. -func (c *FakeMiddlewareTCPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MiddlewareTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(middlewaretcpsResource, c.ns, name), &v1alpha1.MiddlewareTCP{}) - - if obj == nil { - return nil, err +func newFakeMiddlewareTCPs(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.MiddlewareTCPInterface { + return &fakeMiddlewareTCPs{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.MiddlewareTCP, *v1alpha1.MiddlewareTCPList, *traefikiov1alpha1.MiddlewareTCPApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("middlewaretcps"), + v1alpha1.SchemeGroupVersion.WithKind("MiddlewareTCP"), + func() *v1alpha1.MiddlewareTCP { return &v1alpha1.MiddlewareTCP{} }, + func() *v1alpha1.MiddlewareTCPList { return &v1alpha1.MiddlewareTCPList{} }, + func(dst, src *v1alpha1.MiddlewareTCPList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.MiddlewareTCPList) []*v1alpha1.MiddlewareTCP { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.MiddlewareTCPList, items []*v1alpha1.MiddlewareTCP) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.MiddlewareTCP), err -} - -// List takes label and field selectors, and returns the list of MiddlewareTCPs that match those selectors. -func (c *FakeMiddlewareTCPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MiddlewareTCPList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(middlewaretcpsResource, middlewaretcpsKind, c.ns, opts), &v1alpha1.MiddlewareTCPList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.MiddlewareTCPList{ListMeta: obj.(*v1alpha1.MiddlewareTCPList).ListMeta} - for _, item := range obj.(*v1alpha1.MiddlewareTCPList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested middlewareTCPs. -func (c *FakeMiddlewareTCPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(middlewaretcpsResource, c.ns, opts)) - -} - -// Create takes the representation of a middlewareTCP and creates it. Returns the server's representation of the middlewareTCP, and an error, if there is any. -func (c *FakeMiddlewareTCPs) Create(ctx context.Context, middlewareTCP *v1alpha1.MiddlewareTCP, opts v1.CreateOptions) (result *v1alpha1.MiddlewareTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(middlewaretcpsResource, c.ns, middlewareTCP), &v1alpha1.MiddlewareTCP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MiddlewareTCP), err -} - -// Update takes the representation of a middlewareTCP and updates it. Returns the server's representation of the middlewareTCP, and an error, if there is any. -func (c *FakeMiddlewareTCPs) Update(ctx context.Context, middlewareTCP *v1alpha1.MiddlewareTCP, opts v1.UpdateOptions) (result *v1alpha1.MiddlewareTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(middlewaretcpsResource, c.ns, middlewareTCP), &v1alpha1.MiddlewareTCP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MiddlewareTCP), err -} - -// Delete takes name of the middlewareTCP and deletes it. Returns an error if one occurs. -func (c *FakeMiddlewareTCPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(middlewaretcpsResource, c.ns, name, opts), &v1alpha1.MiddlewareTCP{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeMiddlewareTCPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(middlewaretcpsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.MiddlewareTCPList{}) - return err -} - -// Patch applies the patch and returns the patched middlewareTCP. -func (c *FakeMiddlewareTCPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MiddlewareTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(middlewaretcpsResource, c.ns, name, pt, data, subresources...), &v1alpha1.MiddlewareTCP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MiddlewareTCP), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_serverstransport.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_serverstransport.go index e32b23321..85719e75e 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_serverstransport.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_serverstransport.go @@ -27,111 +27,35 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeServersTransports implements ServersTransportInterface -type FakeServersTransports struct { +// fakeServersTransports implements ServersTransportInterface +type fakeServersTransports struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.ServersTransport, *v1alpha1.ServersTransportList, *traefikiov1alpha1.ServersTransportApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var serverstransportsResource = v1alpha1.SchemeGroupVersion.WithResource("serverstransports") - -var serverstransportsKind = v1alpha1.SchemeGroupVersion.WithKind("ServersTransport") - -// Get takes name of the serversTransport, and returns the corresponding serversTransport object, and an error if there is any. -func (c *FakeServersTransports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ServersTransport, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(serverstransportsResource, c.ns, name), &v1alpha1.ServersTransport{}) - - if obj == nil { - return nil, err +func newFakeServersTransports(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.ServersTransportInterface { + return &fakeServersTransports{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.ServersTransport, *v1alpha1.ServersTransportList, *traefikiov1alpha1.ServersTransportApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("serverstransports"), + v1alpha1.SchemeGroupVersion.WithKind("ServersTransport"), + func() *v1alpha1.ServersTransport { return &v1alpha1.ServersTransport{} }, + func() *v1alpha1.ServersTransportList { return &v1alpha1.ServersTransportList{} }, + func(dst, src *v1alpha1.ServersTransportList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.ServersTransportList) []*v1alpha1.ServersTransport { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.ServersTransportList, items []*v1alpha1.ServersTransport) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.ServersTransport), err -} - -// List takes label and field selectors, and returns the list of ServersTransports that match those selectors. -func (c *FakeServersTransports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ServersTransportList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(serverstransportsResource, serverstransportsKind, c.ns, opts), &v1alpha1.ServersTransportList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.ServersTransportList{ListMeta: obj.(*v1alpha1.ServersTransportList).ListMeta} - for _, item := range obj.(*v1alpha1.ServersTransportList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested serversTransports. -func (c *FakeServersTransports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(serverstransportsResource, c.ns, opts)) - -} - -// Create takes the representation of a serversTransport and creates it. Returns the server's representation of the serversTransport, and an error, if there is any. -func (c *FakeServersTransports) Create(ctx context.Context, serversTransport *v1alpha1.ServersTransport, opts v1.CreateOptions) (result *v1alpha1.ServersTransport, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(serverstransportsResource, c.ns, serversTransport), &v1alpha1.ServersTransport{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ServersTransport), err -} - -// Update takes the representation of a serversTransport and updates it. Returns the server's representation of the serversTransport, and an error, if there is any. -func (c *FakeServersTransports) Update(ctx context.Context, serversTransport *v1alpha1.ServersTransport, opts v1.UpdateOptions) (result *v1alpha1.ServersTransport, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(serverstransportsResource, c.ns, serversTransport), &v1alpha1.ServersTransport{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ServersTransport), err -} - -// Delete takes name of the serversTransport and deletes it. Returns an error if one occurs. -func (c *FakeServersTransports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(serverstransportsResource, c.ns, name, opts), &v1alpha1.ServersTransport{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeServersTransports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(serverstransportsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.ServersTransportList{}) - return err -} - -// Patch applies the patch and returns the patched serversTransport. -func (c *FakeServersTransports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServersTransport, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(serverstransportsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ServersTransport{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ServersTransport), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_serverstransporttcp.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_serverstransporttcp.go index 46092fad2..484fcb03e 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_serverstransporttcp.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_serverstransporttcp.go @@ -27,111 +27,35 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeServersTransportTCPs implements ServersTransportTCPInterface -type FakeServersTransportTCPs struct { +// fakeServersTransportTCPs implements ServersTransportTCPInterface +type fakeServersTransportTCPs struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.ServersTransportTCP, *v1alpha1.ServersTransportTCPList, *traefikiov1alpha1.ServersTransportTCPApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var serverstransporttcpsResource = v1alpha1.SchemeGroupVersion.WithResource("serverstransporttcps") - -var serverstransporttcpsKind = v1alpha1.SchemeGroupVersion.WithKind("ServersTransportTCP") - -// Get takes name of the serversTransportTCP, and returns the corresponding serversTransportTCP object, and an error if there is any. -func (c *FakeServersTransportTCPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ServersTransportTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(serverstransporttcpsResource, c.ns, name), &v1alpha1.ServersTransportTCP{}) - - if obj == nil { - return nil, err +func newFakeServersTransportTCPs(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.ServersTransportTCPInterface { + return &fakeServersTransportTCPs{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.ServersTransportTCP, *v1alpha1.ServersTransportTCPList, *traefikiov1alpha1.ServersTransportTCPApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("serverstransporttcps"), + v1alpha1.SchemeGroupVersion.WithKind("ServersTransportTCP"), + func() *v1alpha1.ServersTransportTCP { return &v1alpha1.ServersTransportTCP{} }, + func() *v1alpha1.ServersTransportTCPList { return &v1alpha1.ServersTransportTCPList{} }, + func(dst, src *v1alpha1.ServersTransportTCPList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.ServersTransportTCPList) []*v1alpha1.ServersTransportTCP { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.ServersTransportTCPList, items []*v1alpha1.ServersTransportTCP) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.ServersTransportTCP), err -} - -// List takes label and field selectors, and returns the list of ServersTransportTCPs that match those selectors. -func (c *FakeServersTransportTCPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ServersTransportTCPList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(serverstransporttcpsResource, serverstransporttcpsKind, c.ns, opts), &v1alpha1.ServersTransportTCPList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.ServersTransportTCPList{ListMeta: obj.(*v1alpha1.ServersTransportTCPList).ListMeta} - for _, item := range obj.(*v1alpha1.ServersTransportTCPList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested serversTransportTCPs. -func (c *FakeServersTransportTCPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(serverstransporttcpsResource, c.ns, opts)) - -} - -// Create takes the representation of a serversTransportTCP and creates it. Returns the server's representation of the serversTransportTCP, and an error, if there is any. -func (c *FakeServersTransportTCPs) Create(ctx context.Context, serversTransportTCP *v1alpha1.ServersTransportTCP, opts v1.CreateOptions) (result *v1alpha1.ServersTransportTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(serverstransporttcpsResource, c.ns, serversTransportTCP), &v1alpha1.ServersTransportTCP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ServersTransportTCP), err -} - -// Update takes the representation of a serversTransportTCP and updates it. Returns the server's representation of the serversTransportTCP, and an error, if there is any. -func (c *FakeServersTransportTCPs) Update(ctx context.Context, serversTransportTCP *v1alpha1.ServersTransportTCP, opts v1.UpdateOptions) (result *v1alpha1.ServersTransportTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(serverstransporttcpsResource, c.ns, serversTransportTCP), &v1alpha1.ServersTransportTCP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ServersTransportTCP), err -} - -// Delete takes name of the serversTransportTCP and deletes it. Returns an error if one occurs. -func (c *FakeServersTransportTCPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(serverstransporttcpsResource, c.ns, name, opts), &v1alpha1.ServersTransportTCP{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeServersTransportTCPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(serverstransporttcpsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.ServersTransportTCPList{}) - return err -} - -// Patch applies the patch and returns the patched serversTransportTCP. -func (c *FakeServersTransportTCPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServersTransportTCP, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(serverstransporttcpsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ServersTransportTCP{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.ServersTransportTCP), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_tlsoption.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_tlsoption.go index a12a3f15c..0bef0dde5 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_tlsoption.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_tlsoption.go @@ -27,111 +27,33 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeTLSOptions implements TLSOptionInterface -type FakeTLSOptions struct { +// fakeTLSOptions implements TLSOptionInterface +type fakeTLSOptions struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.TLSOption, *v1alpha1.TLSOptionList, *traefikiov1alpha1.TLSOptionApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var tlsoptionsResource = v1alpha1.SchemeGroupVersion.WithResource("tlsoptions") - -var tlsoptionsKind = v1alpha1.SchemeGroupVersion.WithKind("TLSOption") - -// Get takes name of the tLSOption, and returns the corresponding tLSOption object, and an error if there is any. -func (c *FakeTLSOptions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TLSOption, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(tlsoptionsResource, c.ns, name), &v1alpha1.TLSOption{}) - - if obj == nil { - return nil, err +func newFakeTLSOptions(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.TLSOptionInterface { + return &fakeTLSOptions{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.TLSOption, *v1alpha1.TLSOptionList, *traefikiov1alpha1.TLSOptionApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("tlsoptions"), + v1alpha1.SchemeGroupVersion.WithKind("TLSOption"), + func() *v1alpha1.TLSOption { return &v1alpha1.TLSOption{} }, + func() *v1alpha1.TLSOptionList { return &v1alpha1.TLSOptionList{} }, + func(dst, src *v1alpha1.TLSOptionList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.TLSOptionList) []*v1alpha1.TLSOption { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha1.TLSOptionList, items []*v1alpha1.TLSOption) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.TLSOption), err -} - -// List takes label and field selectors, and returns the list of TLSOptions that match those selectors. -func (c *FakeTLSOptions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TLSOptionList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(tlsoptionsResource, tlsoptionsKind, c.ns, opts), &v1alpha1.TLSOptionList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.TLSOptionList{ListMeta: obj.(*v1alpha1.TLSOptionList).ListMeta} - for _, item := range obj.(*v1alpha1.TLSOptionList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested tLSOptions. -func (c *FakeTLSOptions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(tlsoptionsResource, c.ns, opts)) - -} - -// Create takes the representation of a tLSOption and creates it. Returns the server's representation of the tLSOption, and an error, if there is any. -func (c *FakeTLSOptions) Create(ctx context.Context, tLSOption *v1alpha1.TLSOption, opts v1.CreateOptions) (result *v1alpha1.TLSOption, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(tlsoptionsResource, c.ns, tLSOption), &v1alpha1.TLSOption{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TLSOption), err -} - -// Update takes the representation of a tLSOption and updates it. Returns the server's representation of the tLSOption, and an error, if there is any. -func (c *FakeTLSOptions) Update(ctx context.Context, tLSOption *v1alpha1.TLSOption, opts v1.UpdateOptions) (result *v1alpha1.TLSOption, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(tlsoptionsResource, c.ns, tLSOption), &v1alpha1.TLSOption{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TLSOption), err -} - -// Delete takes name of the tLSOption and deletes it. Returns an error if one occurs. -func (c *FakeTLSOptions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(tlsoptionsResource, c.ns, name, opts), &v1alpha1.TLSOption{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeTLSOptions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(tlsoptionsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.TLSOptionList{}) - return err -} - -// Patch applies the patch and returns the patched tLSOption. -func (c *FakeTLSOptions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TLSOption, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tlsoptionsResource, c.ns, name, pt, data, subresources...), &v1alpha1.TLSOption{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TLSOption), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_tlsstore.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_tlsstore.go index 986ebccc9..55abfda0d 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_tlsstore.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_tlsstore.go @@ -27,111 +27,33 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeTLSStores implements TLSStoreInterface -type FakeTLSStores struct { +// fakeTLSStores implements TLSStoreInterface +type fakeTLSStores struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.TLSStore, *v1alpha1.TLSStoreList, *traefikiov1alpha1.TLSStoreApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var tlsstoresResource = v1alpha1.SchemeGroupVersion.WithResource("tlsstores") - -var tlsstoresKind = v1alpha1.SchemeGroupVersion.WithKind("TLSStore") - -// Get takes name of the tLSStore, and returns the corresponding tLSStore object, and an error if there is any. -func (c *FakeTLSStores) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TLSStore, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(tlsstoresResource, c.ns, name), &v1alpha1.TLSStore{}) - - if obj == nil { - return nil, err +func newFakeTLSStores(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.TLSStoreInterface { + return &fakeTLSStores{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.TLSStore, *v1alpha1.TLSStoreList, *traefikiov1alpha1.TLSStoreApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("tlsstores"), + v1alpha1.SchemeGroupVersion.WithKind("TLSStore"), + func() *v1alpha1.TLSStore { return &v1alpha1.TLSStore{} }, + func() *v1alpha1.TLSStoreList { return &v1alpha1.TLSStoreList{} }, + func(dst, src *v1alpha1.TLSStoreList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.TLSStoreList) []*v1alpha1.TLSStore { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha1.TLSStoreList, items []*v1alpha1.TLSStore) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.TLSStore), err -} - -// List takes label and field selectors, and returns the list of TLSStores that match those selectors. -func (c *FakeTLSStores) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TLSStoreList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(tlsstoresResource, tlsstoresKind, c.ns, opts), &v1alpha1.TLSStoreList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.TLSStoreList{ListMeta: obj.(*v1alpha1.TLSStoreList).ListMeta} - for _, item := range obj.(*v1alpha1.TLSStoreList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested tLSStores. -func (c *FakeTLSStores) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(tlsstoresResource, c.ns, opts)) - -} - -// Create takes the representation of a tLSStore and creates it. Returns the server's representation of the tLSStore, and an error, if there is any. -func (c *FakeTLSStores) Create(ctx context.Context, tLSStore *v1alpha1.TLSStore, opts v1.CreateOptions) (result *v1alpha1.TLSStore, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(tlsstoresResource, c.ns, tLSStore), &v1alpha1.TLSStore{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TLSStore), err -} - -// Update takes the representation of a tLSStore and updates it. Returns the server's representation of the tLSStore, and an error, if there is any. -func (c *FakeTLSStores) Update(ctx context.Context, tLSStore *v1alpha1.TLSStore, opts v1.UpdateOptions) (result *v1alpha1.TLSStore, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(tlsstoresResource, c.ns, tLSStore), &v1alpha1.TLSStore{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TLSStore), err -} - -// Delete takes name of the tLSStore and deletes it. Returns an error if one occurs. -func (c *FakeTLSStores) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(tlsstoresResource, c.ns, name, opts), &v1alpha1.TLSStore{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeTLSStores) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(tlsstoresResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.TLSStoreList{}) - return err -} - -// Patch applies the patch and returns the patched tLSStore. -func (c *FakeTLSStores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TLSStore, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tlsstoresResource, c.ns, name, pt, data, subresources...), &v1alpha1.TLSStore{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TLSStore), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_traefikio_client.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_traefikio_client.go index 32c9b1f03..fa3eab775 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_traefikio_client.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_traefikio_client.go @@ -37,43 +37,43 @@ type FakeTraefikV1alpha1 struct { } func (c *FakeTraefikV1alpha1) IngressRoutes(namespace string) v1alpha1.IngressRouteInterface { - return &FakeIngressRoutes{c, namespace} + return newFakeIngressRoutes(c, namespace) } func (c *FakeTraefikV1alpha1) IngressRouteTCPs(namespace string) v1alpha1.IngressRouteTCPInterface { - return &FakeIngressRouteTCPs{c, namespace} + return newFakeIngressRouteTCPs(c, namespace) } func (c *FakeTraefikV1alpha1) IngressRouteUDPs(namespace string) v1alpha1.IngressRouteUDPInterface { - return &FakeIngressRouteUDPs{c, namespace} + return newFakeIngressRouteUDPs(c, namespace) } func (c *FakeTraefikV1alpha1) Middlewares(namespace string) v1alpha1.MiddlewareInterface { - return &FakeMiddlewares{c, namespace} + return newFakeMiddlewares(c, namespace) } func (c *FakeTraefikV1alpha1) MiddlewareTCPs(namespace string) v1alpha1.MiddlewareTCPInterface { - return &FakeMiddlewareTCPs{c, namespace} + return newFakeMiddlewareTCPs(c, namespace) } func (c *FakeTraefikV1alpha1) ServersTransports(namespace string) v1alpha1.ServersTransportInterface { - return &FakeServersTransports{c, namespace} + return newFakeServersTransports(c, namespace) } func (c *FakeTraefikV1alpha1) ServersTransportTCPs(namespace string) v1alpha1.ServersTransportTCPInterface { - return &FakeServersTransportTCPs{c, namespace} + return newFakeServersTransportTCPs(c, namespace) } func (c *FakeTraefikV1alpha1) TLSOptions(namespace string) v1alpha1.TLSOptionInterface { - return &FakeTLSOptions{c, namespace} + return newFakeTLSOptions(c, namespace) } func (c *FakeTraefikV1alpha1) TLSStores(namespace string) v1alpha1.TLSStoreInterface { - return &FakeTLSStores{c, namespace} + return newFakeTLSStores(c, namespace) } func (c *FakeTraefikV1alpha1) TraefikServices(namespace string) v1alpha1.TraefikServiceInterface { - return &FakeTraefikServices{c, namespace} + return newFakeTraefikServices(c, namespace) } // RESTClient returns a RESTClient that is used to communicate diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_traefikservice.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_traefikservice.go index e0acdb5a3..d9afee423 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_traefikservice.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/fake/fake_traefikservice.go @@ -27,111 +27,35 @@ THE SOFTWARE. package fake import ( - "context" - + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" + typedtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" + gentype "k8s.io/client-go/gentype" ) -// FakeTraefikServices implements TraefikServiceInterface -type FakeTraefikServices struct { +// fakeTraefikServices implements TraefikServiceInterface +type fakeTraefikServices struct { + *gentype.FakeClientWithListAndApply[*v1alpha1.TraefikService, *v1alpha1.TraefikServiceList, *traefikiov1alpha1.TraefikServiceApplyConfiguration] Fake *FakeTraefikV1alpha1 - ns string } -var traefikservicesResource = v1alpha1.SchemeGroupVersion.WithResource("traefikservices") - -var traefikservicesKind = v1alpha1.SchemeGroupVersion.WithKind("TraefikService") - -// Get takes name of the traefikService, and returns the corresponding traefikService object, and an error if there is any. -func (c *FakeTraefikServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TraefikService, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(traefikservicesResource, c.ns, name), &v1alpha1.TraefikService{}) - - if obj == nil { - return nil, err +func newFakeTraefikServices(fake *FakeTraefikV1alpha1, namespace string) typedtraefikiov1alpha1.TraefikServiceInterface { + return &fakeTraefikServices{ + gentype.NewFakeClientWithListAndApply[*v1alpha1.TraefikService, *v1alpha1.TraefikServiceList, *traefikiov1alpha1.TraefikServiceApplyConfiguration]( + fake.Fake, + namespace, + v1alpha1.SchemeGroupVersion.WithResource("traefikservices"), + v1alpha1.SchemeGroupVersion.WithKind("TraefikService"), + func() *v1alpha1.TraefikService { return &v1alpha1.TraefikService{} }, + func() *v1alpha1.TraefikServiceList { return &v1alpha1.TraefikServiceList{} }, + func(dst, src *v1alpha1.TraefikServiceList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.TraefikServiceList) []*v1alpha1.TraefikService { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.TraefikServiceList, items []*v1alpha1.TraefikService) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, } - return obj.(*v1alpha1.TraefikService), err -} - -// List takes label and field selectors, and returns the list of TraefikServices that match those selectors. -func (c *FakeTraefikServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TraefikServiceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(traefikservicesResource, traefikservicesKind, c.ns, opts), &v1alpha1.TraefikServiceList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.TraefikServiceList{ListMeta: obj.(*v1alpha1.TraefikServiceList).ListMeta} - for _, item := range obj.(*v1alpha1.TraefikServiceList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested traefikServices. -func (c *FakeTraefikServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(traefikservicesResource, c.ns, opts)) - -} - -// Create takes the representation of a traefikService and creates it. Returns the server's representation of the traefikService, and an error, if there is any. -func (c *FakeTraefikServices) Create(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.CreateOptions) (result *v1alpha1.TraefikService, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(traefikservicesResource, c.ns, traefikService), &v1alpha1.TraefikService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TraefikService), err -} - -// Update takes the representation of a traefikService and updates it. Returns the server's representation of the traefikService, and an error, if there is any. -func (c *FakeTraefikServices) Update(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.UpdateOptions) (result *v1alpha1.TraefikService, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(traefikservicesResource, c.ns, traefikService), &v1alpha1.TraefikService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TraefikService), err -} - -// Delete takes name of the traefikService and deletes it. Returns an error if one occurs. -func (c *FakeTraefikServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(traefikservicesResource, c.ns, name, opts), &v1alpha1.TraefikService{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeTraefikServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(traefikservicesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.TraefikServiceList{}) - return err -} - -// Patch applies the patch and returns the patched traefikService. -func (c *FakeTraefikServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TraefikService, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(traefikservicesResource, c.ns, name, pt, data, subresources...), &v1alpha1.TraefikService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.TraefikService), err } diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressroute.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressroute.go index e51dab316..66cd158a0 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressroute.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressroute.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // IngressRoutesGetter has a method to return a IngressRouteInterface. @@ -46,141 +46,33 @@ type IngressRoutesGetter interface { // IngressRouteInterface has methods to work with IngressRoute resources. type IngressRouteInterface interface { - Create(ctx context.Context, ingressRoute *v1alpha1.IngressRoute, opts v1.CreateOptions) (*v1alpha1.IngressRoute, error) - Update(ctx context.Context, ingressRoute *v1alpha1.IngressRoute, opts v1.UpdateOptions) (*v1alpha1.IngressRoute, error) + Create(ctx context.Context, ingressRoute *traefikiov1alpha1.IngressRoute, opts v1.CreateOptions) (*traefikiov1alpha1.IngressRoute, error) + Update(ctx context.Context, ingressRoute *traefikiov1alpha1.IngressRoute, opts v1.UpdateOptions) (*traefikiov1alpha1.IngressRoute, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IngressRoute, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IngressRouteList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.IngressRoute, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.IngressRouteList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IngressRoute, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.IngressRoute, err error) + Apply(ctx context.Context, ingressRoute *applyconfigurationtraefikiov1alpha1.IngressRouteApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.IngressRoute, err error) IngressRouteExpansion } // ingressRoutes implements IngressRouteInterface type ingressRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.IngressRoute, *traefikiov1alpha1.IngressRouteList, *applyconfigurationtraefikiov1alpha1.IngressRouteApplyConfiguration] } // newIngressRoutes returns a IngressRoutes func newIngressRoutes(c *TraefikV1alpha1Client, namespace string) *ingressRoutes { return &ingressRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.IngressRoute, *traefikiov1alpha1.IngressRouteList, *applyconfigurationtraefikiov1alpha1.IngressRouteApplyConfiguration]( + "ingressroutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.IngressRoute { return &traefikiov1alpha1.IngressRoute{} }, + func() *traefikiov1alpha1.IngressRouteList { return &traefikiov1alpha1.IngressRouteList{} }, + ), } } - -// Get takes name of the ingressRoute, and returns the corresponding ingressRoute object, and an error if there is any. -func (c *ingressRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IngressRoute, err error) { - result = &v1alpha1.IngressRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ingressroutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IngressRoutes that match those selectors. -func (c *ingressRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IngressRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.IngressRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ingressroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ingressRoutes. -func (c *ingressRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ingressroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ingressRoute and creates it. Returns the server's representation of the ingressRoute, and an error, if there is any. -func (c *ingressRoutes) Create(ctx context.Context, ingressRoute *v1alpha1.IngressRoute, opts v1.CreateOptions) (result *v1alpha1.IngressRoute, err error) { - result = &v1alpha1.IngressRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ingressroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ingressRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ingressRoute and updates it. Returns the server's representation of the ingressRoute, and an error, if there is any. -func (c *ingressRoutes) Update(ctx context.Context, ingressRoute *v1alpha1.IngressRoute, opts v1.UpdateOptions) (result *v1alpha1.IngressRoute, err error) { - result = &v1alpha1.IngressRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ingressroutes"). - Name(ingressRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ingressRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ingressRoute and deletes it. Returns an error if one occurs. -func (c *ingressRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ingressroutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ingressRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ingressroutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ingressRoute. -func (c *ingressRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IngressRoute, err error) { - result = &v1alpha1.IngressRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ingressroutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressroutetcp.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressroutetcp.go index 8fc3e186a..7449553cc 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressroutetcp.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressroutetcp.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // IngressRouteTCPsGetter has a method to return a IngressRouteTCPInterface. @@ -46,141 +46,33 @@ type IngressRouteTCPsGetter interface { // IngressRouteTCPInterface has methods to work with IngressRouteTCP resources. type IngressRouteTCPInterface interface { - Create(ctx context.Context, ingressRouteTCP *v1alpha1.IngressRouteTCP, opts v1.CreateOptions) (*v1alpha1.IngressRouteTCP, error) - Update(ctx context.Context, ingressRouteTCP *v1alpha1.IngressRouteTCP, opts v1.UpdateOptions) (*v1alpha1.IngressRouteTCP, error) + Create(ctx context.Context, ingressRouteTCP *traefikiov1alpha1.IngressRouteTCP, opts v1.CreateOptions) (*traefikiov1alpha1.IngressRouteTCP, error) + Update(ctx context.Context, ingressRouteTCP *traefikiov1alpha1.IngressRouteTCP, opts v1.UpdateOptions) (*traefikiov1alpha1.IngressRouteTCP, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IngressRouteTCP, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IngressRouteTCPList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.IngressRouteTCP, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.IngressRouteTCPList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IngressRouteTCP, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.IngressRouteTCP, err error) + Apply(ctx context.Context, ingressRouteTCP *applyconfigurationtraefikiov1alpha1.IngressRouteTCPApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.IngressRouteTCP, err error) IngressRouteTCPExpansion } // ingressRouteTCPs implements IngressRouteTCPInterface type ingressRouteTCPs struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.IngressRouteTCP, *traefikiov1alpha1.IngressRouteTCPList, *applyconfigurationtraefikiov1alpha1.IngressRouteTCPApplyConfiguration] } // newIngressRouteTCPs returns a IngressRouteTCPs func newIngressRouteTCPs(c *TraefikV1alpha1Client, namespace string) *ingressRouteTCPs { return &ingressRouteTCPs{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.IngressRouteTCP, *traefikiov1alpha1.IngressRouteTCPList, *applyconfigurationtraefikiov1alpha1.IngressRouteTCPApplyConfiguration]( + "ingressroutetcps", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.IngressRouteTCP { return &traefikiov1alpha1.IngressRouteTCP{} }, + func() *traefikiov1alpha1.IngressRouteTCPList { return &traefikiov1alpha1.IngressRouteTCPList{} }, + ), } } - -// Get takes name of the ingressRouteTCP, and returns the corresponding ingressRouteTCP object, and an error if there is any. -func (c *ingressRouteTCPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IngressRouteTCP, err error) { - result = &v1alpha1.IngressRouteTCP{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ingressroutetcps"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IngressRouteTCPs that match those selectors. -func (c *ingressRouteTCPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IngressRouteTCPList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.IngressRouteTCPList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ingressroutetcps"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ingressRouteTCPs. -func (c *ingressRouteTCPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ingressroutetcps"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ingressRouteTCP and creates it. Returns the server's representation of the ingressRouteTCP, and an error, if there is any. -func (c *ingressRouteTCPs) Create(ctx context.Context, ingressRouteTCP *v1alpha1.IngressRouteTCP, opts v1.CreateOptions) (result *v1alpha1.IngressRouteTCP, err error) { - result = &v1alpha1.IngressRouteTCP{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ingressroutetcps"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ingressRouteTCP). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ingressRouteTCP and updates it. Returns the server's representation of the ingressRouteTCP, and an error, if there is any. -func (c *ingressRouteTCPs) Update(ctx context.Context, ingressRouteTCP *v1alpha1.IngressRouteTCP, opts v1.UpdateOptions) (result *v1alpha1.IngressRouteTCP, err error) { - result = &v1alpha1.IngressRouteTCP{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ingressroutetcps"). - Name(ingressRouteTCP.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ingressRouteTCP). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ingressRouteTCP and deletes it. Returns an error if one occurs. -func (c *ingressRouteTCPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ingressroutetcps"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ingressRouteTCPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ingressroutetcps"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ingressRouteTCP. -func (c *ingressRouteTCPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IngressRouteTCP, err error) { - result = &v1alpha1.IngressRouteTCP{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ingressroutetcps"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressrouteudp.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressrouteudp.go index 4d01aa1b5..183791e17 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressrouteudp.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/ingressrouteudp.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // IngressRouteUDPsGetter has a method to return a IngressRouteUDPInterface. @@ -46,141 +46,33 @@ type IngressRouteUDPsGetter interface { // IngressRouteUDPInterface has methods to work with IngressRouteUDP resources. type IngressRouteUDPInterface interface { - Create(ctx context.Context, ingressRouteUDP *v1alpha1.IngressRouteUDP, opts v1.CreateOptions) (*v1alpha1.IngressRouteUDP, error) - Update(ctx context.Context, ingressRouteUDP *v1alpha1.IngressRouteUDP, opts v1.UpdateOptions) (*v1alpha1.IngressRouteUDP, error) + Create(ctx context.Context, ingressRouteUDP *traefikiov1alpha1.IngressRouteUDP, opts v1.CreateOptions) (*traefikiov1alpha1.IngressRouteUDP, error) + Update(ctx context.Context, ingressRouteUDP *traefikiov1alpha1.IngressRouteUDP, opts v1.UpdateOptions) (*traefikiov1alpha1.IngressRouteUDP, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.IngressRouteUDP, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.IngressRouteUDPList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.IngressRouteUDP, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.IngressRouteUDPList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IngressRouteUDP, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.IngressRouteUDP, err error) + Apply(ctx context.Context, ingressRouteUDP *applyconfigurationtraefikiov1alpha1.IngressRouteUDPApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.IngressRouteUDP, err error) IngressRouteUDPExpansion } // ingressRouteUDPs implements IngressRouteUDPInterface type ingressRouteUDPs struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.IngressRouteUDP, *traefikiov1alpha1.IngressRouteUDPList, *applyconfigurationtraefikiov1alpha1.IngressRouteUDPApplyConfiguration] } // newIngressRouteUDPs returns a IngressRouteUDPs func newIngressRouteUDPs(c *TraefikV1alpha1Client, namespace string) *ingressRouteUDPs { return &ingressRouteUDPs{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.IngressRouteUDP, *traefikiov1alpha1.IngressRouteUDPList, *applyconfigurationtraefikiov1alpha1.IngressRouteUDPApplyConfiguration]( + "ingressrouteudps", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.IngressRouteUDP { return &traefikiov1alpha1.IngressRouteUDP{} }, + func() *traefikiov1alpha1.IngressRouteUDPList { return &traefikiov1alpha1.IngressRouteUDPList{} }, + ), } } - -// Get takes name of the ingressRouteUDP, and returns the corresponding ingressRouteUDP object, and an error if there is any. -func (c *ingressRouteUDPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.IngressRouteUDP, err error) { - result = &v1alpha1.IngressRouteUDP{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ingressrouteudps"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of IngressRouteUDPs that match those selectors. -func (c *ingressRouteUDPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.IngressRouteUDPList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.IngressRouteUDPList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("ingressrouteudps"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested ingressRouteUDPs. -func (c *ingressRouteUDPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("ingressrouteudps"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a ingressRouteUDP and creates it. Returns the server's representation of the ingressRouteUDP, and an error, if there is any. -func (c *ingressRouteUDPs) Create(ctx context.Context, ingressRouteUDP *v1alpha1.IngressRouteUDP, opts v1.CreateOptions) (result *v1alpha1.IngressRouteUDP, err error) { - result = &v1alpha1.IngressRouteUDP{} - err = c.client.Post(). - Namespace(c.ns). - Resource("ingressrouteudps"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ingressRouteUDP). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a ingressRouteUDP and updates it. Returns the server's representation of the ingressRouteUDP, and an error, if there is any. -func (c *ingressRouteUDPs) Update(ctx context.Context, ingressRouteUDP *v1alpha1.IngressRouteUDP, opts v1.UpdateOptions) (result *v1alpha1.IngressRouteUDP, err error) { - result = &v1alpha1.IngressRouteUDP{} - err = c.client.Put(). - Namespace(c.ns). - Resource("ingressrouteudps"). - Name(ingressRouteUDP.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(ingressRouteUDP). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the ingressRouteUDP and deletes it. Returns an error if one occurs. -func (c *ingressRouteUDPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("ingressrouteudps"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *ingressRouteUDPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("ingressrouteudps"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched ingressRouteUDP. -func (c *ingressRouteUDPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.IngressRouteUDP, err error) { - result = &v1alpha1.IngressRouteUDP{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("ingressrouteudps"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/middleware.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/middleware.go index b9df75494..330286151 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/middleware.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/middleware.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // MiddlewaresGetter has a method to return a MiddlewareInterface. @@ -46,141 +46,33 @@ type MiddlewaresGetter interface { // MiddlewareInterface has methods to work with Middleware resources. type MiddlewareInterface interface { - Create(ctx context.Context, middleware *v1alpha1.Middleware, opts v1.CreateOptions) (*v1alpha1.Middleware, error) - Update(ctx context.Context, middleware *v1alpha1.Middleware, opts v1.UpdateOptions) (*v1alpha1.Middleware, error) + Create(ctx context.Context, middleware *traefikiov1alpha1.Middleware, opts v1.CreateOptions) (*traefikiov1alpha1.Middleware, error) + Update(ctx context.Context, middleware *traefikiov1alpha1.Middleware, opts v1.UpdateOptions) (*traefikiov1alpha1.Middleware, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Middleware, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MiddlewareList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.Middleware, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.MiddlewareList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Middleware, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.Middleware, err error) + Apply(ctx context.Context, middleware *applyconfigurationtraefikiov1alpha1.MiddlewareApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.Middleware, err error) MiddlewareExpansion } // middlewares implements MiddlewareInterface type middlewares struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.Middleware, *traefikiov1alpha1.MiddlewareList, *applyconfigurationtraefikiov1alpha1.MiddlewareApplyConfiguration] } // newMiddlewares returns a Middlewares func newMiddlewares(c *TraefikV1alpha1Client, namespace string) *middlewares { return &middlewares{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.Middleware, *traefikiov1alpha1.MiddlewareList, *applyconfigurationtraefikiov1alpha1.MiddlewareApplyConfiguration]( + "middlewares", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.Middleware { return &traefikiov1alpha1.Middleware{} }, + func() *traefikiov1alpha1.MiddlewareList { return &traefikiov1alpha1.MiddlewareList{} }, + ), } } - -// Get takes name of the middleware, and returns the corresponding middleware object, and an error if there is any. -func (c *middlewares) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Middleware, err error) { - result = &v1alpha1.Middleware{} - err = c.client.Get(). - Namespace(c.ns). - Resource("middlewares"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Middlewares that match those selectors. -func (c *middlewares) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MiddlewareList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.MiddlewareList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("middlewares"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested middlewares. -func (c *middlewares) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("middlewares"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a middleware and creates it. Returns the server's representation of the middleware, and an error, if there is any. -func (c *middlewares) Create(ctx context.Context, middleware *v1alpha1.Middleware, opts v1.CreateOptions) (result *v1alpha1.Middleware, err error) { - result = &v1alpha1.Middleware{} - err = c.client.Post(). - Namespace(c.ns). - Resource("middlewares"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(middleware). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a middleware and updates it. Returns the server's representation of the middleware, and an error, if there is any. -func (c *middlewares) Update(ctx context.Context, middleware *v1alpha1.Middleware, opts v1.UpdateOptions) (result *v1alpha1.Middleware, err error) { - result = &v1alpha1.Middleware{} - err = c.client.Put(). - Namespace(c.ns). - Resource("middlewares"). - Name(middleware.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(middleware). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the middleware and deletes it. Returns an error if one occurs. -func (c *middlewares) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("middlewares"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *middlewares) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("middlewares"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched middleware. -func (c *middlewares) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Middleware, err error) { - result = &v1alpha1.Middleware{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("middlewares"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/middlewaretcp.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/middlewaretcp.go index bdd11dd57..534a57ff1 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/middlewaretcp.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/middlewaretcp.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // MiddlewareTCPsGetter has a method to return a MiddlewareTCPInterface. @@ -46,141 +46,33 @@ type MiddlewareTCPsGetter interface { // MiddlewareTCPInterface has methods to work with MiddlewareTCP resources. type MiddlewareTCPInterface interface { - Create(ctx context.Context, middlewareTCP *v1alpha1.MiddlewareTCP, opts v1.CreateOptions) (*v1alpha1.MiddlewareTCP, error) - Update(ctx context.Context, middlewareTCP *v1alpha1.MiddlewareTCP, opts v1.UpdateOptions) (*v1alpha1.MiddlewareTCP, error) + Create(ctx context.Context, middlewareTCP *traefikiov1alpha1.MiddlewareTCP, opts v1.CreateOptions) (*traefikiov1alpha1.MiddlewareTCP, error) + Update(ctx context.Context, middlewareTCP *traefikiov1alpha1.MiddlewareTCP, opts v1.UpdateOptions) (*traefikiov1alpha1.MiddlewareTCP, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.MiddlewareTCP, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MiddlewareTCPList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.MiddlewareTCP, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.MiddlewareTCPList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MiddlewareTCP, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.MiddlewareTCP, err error) + Apply(ctx context.Context, middlewareTCP *applyconfigurationtraefikiov1alpha1.MiddlewareTCPApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.MiddlewareTCP, err error) MiddlewareTCPExpansion } // middlewareTCPs implements MiddlewareTCPInterface type middlewareTCPs struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.MiddlewareTCP, *traefikiov1alpha1.MiddlewareTCPList, *applyconfigurationtraefikiov1alpha1.MiddlewareTCPApplyConfiguration] } // newMiddlewareTCPs returns a MiddlewareTCPs func newMiddlewareTCPs(c *TraefikV1alpha1Client, namespace string) *middlewareTCPs { return &middlewareTCPs{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.MiddlewareTCP, *traefikiov1alpha1.MiddlewareTCPList, *applyconfigurationtraefikiov1alpha1.MiddlewareTCPApplyConfiguration]( + "middlewaretcps", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.MiddlewareTCP { return &traefikiov1alpha1.MiddlewareTCP{} }, + func() *traefikiov1alpha1.MiddlewareTCPList { return &traefikiov1alpha1.MiddlewareTCPList{} }, + ), } } - -// Get takes name of the middlewareTCP, and returns the corresponding middlewareTCP object, and an error if there is any. -func (c *middlewareTCPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MiddlewareTCP, err error) { - result = &v1alpha1.MiddlewareTCP{} - err = c.client.Get(). - Namespace(c.ns). - Resource("middlewaretcps"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of MiddlewareTCPs that match those selectors. -func (c *middlewareTCPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MiddlewareTCPList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.MiddlewareTCPList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("middlewaretcps"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested middlewareTCPs. -func (c *middlewareTCPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("middlewaretcps"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a middlewareTCP and creates it. Returns the server's representation of the middlewareTCP, and an error, if there is any. -func (c *middlewareTCPs) Create(ctx context.Context, middlewareTCP *v1alpha1.MiddlewareTCP, opts v1.CreateOptions) (result *v1alpha1.MiddlewareTCP, err error) { - result = &v1alpha1.MiddlewareTCP{} - err = c.client.Post(). - Namespace(c.ns). - Resource("middlewaretcps"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(middlewareTCP). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a middlewareTCP and updates it. Returns the server's representation of the middlewareTCP, and an error, if there is any. -func (c *middlewareTCPs) Update(ctx context.Context, middlewareTCP *v1alpha1.MiddlewareTCP, opts v1.UpdateOptions) (result *v1alpha1.MiddlewareTCP, err error) { - result = &v1alpha1.MiddlewareTCP{} - err = c.client.Put(). - Namespace(c.ns). - Resource("middlewaretcps"). - Name(middlewareTCP.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(middlewareTCP). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the middlewareTCP and deletes it. Returns an error if one occurs. -func (c *middlewareTCPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("middlewaretcps"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *middlewareTCPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("middlewaretcps"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched middlewareTCP. -func (c *middlewareTCPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MiddlewareTCP, err error) { - result = &v1alpha1.MiddlewareTCP{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("middlewaretcps"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/serverstransport.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/serverstransport.go index 757f31dbc..187bb801f 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/serverstransport.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/serverstransport.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ServersTransportsGetter has a method to return a ServersTransportInterface. @@ -46,141 +46,33 @@ type ServersTransportsGetter interface { // ServersTransportInterface has methods to work with ServersTransport resources. type ServersTransportInterface interface { - Create(ctx context.Context, serversTransport *v1alpha1.ServersTransport, opts v1.CreateOptions) (*v1alpha1.ServersTransport, error) - Update(ctx context.Context, serversTransport *v1alpha1.ServersTransport, opts v1.UpdateOptions) (*v1alpha1.ServersTransport, error) + Create(ctx context.Context, serversTransport *traefikiov1alpha1.ServersTransport, opts v1.CreateOptions) (*traefikiov1alpha1.ServersTransport, error) + Update(ctx context.Context, serversTransport *traefikiov1alpha1.ServersTransport, opts v1.UpdateOptions) (*traefikiov1alpha1.ServersTransport, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ServersTransport, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ServersTransportList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.ServersTransport, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.ServersTransportList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServersTransport, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.ServersTransport, err error) + Apply(ctx context.Context, serversTransport *applyconfigurationtraefikiov1alpha1.ServersTransportApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.ServersTransport, err error) ServersTransportExpansion } // serversTransports implements ServersTransportInterface type serversTransports struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.ServersTransport, *traefikiov1alpha1.ServersTransportList, *applyconfigurationtraefikiov1alpha1.ServersTransportApplyConfiguration] } // newServersTransports returns a ServersTransports func newServersTransports(c *TraefikV1alpha1Client, namespace string) *serversTransports { return &serversTransports{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.ServersTransport, *traefikiov1alpha1.ServersTransportList, *applyconfigurationtraefikiov1alpha1.ServersTransportApplyConfiguration]( + "serverstransports", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.ServersTransport { return &traefikiov1alpha1.ServersTransport{} }, + func() *traefikiov1alpha1.ServersTransportList { return &traefikiov1alpha1.ServersTransportList{} }, + ), } } - -// Get takes name of the serversTransport, and returns the corresponding serversTransport object, and an error if there is any. -func (c *serversTransports) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ServersTransport, err error) { - result = &v1alpha1.ServersTransport{} - err = c.client.Get(). - Namespace(c.ns). - Resource("serverstransports"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ServersTransports that match those selectors. -func (c *serversTransports) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ServersTransportList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ServersTransportList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("serverstransports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested serversTransports. -func (c *serversTransports) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("serverstransports"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a serversTransport and creates it. Returns the server's representation of the serversTransport, and an error, if there is any. -func (c *serversTransports) Create(ctx context.Context, serversTransport *v1alpha1.ServersTransport, opts v1.CreateOptions) (result *v1alpha1.ServersTransport, err error) { - result = &v1alpha1.ServersTransport{} - err = c.client.Post(). - Namespace(c.ns). - Resource("serverstransports"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serversTransport). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a serversTransport and updates it. Returns the server's representation of the serversTransport, and an error, if there is any. -func (c *serversTransports) Update(ctx context.Context, serversTransport *v1alpha1.ServersTransport, opts v1.UpdateOptions) (result *v1alpha1.ServersTransport, err error) { - result = &v1alpha1.ServersTransport{} - err = c.client.Put(). - Namespace(c.ns). - Resource("serverstransports"). - Name(serversTransport.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serversTransport). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the serversTransport and deletes it. Returns an error if one occurs. -func (c *serversTransports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("serverstransports"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *serversTransports) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("serverstransports"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched serversTransport. -func (c *serversTransports) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServersTransport, err error) { - result = &v1alpha1.ServersTransport{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("serverstransports"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/serverstransporttcp.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/serverstransporttcp.go index 0a4de9945..f9b56fb3a 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/serverstransporttcp.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/serverstransporttcp.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // ServersTransportTCPsGetter has a method to return a ServersTransportTCPInterface. @@ -46,141 +46,33 @@ type ServersTransportTCPsGetter interface { // ServersTransportTCPInterface has methods to work with ServersTransportTCP resources. type ServersTransportTCPInterface interface { - Create(ctx context.Context, serversTransportTCP *v1alpha1.ServersTransportTCP, opts v1.CreateOptions) (*v1alpha1.ServersTransportTCP, error) - Update(ctx context.Context, serversTransportTCP *v1alpha1.ServersTransportTCP, opts v1.UpdateOptions) (*v1alpha1.ServersTransportTCP, error) + Create(ctx context.Context, serversTransportTCP *traefikiov1alpha1.ServersTransportTCP, opts v1.CreateOptions) (*traefikiov1alpha1.ServersTransportTCP, error) + Update(ctx context.Context, serversTransportTCP *traefikiov1alpha1.ServersTransportTCP, opts v1.UpdateOptions) (*traefikiov1alpha1.ServersTransportTCP, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ServersTransportTCP, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ServersTransportTCPList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.ServersTransportTCP, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.ServersTransportTCPList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServersTransportTCP, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.ServersTransportTCP, err error) + Apply(ctx context.Context, serversTransportTCP *applyconfigurationtraefikiov1alpha1.ServersTransportTCPApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.ServersTransportTCP, err error) ServersTransportTCPExpansion } // serversTransportTCPs implements ServersTransportTCPInterface type serversTransportTCPs struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.ServersTransportTCP, *traefikiov1alpha1.ServersTransportTCPList, *applyconfigurationtraefikiov1alpha1.ServersTransportTCPApplyConfiguration] } // newServersTransportTCPs returns a ServersTransportTCPs func newServersTransportTCPs(c *TraefikV1alpha1Client, namespace string) *serversTransportTCPs { return &serversTransportTCPs{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.ServersTransportTCP, *traefikiov1alpha1.ServersTransportTCPList, *applyconfigurationtraefikiov1alpha1.ServersTransportTCPApplyConfiguration]( + "serverstransporttcps", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.ServersTransportTCP { return &traefikiov1alpha1.ServersTransportTCP{} }, + func() *traefikiov1alpha1.ServersTransportTCPList { return &traefikiov1alpha1.ServersTransportTCPList{} }, + ), } } - -// Get takes name of the serversTransportTCP, and returns the corresponding serversTransportTCP object, and an error if there is any. -func (c *serversTransportTCPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ServersTransportTCP, err error) { - result = &v1alpha1.ServersTransportTCP{} - err = c.client.Get(). - Namespace(c.ns). - Resource("serverstransporttcps"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ServersTransportTCPs that match those selectors. -func (c *serversTransportTCPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ServersTransportTCPList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ServersTransportTCPList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("serverstransporttcps"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested serversTransportTCPs. -func (c *serversTransportTCPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("serverstransporttcps"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a serversTransportTCP and creates it. Returns the server's representation of the serversTransportTCP, and an error, if there is any. -func (c *serversTransportTCPs) Create(ctx context.Context, serversTransportTCP *v1alpha1.ServersTransportTCP, opts v1.CreateOptions) (result *v1alpha1.ServersTransportTCP, err error) { - result = &v1alpha1.ServersTransportTCP{} - err = c.client.Post(). - Namespace(c.ns). - Resource("serverstransporttcps"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serversTransportTCP). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a serversTransportTCP and updates it. Returns the server's representation of the serversTransportTCP, and an error, if there is any. -func (c *serversTransportTCPs) Update(ctx context.Context, serversTransportTCP *v1alpha1.ServersTransportTCP, opts v1.UpdateOptions) (result *v1alpha1.ServersTransportTCP, err error) { - result = &v1alpha1.ServersTransportTCP{} - err = c.client.Put(). - Namespace(c.ns). - Resource("serverstransporttcps"). - Name(serversTransportTCP.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(serversTransportTCP). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the serversTransportTCP and deletes it. Returns an error if one occurs. -func (c *serversTransportTCPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("serverstransporttcps"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *serversTransportTCPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("serverstransporttcps"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched serversTransportTCP. -func (c *serversTransportTCPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ServersTransportTCP, err error) { - result = &v1alpha1.ServersTransportTCP{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("serverstransporttcps"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/tlsoption.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/tlsoption.go index 891d64fae..6f7842f53 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/tlsoption.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/tlsoption.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TLSOptionsGetter has a method to return a TLSOptionInterface. @@ -46,141 +46,33 @@ type TLSOptionsGetter interface { // TLSOptionInterface has methods to work with TLSOption resources. type TLSOptionInterface interface { - Create(ctx context.Context, tLSOption *v1alpha1.TLSOption, opts v1.CreateOptions) (*v1alpha1.TLSOption, error) - Update(ctx context.Context, tLSOption *v1alpha1.TLSOption, opts v1.UpdateOptions) (*v1alpha1.TLSOption, error) + Create(ctx context.Context, tLSOption *traefikiov1alpha1.TLSOption, opts v1.CreateOptions) (*traefikiov1alpha1.TLSOption, error) + Update(ctx context.Context, tLSOption *traefikiov1alpha1.TLSOption, opts v1.UpdateOptions) (*traefikiov1alpha1.TLSOption, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TLSOption, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TLSOptionList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.TLSOption, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.TLSOptionList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TLSOption, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.TLSOption, err error) + Apply(ctx context.Context, tLSOption *applyconfigurationtraefikiov1alpha1.TLSOptionApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.TLSOption, err error) TLSOptionExpansion } // tLSOptions implements TLSOptionInterface type tLSOptions struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.TLSOption, *traefikiov1alpha1.TLSOptionList, *applyconfigurationtraefikiov1alpha1.TLSOptionApplyConfiguration] } // newTLSOptions returns a TLSOptions func newTLSOptions(c *TraefikV1alpha1Client, namespace string) *tLSOptions { return &tLSOptions{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.TLSOption, *traefikiov1alpha1.TLSOptionList, *applyconfigurationtraefikiov1alpha1.TLSOptionApplyConfiguration]( + "tlsoptions", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.TLSOption { return &traefikiov1alpha1.TLSOption{} }, + func() *traefikiov1alpha1.TLSOptionList { return &traefikiov1alpha1.TLSOptionList{} }, + ), } } - -// Get takes name of the tLSOption, and returns the corresponding tLSOption object, and an error if there is any. -func (c *tLSOptions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TLSOption, err error) { - result = &v1alpha1.TLSOption{} - err = c.client.Get(). - Namespace(c.ns). - Resource("tlsoptions"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TLSOptions that match those selectors. -func (c *tLSOptions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TLSOptionList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.TLSOptionList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("tlsoptions"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested tLSOptions. -func (c *tLSOptions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("tlsoptions"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a tLSOption and creates it. Returns the server's representation of the tLSOption, and an error, if there is any. -func (c *tLSOptions) Create(ctx context.Context, tLSOption *v1alpha1.TLSOption, opts v1.CreateOptions) (result *v1alpha1.TLSOption, err error) { - result = &v1alpha1.TLSOption{} - err = c.client.Post(). - Namespace(c.ns). - Resource("tlsoptions"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tLSOption). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a tLSOption and updates it. Returns the server's representation of the tLSOption, and an error, if there is any. -func (c *tLSOptions) Update(ctx context.Context, tLSOption *v1alpha1.TLSOption, opts v1.UpdateOptions) (result *v1alpha1.TLSOption, err error) { - result = &v1alpha1.TLSOption{} - err = c.client.Put(). - Namespace(c.ns). - Resource("tlsoptions"). - Name(tLSOption.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tLSOption). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the tLSOption and deletes it. Returns an error if one occurs. -func (c *tLSOptions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("tlsoptions"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *tLSOptions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("tlsoptions"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched tLSOption. -func (c *tLSOptions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TLSOption, err error) { - result = &v1alpha1.TLSOption{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("tlsoptions"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/tlsstore.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/tlsstore.go index e4c7ffa12..de517efdb 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/tlsstore.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/tlsstore.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TLSStoresGetter has a method to return a TLSStoreInterface. @@ -46,141 +46,33 @@ type TLSStoresGetter interface { // TLSStoreInterface has methods to work with TLSStore resources. type TLSStoreInterface interface { - Create(ctx context.Context, tLSStore *v1alpha1.TLSStore, opts v1.CreateOptions) (*v1alpha1.TLSStore, error) - Update(ctx context.Context, tLSStore *v1alpha1.TLSStore, opts v1.UpdateOptions) (*v1alpha1.TLSStore, error) + Create(ctx context.Context, tLSStore *traefikiov1alpha1.TLSStore, opts v1.CreateOptions) (*traefikiov1alpha1.TLSStore, error) + Update(ctx context.Context, tLSStore *traefikiov1alpha1.TLSStore, opts v1.UpdateOptions) (*traefikiov1alpha1.TLSStore, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TLSStore, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TLSStoreList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.TLSStore, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.TLSStoreList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TLSStore, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.TLSStore, err error) + Apply(ctx context.Context, tLSStore *applyconfigurationtraefikiov1alpha1.TLSStoreApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.TLSStore, err error) TLSStoreExpansion } // tLSStores implements TLSStoreInterface type tLSStores struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.TLSStore, *traefikiov1alpha1.TLSStoreList, *applyconfigurationtraefikiov1alpha1.TLSStoreApplyConfiguration] } // newTLSStores returns a TLSStores func newTLSStores(c *TraefikV1alpha1Client, namespace string) *tLSStores { return &tLSStores{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.TLSStore, *traefikiov1alpha1.TLSStoreList, *applyconfigurationtraefikiov1alpha1.TLSStoreApplyConfiguration]( + "tlsstores", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.TLSStore { return &traefikiov1alpha1.TLSStore{} }, + func() *traefikiov1alpha1.TLSStoreList { return &traefikiov1alpha1.TLSStoreList{} }, + ), } } - -// Get takes name of the tLSStore, and returns the corresponding tLSStore object, and an error if there is any. -func (c *tLSStores) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TLSStore, err error) { - result = &v1alpha1.TLSStore{} - err = c.client.Get(). - Namespace(c.ns). - Resource("tlsstores"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TLSStores that match those selectors. -func (c *tLSStores) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TLSStoreList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.TLSStoreList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("tlsstores"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested tLSStores. -func (c *tLSStores) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("tlsstores"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a tLSStore and creates it. Returns the server's representation of the tLSStore, and an error, if there is any. -func (c *tLSStores) Create(ctx context.Context, tLSStore *v1alpha1.TLSStore, opts v1.CreateOptions) (result *v1alpha1.TLSStore, err error) { - result = &v1alpha1.TLSStore{} - err = c.client.Post(). - Namespace(c.ns). - Resource("tlsstores"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tLSStore). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a tLSStore and updates it. Returns the server's representation of the tLSStore, and an error, if there is any. -func (c *tLSStores) Update(ctx context.Context, tLSStore *v1alpha1.TLSStore, opts v1.UpdateOptions) (result *v1alpha1.TLSStore, err error) { - result = &v1alpha1.TLSStore{} - err = c.client.Put(). - Namespace(c.ns). - Resource("tlsstores"). - Name(tLSStore.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tLSStore). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the tLSStore and deletes it. Returns an error if one occurs. -func (c *tLSStores) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("tlsstores"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *tLSStores) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("tlsstores"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched tLSStore. -func (c *tLSStores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TLSStore, err error) { - result = &v1alpha1.TLSStore{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("tlsstores"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/traefikio_client.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/traefikio_client.go index 9590da009..e5c964747 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/traefikio_client.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/traefikio_client.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - "net/http" + http "net/http" - "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" rest "k8s.io/client-go/rest" ) @@ -98,9 +98,7 @@ func (c *TraefikV1alpha1Client) TraefikServices(namespace string) TraefikService // where httpClient was generated with rest.HTTPClientFor(c). func NewForConfig(c *rest.Config) (*TraefikV1alpha1Client, error) { config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } + setConfigDefaults(&config) httpClient, err := rest.HTTPClientFor(&config) if err != nil { return nil, err @@ -112,9 +110,7 @@ func NewForConfig(c *rest.Config) (*TraefikV1alpha1Client, error) { // Note the http client provided takes precedence over the configured transport values. func NewForConfigAndClient(c *rest.Config, h *http.Client) (*TraefikV1alpha1Client, error) { config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } + setConfigDefaults(&config) client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err @@ -137,17 +133,15 @@ func New(c rest.Interface) *TraefikV1alpha1Client { return &TraefikV1alpha1Client{c} } -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.SchemeGroupVersion +func setConfigDefaults(config *rest.Config) { + gv := traefikiov1alpha1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() if config.UserAgent == "" { config.UserAgent = rest.DefaultKubernetesUserAgent() } - - return nil } // RESTClient returns a RESTClient that is used to communicate diff --git a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/traefikservice.go b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/traefikservice.go index d7744cd6e..1bc07d33e 100644 --- a/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/traefikservice.go +++ b/pkg/provider/kubernetes/crd/generated/clientset/versioned/typed/traefikio/v1alpha1/traefikservice.go @@ -27,15 +27,15 @@ THE SOFTWARE. package v1alpha1 import ( - "context" - "time" + context "context" + applyconfigurationtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/applyconfiguration/traefikio/v1alpha1" scheme "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/scheme" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // TraefikServicesGetter has a method to return a TraefikServiceInterface. @@ -46,141 +46,33 @@ type TraefikServicesGetter interface { // TraefikServiceInterface has methods to work with TraefikService resources. type TraefikServiceInterface interface { - Create(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.CreateOptions) (*v1alpha1.TraefikService, error) - Update(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.UpdateOptions) (*v1alpha1.TraefikService, error) + Create(ctx context.Context, traefikService *traefikiov1alpha1.TraefikService, opts v1.CreateOptions) (*traefikiov1alpha1.TraefikService, error) + Update(ctx context.Context, traefikService *traefikiov1alpha1.TraefikService, opts v1.UpdateOptions) (*traefikiov1alpha1.TraefikService, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.TraefikService, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.TraefikServiceList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*traefikiov1alpha1.TraefikService, error) + List(ctx context.Context, opts v1.ListOptions) (*traefikiov1alpha1.TraefikServiceList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TraefikService, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *traefikiov1alpha1.TraefikService, err error) + Apply(ctx context.Context, traefikService *applyconfigurationtraefikiov1alpha1.TraefikServiceApplyConfiguration, opts v1.ApplyOptions) (result *traefikiov1alpha1.TraefikService, err error) TraefikServiceExpansion } // traefikServices implements TraefikServiceInterface type traefikServices struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*traefikiov1alpha1.TraefikService, *traefikiov1alpha1.TraefikServiceList, *applyconfigurationtraefikiov1alpha1.TraefikServiceApplyConfiguration] } // newTraefikServices returns a TraefikServices func newTraefikServices(c *TraefikV1alpha1Client, namespace string) *traefikServices { return &traefikServices{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*traefikiov1alpha1.TraefikService, *traefikiov1alpha1.TraefikServiceList, *applyconfigurationtraefikiov1alpha1.TraefikServiceApplyConfiguration]( + "traefikservices", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *traefikiov1alpha1.TraefikService { return &traefikiov1alpha1.TraefikService{} }, + func() *traefikiov1alpha1.TraefikServiceList { return &traefikiov1alpha1.TraefikServiceList{} }, + ), } } - -// Get takes name of the traefikService, and returns the corresponding traefikService object, and an error if there is any. -func (c *traefikServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.TraefikService, err error) { - result = &v1alpha1.TraefikService{} - err = c.client.Get(). - Namespace(c.ns). - Resource("traefikservices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TraefikServices that match those selectors. -func (c *traefikServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.TraefikServiceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.TraefikServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("traefikservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested traefikServices. -func (c *traefikServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("traefikservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a traefikService and creates it. Returns the server's representation of the traefikService, and an error, if there is any. -func (c *traefikServices) Create(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.CreateOptions) (result *v1alpha1.TraefikService, err error) { - result = &v1alpha1.TraefikService{} - err = c.client.Post(). - Namespace(c.ns). - Resource("traefikservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(traefikService). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a traefikService and updates it. Returns the server's representation of the traefikService, and an error, if there is any. -func (c *traefikServices) Update(ctx context.Context, traefikService *v1alpha1.TraefikService, opts v1.UpdateOptions) (result *v1alpha1.TraefikService, err error) { - result = &v1alpha1.TraefikService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("traefikservices"). - Name(traefikService.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(traefikService). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the traefikService and deletes it. Returns an error if one occurs. -func (c *traefikServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("traefikservices"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *traefikServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("traefikservices"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched traefikService. -func (c *traefikServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.TraefikService, err error) { - result = &v1alpha1.TraefikService{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("traefikservices"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/factory.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/factory.go index c876b0d25..41ed66f44 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/factory.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/factory.go @@ -236,6 +236,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/generic.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/generic.go index 7d17a1de2..f975efcc5 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/generic.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/generic.go @@ -27,7 +27,7 @@ THE SOFTWARE. package externalversions import ( - "fmt" + fmt "fmt" v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressroute.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressroute.go index af7739407..5bfc88702 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressroute.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressroute.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // IngressRoutes. type IngressRouteInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.IngressRouteLister + Lister() traefikiov1alpha1.IngressRouteLister } type ingressRouteInformer struct { @@ -70,16 +70,28 @@ func NewFilteredIngressRouteInformer(client versioned.Interface, namespace strin if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().IngressRoutes(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().IngressRoutes(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().IngressRoutes(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().IngressRoutes(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().IngressRoutes(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().IngressRoutes(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.IngressRoute{}, + &crdtraefikiov1alpha1.IngressRoute{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *ingressRouteInformer) defaultInformer(client versioned.Interface, resyn } func (f *ingressRouteInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.IngressRoute{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.IngressRoute{}, f.defaultInformer) } -func (f *ingressRouteInformer) Lister() v1alpha1.IngressRouteLister { - return v1alpha1.NewIngressRouteLister(f.Informer().GetIndexer()) +func (f *ingressRouteInformer) Lister() traefikiov1alpha1.IngressRouteLister { + return traefikiov1alpha1.NewIngressRouteLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressroutetcp.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressroutetcp.go index e0a42f5d8..52405235a 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressroutetcp.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressroutetcp.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // IngressRouteTCPs. type IngressRouteTCPInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.IngressRouteTCPLister + Lister() traefikiov1alpha1.IngressRouteTCPLister } type ingressRouteTCPInformer struct { @@ -70,16 +70,28 @@ func NewFilteredIngressRouteTCPInformer(client versioned.Interface, namespace st if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().IngressRouteTCPs(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().IngressRouteTCPs(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().IngressRouteTCPs(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().IngressRouteTCPs(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().IngressRouteTCPs(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().IngressRouteTCPs(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.IngressRouteTCP{}, + &crdtraefikiov1alpha1.IngressRouteTCP{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *ingressRouteTCPInformer) defaultInformer(client versioned.Interface, re } func (f *ingressRouteTCPInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.IngressRouteTCP{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.IngressRouteTCP{}, f.defaultInformer) } -func (f *ingressRouteTCPInformer) Lister() v1alpha1.IngressRouteTCPLister { - return v1alpha1.NewIngressRouteTCPLister(f.Informer().GetIndexer()) +func (f *ingressRouteTCPInformer) Lister() traefikiov1alpha1.IngressRouteTCPLister { + return traefikiov1alpha1.NewIngressRouteTCPLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressrouteudp.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressrouteudp.go index f30010239..273dfe7b2 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressrouteudp.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/ingressrouteudp.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // IngressRouteUDPs. type IngressRouteUDPInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.IngressRouteUDPLister + Lister() traefikiov1alpha1.IngressRouteUDPLister } type ingressRouteUDPInformer struct { @@ -70,16 +70,28 @@ func NewFilteredIngressRouteUDPInformer(client versioned.Interface, namespace st if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().IngressRouteUDPs(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().IngressRouteUDPs(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().IngressRouteUDPs(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().IngressRouteUDPs(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().IngressRouteUDPs(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().IngressRouteUDPs(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.IngressRouteUDP{}, + &crdtraefikiov1alpha1.IngressRouteUDP{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *ingressRouteUDPInformer) defaultInformer(client versioned.Interface, re } func (f *ingressRouteUDPInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.IngressRouteUDP{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.IngressRouteUDP{}, f.defaultInformer) } -func (f *ingressRouteUDPInformer) Lister() v1alpha1.IngressRouteUDPLister { - return v1alpha1.NewIngressRouteUDPLister(f.Informer().GetIndexer()) +func (f *ingressRouteUDPInformer) Lister() traefikiov1alpha1.IngressRouteUDPLister { + return traefikiov1alpha1.NewIngressRouteUDPLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/middleware.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/middleware.go index 62eb4adbe..324c5219d 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/middleware.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/middleware.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // Middlewares. type MiddlewareInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.MiddlewareLister + Lister() traefikiov1alpha1.MiddlewareLister } type middlewareInformer struct { @@ -70,16 +70,28 @@ func NewFilteredMiddlewareInformer(client versioned.Interface, namespace string, if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().Middlewares(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().Middlewares(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().Middlewares(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().Middlewares(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().Middlewares(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().Middlewares(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.Middleware{}, + &crdtraefikiov1alpha1.Middleware{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *middlewareInformer) defaultInformer(client versioned.Interface, resyncP } func (f *middlewareInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.Middleware{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.Middleware{}, f.defaultInformer) } -func (f *middlewareInformer) Lister() v1alpha1.MiddlewareLister { - return v1alpha1.NewMiddlewareLister(f.Informer().GetIndexer()) +func (f *middlewareInformer) Lister() traefikiov1alpha1.MiddlewareLister { + return traefikiov1alpha1.NewMiddlewareLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/middlewaretcp.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/middlewaretcp.go index 0019fbc6d..e8cacfd41 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/middlewaretcp.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/middlewaretcp.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // MiddlewareTCPs. type MiddlewareTCPInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.MiddlewareTCPLister + Lister() traefikiov1alpha1.MiddlewareTCPLister } type middlewareTCPInformer struct { @@ -70,16 +70,28 @@ func NewFilteredMiddlewareTCPInformer(client versioned.Interface, namespace stri if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().MiddlewareTCPs(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().MiddlewareTCPs(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().MiddlewareTCPs(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().MiddlewareTCPs(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().MiddlewareTCPs(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().MiddlewareTCPs(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.MiddlewareTCP{}, + &crdtraefikiov1alpha1.MiddlewareTCP{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *middlewareTCPInformer) defaultInformer(client versioned.Interface, resy } func (f *middlewareTCPInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.MiddlewareTCP{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.MiddlewareTCP{}, f.defaultInformer) } -func (f *middlewareTCPInformer) Lister() v1alpha1.MiddlewareTCPLister { - return v1alpha1.NewMiddlewareTCPLister(f.Informer().GetIndexer()) +func (f *middlewareTCPInformer) Lister() traefikiov1alpha1.MiddlewareTCPLister { + return traefikiov1alpha1.NewMiddlewareTCPLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/serverstransport.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/serverstransport.go index f285c5e76..8b091354d 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/serverstransport.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/serverstransport.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // ServersTransports. type ServersTransportInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.ServersTransportLister + Lister() traefikiov1alpha1.ServersTransportLister } type serversTransportInformer struct { @@ -70,16 +70,28 @@ func NewFilteredServersTransportInformer(client versioned.Interface, namespace s if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().ServersTransports(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().ServersTransports(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().ServersTransports(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().ServersTransports(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().ServersTransports(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().ServersTransports(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.ServersTransport{}, + &crdtraefikiov1alpha1.ServersTransport{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *serversTransportInformer) defaultInformer(client versioned.Interface, r } func (f *serversTransportInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.ServersTransport{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.ServersTransport{}, f.defaultInformer) } -func (f *serversTransportInformer) Lister() v1alpha1.ServersTransportLister { - return v1alpha1.NewServersTransportLister(f.Informer().GetIndexer()) +func (f *serversTransportInformer) Lister() traefikiov1alpha1.ServersTransportLister { + return traefikiov1alpha1.NewServersTransportLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/serverstransporttcp.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/serverstransporttcp.go index d9b0d51d1..824c67cae 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/serverstransporttcp.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/serverstransporttcp.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // ServersTransportTCPs. type ServersTransportTCPInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.ServersTransportTCPLister + Lister() traefikiov1alpha1.ServersTransportTCPLister } type serversTransportTCPInformer struct { @@ -70,16 +70,28 @@ func NewFilteredServersTransportTCPInformer(client versioned.Interface, namespac if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().ServersTransportTCPs(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().ServersTransportTCPs(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().ServersTransportTCPs(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().ServersTransportTCPs(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().ServersTransportTCPs(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().ServersTransportTCPs(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.ServersTransportTCP{}, + &crdtraefikiov1alpha1.ServersTransportTCP{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *serversTransportTCPInformer) defaultInformer(client versioned.Interface } func (f *serversTransportTCPInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.ServersTransportTCP{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.ServersTransportTCP{}, f.defaultInformer) } -func (f *serversTransportTCPInformer) Lister() v1alpha1.ServersTransportTCPLister { - return v1alpha1.NewServersTransportTCPLister(f.Informer().GetIndexer()) +func (f *serversTransportTCPInformer) Lister() traefikiov1alpha1.ServersTransportTCPLister { + return traefikiov1alpha1.NewServersTransportTCPLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/tlsoption.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/tlsoption.go index 60af5953a..fbc03787a 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/tlsoption.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/tlsoption.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // TLSOptions. type TLSOptionInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.TLSOptionLister + Lister() traefikiov1alpha1.TLSOptionLister } type tLSOptionInformer struct { @@ -70,16 +70,28 @@ func NewFilteredTLSOptionInformer(client versioned.Interface, namespace string, if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().TLSOptions(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().TLSOptions(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().TLSOptions(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().TLSOptions(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().TLSOptions(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().TLSOptions(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.TLSOption{}, + &crdtraefikiov1alpha1.TLSOption{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *tLSOptionInformer) defaultInformer(client versioned.Interface, resyncPe } func (f *tLSOptionInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.TLSOption{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.TLSOption{}, f.defaultInformer) } -func (f *tLSOptionInformer) Lister() v1alpha1.TLSOptionLister { - return v1alpha1.NewTLSOptionLister(f.Informer().GetIndexer()) +func (f *tLSOptionInformer) Lister() traefikiov1alpha1.TLSOptionLister { + return traefikiov1alpha1.NewTLSOptionLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/tlsstore.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/tlsstore.go index bfbf16be7..02eea4cf8 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/tlsstore.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/tlsstore.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // TLSStores. type TLSStoreInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.TLSStoreLister + Lister() traefikiov1alpha1.TLSStoreLister } type tLSStoreInformer struct { @@ -70,16 +70,28 @@ func NewFilteredTLSStoreInformer(client versioned.Interface, namespace string, r if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().TLSStores(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().TLSStores(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().TLSStores(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().TLSStores(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().TLSStores(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().TLSStores(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.TLSStore{}, + &crdtraefikiov1alpha1.TLSStore{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *tLSStoreInformer) defaultInformer(client versioned.Interface, resyncPer } func (f *tLSStoreInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.TLSStore{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.TLSStore{}, f.defaultInformer) } -func (f *tLSStoreInformer) Lister() v1alpha1.TLSStoreLister { - return v1alpha1.NewTLSStoreLister(f.Informer().GetIndexer()) +func (f *tLSStoreInformer) Lister() traefikiov1alpha1.TLSStoreLister { + return traefikiov1alpha1.NewTLSStoreLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/traefikservice.go b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/traefikservice.go index ffe96b417..272be98cb 100644 --- a/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/traefikservice.go +++ b/pkg/provider/kubernetes/crd/generated/informers/externalversions/traefikio/v1alpha1/traefikservice.go @@ -27,13 +27,13 @@ THE SOFTWARE. package v1alpha1 import ( - "context" + context "context" time "time" versioned "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned" internalinterfaces "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" - traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1" + crdtraefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -44,7 +44,7 @@ import ( // TraefikServices. type TraefikServiceInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha1.TraefikServiceLister + Lister() traefikiov1alpha1.TraefikServiceLister } type traefikServiceInformer struct { @@ -70,16 +70,28 @@ func NewFilteredTraefikServiceInformer(client versioned.Interface, namespace str if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().TraefikServices(namespace).List(context.TODO(), options) + return client.TraefikV1alpha1().TraefikServices(namespace).List(context.Background(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.TraefikV1alpha1().TraefikServices(namespace).Watch(context.TODO(), options) + return client.TraefikV1alpha1().TraefikServices(namespace).Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().TraefikServices(namespace).List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.TraefikV1alpha1().TraefikServices(namespace).Watch(ctx, options) }, }, - &traefikiov1alpha1.TraefikService{}, + &crdtraefikiov1alpha1.TraefikService{}, resyncPeriod, indexers, ) @@ -90,9 +102,9 @@ func (f *traefikServiceInformer) defaultInformer(client versioned.Interface, res } func (f *traefikServiceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&traefikiov1alpha1.TraefikService{}, f.defaultInformer) + return f.factory.InformerFor(&crdtraefikiov1alpha1.TraefikService{}, f.defaultInformer) } -func (f *traefikServiceInformer) Lister() v1alpha1.TraefikServiceLister { - return v1alpha1.NewTraefikServiceLister(f.Informer().GetIndexer()) +func (f *traefikServiceInformer) Lister() traefikiov1alpha1.TraefikServiceLister { + return traefikiov1alpha1.NewTraefikServiceLister(f.Informer().GetIndexer()) } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressroute.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressroute.go index 3a3c6ee29..57647bde4 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressroute.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressroute.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // IngressRouteLister helps list IngressRoutes. @@ -38,7 +38,7 @@ import ( type IngressRouteLister interface { // List lists all IngressRoutes in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IngressRoute, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.IngressRoute, err error) // IngressRoutes returns an object that can list and get IngressRoutes. IngressRoutes(namespace string) IngressRouteNamespaceLister IngressRouteListerExpansion @@ -46,25 +46,17 @@ type IngressRouteLister interface { // ingressRouteLister implements the IngressRouteLister interface. type ingressRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.IngressRoute] } // NewIngressRouteLister returns a new IngressRouteLister. func NewIngressRouteLister(indexer cache.Indexer) IngressRouteLister { - return &ingressRouteLister{indexer: indexer} -} - -// List lists all IngressRoutes in the indexer. -func (s *ingressRouteLister) List(selector labels.Selector) (ret []*v1alpha1.IngressRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IngressRoute)) - }) - return ret, err + return &ingressRouteLister{listers.New[*traefikiov1alpha1.IngressRoute](indexer, traefikiov1alpha1.Resource("ingressroute"))} } // IngressRoutes returns an object that can list and get IngressRoutes. func (s *ingressRouteLister) IngressRoutes(namespace string) IngressRouteNamespaceLister { - return ingressRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return ingressRouteNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.IngressRoute](s.ResourceIndexer, namespace)} } // IngressRouteNamespaceLister helps list and get IngressRoutes. @@ -72,36 +64,15 @@ func (s *ingressRouteLister) IngressRoutes(namespace string) IngressRouteNamespa type IngressRouteNamespaceLister interface { // List lists all IngressRoutes in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IngressRoute, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.IngressRoute, err error) // Get retrieves the IngressRoute from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.IngressRoute, error) + Get(name string) (*traefikiov1alpha1.IngressRoute, error) IngressRouteNamespaceListerExpansion } // ingressRouteNamespaceLister implements the IngressRouteNamespaceLister // interface. type ingressRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all IngressRoutes in the indexer for a given namespace. -func (s ingressRouteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IngressRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IngressRoute)) - }) - return ret, err -} - -// Get retrieves the IngressRoute from the indexer for a given namespace and name. -func (s ingressRouteNamespaceLister) Get(name string) (*v1alpha1.IngressRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("ingressroute"), name) - } - return obj.(*v1alpha1.IngressRoute), nil + listers.ResourceIndexer[*traefikiov1alpha1.IngressRoute] } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressroutetcp.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressroutetcp.go index d9f8aaad9..661047de6 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressroutetcp.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressroutetcp.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // IngressRouteTCPLister helps list IngressRouteTCPs. @@ -38,7 +38,7 @@ import ( type IngressRouteTCPLister interface { // List lists all IngressRouteTCPs in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IngressRouteTCP, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.IngressRouteTCP, err error) // IngressRouteTCPs returns an object that can list and get IngressRouteTCPs. IngressRouteTCPs(namespace string) IngressRouteTCPNamespaceLister IngressRouteTCPListerExpansion @@ -46,25 +46,17 @@ type IngressRouteTCPLister interface { // ingressRouteTCPLister implements the IngressRouteTCPLister interface. type ingressRouteTCPLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.IngressRouteTCP] } // NewIngressRouteTCPLister returns a new IngressRouteTCPLister. func NewIngressRouteTCPLister(indexer cache.Indexer) IngressRouteTCPLister { - return &ingressRouteTCPLister{indexer: indexer} -} - -// List lists all IngressRouteTCPs in the indexer. -func (s *ingressRouteTCPLister) List(selector labels.Selector) (ret []*v1alpha1.IngressRouteTCP, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IngressRouteTCP)) - }) - return ret, err + return &ingressRouteTCPLister{listers.New[*traefikiov1alpha1.IngressRouteTCP](indexer, traefikiov1alpha1.Resource("ingressroutetcp"))} } // IngressRouteTCPs returns an object that can list and get IngressRouteTCPs. func (s *ingressRouteTCPLister) IngressRouteTCPs(namespace string) IngressRouteTCPNamespaceLister { - return ingressRouteTCPNamespaceLister{indexer: s.indexer, namespace: namespace} + return ingressRouteTCPNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.IngressRouteTCP](s.ResourceIndexer, namespace)} } // IngressRouteTCPNamespaceLister helps list and get IngressRouteTCPs. @@ -72,36 +64,15 @@ func (s *ingressRouteTCPLister) IngressRouteTCPs(namespace string) IngressRouteT type IngressRouteTCPNamespaceLister interface { // List lists all IngressRouteTCPs in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IngressRouteTCP, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.IngressRouteTCP, err error) // Get retrieves the IngressRouteTCP from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.IngressRouteTCP, error) + Get(name string) (*traefikiov1alpha1.IngressRouteTCP, error) IngressRouteTCPNamespaceListerExpansion } // ingressRouteTCPNamespaceLister implements the IngressRouteTCPNamespaceLister // interface. type ingressRouteTCPNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all IngressRouteTCPs in the indexer for a given namespace. -func (s ingressRouteTCPNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IngressRouteTCP, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IngressRouteTCP)) - }) - return ret, err -} - -// Get retrieves the IngressRouteTCP from the indexer for a given namespace and name. -func (s ingressRouteTCPNamespaceLister) Get(name string) (*v1alpha1.IngressRouteTCP, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("ingressroutetcp"), name) - } - return obj.(*v1alpha1.IngressRouteTCP), nil + listers.ResourceIndexer[*traefikiov1alpha1.IngressRouteTCP] } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressrouteudp.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressrouteudp.go index 2f2bdb194..ae03f3299 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressrouteudp.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/ingressrouteudp.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // IngressRouteUDPLister helps list IngressRouteUDPs. @@ -38,7 +38,7 @@ import ( type IngressRouteUDPLister interface { // List lists all IngressRouteUDPs in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IngressRouteUDP, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.IngressRouteUDP, err error) // IngressRouteUDPs returns an object that can list and get IngressRouteUDPs. IngressRouteUDPs(namespace string) IngressRouteUDPNamespaceLister IngressRouteUDPListerExpansion @@ -46,25 +46,17 @@ type IngressRouteUDPLister interface { // ingressRouteUDPLister implements the IngressRouteUDPLister interface. type ingressRouteUDPLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.IngressRouteUDP] } // NewIngressRouteUDPLister returns a new IngressRouteUDPLister. func NewIngressRouteUDPLister(indexer cache.Indexer) IngressRouteUDPLister { - return &ingressRouteUDPLister{indexer: indexer} -} - -// List lists all IngressRouteUDPs in the indexer. -func (s *ingressRouteUDPLister) List(selector labels.Selector) (ret []*v1alpha1.IngressRouteUDP, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IngressRouteUDP)) - }) - return ret, err + return &ingressRouteUDPLister{listers.New[*traefikiov1alpha1.IngressRouteUDP](indexer, traefikiov1alpha1.Resource("ingressrouteudp"))} } // IngressRouteUDPs returns an object that can list and get IngressRouteUDPs. func (s *ingressRouteUDPLister) IngressRouteUDPs(namespace string) IngressRouteUDPNamespaceLister { - return ingressRouteUDPNamespaceLister{indexer: s.indexer, namespace: namespace} + return ingressRouteUDPNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.IngressRouteUDP](s.ResourceIndexer, namespace)} } // IngressRouteUDPNamespaceLister helps list and get IngressRouteUDPs. @@ -72,36 +64,15 @@ func (s *ingressRouteUDPLister) IngressRouteUDPs(namespace string) IngressRouteU type IngressRouteUDPNamespaceLister interface { // List lists all IngressRouteUDPs in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.IngressRouteUDP, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.IngressRouteUDP, err error) // Get retrieves the IngressRouteUDP from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.IngressRouteUDP, error) + Get(name string) (*traefikiov1alpha1.IngressRouteUDP, error) IngressRouteUDPNamespaceListerExpansion } // ingressRouteUDPNamespaceLister implements the IngressRouteUDPNamespaceLister // interface. type ingressRouteUDPNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all IngressRouteUDPs in the indexer for a given namespace. -func (s ingressRouteUDPNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IngressRouteUDP, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.IngressRouteUDP)) - }) - return ret, err -} - -// Get retrieves the IngressRouteUDP from the indexer for a given namespace and name. -func (s ingressRouteUDPNamespaceLister) Get(name string) (*v1alpha1.IngressRouteUDP, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("ingressrouteudp"), name) - } - return obj.(*v1alpha1.IngressRouteUDP), nil + listers.ResourceIndexer[*traefikiov1alpha1.IngressRouteUDP] } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/middleware.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/middleware.go index c3a0dec16..f87306ef2 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/middleware.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/middleware.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // MiddlewareLister helps list Middlewares. @@ -38,7 +38,7 @@ import ( type MiddlewareLister interface { // List lists all Middlewares in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Middleware, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.Middleware, err error) // Middlewares returns an object that can list and get Middlewares. Middlewares(namespace string) MiddlewareNamespaceLister MiddlewareListerExpansion @@ -46,25 +46,17 @@ type MiddlewareLister interface { // middlewareLister implements the MiddlewareLister interface. type middlewareLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.Middleware] } // NewMiddlewareLister returns a new MiddlewareLister. func NewMiddlewareLister(indexer cache.Indexer) MiddlewareLister { - return &middlewareLister{indexer: indexer} -} - -// List lists all Middlewares in the indexer. -func (s *middlewareLister) List(selector labels.Selector) (ret []*v1alpha1.Middleware, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Middleware)) - }) - return ret, err + return &middlewareLister{listers.New[*traefikiov1alpha1.Middleware](indexer, traefikiov1alpha1.Resource("middleware"))} } // Middlewares returns an object that can list and get Middlewares. func (s *middlewareLister) Middlewares(namespace string) MiddlewareNamespaceLister { - return middlewareNamespaceLister{indexer: s.indexer, namespace: namespace} + return middlewareNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.Middleware](s.ResourceIndexer, namespace)} } // MiddlewareNamespaceLister helps list and get Middlewares. @@ -72,36 +64,15 @@ func (s *middlewareLister) Middlewares(namespace string) MiddlewareNamespaceList type MiddlewareNamespaceLister interface { // List lists all Middlewares in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.Middleware, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.Middleware, err error) // Get retrieves the Middleware from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.Middleware, error) + Get(name string) (*traefikiov1alpha1.Middleware, error) MiddlewareNamespaceListerExpansion } // middlewareNamespaceLister implements the MiddlewareNamespaceLister // interface. type middlewareNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Middlewares in the indexer for a given namespace. -func (s middlewareNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Middleware, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Middleware)) - }) - return ret, err -} - -// Get retrieves the Middleware from the indexer for a given namespace and name. -func (s middlewareNamespaceLister) Get(name string) (*v1alpha1.Middleware, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("middleware"), name) - } - return obj.(*v1alpha1.Middleware), nil + listers.ResourceIndexer[*traefikiov1alpha1.Middleware] } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/middlewaretcp.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/middlewaretcp.go index 85b3f9803..8eca35e2d 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/middlewaretcp.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/middlewaretcp.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // MiddlewareTCPLister helps list MiddlewareTCPs. @@ -38,7 +38,7 @@ import ( type MiddlewareTCPLister interface { // List lists all MiddlewareTCPs in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.MiddlewareTCP, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.MiddlewareTCP, err error) // MiddlewareTCPs returns an object that can list and get MiddlewareTCPs. MiddlewareTCPs(namespace string) MiddlewareTCPNamespaceLister MiddlewareTCPListerExpansion @@ -46,25 +46,17 @@ type MiddlewareTCPLister interface { // middlewareTCPLister implements the MiddlewareTCPLister interface. type middlewareTCPLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.MiddlewareTCP] } // NewMiddlewareTCPLister returns a new MiddlewareTCPLister. func NewMiddlewareTCPLister(indexer cache.Indexer) MiddlewareTCPLister { - return &middlewareTCPLister{indexer: indexer} -} - -// List lists all MiddlewareTCPs in the indexer. -func (s *middlewareTCPLister) List(selector labels.Selector) (ret []*v1alpha1.MiddlewareTCP, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.MiddlewareTCP)) - }) - return ret, err + return &middlewareTCPLister{listers.New[*traefikiov1alpha1.MiddlewareTCP](indexer, traefikiov1alpha1.Resource("middlewaretcp"))} } // MiddlewareTCPs returns an object that can list and get MiddlewareTCPs. func (s *middlewareTCPLister) MiddlewareTCPs(namespace string) MiddlewareTCPNamespaceLister { - return middlewareTCPNamespaceLister{indexer: s.indexer, namespace: namespace} + return middlewareTCPNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.MiddlewareTCP](s.ResourceIndexer, namespace)} } // MiddlewareTCPNamespaceLister helps list and get MiddlewareTCPs. @@ -72,36 +64,15 @@ func (s *middlewareTCPLister) MiddlewareTCPs(namespace string) MiddlewareTCPName type MiddlewareTCPNamespaceLister interface { // List lists all MiddlewareTCPs in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.MiddlewareTCP, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.MiddlewareTCP, err error) // Get retrieves the MiddlewareTCP from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.MiddlewareTCP, error) + Get(name string) (*traefikiov1alpha1.MiddlewareTCP, error) MiddlewareTCPNamespaceListerExpansion } // middlewareTCPNamespaceLister implements the MiddlewareTCPNamespaceLister // interface. type middlewareTCPNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all MiddlewareTCPs in the indexer for a given namespace. -func (s middlewareTCPNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MiddlewareTCP, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.MiddlewareTCP)) - }) - return ret, err -} - -// Get retrieves the MiddlewareTCP from the indexer for a given namespace and name. -func (s middlewareTCPNamespaceLister) Get(name string) (*v1alpha1.MiddlewareTCP, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("middlewaretcp"), name) - } - return obj.(*v1alpha1.MiddlewareTCP), nil + listers.ResourceIndexer[*traefikiov1alpha1.MiddlewareTCP] } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/serverstransport.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/serverstransport.go index 99c1d0956..3b9374428 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/serverstransport.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/serverstransport.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // ServersTransportLister helps list ServersTransports. @@ -38,7 +38,7 @@ import ( type ServersTransportLister interface { // List lists all ServersTransports in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ServersTransport, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.ServersTransport, err error) // ServersTransports returns an object that can list and get ServersTransports. ServersTransports(namespace string) ServersTransportNamespaceLister ServersTransportListerExpansion @@ -46,25 +46,17 @@ type ServersTransportLister interface { // serversTransportLister implements the ServersTransportLister interface. type serversTransportLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.ServersTransport] } // NewServersTransportLister returns a new ServersTransportLister. func NewServersTransportLister(indexer cache.Indexer) ServersTransportLister { - return &serversTransportLister{indexer: indexer} -} - -// List lists all ServersTransports in the indexer. -func (s *serversTransportLister) List(selector labels.Selector) (ret []*v1alpha1.ServersTransport, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ServersTransport)) - }) - return ret, err + return &serversTransportLister{listers.New[*traefikiov1alpha1.ServersTransport](indexer, traefikiov1alpha1.Resource("serverstransport"))} } // ServersTransports returns an object that can list and get ServersTransports. func (s *serversTransportLister) ServersTransports(namespace string) ServersTransportNamespaceLister { - return serversTransportNamespaceLister{indexer: s.indexer, namespace: namespace} + return serversTransportNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.ServersTransport](s.ResourceIndexer, namespace)} } // ServersTransportNamespaceLister helps list and get ServersTransports. @@ -72,36 +64,15 @@ func (s *serversTransportLister) ServersTransports(namespace string) ServersTran type ServersTransportNamespaceLister interface { // List lists all ServersTransports in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ServersTransport, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.ServersTransport, err error) // Get retrieves the ServersTransport from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.ServersTransport, error) + Get(name string) (*traefikiov1alpha1.ServersTransport, error) ServersTransportNamespaceListerExpansion } // serversTransportNamespaceLister implements the ServersTransportNamespaceLister // interface. type serversTransportNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ServersTransports in the indexer for a given namespace. -func (s serversTransportNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ServersTransport, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ServersTransport)) - }) - return ret, err -} - -// Get retrieves the ServersTransport from the indexer for a given namespace and name. -func (s serversTransportNamespaceLister) Get(name string) (*v1alpha1.ServersTransport, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("serverstransport"), name) - } - return obj.(*v1alpha1.ServersTransport), nil + listers.ResourceIndexer[*traefikiov1alpha1.ServersTransport] } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/serverstransporttcp.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/serverstransporttcp.go index 77a9b06a1..8b4bba0a6 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/serverstransporttcp.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/serverstransporttcp.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // ServersTransportTCPLister helps list ServersTransportTCPs. @@ -38,7 +38,7 @@ import ( type ServersTransportTCPLister interface { // List lists all ServersTransportTCPs in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ServersTransportTCP, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.ServersTransportTCP, err error) // ServersTransportTCPs returns an object that can list and get ServersTransportTCPs. ServersTransportTCPs(namespace string) ServersTransportTCPNamespaceLister ServersTransportTCPListerExpansion @@ -46,25 +46,17 @@ type ServersTransportTCPLister interface { // serversTransportTCPLister implements the ServersTransportTCPLister interface. type serversTransportTCPLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.ServersTransportTCP] } // NewServersTransportTCPLister returns a new ServersTransportTCPLister. func NewServersTransportTCPLister(indexer cache.Indexer) ServersTransportTCPLister { - return &serversTransportTCPLister{indexer: indexer} -} - -// List lists all ServersTransportTCPs in the indexer. -func (s *serversTransportTCPLister) List(selector labels.Selector) (ret []*v1alpha1.ServersTransportTCP, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ServersTransportTCP)) - }) - return ret, err + return &serversTransportTCPLister{listers.New[*traefikiov1alpha1.ServersTransportTCP](indexer, traefikiov1alpha1.Resource("serverstransporttcp"))} } // ServersTransportTCPs returns an object that can list and get ServersTransportTCPs. func (s *serversTransportTCPLister) ServersTransportTCPs(namespace string) ServersTransportTCPNamespaceLister { - return serversTransportTCPNamespaceLister{indexer: s.indexer, namespace: namespace} + return serversTransportTCPNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.ServersTransportTCP](s.ResourceIndexer, namespace)} } // ServersTransportTCPNamespaceLister helps list and get ServersTransportTCPs. @@ -72,36 +64,15 @@ func (s *serversTransportTCPLister) ServersTransportTCPs(namespace string) Serve type ServersTransportTCPNamespaceLister interface { // List lists all ServersTransportTCPs in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.ServersTransportTCP, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.ServersTransportTCP, err error) // Get retrieves the ServersTransportTCP from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.ServersTransportTCP, error) + Get(name string) (*traefikiov1alpha1.ServersTransportTCP, error) ServersTransportTCPNamespaceListerExpansion } // serversTransportTCPNamespaceLister implements the ServersTransportTCPNamespaceLister // interface. type serversTransportTCPNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ServersTransportTCPs in the indexer for a given namespace. -func (s serversTransportTCPNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ServersTransportTCP, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.ServersTransportTCP)) - }) - return ret, err -} - -// Get retrieves the ServersTransportTCP from the indexer for a given namespace and name. -func (s serversTransportTCPNamespaceLister) Get(name string) (*v1alpha1.ServersTransportTCP, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("serverstransporttcp"), name) - } - return obj.(*v1alpha1.ServersTransportTCP), nil + listers.ResourceIndexer[*traefikiov1alpha1.ServersTransportTCP] } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/tlsoption.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/tlsoption.go index 52c8a4881..495b134e8 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/tlsoption.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/tlsoption.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // TLSOptionLister helps list TLSOptions. @@ -38,7 +38,7 @@ import ( type TLSOptionLister interface { // List lists all TLSOptions in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.TLSOption, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.TLSOption, err error) // TLSOptions returns an object that can list and get TLSOptions. TLSOptions(namespace string) TLSOptionNamespaceLister TLSOptionListerExpansion @@ -46,25 +46,17 @@ type TLSOptionLister interface { // tLSOptionLister implements the TLSOptionLister interface. type tLSOptionLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.TLSOption] } // NewTLSOptionLister returns a new TLSOptionLister. func NewTLSOptionLister(indexer cache.Indexer) TLSOptionLister { - return &tLSOptionLister{indexer: indexer} -} - -// List lists all TLSOptions in the indexer. -func (s *tLSOptionLister) List(selector labels.Selector) (ret []*v1alpha1.TLSOption, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TLSOption)) - }) - return ret, err + return &tLSOptionLister{listers.New[*traefikiov1alpha1.TLSOption](indexer, traefikiov1alpha1.Resource("tlsoption"))} } // TLSOptions returns an object that can list and get TLSOptions. func (s *tLSOptionLister) TLSOptions(namespace string) TLSOptionNamespaceLister { - return tLSOptionNamespaceLister{indexer: s.indexer, namespace: namespace} + return tLSOptionNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.TLSOption](s.ResourceIndexer, namespace)} } // TLSOptionNamespaceLister helps list and get TLSOptions. @@ -72,36 +64,15 @@ func (s *tLSOptionLister) TLSOptions(namespace string) TLSOptionNamespaceLister type TLSOptionNamespaceLister interface { // List lists all TLSOptions in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.TLSOption, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.TLSOption, err error) // Get retrieves the TLSOption from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.TLSOption, error) + Get(name string) (*traefikiov1alpha1.TLSOption, error) TLSOptionNamespaceListerExpansion } // tLSOptionNamespaceLister implements the TLSOptionNamespaceLister // interface. type tLSOptionNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TLSOptions in the indexer for a given namespace. -func (s tLSOptionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TLSOption, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TLSOption)) - }) - return ret, err -} - -// Get retrieves the TLSOption from the indexer for a given namespace and name. -func (s tLSOptionNamespaceLister) Get(name string) (*v1alpha1.TLSOption, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("tlsoption"), name) - } - return obj.(*v1alpha1.TLSOption), nil + listers.ResourceIndexer[*traefikiov1alpha1.TLSOption] } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/tlsstore.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/tlsstore.go index e65331d1e..787246420 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/tlsstore.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/tlsstore.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // TLSStoreLister helps list TLSStores. @@ -38,7 +38,7 @@ import ( type TLSStoreLister interface { // List lists all TLSStores in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.TLSStore, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.TLSStore, err error) // TLSStores returns an object that can list and get TLSStores. TLSStores(namespace string) TLSStoreNamespaceLister TLSStoreListerExpansion @@ -46,25 +46,17 @@ type TLSStoreLister interface { // tLSStoreLister implements the TLSStoreLister interface. type tLSStoreLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.TLSStore] } // NewTLSStoreLister returns a new TLSStoreLister. func NewTLSStoreLister(indexer cache.Indexer) TLSStoreLister { - return &tLSStoreLister{indexer: indexer} -} - -// List lists all TLSStores in the indexer. -func (s *tLSStoreLister) List(selector labels.Selector) (ret []*v1alpha1.TLSStore, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TLSStore)) - }) - return ret, err + return &tLSStoreLister{listers.New[*traefikiov1alpha1.TLSStore](indexer, traefikiov1alpha1.Resource("tlsstore"))} } // TLSStores returns an object that can list and get TLSStores. func (s *tLSStoreLister) TLSStores(namespace string) TLSStoreNamespaceLister { - return tLSStoreNamespaceLister{indexer: s.indexer, namespace: namespace} + return tLSStoreNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.TLSStore](s.ResourceIndexer, namespace)} } // TLSStoreNamespaceLister helps list and get TLSStores. @@ -72,36 +64,15 @@ func (s *tLSStoreLister) TLSStores(namespace string) TLSStoreNamespaceLister { type TLSStoreNamespaceLister interface { // List lists all TLSStores in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.TLSStore, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.TLSStore, err error) // Get retrieves the TLSStore from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.TLSStore, error) + Get(name string) (*traefikiov1alpha1.TLSStore, error) TLSStoreNamespaceListerExpansion } // tLSStoreNamespaceLister implements the TLSStoreNamespaceLister // interface. type tLSStoreNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TLSStores in the indexer for a given namespace. -func (s tLSStoreNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TLSStore, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TLSStore)) - }) - return ret, err -} - -// Get retrieves the TLSStore from the indexer for a given namespace and name. -func (s tLSStoreNamespaceLister) Get(name string) (*v1alpha1.TLSStore, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("tlsstore"), name) - } - return obj.(*v1alpha1.TLSStore), nil + listers.ResourceIndexer[*traefikiov1alpha1.TLSStore] } diff --git a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/traefikservice.go b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/traefikservice.go index 5372dff84..5712a2628 100644 --- a/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/traefikservice.go +++ b/pkg/provider/kubernetes/crd/generated/listers/traefikio/v1alpha1/traefikservice.go @@ -27,10 +27,10 @@ THE SOFTWARE. package v1alpha1 import ( - v1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" + traefikiov1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" ) // TraefikServiceLister helps list TraefikServices. @@ -38,7 +38,7 @@ import ( type TraefikServiceLister interface { // List lists all TraefikServices in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.TraefikService, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.TraefikService, err error) // TraefikServices returns an object that can list and get TraefikServices. TraefikServices(namespace string) TraefikServiceNamespaceLister TraefikServiceListerExpansion @@ -46,25 +46,17 @@ type TraefikServiceLister interface { // traefikServiceLister implements the TraefikServiceLister interface. type traefikServiceLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*traefikiov1alpha1.TraefikService] } // NewTraefikServiceLister returns a new TraefikServiceLister. func NewTraefikServiceLister(indexer cache.Indexer) TraefikServiceLister { - return &traefikServiceLister{indexer: indexer} -} - -// List lists all TraefikServices in the indexer. -func (s *traefikServiceLister) List(selector labels.Selector) (ret []*v1alpha1.TraefikService, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TraefikService)) - }) - return ret, err + return &traefikServiceLister{listers.New[*traefikiov1alpha1.TraefikService](indexer, traefikiov1alpha1.Resource("traefikservice"))} } // TraefikServices returns an object that can list and get TraefikServices. func (s *traefikServiceLister) TraefikServices(namespace string) TraefikServiceNamespaceLister { - return traefikServiceNamespaceLister{indexer: s.indexer, namespace: namespace} + return traefikServiceNamespaceLister{listers.NewNamespaced[*traefikiov1alpha1.TraefikService](s.ResourceIndexer, namespace)} } // TraefikServiceNamespaceLister helps list and get TraefikServices. @@ -72,36 +64,15 @@ func (s *traefikServiceLister) TraefikServices(namespace string) TraefikServiceN type TraefikServiceNamespaceLister interface { // List lists all TraefikServices in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.TraefikService, err error) + List(selector labels.Selector) (ret []*traefikiov1alpha1.TraefikService, err error) // Get retrieves the TraefikService from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.TraefikService, error) + Get(name string) (*traefikiov1alpha1.TraefikService, error) TraefikServiceNamespaceListerExpansion } // traefikServiceNamespaceLister implements the TraefikServiceNamespaceLister // interface. type traefikServiceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TraefikServices in the indexer for a given namespace. -func (s traefikServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TraefikService, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.TraefikService)) - }) - return ret, err -} - -// Get retrieves the TraefikService from the indexer for a given namespace and name. -func (s traefikServiceNamespaceLister) Get(name string) (*v1alpha1.TraefikService, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("traefikservice"), name) - } - return obj.(*v1alpha1.TraefikService), nil + listers.ResourceIndexer[*traefikiov1alpha1.TraefikService] } diff --git a/pkg/provider/kubernetes/crd/kubernetes_test.go b/pkg/provider/kubernetes/crd/kubernetes_test.go index eac9b5fc1..018a3dd43 100644 --- a/pkg/provider/kubernetes/crd/kubernetes_test.go +++ b/pkg/provider/kubernetes/crd/kubernetes_test.go @@ -1655,7 +1655,7 @@ func TestLoadIngressRouteTCPs(t *testing.T) { k8sObjects, crdObjects := readResources(t, test.paths) kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset(crdObjects...) + crdClient := traefikcrdfake.NewClientset(crdObjects...) client := newClientImpl(kubeClient, crdClient) @@ -5728,7 +5728,7 @@ func TestLoadIngressRoutes(t *testing.T) { k8sObjects, crdObjects := readResources(t, test.paths) kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset(crdObjects...) + crdClient := traefikcrdfake.NewClientset(crdObjects...) client := newClientImpl(kubeClient, crdClient) @@ -5810,7 +5810,7 @@ func TestLoadIngressRoutes_multipleEndpointAddresses(t *testing.T) { k8sObjects, crdObjects := readResources(t, []string{"services.yml", "with_multiple_endpointslices.yml"}) kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset(crdObjects...) + crdClient := traefikcrdfake.NewClientset(crdObjects...) client := newClientImpl(kubeClient, crdClient) @@ -6319,7 +6319,7 @@ func TestLoadIngressRouteUDPs(t *testing.T) { k8sObjects, crdObjects := readResources(t, test.paths) kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset(crdObjects...) + crdClient := traefikcrdfake.NewClientset(crdObjects...) client := newClientImpl(kubeClient, crdClient) @@ -7822,7 +7822,7 @@ func TestCrossNamespace(t *testing.T) { k8sObjects, crdObjects := readResources(t, test.paths) kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset(crdObjects...) + crdClient := traefikcrdfake.NewClientset(crdObjects...) client := newClientImpl(kubeClient, crdClient) @@ -8092,7 +8092,7 @@ func TestExternalNameService(t *testing.T) { k8sObjects, crdObjects := readResources(t, test.paths) kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset(crdObjects...) + crdClient := traefikcrdfake.NewClientset(crdObjects...) client := newClientImpl(kubeClient, crdClient) @@ -8274,7 +8274,7 @@ func TestNativeLB(t *testing.T) { k8sObjects, crdObjects := readResources(t, test.paths) kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset(crdObjects...) + crdClient := traefikcrdfake.NewClientset(crdObjects...) client := newClientImpl(kubeClient, crdClient) @@ -8540,7 +8540,7 @@ func TestNodePortLB(t *testing.T) { k8sObjects, crdObjects := readResources(t, test.paths) kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset(crdObjects...) + crdClient := traefikcrdfake.NewClientset(crdObjects...) client := newClientImpl(kubeClient, crdClient) @@ -8581,7 +8581,7 @@ func TestCreateBasicAuthCredentials(t *testing.T) { } kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset() + crdClient := traefikcrdfake.NewClientset() client := newClientImpl(kubeClient, crdClient) @@ -9186,7 +9186,7 @@ func TestGlobalNativeLB(t *testing.T) { } kubeClient := kubefake.NewClientset(k8sObjects...) - crdClient := traefikcrdfake.NewSimpleClientset(crdObjects...) + crdClient := traefikcrdfake.NewClientset(crdObjects...) client := newClientImpl(kubeClient, crdClient) diff --git a/pkg/provider/kubernetes/gateway/kubernetes_test.go b/pkg/provider/kubernetes/gateway/kubernetes_test.go index f08a58fc3..1f5c1df8f 100644 --- a/pkg/provider/kubernetes/gateway/kubernetes_test.go +++ b/pkg/provider/kubernetes/gateway/kubernetes_test.go @@ -71,7 +71,7 @@ NL0leX2m+k218i/LZbBq3k0SBdhMILLXjDpMRiikpQ77mg8KvKf6lftL func TestGatewayClassLabelSelector(t *testing.T) { k8sObjects, gwObjects := readResources(t, []string{"gatewayclass_labelselector.yaml"}) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -2552,7 +2552,7 @@ func TestLoadHTTPRoutes(t *testing.T) { k8sObjects, gwObjects := readResources(t, test.paths) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -3013,7 +3013,7 @@ func TestLoadHTTPRoutes_backendExtensionRef(t *testing.T) { k8sObjects, gwObjects := readResources(t, test.paths) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -3299,7 +3299,7 @@ func TestLoadHTTPRoutes_filterExtensionRef(t *testing.T) { k8sObjects, gwObjects := readResources(t, []string{"services.yml", "httproute/filter_extension_ref.yml"}) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -3591,7 +3591,7 @@ func TestLoadGRPCRoutes_filterExtensionRef(t *testing.T) { k8sObjects, gwObjects := readResources(t, []string{"services.yml", "grpcroute/filter_extension_ref.yml"}) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -4552,7 +4552,7 @@ func TestLoadTCPRoutes(t *testing.T) { k8sObjects, gwObjects := readResources(t, test.paths) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -5831,7 +5831,7 @@ func TestLoadTLSRoutes(t *testing.T) { k8sObjects, gwObjects := readResources(t, test.paths) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -6888,7 +6888,7 @@ func TestLoadMixedRoutes(t *testing.T) { k8sObjects, gwObjects := readResources(t, test.paths) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -7224,7 +7224,7 @@ func TestLoadRoutesWithReferenceGrants(t *testing.T) { k8sObjects, gwObjects := readResources(t, test.paths) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -8129,7 +8129,7 @@ func Test_gatewayAddresses(t *testing.T) { k8sObjects, gwObjects := readResources(t, test.paths) - kubeClient := kubefake.NewSimpleClientset(k8sObjects...) + kubeClient := kubefake.NewClientset(k8sObjects...) gwClient := newGatewaySimpleClientSet(t, gwObjects...) client := newClientImpl(kubeClient, gwClient) @@ -8285,7 +8285,7 @@ func Test_upsertRouteConditionResolvedRefs(t *testing.T) { } } -// We cannot use the gateway-api fake.NewSimpleClientset due to Gateway being pluralized as "gatewaies" instead of "gateways". +// We cannot use the gateway-api fake.NewClientset due to Gateway being pluralized as "gatewaies" instead of "gateways". func newGatewaySimpleClientSet(t *testing.T, objects ...runtime.Object) *gatefake.Clientset { t.Helper() diff --git a/pkg/provider/kubernetes/ingress/client_test.go b/pkg/provider/kubernetes/ingress/client_test.go index 9014265bd..38b7e475b 100644 --- a/pkg/provider/kubernetes/ingress/client_test.go +++ b/pkg/provider/kubernetes/ingress/client_test.go @@ -149,7 +149,7 @@ func TestClientIgnoresHelmOwnedSecrets(t *testing.T) { }, } - kubeClient := kubefake.NewSimpleClientset(helmSecret, secret) + kubeClient := kubefake.NewClientset(helmSecret, secret) discovery, _ := kubeClient.Discovery().(*discoveryfake.FakeDiscovery) discovery.FakedServerVersion = &kversion.Info{ @@ -224,7 +224,7 @@ func TestClientIgnoresEmptyEndpointSliceUpdates(t *testing.T) { }}, } - kubeClient := kubefake.NewSimpleClientset(emptyEndpointSlice, filledEndpointSlice) + kubeClient := kubefake.NewClientset(emptyEndpointSlice, filledEndpointSlice) discovery, _ := kubeClient.Discovery().(*discoveryfake.FakeDiscovery) discovery.FakedServerVersion = &kversion.Info{ diff --git a/script/code-gen.sh b/script/code-gen.sh index 59985a018..3f0112f35 100755 --- a/script/code-gen.sh +++ b/script/code-gen.sh @@ -4,11 +4,11 @@ set -e -o pipefail PROJECT_MODULE="github.com/traefik/traefik" MODULE_VERSION="v3" -KUBE_VERSION=v0.30.10 +KUBE_VERSION=v0.34.3 CURRENT_DIR="$(pwd)" go install "k8s.io/code-generator/cmd/deepcopy-gen@${KUBE_VERSION}" -go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.1 +go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.19.0 CODEGEN_PKG="$(go env GOPATH)/pkg/mod/k8s.io/code-generator@${KUBE_VERSION}" # shellcheck disable=SC1091 # Cannot check source of this file @@ -20,6 +20,7 @@ kube::codegen::gen_helpers \ "${CURRENT_DIR}" kube::codegen::gen_client \ + --with-applyconfig \ --with-watch \ --output-dir "${CURRENT_DIR}/pkg/provider/kubernetes/crd/generated" \ --output-pkg "${PROJECT_MODULE}/${MODULE_VERSION}/pkg/provider/kubernetes/crd/generated" \ From adf47fba316be4fa639ad980e079e5ecbc6b0e33 Mon Sep 17 00:00:00 2001 From: "Gina A." <70909035+gndz07@users.noreply.github.com> Date: Wed, 14 Jan 2026 10:16:04 +0100 Subject: [PATCH 07/13] Make encoded character options opt-in --- cmd/traefik/traefik.go | 8 +- docs/content/migration/v2.md | 27 +++++ .../reference/static-configuration/cli-ref.md | 14 +-- .../reference/static-configuration/env-ref.md | 14 +-- docs/content/routing/entrypoints.md | 105 +++++++++--------- docs/content/security/request-path.md | 23 ++-- .../fixtures/simple_encoded_chars.toml | 10 +- integration/fixtures/websocket/config.toml | 2 - integration/simple_test.go | 12 ++ pkg/config/dynamic/http_config.go | 16 +-- pkg/config/dynamic/zz_generated.deepcopy.go | 6 +- pkg/config/static/entrypoints.go | 10 ++ pkg/server/aggregator.go | 2 +- pkg/server/router/deny.go | 19 ---- pkg/server/router/deny_test.go | 36 ------ pkg/server/router/router.go | 13 +-- pkg/server/router/router_test.go | 27 +---- pkg/server/server_entrypoint_tcp.go | 20 ++++ pkg/server/server_entrypoint_tcp_test.go | 36 ++++++ 19 files changed, 221 insertions(+), 179 deletions(-) diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go index 7900bb21f..1a4de5a39 100644 --- a/cmd/traefik/traefik.go +++ b/cmd/traefik/traefik.go @@ -87,10 +87,10 @@ Complete documentation is available at https://traefik.io`, func runCmd(staticConfiguration *static.Configuration) error { configureLogging(staticConfiguration) - // Display warning to advertise for new behavior of rejecting encoded characters in the request path. - // Deprecated: this has to be removed in the next minor/major version. - log.WithoutContext().Warnf("Starting with v2.11.32, Traefik now rejects some encoded characters in the request path by default. " + - "Refer to the documentation for more details: https://doc.traefik.io/traefik/v2.11/migration/v2/#encoded-characters-in-request-path") + log.WithoutContext().Warn("Traefik can reject some encoded characters in the request path." + + "When your backend is not fully compliant with [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986)," + + "it is recommended to set these options to `false` to avoid split-view situation." + + "Refer to the documentation for more details: https://doc.traefik.io/traefik/v2.11/migration/v2/#encoded-characters-configuration-default-values") http.DefaultTransport.(*http.Transport).Proxy = http.ProxyFromEnvironment diff --git a/docs/content/migration/v2.md b/docs/content/migration/v2.md index a7fa96ffd..325e2ac3b 100644 --- a/docs/content/migration/v2.md +++ b/docs/content/migration/v2.md @@ -737,3 +737,30 @@ Note: This check is not done against query parameters, but only against the request path as defined in [RFC3986 section-3](https://datatracker.ietf.org/doc/html/rfc3986#section-3). Please check out the entrypoint [encodedCharacters option](../routing/entrypoints.md#encoded-characters) documentation for more details. + +## v2.11.35 + +### Encoded Characters Configuration Default Values + +Since `v2.11.35`, the options for encoded characters now have a `true` default value. +This means that Traefik will not reject requests with a path containing a specific set of encoded characters by default. +It is now up to the users to configure the security hardening of encoded characters. + +Here is the list of the encoded characters that can be configured to `false` to disallow them: + +| Encoded Character | Character | Config options | Default value | +|-------------------|-------------------------|--------------------------------------------------------------------------------------|---------------| +| `%2f` or `%2F` | `/` (slash) | `entryPoints.`
`.http.encodedCharacters`
`.allowEncodedSlash` | `true` | +| `%5c` or `%5C` | `\` (backslash) | `entryPoints..`
`.http.encodedCharacters`
`.allowEncodedBackSlash` | `true` | +| `%00` | `NULL` (null character) | `entryPoints..`
`.http.encodedCharacters`
`.allowEncodedNullCharacter` | `true` | +| `%3b` or `%3B` | `;` (semicolon) | `entryPoints..`
`.http.encodedCharacters`
`.allowEncodedSemicolon` | `true` | +| `%25` | `%` (percent) | `entryPoints..`
`.http.encodedCharacters`
`.allowEncodedPercent` | `true` | +| `%3f` or `%3F` | `?` (question mark) | `entryPoints..`
`.http.encodedCharacters`
`.allowEncodedQuestionMark` | `true` | +| `%23` | `#` (hash) | `entryPoints..`
`.http.encodedCharacters`
`.allowEncodedHash` | `true` | + +Note: This check is not done against query parameters, +but only against the request path as defined +in [RFC3986 section-3](https://datatracker.ietf.org/doc/html/rfc3986#section-3). + +Please check out the entrypoint [encodedCharacters option](../routing/entrypoints.md#encoded-characters) documentation +for more details. diff --git a/docs/content/reference/static-configuration/cli-ref.md b/docs/content/reference/static-configuration/cli-ref.md index b9fd73d71..cec0dafd3 100644 --- a/docs/content/reference/static-configuration/cli-ref.md +++ b/docs/content/reference/static-configuration/cli-ref.md @@ -124,25 +124,25 @@ Trust only forwarded headers from selected IPs. HTTP configuration. `--entrypoints..http.encodedcharacters.allowencodedbackslash`: -Defines whether requests with encoded back slash characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded back slash characters in the path are allowed. (Default: ```true```) `--entrypoints..http.encodedcharacters.allowencodedhash`: -Defines whether requests with encoded hash characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded hash characters in the path are allowed. (Default: ```true```) `--entrypoints..http.encodedcharacters.allowencodednullcharacter`: -Defines whether requests with encoded null characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded null characters in the path are allowed. (Default: ```true```) `--entrypoints..http.encodedcharacters.allowencodedpercent`: -Defines whether requests with encoded percent characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded percent characters in the path are allowed. (Default: ```true```) `--entrypoints..http.encodedcharacters.allowencodedquestionmark`: -Defines whether requests with encoded question mark characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded question mark characters in the path are allowed. (Default: ```true```) `--entrypoints..http.encodedcharacters.allowencodedsemicolon`: -Defines whether requests with encoded semicolon characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded semicolon characters in the path are allowed. (Default: ```true```) `--entrypoints..http.encodedcharacters.allowencodedslash`: -Defines whether requests with encoded slash characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded slash characters in the path are allowed. (Default: ```true```) `--entrypoints..http.encodequerysemicolons`: Defines whether request query semicolons should be URLEncoded. (Default: ```false```) diff --git a/docs/content/reference/static-configuration/env-ref.md b/docs/content/reference/static-configuration/env-ref.md index 51be942b0..6947150fa 100644 --- a/docs/content/reference/static-configuration/env-ref.md +++ b/docs/content/reference/static-configuration/env-ref.md @@ -133,25 +133,25 @@ HTTP/3 configuration. (Default: ```false```) UDP port to advertise, on which HTTP/3 is available. (Default: ```0```) `TRAEFIK_ENTRYPOINTS__HTTP_ENCODEDCHARACTERS_ALLOWENCODEDBACKSLASH`: -Defines whether requests with encoded back slash characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded back slash characters in the path are allowed. (Default: ```true```) `TRAEFIK_ENTRYPOINTS__HTTP_ENCODEDCHARACTERS_ALLOWENCODEDHASH`: -Defines whether requests with encoded hash characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded hash characters in the path are allowed. (Default: ```true```) `TRAEFIK_ENTRYPOINTS__HTTP_ENCODEDCHARACTERS_ALLOWENCODEDNULLCHARACTER`: -Defines whether requests with encoded null characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded null characters in the path are allowed. (Default: ```true```) `TRAEFIK_ENTRYPOINTS__HTTP_ENCODEDCHARACTERS_ALLOWENCODEDPERCENT`: -Defines whether requests with encoded percent characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded percent characters in the path are allowed. (Default: ```true```) `TRAEFIK_ENTRYPOINTS__HTTP_ENCODEDCHARACTERS_ALLOWENCODEDQUESTIONMARK`: -Defines whether requests with encoded question mark characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded question mark characters in the path are allowed. (Default: ```true```) `TRAEFIK_ENTRYPOINTS__HTTP_ENCODEDCHARACTERS_ALLOWENCODEDSEMICOLON`: -Defines whether requests with encoded semicolon characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded semicolon characters in the path are allowed. (Default: ```true```) `TRAEFIK_ENTRYPOINTS__HTTP_ENCODEDCHARACTERS_ALLOWENCODEDSLASH`: -Defines whether requests with encoded slash characters in the path are allowed. (Default: ```false```) +Defines whether requests with encoded slash characters in the path are allowed. (Default: ```true```) `TRAEFIK_ENTRYPOINTS__HTTP_ENCODEQUERYSEMICOLONS`: Defines whether request query semicolons should be URLEncoded. (Default: ```false```) diff --git a/docs/content/routing/entrypoints.md b/docs/content/routing/entrypoints.md index 02ad3d79d..d6126df56 100644 --- a/docs/content/routing/entrypoints.md +++ b/docs/content/routing/entrypoints.md @@ -129,13 +129,13 @@ They can be defined by using a file (YAML or TOML) or CLI arguments. - "192.168.0.1" http: encodedCharacters: - allowEncodedSlash: true - allowEncodedBackSlash: true - allowEncodedNullCharacter: true - allowEncodedSemicolon: true - allowEncodedPercent: true - allowEncodedQuestionMark: true - allowEncodedHash: true + allowEncodedSlash: false + allowEncodedBackSlash: false + allowEncodedNullCharacter: false + allowEncodedSemicolon: false + allowEncodedPercent: false + allowEncodedQuestionMark: false + allowEncodedHash: false ``` ```toml tab="File (TOML)" @@ -162,13 +162,13 @@ They can be defined by using a file (YAML or TOML) or CLI arguments. insecure = true trustedIPs = ["127.0.0.1", "192.168.0.1"] [entryPoints.name.http.encodedCharacters] - allowEncodedSlash = true - allowEncodedBackSlash = true - allowEncodedNullCharacter = true - allowEncodedSemicolon = true - allowEncodedPercent = true - allowEncodedQuestionMark = true - allowEncodedHash = true + allowEncodedSlash = false + allowEncodedBackSlash = false + allowEncodedNullCharacter = false + allowEncodedSemicolon = false + allowEncodedPercent = false + allowEncodedQuestionMark = false + allowEncodedHash = false ``` ```bash tab="CLI" @@ -185,13 +185,13 @@ They can be defined by using a file (YAML or TOML) or CLI arguments. --entryPoints.name.proxyProtocol.trustedIPs=127.0.0.1,192.168.0.1 --entryPoints.name.forwardedHeaders.insecure=true --entryPoints.name.forwardedHeaders.trustedIPs=127.0.0.1,192.168.0.1 - --entryPoints.name.http.encodedCharacters.allowEncodedSlash=true - --entryPoints.name.http.encodedCharacters.allowEncodedBackSlash=true - --entryPoints.name.http.encodedCharacters.allowEncodedNullCharacter=true - --entryPoints.name.http.encodedCharacters.allowEncodedSemicolon=true - --entryPoints.name.http.encodedCharacters.allowEncodedPercent=true - --entryPoints.name.http.encodedCharacters.allowEncodedQuestionMark=true - --entryPoints.name.http.encodedCharacters.allowEncodedHash=true + --entryPoints.name.http.encodedCharacters.allowEncodedSlash=false + --entryPoints.name.http.encodedCharacters.allowEncodedBackSlash=false + --entryPoints.name.http.encodedCharacters.allowEncodedNullCharacter=false + --entryPoints.name.http.encodedCharacters.allowEncodedSemicolon=false + --entryPoints.name.http.encodedCharacters.allowEncodedPercent=false + --entryPoints.name.http.encodedCharacters.allowEncodedQuestionMark=false + --entryPoints.name.http.encodedCharacters.allowEncodedHash=false ``` ### Address @@ -1021,20 +1021,21 @@ entryPoints: ### Encoded Characters You can configure Traefik to control the handling of encoded characters in request paths for security purposes. -By default, Traefik rejects requests with path containing certain encoded characters that could be used in path traversal or other security attacks. +By default, Traefik do not reject requests with path containing certain encoded characters that could be used in path traversal or other security attacks. !!! info This check is not done against the request query parameters, but only against the request path as defined in [RFC3986 section-3](https://datatracker.ietf.org/doc/html/rfc3986#section-3). -!!! warning "Security Considerations" +!!! info "Security Considerations" - Allowing certain encoded characters may expose your application to security vulnerabilities. + When your backend is not fully compliant with [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986) and notably decode encoded reserved characters in the requets path, + it is recommended to set these options to `false` to avoid split-view situation and helps prevent path traversal attacks or other malicious attempts to bypass security controls. ??? info "`encodedCharacters.allowEncodedSlash`" - _Optional, Default=false_ + _Optional, Default=true_ Controls whether requests with encoded slash characters (`%2F` or `%2f`) in the path are allowed. @@ -1045,7 +1046,7 @@ By default, Traefik rejects requests with path containing certain encoded charac address: ":80" http: encodedCharacters: - allowEncodedSlash: true + allowEncodedSlash: false ``` ```toml tab="File (TOML)" @@ -1055,18 +1056,18 @@ By default, Traefik rejects requests with path containing certain encoded charac address = ":80" [entryPoints.web.http.encodedCharacters] - allowEncodedSlash = true + allowEncodedSlash = false ``` ```bash tab="CLI" ## Static configuration --entryPoints.web.address=:80 - --entryPoints.web.http.encodedCharacters.allowEncodedSlash=true + --entryPoints.web.http.encodedCharacters.allowEncodedSlash=false ``` ??? info "`encodedCharacters.allowEncodedBackSlash`" - _Optional, Default=false_ + _Optional, Default=true_ Controls whether requests with encoded back slash characters (`%5C` or `%5c`) in the path are allowed. @@ -1077,7 +1078,7 @@ By default, Traefik rejects requests with path containing certain encoded charac address: ":80" http: encodedCharacters: - allowEncodedBackSlash: true + allowEncodedBackSlash: false ``` ```toml tab="File (TOML)" @@ -1087,18 +1088,18 @@ By default, Traefik rejects requests with path containing certain encoded charac address = ":80" [entryPoints.web.http.encodedCharacters] - allowEncodedBackSlash = true + allowEncodedBackSlash = false ``` ```bash tab="CLI" ## Static configuration --entryPoints.web.address=:80 - --entryPoints.web.http.encodedCharacters.allowEncodedBackSlash=true + --entryPoints.web.http.encodedCharacters.allowEncodedBackSlash=false ``` ??? info "`encodedCharacters.allowEncodedNullCharacter`" - _Optional, Default=false_ + _Optional, Default=true_ Controls whether requests with encoded null characters (`%00`) in the path are allowed. @@ -1109,7 +1110,7 @@ By default, Traefik rejects requests with path containing certain encoded charac address: ":80" http: encodedCharacters: - allowEncodedNullCharacter: true + allowEncodedNullCharacter: false ``` ```toml tab="File (TOML)" @@ -1119,18 +1120,18 @@ By default, Traefik rejects requests with path containing certain encoded charac address = ":80" [entryPoints.web.http.encodedCharacters] - allowEncodedNullCharacter = true + allowEncodedNullCharacter = false ``` ```bash tab="CLI" ## Static configuration --entryPoints.web.address=:80 - --entryPoints.web.http.encodedCharacters.allowEncodedNullCharacter=true + --entryPoints.web.http.encodedCharacters.allowEncodedNullCharacter=false ``` ??? info "`encodedCharacters.allowEncodedSemicolon`" - _Optional, Default=false_ + _Optional, Default=true_ Controls whether requests with encoded semicolon characters (`%3B` or `%3b`) in the path are allowed. @@ -1141,7 +1142,7 @@ By default, Traefik rejects requests with path containing certain encoded charac address: ":80" http: encodedCharacters: - allowEncodedSemicolon: true + allowEncodedSemicolon: false ``` ```toml tab="File (TOML)" @@ -1151,18 +1152,18 @@ By default, Traefik rejects requests with path containing certain encoded charac address = ":80" [entryPoints.web.http.encodedCharacters] - allowEncodedSemicolon = true + allowEncodedSemicolon = false ``` ```bash tab="CLI" ## Static configuration --entryPoints.web.address=:80 - --entryPoints.web.http.encodedCharacters.allowEncodedSemicolon=true + --entryPoints.web.http.encodedCharacters.allowEncodedSemicolon=false ``` ??? info "`encodedCharacters.allowEncodedPercent`" - _Optional, Default=false_ + _Optional, Default=true_ Controls whether requests with encoded percent characters (`%25`) in the path are allowed. @@ -1173,7 +1174,7 @@ By default, Traefik rejects requests with path containing certain encoded charac address: ":80" http: encodedCharacters: - allowEncodedPercent: true + allowEncodedPercent: false ``` ```toml tab="File (TOML)" @@ -1183,18 +1184,18 @@ By default, Traefik rejects requests with path containing certain encoded charac address = ":80" [entryPoints.web.http.encodedCharacters] - allowEncodedPercent = true + allowEncodedPercent = false ``` ```bash tab="CLI" ## Static configuration --entryPoints.web.address=:80 - --entryPoints.web.http.encodedCharacters.allowEncodedPercent=true + --entryPoints.web.http.encodedCharacters.allowEncodedPercent=false ``` ??? info "`encodedCharacters.allowEncodedQuestionMark`" - _Optional, Default=false_ + _Optional, Default=true_ Controls whether requests with encoded question mark characters (`%3F` or `%3f`) in the path are allowed. @@ -1205,7 +1206,7 @@ By default, Traefik rejects requests with path containing certain encoded charac address: ":80" http: encodedCharacters: - allowEncodedQuestionMark: true + allowEncodedQuestionMark: false ``` ```toml tab="File (TOML)" @@ -1215,18 +1216,18 @@ By default, Traefik rejects requests with path containing certain encoded charac address = ":80" [entryPoints.web.http.encodedCharacters] - allowEncodedQuestionMark = true + allowEncodedQuestionMark = false ``` ```bash tab="CLI" ## Static configuration --entryPoints.web.address=:80 - --entryPoints.web.http.encodedCharacters.allowEncodedQuestionMark=true + --entryPoints.web.http.encodedCharacters.allowEncodedQuestionMark=false ``` ??? info "`encodedCharacters.allowEncodedHash`" - _Optional, Default=false_ + _Optional, Default=true_ Controls whether requests with encoded hash characters (`%23`) in the path are allowed. @@ -1237,7 +1238,7 @@ By default, Traefik rejects requests with path containing certain encoded charac address: ":80" http: encodedCharacters: - allowEncodedHash: true + allowEncodedHash: false ``` ```toml tab="File (TOML)" @@ -1247,13 +1248,13 @@ By default, Traefik rejects requests with path containing certain encoded charac address = ":80" [entryPoints.web.http.encodedCharacters] - allowEncodedHash = true + allowEncodedHash = false ``` ```bash tab="CLI" ## Static configuration --entryPoints.web.address=:80 - --entryPoints.web.http.encodedCharacters.allowEncodedHash=true + --entryPoints.web.http.encodedCharacters.allowEncodedHash=false ``` ### SanitizePath diff --git a/docs/content/security/request-path.md b/docs/content/security/request-path.md index 464391356..fe88c3142 100644 --- a/docs/content/security/request-path.md +++ b/docs/content/security/request-path.md @@ -20,7 +20,7 @@ When Traefik receives an HTTP request, it processes the request path through sev Traefik inspects the path for potentially dangerous encoded characters and rejects requests containing them unless explicitly allowed. -Here is the list of the encoded characters that are rejected by default: +Here is the list of the encoded characters that are allowed by default: | Encoded Character | Character | |-------------------|-------------------------| @@ -87,7 +87,12 @@ Configure it in the [EntryPoints](../routing/entrypoints.md#encoded-characters) This filtering occurs before path sanitization and catches attack attempts that use encoding to bypass other security controls. -All encoded character filtering is enabled by default (`false` means encoded characters are rejected), providing maximum security: +All encoded character filtering is disabled by default (`true` means encoded characters are allowed). + +!!! info "Security Considerations" + + When your backend is not fully compliant with [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986) and notably decode encoded reserved characters in the requets path, + it is recommended to set these options to `false` to avoid split-view situation and helps prevent path traversal attacks or other malicious attempts to bypass security controls. ```yaml tab="File (YAML)" entryPoints: @@ -95,13 +100,13 @@ entryPoints: address: ":443" http: encodedCharacters: - allowEncodedSlash: false # %2F - Default: false (RECOMMENDED) - allowEncodedBackSlash: false # %5C - Default: false (RECOMMENDED) - allowEncodedNullCharacter: false # %00 - Default: false (RECOMMENDED) - allowEncodedSemicolon: false # %3B - Default: false (RECOMMENDED) - allowEncodedPercent: false # %25 - Default: false (RECOMMENDED) - allowEncodedQuestionMark: false # %3F - Default: false (RECOMMENDED) - allowEncodedHash: false # %23 - Default: false (RECOMMENDED) + allowEncodedSlash: false # %2F - Default: true + allowEncodedBackSlash: false # %5C - Default: true + allowEncodedNullCharacter: false # %00 - Default: true + allowEncodedSemicolon: false # %3B - Default: true + allowEncodedPercent: false # %25 - Default: true + allowEncodedQuestionMark: false # %3F - Default: true + allowEncodedHash: false # %23 - Default: true ``` ```toml tab="File (TOML)" diff --git a/integration/fixtures/simple_encoded_chars.toml b/integration/fixtures/simple_encoded_chars.toml index 56f645ca3..669c60b9b 100644 --- a/integration/fixtures/simple_encoded_chars.toml +++ b/integration/fixtures/simple_encoded_chars.toml @@ -8,12 +8,18 @@ [entryPoints] [entryPoints.strict] address = ":8000" - # Default: no encoded characters allowed + [entryPoints.strict.http.encodedCharacters] + allowEncodedSlash = false [entryPoints.permissive] address = ":8001" + # No config, default values should apply + + [entryPoints.permissive2] + address = ":8002" + # No config for allowEncodedSlash, default value is effectively true [entryPoints.permissive.http.encodedCharacters] - allowEncodedSlash = true + allowEncodedBackSlash = false [api] insecure = true diff --git a/integration/fixtures/websocket/config.toml b/integration/fixtures/websocket/config.toml index c4a25c48b..83a499ce7 100644 --- a/integration/fixtures/websocket/config.toml +++ b/integration/fixtures/websocket/config.toml @@ -8,8 +8,6 @@ [entryPoints] [entryPoints.web] address = ":8000" - [entryPoints.web.http.encodedCharacters] - allowEncodedSlash = true [api] insecure = true diff --git a/integration/simple_test.go b/integration/simple_test.go index 2b85b8e2c..c2f1392c4 100644 --- a/integration/simple_test.go +++ b/integration/simple_test.go @@ -1520,6 +1520,12 @@ func (s *SimpleSuite) TestEncodedCharactersDifferentEntryPoints() { target: "127.0.0.1:8001", // permissive entry point expected: http.StatusOK, }, + { + desc: "Encoded slash should be ALLOWED on permissive2 entry point", + request: "GET /path%2Fwith%2Fslash HTTP/1.1\r\nHost: test.localhost\r\n\r\n", + target: "127.0.0.1:8002", // permissive2 entry point + expected: http.StatusOK, + }, { desc: "Regular path should work on strict entry point", request: "GET /regular/path HTTP/1.1\r\nHost: test.localhost\r\n\r\n", @@ -1532,6 +1538,12 @@ func (s *SimpleSuite) TestEncodedCharactersDifferentEntryPoints() { target: "127.0.0.1:8001", expected: http.StatusOK, }, + { + desc: "Regular path should work on permissive2 entry point", + request: "GET /regular/path HTTP/1.1\r\nHost: test.localhost\r\n\r\n", + target: "127.0.0.1:8002", + expected: http.StatusOK, + }, } for _, test := range testCases { diff --git a/pkg/config/dynamic/http_config.go b/pkg/config/dynamic/http_config.go index 3bd9c4364..d397d2306 100644 --- a/pkg/config/dynamic/http_config.go +++ b/pkg/config/dynamic/http_config.go @@ -43,14 +43,14 @@ type Service struct { // Router holds the router configuration. type Router struct { - EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty" export:"true"` - Middlewares []string `json:"middlewares,omitempty" toml:"middlewares,omitempty" yaml:"middlewares,omitempty" export:"true"` - Service string `json:"service,omitempty" toml:"service,omitempty" yaml:"service,omitempty" export:"true"` - Rule string `json:"rule,omitempty" toml:"rule,omitempty" yaml:"rule,omitempty"` - Priority int `json:"priority,omitempty" toml:"priority,omitempty,omitzero" yaml:"priority,omitempty" export:"true"` - TLS *RouterTLSConfig `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" label:"allowEmpty" file:"allowEmpty" kv:"allowEmpty" export:"true"` - DefaultRule bool `json:"-" toml:"-" yaml:"-" label:"-" file:"-"` - DeniedEncodedPathCharacters RouterDeniedEncodedPathCharacters `json:"-" toml:"-" yaml:"-" label:"-" file:"-"` + EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty" export:"true"` + Middlewares []string `json:"middlewares,omitempty" toml:"middlewares,omitempty" yaml:"middlewares,omitempty" export:"true"` + Service string `json:"service,omitempty" toml:"service,omitempty" yaml:"service,omitempty" export:"true"` + Rule string `json:"rule,omitempty" toml:"rule,omitempty" yaml:"rule,omitempty"` + Priority int `json:"priority,omitempty" toml:"priority,omitempty,omitzero" yaml:"priority,omitempty" export:"true"` + TLS *RouterTLSConfig `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" label:"allowEmpty" file:"allowEmpty" kv:"allowEmpty" export:"true"` + DefaultRule bool `json:"-" toml:"-" yaml:"-" label:"-" file:"-"` + DeniedEncodedPathCharacters *RouterDeniedEncodedPathCharacters `json:"-" toml:"-" yaml:"-" label:"-" file:"-" kv:"-"` } // +k8s:deepcopy-gen=true diff --git a/pkg/config/dynamic/zz_generated.deepcopy.go b/pkg/config/dynamic/zz_generated.deepcopy.go index 068300ab8..b8f68c946 100644 --- a/pkg/config/dynamic/zz_generated.deepcopy.go +++ b/pkg/config/dynamic/zz_generated.deepcopy.go @@ -1035,7 +1035,11 @@ func (in *Router) DeepCopyInto(out *Router) { *out = new(RouterTLSConfig) (*in).DeepCopyInto(*out) } - out.DeniedEncodedPathCharacters = in.DeniedEncodedPathCharacters + if in.DeniedEncodedPathCharacters != nil { + in, out := &in.DeniedEncodedPathCharacters, &out.DeniedEncodedPathCharacters + *out = new(RouterDeniedEncodedPathCharacters) + **out = **in + } return } diff --git a/pkg/config/static/entrypoints.go b/pkg/config/static/entrypoints.go index 29f37fa13..ad9863643 100644 --- a/pkg/config/static/entrypoints.go +++ b/pkg/config/static/entrypoints.go @@ -84,6 +84,16 @@ type EncodedCharacters struct { AllowEncodedHash bool `description:"Defines whether requests with encoded hash characters in the path are allowed." json:"allowEncodedHash,omitempty" toml:"allowEncodedHash,omitempty" yaml:"allowEncodedHash,omitempty" export:"true"` } +func (ec *EncodedCharacters) SetDefaults() { + ec.AllowEncodedSlash = true + ec.AllowEncodedBackSlash = true + ec.AllowEncodedNullCharacter = true + ec.AllowEncodedSemicolon = true + ec.AllowEncodedPercent = true + ec.AllowEncodedQuestionMark = true + ec.AllowEncodedHash = true +} + // HTTP2Config is the HTTP2 configuration of an entry point. type HTTP2Config struct { MaxConcurrentStreams int32 `description:"Specifies the number of concurrent streams per connection that each client is allowed to initiate." json:"maxConcurrentStreams,omitempty" toml:"maxConcurrentStreams,omitempty" yaml:"maxConcurrentStreams,omitempty" export:"true"` diff --git a/pkg/server/aggregator.go b/pkg/server/aggregator.go index 697fe3cf8..28d07dda9 100644 --- a/pkg/server/aggregator.go +++ b/pkg/server/aggregator.go @@ -167,7 +167,7 @@ func applyModel(cfg dynamic.Configuration) dynamic.Configuration { if m.DeniedEncodedPathCharacters != nil { // As the denied encoded path characters option is not configurable at the router level, // we can simply copy the whole structure to override the router's default config. - cp.DeniedEncodedPathCharacters = *m.DeniedEncodedPathCharacters + cp.DeniedEncodedPathCharacters = m.DeniedEncodedPathCharacters } rtName := name diff --git a/pkg/server/router/deny.go b/pkg/server/router/deny.go index 9c64af119..423fdb696 100644 --- a/pkg/server/router/deny.go +++ b/pkg/server/router/deny.go @@ -2,29 +2,10 @@ package router import ( "net/http" - "strings" "github.com/traefik/traefik/v2/pkg/log" ) -// denyFragment rejects the request if the URL path contains a fragment (hash character). -// When go receives an HTTP request, it assumes the absence of fragment URL. -// However, it is still possible to send a fragment in the request. -// In this case, Traefik will encode the '#' character, altering the request's intended meaning. -// To avoid this behavior, the following function rejects requests that include a fragment in the URL. -func denyFragment(h http.Handler) http.Handler { - return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - if strings.Contains(req.URL.RawPath, "#") { - log.WithoutContext().Debugf("Rejecting request because it contains a fragment in the URL path: %s", req.URL.RawPath) - rw.WriteHeader(http.StatusBadRequest) - - return - } - - h.ServeHTTP(rw, req) - }) -} - // denyEncodedPathCharacters reject the request if the escaped path contains encoded characters in the given list. func denyEncodedPathCharacters(encodedCharacters map[string]struct{}, h http.Handler) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { diff --git a/pkg/server/router/deny_test.go b/pkg/server/router/deny_test.go index 19ece6013..de17fe5fc 100644 --- a/pkg/server/router/deny_test.go +++ b/pkg/server/router/deny_test.go @@ -8,42 +8,6 @@ import ( "github.com/stretchr/testify/assert" ) -func Test_denyFragment(t *testing.T) { - tests := []struct { - name string - url string - wantStatus int - }{ - { - name: "Rejects fragment character", - url: "http://example.com/#", - wantStatus: http.StatusBadRequest, - }, - { - name: "Allows without fragment", - url: "http://example.com/", - wantStatus: http.StatusOK, - }, - } - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - t.Parallel() - - handler := denyFragment(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - })) - - req := httptest.NewRequest(http.MethodGet, test.url, nil) - res := httptest.NewRecorder() - - handler.ServeHTTP(res, req) - - assert.Equal(t, test.wantStatus, res.Code) - }) - } -} - func Test_denyEncodedPathCharacters(t *testing.T) { tests := []struct { name string diff --git a/pkg/server/router/router.go b/pkg/server/router/router.go index 2d46f7388..f01210bfa 100644 --- a/pkg/server/router/router.go +++ b/pkg/server/router/router.go @@ -223,14 +223,11 @@ func (m *Manager) buildHTTPHandler(ctx context.Context, router *runtime.RouterIn chain = chain.Append(denyrouterrecursion.WrapHandler(routerName)) } - // Here we are adding deny handlers for encoded path characters and fragment. - // Deny handler are only added for root routers, child routers are protected by their parent router deny handlers. - chain = chain.Append(func(next http.Handler) (http.Handler, error) { - return denyFragment(next), nil - }) - chain = chain.Append(func(next http.Handler) (http.Handler, error) { - return denyEncodedPathCharacters(router.DeniedEncodedPathCharacters.Map(), next), nil - }) + if router.DeniedEncodedPathCharacters != nil { + chain = chain.Append(func(next http.Handler) (http.Handler, error) { + return denyEncodedPathCharacters(router.DeniedEncodedPathCharacters.Map(), next), nil + }) + } return chain.Extend(*mHandler).Append(tHandler).Then(sHandler) } diff --git a/pkg/server/router/router_test.go b/pkg/server/router/router_test.go index 1c669cf09..add135bc5 100644 --- a/pkg/server/router/router_test.go +++ b/pkg/server/router/router_test.go @@ -910,13 +910,16 @@ func TestManager_BuildHandlers_Deny(t *testing.T) { expectedStatusCode int }{ { - desc: "unallowed request with encoded slash", + desc: "disallow request with encoded slash", requestPath: "/foo%2F", routers: map[string]*dynamic.Router{ "parent": { EntryPoints: []string{"web"}, Rule: "PathPrefix(`/`)", Service: "service", + DeniedEncodedPathCharacters: &dynamic.RouterDeniedEncodedPathCharacters{ + AllowEncodedSlash: false, + }, }, }, services: map[string]*dynamic.Service{ @@ -936,9 +939,6 @@ func TestManager_BuildHandlers_Deny(t *testing.T) { EntryPoints: []string{"web"}, Rule: "PathPrefix(`/`)", Service: "service", - DeniedEncodedPathCharacters: dynamic.RouterDeniedEncodedPathCharacters{ - AllowEncodedSlash: true, - }, }, }, services: map[string]*dynamic.Service{ @@ -950,25 +950,6 @@ func TestManager_BuildHandlers_Deny(t *testing.T) { }, expectedStatusCode: http.StatusBadGateway, }, - { - desc: "unallowed request with fragment", - requestPath: "/foo#", - routers: map[string]*dynamic.Router{ - "parent": { - EntryPoints: []string{"web"}, - Rule: "PathPrefix(`/`)", - Service: "service", - }, - }, - services: map[string]*dynamic.Service{ - "service": { - LoadBalancer: &dynamic.ServersLoadBalancer{ - Servers: []dynamic.Server{{URL: "http://localhost:8080"}}, - }, - }, - }, - expectedStatusCode: http.StatusBadRequest, - }, } for _, test := range testCases { diff --git a/pkg/server/server_entrypoint_tcp.go b/pkg/server/server_entrypoint_tcp.go index 51b946c09..47d5c941c 100644 --- a/pkg/server/server_entrypoint_tcp.go +++ b/pkg/server/server_entrypoint_tcp.go @@ -606,6 +606,8 @@ func createHTTPServer(ctx context.Context, ln net.Listener, configuration *stati handler = normalizePath(handler) + handler = denyFragment(handler) + serverHTTP := &http.Server{ Protocols: &protocols, Handler: handler, @@ -685,6 +687,24 @@ func (t *trackedConnection) Close() error { return t.WriteCloser.Close() } +// denyFragment rejects the request if the URL path contains a fragment (hash character). +// When go receives an HTTP request, it assumes the absence of fragment URL. +// However, it is still possible to send a fragment in the request. +// In this case, Traefik will encode the '#' character, altering the request's intended meaning. +// To avoid this behavior, the following function rejects requests that include a fragment in the URL. +func denyFragment(h http.Handler) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { + if strings.Contains(req.URL.RawPath, "#") { + log.WithoutContext().Debugf("Rejecting request because it contains a fragment in the URL path: %s", req.URL.RawPath) + rw.WriteHeader(http.StatusBadRequest) + + return + } + + h.ServeHTTP(rw, req) + }) +} + // This function is inspired by http.AllowQuerySemicolons. func encodeQuerySemicolons(h http.Handler) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { diff --git a/pkg/server/server_entrypoint_tcp_test.go b/pkg/server/server_entrypoint_tcp_test.go index 3a56856b3..dbcde6b00 100644 --- a/pkg/server/server_entrypoint_tcp_test.go +++ b/pkg/server/server_entrypoint_tcp_test.go @@ -388,6 +388,42 @@ func TestKeepAliveH2c(t *testing.T) { require.Contains(t, err.Error(), "use of closed network connection") } +func Test_denyFragment(t *testing.T) { + tests := []struct { + name string + url string + wantStatus int + }{ + { + name: "Rejects fragment character", + url: "http://example.com/#", + wantStatus: http.StatusBadRequest, + }, + { + name: "Allows without fragment", + url: "http://example.com/", + wantStatus: http.StatusOK, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + + handler := denyFragment(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + })) + + req := httptest.NewRequest(http.MethodGet, test.url, nil) + res := httptest.NewRecorder() + + handler.ServeHTTP(res, req) + + assert.Equal(t, test.wantStatus, res.Code) + }) + } +} + func TestSanitizePath(t *testing.T) { tests := []struct { path string From 9e5d4ba5a1cdcf3465630cef858945f90f6b4279 Mon Sep 17 00:00:00 2001 From: Kevin Pollet Date: Wed, 14 Jan 2026 10:28:04 +0100 Subject: [PATCH 08/13] Prepare release v2.11.35 --- CHANGELOG.md | 7 +++++++ script/gcg/traefik-bugfix.toml | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9930ef14d..3e1736b31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [v2.11.35](https://github.com/traefik/traefik/tree/v2.11.35) (2026-01-14) +[All Commits](https://github.com/traefik/traefik/compare/v2.11.34...v2.11.35) + +**Bug fixes:** +- **[acme]** Add timeout to ACME-TLS/1 challenge handshake ([#12516](https://github.com/traefik/traefik/pull/12516) by [LBF38](https://github.com/LBF38)) +- **[server]** Make encoded character options opt-in ([#12540](https://github.com/traefik/traefik/pull/12540) by [gndz07](https://github.com/gndz07)) + ## [v2.11.34](https://github.com/traefik/traefik/tree/v2.11.34) (2025-12-23) [All Commits](https://github.com/traefik/traefik/compare/v2.11.33...v2.11.34) diff --git a/script/gcg/traefik-bugfix.toml b/script/gcg/traefik-bugfix.toml index cdb8a357f..640bbc3ea 100644 --- a/script/gcg/traefik-bugfix.toml +++ b/script/gcg/traefik-bugfix.toml @@ -4,11 +4,11 @@ RepositoryName = "traefik" OutputType = "file" FileName = "traefik_changelog.md" -# example new bugfix v2.11.34 +# example new bugfix v2.11.35 CurrentRef = "v2.11" -PreviousRef = "v2.11.33" +PreviousRef = "v2.11.34" BaseBranch = "v2.11" -FutureCurrentRefName = "v2.11.34" +FutureCurrentRefName = "v2.11.35" ThresholdPreviousRef = 10000 ThresholdCurrentRef = 10000 From 17283643416ef8e830565ce40d3d3d7cc453e68e Mon Sep 17 00:00:00 2001 From: Kevin Pollet Date: Wed, 14 Jan 2026 14:56:04 +0100 Subject: [PATCH 09/13] Prepare release v3.6.7 --- CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ script/gcg/traefik-bugfix.toml | 6 +++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55b55ba1f..135a288b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,33 @@ +## [v3.6.7](https://github.com/traefik/traefik/tree/v3.6.7) (2026-01-14) +[All Commits](https://github.com/traefik/traefik/compare/v3.6.6...v3.6.7) + +**Bug fixes:** +- **[acme]** Bump github.com/go-acme/lego/v4 to v4.31.0 ([#12529](https://github.com/traefik/traefik/pull/12529) by [ldez](https://github.com/ldez)) +- **[acme]** Add missing renew options ([#12467](https://github.com/traefik/traefik/pull/12467) by [ldez](https://github.com/ldez)) +- **[acme]** Replace hardcoded references to LetsEncrypt in log messages ([#12464](https://github.com/traefik/traefik/pull/12464) by [schildbach](https://github.com/schildbach)) +- **[k8s/ingress-nginx]** Fix use-regex nginx annotation ([#12531](https://github.com/traefik/traefik/pull/12531) by [LBF38](https://github.com/LBF38)) +- **[k8s/ingress-nginx]** Prevent Ingress Nginx provider http router to attach to an entrypoint with TLS ([#12528](https://github.com/traefik/traefik/pull/12528) by [rtribotte](https://github.com/rtribotte)) +- **[k8s/ingress]** Fix panic for empty defaultBackend and defaultBackend without resources ([#12509](https://github.com/traefik/traefik/pull/12509) by [gndz07](https://github.com/gndz07)) +- **[k8s]** Fix condition used for serving and fenced endpoints ([#12521](https://github.com/traefik/traefik/pull/12521) by [LBF38](https://github.com/LBF38)) +- **[webui]** Validate X-Forwarded-Prefix value for dashboard redirect ([#12514](https://github.com/traefik/traefik/pull/12514) by [LBF38](https://github.com/LBF38)) +- **[acme]** Add timeout to ACME-TLS/1 challenge handshake ([#12516](https://github.com/traefik/traefik/pull/12516) by [LBF38](https://github.com/LBF38)) +- **[server]** Make encoded character options opt-in ([#12540](https://github.com/traefik/traefik/pull/12540) by [gndz07](https://github.com/gndz07)) + +**Documentation:** +- **[docker/swarm]** Update swarm.md traefik version ([#12508](https://github.com/traefik/traefik/pull/12508) by [DBouraoui](https://github.com/DBouraoui)) +- **[k8s/ingress-nginx]** Fix ingress-nginx annotations documentation ([#12510](https://github.com/traefik/traefik/pull/12510) by [nmengin](https://github.com/nmengin)) +- **[k8s]** Fix Kubernetes reference yml file ([#12406](https://github.com/traefik/traefik/pull/12406) by [mmatur](https://github.com/mmatur)) +- Fix code copy button positioning ([#12520](https://github.com/traefik/traefik/pull/12520) by [AnuragEkkati](https://github.com/AnuragEkkati)) +- Fix typo in kubernetes.md ([#12515](https://github.com/traefik/traefik/pull/12515) by [EdwardSalkeld](https://github.com/EdwardSalkeld)) +- Bring back security section on API & Dashboard documentation page ([#12507](https://github.com/traefik/traefik/pull/12507) by [gndz07](https://github.com/gndz07)) +- Fix link description in Traefik Proxy documentation ([#12488](https://github.com/traefik/traefik/pull/12488) by [schaerfo](https://github.com/schaerfo)) +- Add product comparison matrix and features page ([#12037](https://github.com/traefik/traefik/pull/12037) by [sheddy-traefik](https://github.com/sheddy-traefik)) + +**Misc:** +- Merge branch v2.11 into v3.6 ([#12552](https://github.com/traefik/traefik/pull/12552) by [rtribotte](https://github.com/rtribotte)) +- Merge branch v2.11 into v3.6 ([#12533](https://github.com/traefik/traefik/pull/12533) by [mmatur](https://github.com/mmatur)) +- Merge branch v2.11 into v3.6 ([#12497](https://github.com/traefik/traefik/pull/12497) by [mmatur](https://github.com/mmatur)) + ## [v2.11.35](https://github.com/traefik/traefik/tree/v2.11.35) (2026-01-14) [All Commits](https://github.com/traefik/traefik/compare/v2.11.34...v2.11.35) diff --git a/script/gcg/traefik-bugfix.toml b/script/gcg/traefik-bugfix.toml index 32d729732..a893c77c6 100644 --- a/script/gcg/traefik-bugfix.toml +++ b/script/gcg/traefik-bugfix.toml @@ -4,11 +4,11 @@ RepositoryName = "traefik" OutputType = "file" FileName = "traefik_changelog.md" -# example new bugfix v3.6.6 +# example new bugfix v3.6.7 CurrentRef = "v3.6" -PreviousRef = "v3.6.5" +PreviousRef = "v3.6.6" BaseBranch = "v3.6" -FutureCurrentRefName = "v3.6.6" +FutureCurrentRefName = "v3.6.7" ThresholdPreviousRef = 10000 ThresholdCurrentRef = 10000 From 105bf1cfd699d32b5397efe58d98a94000f8a7a7 Mon Sep 17 00:00:00 2001 From: Alessandro Marotta Date: Wed, 14 Jan 2026 17:12:07 +0100 Subject: [PATCH 10/13] Fix migration guide URLs in deprecation notice --- pkg/cli/deprecation.go | 55 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/pkg/cli/deprecation.go b/pkg/cli/deprecation.go index 1277e52c6..337434aed 100644 --- a/pkg/cli/deprecation.go +++ b/pkg/cli/deprecation.go @@ -271,7 +271,7 @@ func (c *configuration) deprecationNotice(logger zerolog.Logger) bool { if c.Pilot != nil { incompatible = true logger.Error().Msg("Pilot configuration has been removed in v3, please remove all Pilot-related install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#pilot") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#pilot") } incompatibleCore := c.Core.deprecationNotice(logger) @@ -289,7 +289,7 @@ func (c *core) deprecationNotice(logger zerolog.Logger) bool { if c != nil && c.DefaultRuleSyntax != "" { logger.Error().Msg("`Core.DefaultRuleSyntax` option has been deprecated in v3.4, and will be removed in the next major version." + " Please consider migrating all router rules to v3 syntax." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v3/#rule-syntax") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#router-rule-matchers") } return false @@ -319,13 +319,14 @@ func (p *providers) deprecationNotice(logger zerolog.Logger) bool { if p.Marathon != nil { incompatible = true logger.Error().Msg("Marathon provider has been removed in v3, please remove all Marathon-related install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#marathon-provider") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#marathon-provider" + + "") } if p.Rancher != nil { incompatible = true logger.Error().Msg("Rancher provider has been removed in v3, please remove all Rancher-related install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#rancher-v1-provider") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#rancher-v1-provider") } dockerIncompatible := p.Docker.deprecationNotice(logger) @@ -367,14 +368,14 @@ func (d *docker) deprecationNotice(logger zerolog.Logger) bool { if d.SwarmMode != nil { incompatible = true logger.Error().Msg("Docker provider `swarmMode` option has been removed in v3, please use the Swarm Provider instead." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#docker-docker-swarm") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#swarmmode") } if d.TLS != nil && d.TLS.CAOptional != nil { incompatible = true logger.Error().Msg("Docker provider `tls.CAOptional` option has been removed in v3, as TLS client authentication is a server side option (see https://github.com/golang/go/blob/740a490f71d026bb7d2d13cb8fa2d6d6e0572b70/src/crypto/tls/common.go#L634)." + " Please remove all occurrences from the install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tlscaoptional") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tlscaoptional") } return incompatible @@ -415,7 +416,7 @@ func (e *etcd) deprecationNotice(logger zerolog.Logger) bool { incompatible = true logger.Error().Msg("ETCD provider `tls.CAOptional` option has been removed in v3, as TLS client authentication is a server side option (see https://github.com/golang/go/blob/740a490f71d026bb7d2d13cb8fa2d6d6e0572b70/src/crypto/tls/common.go#L634)." + " Please remove all occurrences from the install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tlscaoptional_3") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tlscaoptional_3") } return incompatible @@ -436,7 +437,7 @@ func (r *redis) deprecationNotice(logger zerolog.Logger) bool { incompatible = true logger.Error().Msg("Redis provider `tls.CAOptional` option has been removed in v3, as TLS client authentication is a server side option (see https://github.com/golang/go/blob/740a490f71d026bb7d2d13cb8fa2d6d6e0572b70/src/crypto/tls/common.go#L634)." + " Please remove all occurrences from the install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tlscaoptional_4") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tlscaoptional_4") } return incompatible @@ -457,14 +458,14 @@ func (c *consul) deprecationNotice(logger zerolog.Logger) bool { if c.Namespace != nil { incompatible = true logger.Error().Msg("Consul provider `namespace` option has been removed, please use the `namespaces` option instead." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#consul-provider") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#namespace") } if c.TLS != nil && c.TLS.CAOptional != nil { incompatible = true logger.Error().Msg("Consul provider `tls.CAOptional` option has been removed in v3, as TLS client authentication is a server side option (see https://github.com/golang/go/blob/740a490f71d026bb7d2d13cb8fa2d6d6e0572b70/src/crypto/tls/common.go#L634)." + " Please remove all occurrences from the install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tlscaoptional_1") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tlscaoptional_1") } return incompatible @@ -489,14 +490,14 @@ func (c *consulCatalog) deprecationNotice(logger zerolog.Logger) bool { if c.Namespace != nil { incompatible = true logger.Error().Msg("ConsulCatalog provider `namespace` option has been removed, please use the `namespaces` option instead." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#consulcatalog-provider") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#namespace_1") } if c.Endpoint != nil && c.Endpoint.TLS != nil && c.Endpoint.TLS.CAOptional != nil { incompatible = true logger.Error().Msg("ConsulCatalog provider `tls.CAOptional` option has been removed in v3, as TLS client authentication is a server side option (see https://github.com/golang/go/blob/740a490f71d026bb7d2d13cb8fa2d6d6e0572b70/src/crypto/tls/common.go#L634)." + " Please remove all occurrences from the install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#endpointtlscaoptional") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#endpointtlscaoptional") } return incompatible @@ -517,14 +518,14 @@ func (n *nomad) deprecationNotice(logger zerolog.Logger) bool { if n.Namespace != nil { incompatible = true logger.Error().Msg("Nomad provider `namespace` option has been removed, please use the `namespaces` option instead." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#nomad-provider") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#namespace_2") } if n.Endpoint != nil && n.Endpoint.TLS != nil && n.Endpoint.TLS.CAOptional != nil { incompatible = true logger.Error().Msg("Nomad provider `tls.CAOptional` option has been removed in v3, as TLS client authentication is a server side option (see https://github.com/golang/go/blob/740a490f71d026bb7d2d13cb8fa2d6d6e0572b70/src/crypto/tls/common.go#L634)." + " Please remove all occurrences from the install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#endpointtlscaoptional_1") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#endpointtlscaoptional_1") } return incompatible @@ -545,7 +546,7 @@ func (h *http) deprecationNotice(logger zerolog.Logger) bool { incompatible = true logger.Error().Msg("HTTP provider `tls.CAOptional` option has been removed in v3, as TLS client authentication is a server side option (see https://github.com/golang/go/blob/740a490f71d026bb7d2d13cb8fa2d6d6e0572b70/src/crypto/tls/common.go#L634)." + " Please remove all occurrences from the install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tlscaoptional_2") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tlscaoptional_2") } return incompatible @@ -563,7 +564,7 @@ func (i *ingress) deprecationNotice(logger zerolog.Logger) { if i.DisableIngressClassLookup != nil { logger.Error().Msg("Kubernetes Ingress provider `disableIngressClassLookup` option has been deprecated in v3.1, and will be removed in the next major version." + " Please use the `disableClusterScopeResources` option instead." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v3/#ingressclasslookup") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v3/#ingressclass-lookup") } } @@ -581,7 +582,7 @@ func (e *experimental) deprecationNotice(logger zerolog.Logger) bool { if e.HTTP3 != nil { logger.Error().Msg("HTTP3 is not an experimental feature in v3 and the associated enablement has been removed." + " Please remove its usage from the install configuration for Traefik to start." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3-details/#http3") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#http3") return true } @@ -589,13 +590,13 @@ func (e *experimental) deprecationNotice(logger zerolog.Logger) bool { if e.KubernetesGateway != nil { logger.Error().Msg("KubernetesGateway provider is not an experimental feature starting with v3.1." + " Please remove its usage from the install configuration." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v3/#gateway-api-kubernetesgateway-provider") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v3/#gateway-api-kubernetesgateway-provider") } if e.KubernetesIngressNGINX != nil { logger.Error().Msg("KubernetesIngressNGINX provider is not an experimental feature starting with v3.6.2." + " Please remove its usage from the install configuration." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v3/#ingress-nginx-provider") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v3/#ingress-nginx-provider") } return false @@ -622,7 +623,7 @@ func (t *tracing) deprecationNotice(logger zerolog.Logger) bool { if t.SpanNameLimit != nil { incompatible = true logger.Error().Msg("SpanNameLimit option for Tracing has been removed in v3, as Span names are now of a fixed length." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tracing") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tracing") } if t.GlobalAttributes != nil { @@ -630,49 +631,49 @@ func (t *tracing) deprecationNotice(logger zerolog.Logger) bool { logger.Error().Msg("`tracing.globalAttributes` option has been deprecated in v3.3, and will be removed in the next major version." + " Please use the `tracing.resourceAttributes` option instead." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v3/#tracing-global-attributes") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v3/#tracing-global-attributes") } if t.Jaeger != nil { incompatible = true logger.Error().Msg("Jaeger Tracing backend has been removed in v3, please remove all Jaeger-related Tracing install configuration for Traefik to start." + " In v3, Open Telemetry replaces specific tracing backend implementations, and an collector/exporter can be used to export metrics in a vendor specific format." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tracing") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tracing") } if t.Zipkin != nil { incompatible = true logger.Error().Msg("Zipkin Tracing backend has been removed in v3, please remove all Zipkin-related Tracing install configuration for Traefik to start." + " In v3, Open Telemetry replaces specific tracing backend implementations, and an collector/exporter can be used to export metrics in a vendor specific format." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tracing") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tracing") } if t.Datadog != nil { incompatible = true logger.Error().Msg("Datadog Tracing backend has been removed in v3, please remove all Datadog-related Tracing install configuration for Traefik to start." + " In v3, Open Telemetry replaces specific tracing backend implementations, and an collector/exporter can be used to export metrics in a vendor specific format." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tracing") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tracing") } if t.Instana != nil { incompatible = true logger.Error().Msg("Instana Tracing backend has been removed in v3, please remove all Instana-related Tracing install configuration for Traefik to start." + " In v3, Open Telemetry replaces specific tracing backend implementations, and an collector/exporter can be used to export metrics in a vendor specific format." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tracing") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tracing") } if t.Haystack != nil { incompatible = true logger.Error().Msg("Haystack Tracing backend has been removed in v3, please remove all Haystack-related Tracing install configuration for Traefik to start." + " In v3, Open Telemetry replaces specific tracing backend implementations, and an collector/exporter can be used to export metrics in a vendor specific format." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tracing") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tracing") } if t.Elastic != nil { incompatible = true logger.Error().Msg("Elastic Tracing backend has been removed in v3, please remove all Elastic-related Tracing install configuration for Traefik to start." + " In v3, Open Telemetry replaces specific tracing backend implementations, and an collector/exporter can be used to export metrics in a vendor specific format." + - " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migration/v2-to-v3/#tracing") + " For more information please read the migration guide: https://doc.traefik.io/traefik/v3.6/migrate/v2-to-v3-details/#tracing") } return incompatible From 34d8491ac2ab6d733741ee34b6e6a5ae1350aa48 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij <45041769+jnoordsij@users.noreply.github.com> Date: Wed, 14 Jan 2026 18:15:35 +0100 Subject: [PATCH 11/13] Bump github.com/quic-go/quic-go to v0.59.0 --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index d3ceb8d09..0582836fd 100644 --- a/go.mod +++ b/go.mod @@ -55,7 +55,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // No tag on the repo. github.com/prometheus/client_golang v1.23.0 github.com/prometheus/client_model v0.6.2 - github.com/quic-go/quic-go v0.58.0 + github.com/quic-go/quic-go v0.59.0 github.com/redis/go-redis/v9 v9.8.0 github.com/rs/zerolog v1.33.0 github.com/sirupsen/logrus v1.9.3 @@ -95,12 +95,12 @@ require ( go.opentelemetry.io/otel/sdk/log v0.14.0 go.opentelemetry.io/otel/sdk/metric v1.38.0 go.opentelemetry.io/otel/trace v1.38.0 - golang.org/x/crypto v0.46.0 + golang.org/x/crypto v0.47.0 golang.org/x/mod v0.31.0 - golang.org/x/net v0.48.0 + golang.org/x/net v0.49.0 golang.org/x/sync v0.19.0 - golang.org/x/sys v0.39.0 - golang.org/x/text v0.32.0 + golang.org/x/sys v0.40.0 + golang.org/x/text v0.33.0 golang.org/x/time v0.14.0 golang.org/x/tools v0.40.0 google.golang.org/grpc v1.78.0 @@ -393,7 +393,7 @@ require ( golang.org/x/arch v0.4.0 // indirect golang.org/x/exp v0.0.0-20241210194714-1829a127f884 // indirect golang.org/x/oauth2 v0.34.0 // indirect - golang.org/x/term v0.38.0 // indirect + golang.org/x/term v0.39.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/api v0.259.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect diff --git a/go.sum b/go.sum index a81ba3393..3bad3f623 100644 --- a/go.sum +++ b/go.sum @@ -1122,8 +1122,8 @@ github.com/prometheus/statsd_exporter v0.22.7/go.mod h1:N/TevpjkIh9ccs6nuzY3jQn9 github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8= github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII= -github.com/quic-go/quic-go v0.58.0 h1:ggY2pvZaVdB9EyojxL1p+5mptkuHyX5MOSv4dgWF4Ug= -github.com/quic-go/quic-go v0.58.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU= +github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw= +github.com/quic-go/quic-go v0.59.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/redis/go-redis/v9 v9.8.0 h1:q3nRvjrlge/6UD7eTu/DSg2uYiU2mCL0G/uzBWqhicI= @@ -1509,8 +1509,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= -golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= -golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= +golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8= +golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1619,8 +1619,8 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= -golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= +golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1744,8 +1744,8 @@ golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= -golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= +golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1762,8 +1762,8 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= -golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= -golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= +golang.org/x/term v0.39.0 h1:RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY= +golang.org/x/term v0.39.0/go.mod h1:yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1782,8 +1782,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= -golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= +golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= +golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 27b27e9b1fbf3fd47907b8e45dcc6517a1373f10 Mon Sep 17 00:00:00 2001 From: understood-the-assignment <222684290+understood-the-assignment@users.noreply.github.com> Date: Thu, 15 Jan 2026 09:00:05 +0000 Subject: [PATCH 12/13] Document negative priority support for routers --- .../reference/routing-configuration/http/routing/router.md | 2 +- .../routing-configuration/http/routing/rules-and-priority.md | 2 ++ .../routing-configuration/kubernetes/crd/http/ingressroute.md | 2 +- .../reference/routing-configuration/tcp/routing/router.md | 2 +- .../routing-configuration/tcp/routing/rules-and-priority.md | 2 ++ docs/content/routing/routers/index.md | 4 ++++ 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/content/reference/routing-configuration/http/routing/router.md b/docs/content/reference/routing-configuration/http/routing/router.md index 6d322e121..7b1a1d7c3 100644 --- a/docs/content/reference/routing-configuration/http/routing/router.md +++ b/docs/content/reference/routing-configuration/http/routing/router.md @@ -103,7 +103,7 @@ labels: |----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|----------| | `entryPoints` | The list of entry points to which the router is attached. If not specified, HTTP routers are attached to all entry points. | All entry points | No | | `rule` | Rules are a set of matchers configured with values, that determine if a particular request matches specific criteria. If the rule is verified, the router becomes active, calls middlewares, and then forwards the request to the service. See [Rules & Priority](./rules-and-priority.md) for details. | | Yes | -| `priority` | To avoid path overlap, routes are sorted, by default, in descending order using rules length. The priority is directly equal to the length of the rule, and so the longest length has the highest priority. A value of `0` for the priority is ignored. See [Rules & Priority](./rules-and-priority.md) for details. | Rule length | No | +| `priority` | To avoid path overlap, routes are sorted, by default, in descending order using rules length. The priority is directly equal to the length of the rule, and so the longest length has the highest priority. A value of `0` for the priority is ignored. Negative values are supported. See [Rules & Priority](./rules-and-priority.md) for details. | Rule length | No | | `middlewares` | The list of middlewares that are applied to the router. Middlewares are applied in the order they are declared. See [Middlewares overview](../middlewares/overview.md) for available middlewares. | | No | | `tls` | TLS configuration for the router. When specified, the router will only handle HTTPS requests. | | No | | `tls.certResolver` | The name of the certificate resolver to use for automatic certificate generation. See [Certificate Resolver](../tls/overview.md#certificate-resolver) for details. | | No | diff --git a/docs/content/reference/routing-configuration/http/routing/rules-and-priority.md b/docs/content/reference/routing-configuration/http/routing/rules-and-priority.md index 7e15cb954..1a8acf172 100644 --- a/docs/content/reference/routing-configuration/http/routing/rules-and-priority.md +++ b/docs/content/reference/routing-configuration/http/routing/rules-and-priority.md @@ -225,6 +225,8 @@ The priority is directly equal to the length of the rule, and so the longest len A value of `0` for the priority is ignored: `priority: 0` means that the default rules length sorting is used. +Negative priority values are supported. + Traefik reserves a range of priorities for its internal routers, the maximum user-defined router priority value is: - `(MaxInt32 - 1000)` for 32-bit platforms, diff --git a/docs/content/reference/routing-configuration/kubernetes/crd/http/ingressroute.md b/docs/content/reference/routing-configuration/kubernetes/crd/http/ingressroute.md index fc7ae06b2..1ef20b9ba 100644 --- a/docs/content/reference/routing-configuration/kubernetes/crd/http/ingressroute.md +++ b/docs/content/reference/routing-configuration/kubernetes/crd/http/ingressroute.md @@ -86,7 +86,7 @@ spec: | `routes` | List of routes. | | Yes | | `routes[n].kind` | Kind of router matching, only `Rule` is allowed yet. | "Rule" | No | | `routes[n].match` | Defines the [rule](../../../http/routing/rules-and-priority.md#rules) corresponding to an underlying router. | | Yes | -| `routes[n].priority` | Defines the [priority](../../../http/routing/rules-and-priority.md#priority-calculation) to disambiguate rules of the same length, for route matching.
If not set, the priority is directly equal to the length of the rule, and so the longest length has the highest priority.
A value of `0` for the priority is ignored, the default rules length sorting is used. | 0 | No | +| `routes[n].priority` | Defines the [priority](../../../http/routing/rules-and-priority.md#priority-calculation) to disambiguate rules of the same length, for route matching.
If not set, the priority is directly equal to the length of the rule, and so the longest length has the highest priority.
A value of `0` for the priority is ignored, the default rules length sorting is used.
Negative values are supported. | 0 | No | | `routes[n].middlewares` | List of middlewares to attach to the IngressRoute.
More information [here](#middleware). | "" | No | | `routes[n].`
`middlewares[m].`
`name`
| Middleware name.
The character `@` is not authorized.
More information [here](#middleware). | | Yes | | `routes[n].`
`middlewares[m].`
`namespace`
| Middleware namespace.
Can be empty if the middleware belongs to the same namespace as the IngressRoute.
More information [here](#middleware). | | No | diff --git a/docs/content/reference/routing-configuration/tcp/routing/router.md b/docs/content/reference/routing-configuration/tcp/routing/router.md index 54eeb09d2..4f98916a2 100644 --- a/docs/content/reference/routing-configuration/tcp/routing/router.md +++ b/docs/content/reference/routing-configuration/tcp/routing/router.md @@ -90,7 +90,7 @@ labels: |--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------|----------| | `entryPoints` | The list of entry points to which the router is attached. If not specified, TCP routers are attached to all TCP entry points. | All TCP entry points | No | | `rule` | Rules are a set of matchers configured with values, that determine if a particular connection matches specific criteria. If the rule is verified, the router becomes active, calls middlewares, and then forwards the connection to the service. See [Rules & Priority](./rules-and-priority.md) for details. | | Yes | -| `priority` | To avoid rule overlap, routes are sorted, by default, in descending order using rules length. The priority is directly equal to the length of the rule, and so the longest length has the highest priority. A value of `0` for the priority is ignored. See [Rules & Priority](./rules-and-priority.md) for details. | Rule length | No | +| `priority` | To avoid rule overlap, routes are sorted, by default, in descending order using rules length. The priority is directly equal to the length of the rule, and so the longest length has the highest priority. A value of `0` for the priority is ignored. Negative values are supported. See [Rules & Priority](./rules-and-priority.md) for details. | Rule length | No | | `middlewares` | The list of middlewares that are applied to the router. Middlewares are applied in the order they are declared. See [TCP Middlewares overview](../middlewares/overview.md) for available TCP middlewares. | | No | | `tls` | TLS configuration for the router. When specified, the router will only handle TLS connections. See [TLS configuration](../tls.md) for detailed TLS options. | | No | | `service` | The name of the service that will handle the matched connections. Services can be load balancer services or weighted round robin services. See [TCP Service](../service.md) for details. | | Yes | diff --git a/docs/content/reference/routing-configuration/tcp/routing/rules-and-priority.md b/docs/content/reference/routing-configuration/tcp/routing/rules-and-priority.md index 359a17846..2e6f7b966 100644 --- a/docs/content/reference/routing-configuration/tcp/routing/rules-and-priority.md +++ b/docs/content/reference/routing-configuration/tcp/routing/rules-and-priority.md @@ -195,6 +195,8 @@ To avoid path overlap, routes are sorted, by default, in descending order using The priority is directly equal to the length of the rule, and so the longest length has the highest priority. A value of `0` for the priority is ignored: `priority: 0` means that the default rules length sorting is used. +Negative priority values are supported. + Traefik reserves a range of priorities for its internal routers, the maximum user-defined router priority value is: - `(MaxInt32 - 1000)` for 32-bit platforms, diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index 9b0807f07..b8e020772 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -442,6 +442,8 @@ The priority is directly equal to the length of the rule, and so the longest len A value of `0` for the priority is ignored: `priority = 0` means that the default rules length sorting is used. +Negative priority values are supported. + ??? warning "Maximum Value" Traefik reserves a range of priorities for its internal routers, @@ -1267,6 +1269,8 @@ The priority is directly equal to the length of the rule, and so the longest len A value of `0` for the priority is ignored: `priority = 0` means that the default rules length sorting is used. +Negative priority values are supported. + ??? warning "Maximum Value" Traefik reserves a range of priorities for its internal routers, From 3315a9fbec5ffd61ebfd200e6af4c53f7a780b19 Mon Sep 17 00:00:00 2001 From: mmatur Date: Thu, 15 Jan 2026 11:26:40 +0100 Subject: [PATCH 13/13] Merge current v2.11 into v3.6 --- .github/workflows/validate.yaml | 2 +- .golangci.yml | 22 +- cmd/configuration.go | 1 + cmd/internal/gen/main.go | 2 +- .../kubernetes-crd-definition-v1.yml | 11 +- .../traefik.containo.us_tlsoptions.yaml | 114 ---------- .../traefik.io_ingressroutes.yaml | 1 + .../traefik.io_ingressroutetcps.yaml | 3 + .../traefik.io_middlewares.yaml | 1 + .../traefik.io_middlewaretcps.yaml | 3 +- .../traefik.io_serverstransports.yaml | 1 + .../traefik.io_serverstransporttcps.yaml | 1 + .../traefik.io_tlsoptions.yaml | 1 + integration/access_log_test.go | 3 +- integration/acme_test.go | 11 +- integration/consul_catalog_test.go | 83 ++++---- integration/consul_test.go | 21 +- integration/docker_test.go | 6 +- integration/dual_logging_test.go | 1 + integration/error_pages_test.go | 1 + integration/etcd_test.go | 1 + integration/fixtures/k8s/01-traefik-crd.yml | 11 +- integration/healthcheck_test.go | 1 + integration/helloworld/helloworld.pb.go | 6 +- integration/https_test.go | 68 +++--- integration/integration_test.go | 73 +++---- integration/log_rotation_test.go | 1 - integration/proxy_protocol_test.go | 9 +- integration/ratelimit_test.go | 1 + integration/redis_sentinel_test.go | 61 +++--- integration/redis_test.go | 1 + integration/rest_test.go | 1 + integration/retry_test.go | 1 + integration/tcp_healthcheck_test.go | 1 + integration/tracing_test.go | 1 + integration/try/try.go | 6 +- integration/zk_test.go | 1 + internal/gendoc.go | 2 +- pkg/api/criterion.go | 13 +- pkg/api/debug.go | 2 +- pkg/api/handler.go | 4 +- pkg/api/handler_entrypoint.go | 1 + pkg/api/handler_entrypoint_test.go | 2 +- pkg/api/handler_http.go | 3 + pkg/api/handler_http_test.go | 2 +- pkg/api/handler_overview_test.go | 4 +- pkg/api/handler_tcp.go | 3 + pkg/api/handler_tcp_test.go | 2 +- pkg/api/handler_test.go | 2 +- pkg/api/handler_udp.go | 2 + pkg/api/handler_udp_test.go | 2 +- pkg/cli/deprecation.go | 12 +- pkg/cli/loader_file.go | 2 +- pkg/collector/hydratation/hydration.go | 4 +- pkg/config/dynamic/config_test.go | 4 +- pkg/config/dynamic/middlewares.go | 2 + pkg/config/dynamic/plugins_test.go | 6 +- pkg/config/dynamic/tcp_config.go | 2 + pkg/config/dynamic/tcp_middlewares.go | 1 + pkg/config/kv/kv.go | 4 +- pkg/config/label/label.go | 2 +- pkg/config/runtime/runtime_http.go | 28 +-- pkg/config/runtime/runtime_tcp.go | 34 ++- pkg/config/runtime/runtime_udp.go | 22 +- pkg/config/static/plugins.go | 2 +- pkg/config/static/static_config.go | 30 +-- pkg/healthcheck/healthcheck.go | 2 +- pkg/healthcheck/mock_test.go | 1 + pkg/job/job.go | 1 + .../accesslog/field_middleware_test.go | 2 +- pkg/middlewares/accesslog/logdata.go | 2 +- pkg/middlewares/accesslog/logger.go | 102 ++++----- .../accesslog/logger_formatters.go | 2 +- .../accesslog/logger_formatters_test.go | 18 +- pkg/middlewares/accesslog/logger_test.go | 42 ++-- pkg/middlewares/auth/connectionheader.go | 2 +- pkg/middlewares/capture/capture.go | 28 +-- pkg/middlewares/compress/acceptencoding.go | 2 +- pkg/middlewares/compress/compress.go | 8 +- .../compress/compression_handler.go | 1 + .../compress/compression_handler_test.go | 10 +- pkg/middlewares/customerrors/custom_errors.go | 39 ++-- .../forwardedheaders/forwarded_header.go | 50 ++--- .../request_header_modifier_test.go | 5 +- .../response_header_modifier_test.go | 5 +- pkg/middlewares/headers/header.go | 42 ++-- .../observability/observability.go | 2 +- pkg/middlewares/observability/status_code.go | 1 + pkg/middlewares/ratelimiter/lua.go | 8 +- pkg/middlewares/ratelimiter/rate_limiter.go | 5 +- .../ratelimiter/rate_limiter_test.go | 24 +-- pkg/middlewares/ratelimiter/redis_limiter.go | 4 +- pkg/middlewares/recovery/recovery.go | 2 +- pkg/middlewares/retry/retry.go | 6 +- pkg/muxer/http/matcher.go | 16 +- pkg/muxer/http/mux.go | 3 +- pkg/muxer/tcp/matcher.go | 9 +- pkg/muxer/tcp/matcher_v2.go | 7 +- pkg/muxer/tcp/mux.go | 2 +- pkg/observability/logs/aws.go | 4 +- pkg/observability/logs/elastic.go | 4 +- pkg/observability/logs/gokit.go | 4 +- pkg/observability/logs/hclog.go | 10 +- pkg/observability/logs/instana.go | 8 +- pkg/observability/logs/logrus.go | 18 +- pkg/observability/logs/oxy.go | 8 +- pkg/observability/metrics/headers.go | 10 +- pkg/observability/metrics/otel.go | 2 +- pkg/observability/tracing/tracing.go | 140 ++++++------- pkg/observability/tracing/tracing_test.go | 2 + pkg/plugins/builder.go | 4 +- pkg/plugins/manager_test.go | 2 +- pkg/plugins/middlewarewasm.go | 4 +- pkg/plugins/middlewarewasm_test.go | 18 +- pkg/plugins/middlewareyaegi.go | 4 +- pkg/plugins/middlewareyaegi_test.go | 2 +- pkg/plugins/providers.go | 6 +- pkg/plugins/types.go | 20 +- pkg/provider/acme/local_store.go | 102 +++++---- pkg/provider/acme/local_store_unix.go | 1 - pkg/provider/acme/provider.go | 4 +- pkg/provider/aggregator/aggregator.go | 14 +- pkg/provider/configuration.go | 6 +- .../constraints/constraints_labels.go | 2 +- pkg/provider/constraints/constraints_tags.go | 2 +- pkg/provider/consulcatalog/consul_catalog.go | 132 ++++++------ pkg/provider/docker/config.go | 1 + pkg/provider/docker/pdocker.go | 8 +- pkg/provider/docker/pswarm.go | 8 +- pkg/provider/docker/pswarm_mock_test.go | 2 + pkg/provider/ecs/ecs.go | 70 +++---- pkg/provider/file/file.go | 153 +++++++------- pkg/provider/kubernetes/crd/client.go | 6 +- pkg/provider/kubernetes/crd/kubernetes.go | 196 +++++++++--------- .../kubernetes/crd/kubernetes_test.go | 22 +- .../crd/traefikio/v1alpha1/ingressroute.go | 1 + .../crd/traefikio/v1alpha1/ingressroutetcp.go | 3 + .../crd/traefikio/v1alpha1/middlewaretcp.go | 3 +- .../traefikio/v1alpha1/serverstransport.go | 1 + .../traefikio/v1alpha1/serverstransporttcp.go | 1 + .../crd/traefikio/v1alpha1/tlsoption.go | 1 + pkg/provider/kubernetes/gateway/client.go | 4 +- pkg/provider/kubernetes/gateway/httproute.go | 17 +- pkg/provider/kubernetes/gateway/kubernetes.go | 90 ++++---- pkg/provider/kubernetes/gateway/tcproute.go | 13 +- .../kubernetes/ingress-nginx/annotations.go | 5 +- .../kubernetes/ingress-nginx/client.go | 4 +- .../kubernetes/ingress-nginx/kubernetes.go | 7 +- pkg/provider/kubernetes/ingress/client.go | 6 +- .../kubernetes/ingress/client_mock_test.go | 4 +- pkg/provider/kubernetes/ingress/kubernetes.go | 116 +++++------ pkg/provider/kubernetes/k8s/event_handler.go | 12 +- .../kubernetes/k8s/event_handler_test.go | 4 +- pkg/provider/kubernetes/knative/client.go | 12 +- pkg/provider/kubernetes/knative/kubernetes.go | 20 +- pkg/provider/nomad/nomad.go | 10 +- pkg/proxy/fast/proxy.go | 2 +- pkg/proxy/httputil/bufferpool.go | 2 +- pkg/redactor/redactor.go | 12 +- pkg/rules/parser.go | 9 +- pkg/safe/routine.go | 4 +- pkg/safe/routine_test.go | 1 + pkg/safe/safe.go | 8 +- pkg/server/middleware/plugins.go | 6 +- pkg/server/router/router.go | 192 ++++++++--------- pkg/server/router/router_test.go | 4 +- pkg/server/router/tcp/manager.go | 52 ++--- pkg/server/router/tcp/router.go | 75 +++---- pkg/server/router/tcp/router_test.go | 11 +- pkg/server/router/udp/router.go | 28 +-- pkg/server/server_entrypoint_tcp.go | 38 ++-- pkg/server/server_entrypoint_tcp_http3.go | 10 +- pkg/server/server_signals.go | 1 - pkg/server/server_signals_windows.go | 1 - .../loadbalancer/failover/failover_test.go | 1 + pkg/server/service/loadbalancer/hrw/hrw.go | 63 +++--- .../service/loadbalancer/hrw/hrw_test.go | 1 + .../loadbalancer/leasttime/leasttime.go | 185 +++++++++-------- .../loadbalancer/leasttime/leasttime_test.go | 1 + .../service/loadbalancer/mirror/mirror.go | 49 ++--- pkg/server/service/loadbalancer/p2c/p2c.go | 88 ++++---- .../service/loadbalancer/p2c/p2c_test.go | 1 + pkg/server/service/loadbalancer/wrr/wrr.go | 65 +++--- .../service/loadbalancer/wrr/wrr_test.go | 1 + pkg/server/service/service.go | 26 +-- pkg/tcp/dialer.go | 1 + pkg/tcp/proxy_unix.go | 1 - pkg/tcp/proxy_windows.go | 1 - pkg/tcp/wrr_load_balancer.go | 1 + pkg/testhelpers/metrics.go | 10 +- pkg/tls/certificate_store.go | 4 +- pkg/tls/tls.go | 3 +- pkg/tls/tlsmanager.go | 16 +- pkg/udp/conn.go | 107 +++++----- pkg/udp/wrr_load_balancer.go | 1 + 195 files changed, 1748 insertions(+), 1852 deletions(-) delete mode 100644 docs/content/reference/dynamic-configuration/traefik.containo.us_tlsoptions.yaml diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index ed46d1599..e81b4aa99 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -7,7 +7,7 @@ on: env: GO_VERSION: '1.24' - GOLANGCI_LINT_VERSION: v2.0.2 + GOLANGCI_LINT_VERSION: v2.8.0 MISSPELL_VERSION: v0.7.0 jobs: diff --git a/.golangci.yml b/.golangci.yml index 50afac812..d49dcdcae 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -36,6 +36,7 @@ linters: - nilnil # Not relevant - nlreturn # Not relevant - noctx # Too strict + - noinlineerr # Too strict - nonamedreturns # Too strict - paralleltest # Not relevant - prealloc # Too many false-positive. @@ -47,6 +48,7 @@ linters: - varnamelen # Not relevant - wrapcheck # Too strict - wsl # Too strict + - wsl_v5 # Too strict settings: depguard: @@ -295,15 +297,31 @@ linters: source: 'errors.New\("Nomad provider' text: 'ST1005: error strings should not be capitalized' - path: (.+)\.go - text: 'struct-tag: unknown option ''inline'' in JSON tag' + text: 'omitzero: Omitempty has no effect on nested struct field' + linters: + - modernize + - path: (.+)\.go + text: 'struct-tag: unknown option "inline" in json tag' linters: - revive - path: (.+)\.go - text: 'struct-tag: unknown option ''omitzero'' in TOML tag' + text: 'struct-tag: unknown option "omitzero" in toml tag' + linters: + - revive + - path: (pkg/types/.+|pkg/api/.+|pkg/observability/types/.+)\.go + text: 'var-naming: avoid meaningless package names' + linters: + - revive + - path: (pkg/muxer/http/.+|pkg/provider/http/.+)\.go + text: 'var-naming: avoid package names that conflict with Go standard library package names' linters: - revive - path: (.+)\.go$ text: 'SA1019: http.CloseNotifier has been deprecated' # FIXME must be fixed + - path: (.+)\.go$ + text: 'SA1019: dynamic.(TCPIPWhiteList|IPWhiteList) is deprecated: please use IPAllowList instead.' + - path: (.+)\.go$ + text: 'SA1019: middlewareTCP.Spec.IPWhiteList is deprecated: please use IPAllowList instead.' - path: (.+)\.go$ text: 'SA1019: cfg.(SSLRedirect|SSLTemporaryRedirect|SSLHost|SSLForceHost|FeaturePolicy) is deprecated' - path: (.+)\.go$ diff --git a/cmd/configuration.go b/cmd/configuration.go index d65bdf04d..49a69507d 100644 --- a/cmd/configuration.go +++ b/cmd/configuration.go @@ -10,6 +10,7 @@ import ( // TraefikCmdConfiguration wraps the static configuration and extra parameters. type TraefikCmdConfiguration struct { static.Configuration `export:"true"` + // ConfigFile is the path to the configuration file. ConfigFile string `description:"Configuration file to use. If specified all other flags are ignored." export:"true"` } diff --git a/cmd/internal/gen/main.go b/cmd/internal/gen/main.go index a85544688..cacc64fb1 100644 --- a/cmd/internal/gen/main.go +++ b/cmd/internal/gen/main.go @@ -83,7 +83,7 @@ func run(dest string) error { return err } - return os.WriteFile(filepath.Join(dest, "marshaler.go"), []byte(fmt.Sprintf(marsh, destPkg)), 0o666) + return os.WriteFile(filepath.Join(dest, "marshaler.go"), fmt.Appendf(nil, marsh, destPkg), 0o666) } func cleanType(typ types.Type, base string) string { diff --git a/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml b/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml index 763d981eb..6634b09b2 100644 --- a/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml +++ b/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml @@ -373,6 +373,7 @@ spec: description: |- Syntax defines the router's rule syntax. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/http/routing/rules-and-priority/#rulesyntax + Deprecated: Please do not use this field and rewrite the router rules to use the v3 syntax. type: string required: @@ -584,6 +585,7 @@ spec: description: |- ProxyProtocol defines the PROXY protocol configuration. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/service/#proxy-protocol + Deprecated: ProxyProtocol will not be supported in future APIVersions, please use ServersTransport to configure ProxyProtocol instead. properties: version: @@ -606,6 +608,7 @@ spec: hence fully terminating the connection. It is a duration in milliseconds, defaulting to 100. A negative value means an infinite deadline (i.e. the reading capability is never closed). + Deprecated: TerminationDelay will not be supported in future APIVersions, please use ServersTransport to configure the TerminationDelay instead. type: integer tls: @@ -626,6 +629,7 @@ spec: description: |- Syntax defines the router's rule syntax. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/routing/rules-and-priority/#rulesyntax + Deprecated: Please do not use this field and rewrite the router rules to use the v3 syntax. enum: - v3 @@ -1060,6 +1064,7 @@ spec: description: |- AutoDetect specifies whether to let the `Content-Type` header, if it has not been set by the backend, be automatically set to a value derived from the contents of the response. + Deprecated: AutoDetect option is deprecated, Content-Type middleware is only meant to be used to enable the content-type detection, please remove any usage of this option. type: boolean type: object @@ -2212,8 +2217,9 @@ spec: description: |- IPWhiteList defines the IPWhiteList middleware configuration. This middleware accepts/refuses connections based on the client IP. - Deprecated: please use IPAllowList instead. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/middlewares/ipwhitelist/ + + Deprecated: please use IPAllowList instead. properties: sourceRange: description: SourceRange defines the allowed IPs (or ranges of @@ -2370,6 +2376,7 @@ spec: rootCAsSecrets: description: |- RootCAsSecrets defines a list of CA secret used to validate self-signed certificate. + Deprecated: RootCAsSecrets is deprecated, please use the RootCAs option instead. items: type: string @@ -2524,6 +2531,7 @@ spec: rootCAsSecrets: description: |- RootCAsSecrets defines a list of CA secret used to validate self-signed certificate. + Deprecated: RootCAsSecrets is deprecated, please use the RootCAs option instead. items: type: string @@ -2659,6 +2667,7 @@ spec: description: |- PreferServerCipherSuites defines whether the server chooses a cipher suite among his own instead of among the client's. It is enabled automatically when minVersion or maxVersion is set. + Deprecated: https://github.com/golang/go/issues/45430 type: boolean sniStrict: diff --git a/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsoptions.yaml b/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsoptions.yaml deleted file mode 100644 index 6c7fdc914..000000000 --- a/docs/content/reference/dynamic-configuration/traefik.containo.us_tlsoptions.yaml +++ /dev/null @@ -1,114 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.16.1 - name: tlsoptions.traefik.containo.us -spec: - group: traefik.containo.us - names: - kind: TLSOption - listKind: TLSOptionList - plural: tlsoptions - singular: tlsoption - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: |- - TLSOption is the CRD implementation of a Traefik TLS Option, allowing to configure some parameters of the TLS connection. - More info: https://doc.traefik.io/traefik/v2.11/https/tls/#tls-options - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: TLSOptionSpec defines the desired state of a TLSOption. - properties: - alpnProtocols: - description: |- - ALPNProtocols defines the list of supported application level protocols for the TLS handshake, in order of preference. - More info: https://doc.traefik.io/traefik/v2.11/https/tls/#alpn-protocols - items: - type: string - type: array - cipherSuites: - description: |- - CipherSuites defines the list of supported cipher suites for TLS versions up to TLS 1.2. - More info: https://doc.traefik.io/traefik/v2.11/https/tls/#cipher-suites - items: - type: string - type: array - clientAuth: - description: ClientAuth defines the server's policy for TLS Client - Authentication. - properties: - clientAuthType: - description: ClientAuthType defines the client authentication - type to apply. - enum: - - NoClientCert - - RequestClientCert - - RequireAnyClientCert - - VerifyClientCertIfGiven - - RequireAndVerifyClientCert - type: string - secretNames: - description: SecretNames defines the names of the referenced Kubernetes - Secret storing certificate details. - items: - type: string - type: array - type: object - curvePreferences: - description: |- - CurvePreferences defines the preferred elliptic curves. - More info: https://doc.traefik.io/traefik/v2.11/https/tls/#curve-preferences - items: - type: string - type: array - maxVersion: - description: |- - MaxVersion defines the maximum TLS version that Traefik will accept. - Possible values: VersionTLS10, VersionTLS11, VersionTLS12, VersionTLS13. - Default: None. - type: string - minVersion: - description: |- - MinVersion defines the minimum TLS version that Traefik will accept. - Possible values: VersionTLS10, VersionTLS11, VersionTLS12, VersionTLS13. - Default: VersionTLS10. - type: string - preferServerCipherSuites: - description: |- - PreferServerCipherSuites defines whether the server chooses a cipher suite among his own instead of among the client's. - It is enabled automatically when minVersion or maxVersion is set. - Deprecated: https://github.com/golang/go/issues/45430 - type: boolean - sniStrict: - description: SniStrict defines whether Traefik allows connections - from clients connections that do not specify a server_name extension. - type: boolean - type: object - required: - - metadata - - spec - type: object - served: true - storage: true diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml index 3debb5926..19aa7b3f2 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutes.yaml @@ -374,6 +374,7 @@ spec: description: |- Syntax defines the router's rule syntax. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/http/routing/rules-and-priority/#rulesyntax + Deprecated: Please do not use this field and rewrite the router rules to use the v3 syntax. type: string required: diff --git a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml index c7006f6d0..e70f8ac20 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_ingressroutetcps.yaml @@ -123,6 +123,7 @@ spec: description: |- ProxyProtocol defines the PROXY protocol configuration. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/service/#proxy-protocol + Deprecated: ProxyProtocol will not be supported in future APIVersions, please use ServersTransport to configure ProxyProtocol instead. properties: version: @@ -145,6 +146,7 @@ spec: hence fully terminating the connection. It is a duration in milliseconds, defaulting to 100. A negative value means an infinite deadline (i.e. the reading capability is never closed). + Deprecated: TerminationDelay will not be supported in future APIVersions, please use ServersTransport to configure the TerminationDelay instead. type: integer tls: @@ -165,6 +167,7 @@ spec: description: |- Syntax defines the router's rule syntax. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/routing/rules-and-priority/#rulesyntax + Deprecated: Please do not use this field and rewrite the router rules to use the v3 syntax. enum: - v3 diff --git a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml index f0999cf22..e5ececaec 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_middlewares.yaml @@ -231,6 +231,7 @@ spec: description: |- AutoDetect specifies whether to let the `Content-Type` header, if it has not been set by the backend, be automatically set to a value derived from the contents of the response. + Deprecated: AutoDetect option is deprecated, Content-Type middleware is only meant to be used to enable the content-type detection, please remove any usage of this option. type: boolean type: object diff --git a/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml index b2a19f9d5..e68050d2b 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_middlewaretcps.yaml @@ -69,8 +69,9 @@ spec: description: |- IPWhiteList defines the IPWhiteList middleware configuration. This middleware accepts/refuses connections based on the client IP. - Deprecated: please use IPAllowList instead. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/middlewares/ipwhitelist/ + + Deprecated: please use IPAllowList instead. properties: sourceRange: description: SourceRange defines the allowed IPs (or ranges of diff --git a/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml b/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml index d5ec61903..fb8f24f89 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_serverstransports.yaml @@ -139,6 +139,7 @@ spec: rootCAsSecrets: description: |- RootCAsSecrets defines a list of CA secret used to validate self-signed certificate. + Deprecated: RootCAsSecrets is deprecated, please use the RootCAs option instead. items: type: string diff --git a/docs/content/reference/dynamic-configuration/traefik.io_serverstransporttcps.yaml b/docs/content/reference/dynamic-configuration/traefik.io_serverstransporttcps.yaml index 79469823b..c4104f8a5 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_serverstransporttcps.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_serverstransporttcps.yaml @@ -124,6 +124,7 @@ spec: rootCAsSecrets: description: |- RootCAsSecrets defines a list of CA secret used to validate self-signed certificate. + Deprecated: RootCAsSecrets is deprecated, please use the RootCAs option instead. items: type: string diff --git a/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml b/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml index 5f37cb023..1520612a4 100644 --- a/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml +++ b/docs/content/reference/dynamic-configuration/traefik.io_tlsoptions.yaml @@ -103,6 +103,7 @@ spec: description: |- PreferServerCipherSuites defines whether the server chooses a cipher suite among his own instead of among the client's. It is enabled automatically when minVersion or maxVersion is set. + Deprecated: https://github.com/golang/go/issues/45430 type: boolean sniStrict: diff --git a/integration/access_log_test.go b/integration/access_log_test.go index 2f480b524..200e73360 100644 --- a/integration/access_log_test.go +++ b/integration/access_log_test.go @@ -245,8 +245,7 @@ func digestParts(resp *http.Response) map[string]string { result := map[string]string{} if len(resp.Header["Www-Authenticate"]) > 0 { wantedHeaders := []string{"nonce", "realm", "qop", "opaque"} - responseHeaders := strings.Split(resp.Header["Www-Authenticate"][0], ",") - for _, r := range responseHeaders { + for r := range strings.SplitSeq(resp.Header["Www-Authenticate"][0], ",") { for _, w := range wantedHeaders { if strings.Contains(r, w) { result[w] = strings.Split(r, `"`)[1] diff --git a/integration/acme_test.go b/integration/acme_test.go index a226ea88d..51173ebf2 100644 --- a/integration/acme_test.go +++ b/integration/acme_test.go @@ -27,6 +27,7 @@ import ( // ACME test suites. type AcmeSuite struct { BaseSuite + pebbleIP string fakeDNSServer *dns.Server } @@ -63,11 +64,6 @@ const ( wildcardDomain = "*.acme.wtf" ) -func (s *AcmeSuite) getAcmeURL() string { - return fmt.Sprintf("https://%s/dir", - net.JoinHostPort(s.pebbleIP, "14000")) -} - func setupPebbleRootCA() (*http.Transport, error) { path, err := filepath.Abs("fixtures/acme/ssl/pebble.minica.pem") if err != nil { @@ -540,3 +536,8 @@ func (s *AcmeSuite) retrieveAcmeCertificate(testCase acmeTestCase) { assert.Equal(s.T(), sub.expectedAlgorithm, gotPublicKeyAlgorithm) } } + +func (s *AcmeSuite) getAcmeURL() string { + return fmt.Sprintf("https://%s/dir", + net.JoinHostPort(s.pebbleIP, "14000")) +} diff --git a/integration/consul_catalog_test.go b/integration/consul_catalog_test.go index 65bb89a5e..11a69c490 100644 --- a/integration/consul_catalog_test.go +++ b/integration/consul_catalog_test.go @@ -16,6 +16,7 @@ import ( type ConsulCatalogSuite struct { BaseSuite + consulClient *api.Client consulAgentClient *api.Client consulURL string @@ -53,47 +54,6 @@ func (s *ConsulCatalogSuite) TearDownSuite() { s.BaseSuite.TearDownSuite() } -func (s *ConsulCatalogSuite) waitToElectConsulLeader() error { - return try.Do(15*time.Second, func() error { - leader, err := s.consulClient.Status().Leader() - - if err != nil || len(leader) == 0 { - return fmt.Errorf("leader not found. %w", err) - } - - return nil - }) -} - -func (s *ConsulCatalogSuite) waitForConnectCA() error { - return try.Do(15*time.Second, func() error { - caroots, _, err := s.consulClient.Connect().CARoots(nil) - - if err != nil || len(caroots.Roots) == 0 { - return fmt.Errorf("connect CA not fully initialized. %w", err) - } - - return nil - }) -} - -func (s *ConsulCatalogSuite) registerService(reg *api.AgentServiceRegistration, onAgent bool) error { - client := s.consulClient - if onAgent { - client = s.consulAgentClient - } - - return client.Agent().ServiceRegister(reg) -} - -func (s *ConsulCatalogSuite) deregisterService(id string, onAgent bool) error { - client := s.consulClient - if onAgent { - client = s.consulAgentClient - } - return client.Agent().ServiceDeregister(id) -} - func (s *ConsulCatalogSuite) TestWithNotExposedByDefaultAndDefaultsSettings() { reg1 := &api.AgentServiceRegistration{ ID: "whoami1", @@ -837,3 +797,44 @@ func (s *ConsulCatalogSuite) TestConsulConnect_NotAware() { err = s.deregisterService("whoami1", false) require.NoError(s.T(), err) } + +func (s *ConsulCatalogSuite) waitToElectConsulLeader() error { + return try.Do(15*time.Second, func() error { + leader, err := s.consulClient.Status().Leader() + + if err != nil || len(leader) == 0 { + return fmt.Errorf("leader not found. %w", err) + } + + return nil + }) +} + +func (s *ConsulCatalogSuite) waitForConnectCA() error { + return try.Do(15*time.Second, func() error { + caroots, _, err := s.consulClient.Connect().CARoots(nil) + + if err != nil || len(caroots.Roots) == 0 { + return fmt.Errorf("connect CA not fully initialized. %w", err) + } + + return nil + }) +} + +func (s *ConsulCatalogSuite) registerService(reg *api.AgentServiceRegistration, onAgent bool) error { + client := s.consulClient + if onAgent { + client = s.consulAgentClient + } + + return client.Agent().ServiceRegister(reg) +} + +func (s *ConsulCatalogSuite) deregisterService(id string, onAgent bool) error { + client := s.consulClient + if onAgent { + client = s.consulAgentClient + } + return client.Agent().ServiceDeregister(id) +} diff --git a/integration/consul_test.go b/integration/consul_test.go index 31908556e..4b5ad5146 100644 --- a/integration/consul_test.go +++ b/integration/consul_test.go @@ -25,6 +25,7 @@ import ( // Consul test suites. type ConsulSuite struct { BaseSuite + kvClient store.Store consulURL string } @@ -162,16 +163,6 @@ func (s *ConsulSuite) TestSimpleConfiguration() { } } -func (s *ConsulSuite) assertWhoami(host string, expectedStatusCode int) { - req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000", nil) - require.NoError(s.T(), err) - req.Host = host - - resp, err := try.ResponseUntilStatusCode(req, 15*time.Second, expectedStatusCode) - require.NoError(s.T(), err) - resp.Body.Close() -} - func (s *ConsulSuite) TestDeleteRootKey() { // This test case reproduce the issue: https://github.com/traefik/traefik/issues/8092 @@ -220,3 +211,13 @@ func (s *ConsulSuite) TestDeleteRootKey() { s.assertWhoami("kv1.localhost", http.StatusNotFound) s.assertWhoami("kv2.localhost", http.StatusNotFound) } + +func (s *ConsulSuite) assertWhoami(host string, expectedStatusCode int) { + req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000", nil) + require.NoError(s.T(), err) + req.Host = host + + resp, err := try.ResponseUntilStatusCode(req, 15*time.Second, expectedStatusCode) + require.NoError(s.T(), err) + resp.Body.Close() +} diff --git a/integration/docker_test.go b/integration/docker_test.go index 08606b60b..8ae24d921 100644 --- a/integration/docker_test.go +++ b/integration/docker_test.go @@ -81,7 +81,7 @@ func (s *DockerSuite) TestDefaultDockerContainers() { body, err := io.ReadAll(resp.Body) require.NoError(s.T(), err) - var version map[string]interface{} + var version map[string]any assert.NoError(s.T(), json.Unmarshal(body, &version)) assert.Equal(s.T(), "swarm/1.0.0", version["Version"]) @@ -145,7 +145,7 @@ func (s *DockerSuite) TestDockerContainersWithLabels() { body, err := io.ReadAll(resp.Body) require.NoError(s.T(), err) - var version map[string]interface{} + var version map[string]any assert.NoError(s.T(), json.Unmarshal(body, &version)) assert.Equal(s.T(), "swarm/1.0.0", version["Version"]) @@ -203,7 +203,7 @@ func (s *DockerSuite) TestRestartDockerContainers() { body, err := io.ReadAll(resp.Body) require.NoError(s.T(), err) - var version map[string]interface{} + var version map[string]any assert.NoError(s.T(), json.Unmarshal(body, &version)) assert.Equal(s.T(), "swarm/1.0.0", version["Version"]) diff --git a/integration/dual_logging_test.go b/integration/dual_logging_test.go index fef4cbd54..c2affa3e8 100644 --- a/integration/dual_logging_test.go +++ b/integration/dual_logging_test.go @@ -21,6 +21,7 @@ const traefikTestOTLPLogFile = "traefik_otlp.log" // DualLoggingSuite tests that both OTLP and stdout logging can work together. type DualLoggingSuite struct { BaseSuite + otlpLogs []string collector *httptest.Server } diff --git a/integration/error_pages_test.go b/integration/error_pages_test.go index f895216e0..db8f15647 100644 --- a/integration/error_pages_test.go +++ b/integration/error_pages_test.go @@ -14,6 +14,7 @@ import ( // ErrorPagesSuite test suites. type ErrorPagesSuite struct { BaseSuite + ErrorPageIP string BackendIP string } diff --git a/integration/etcd_test.go b/integration/etcd_test.go index 067c4d61c..718601fc4 100644 --- a/integration/etcd_test.go +++ b/integration/etcd_test.go @@ -23,6 +23,7 @@ import ( // etcd test suites. type EtcdSuite struct { BaseSuite + kvClient store.Store etcdAddr string } diff --git a/integration/fixtures/k8s/01-traefik-crd.yml b/integration/fixtures/k8s/01-traefik-crd.yml index bbf30fb63..dfd63fe83 100644 --- a/integration/fixtures/k8s/01-traefik-crd.yml +++ b/integration/fixtures/k8s/01-traefik-crd.yml @@ -374,6 +374,7 @@ spec: description: |- Syntax defines the router's rule syntax. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/http/routing/rules-and-priority/#rulesyntax + Deprecated: Please do not use this field and rewrite the router rules to use the v3 syntax. type: string required: @@ -585,6 +586,7 @@ spec: description: |- ProxyProtocol defines the PROXY protocol configuration. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/service/#proxy-protocol + Deprecated: ProxyProtocol will not be supported in future APIVersions, please use ServersTransport to configure ProxyProtocol instead. properties: version: @@ -607,6 +609,7 @@ spec: hence fully terminating the connection. It is a duration in milliseconds, defaulting to 100. A negative value means an infinite deadline (i.e. the reading capability is never closed). + Deprecated: TerminationDelay will not be supported in future APIVersions, please use ServersTransport to configure the TerminationDelay instead. type: integer tls: @@ -627,6 +630,7 @@ spec: description: |- Syntax defines the router's rule syntax. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/routing/rules-and-priority/#rulesyntax + Deprecated: Please do not use this field and rewrite the router rules to use the v3 syntax. enum: - v3 @@ -1061,6 +1065,7 @@ spec: description: |- AutoDetect specifies whether to let the `Content-Type` header, if it has not been set by the backend, be automatically set to a value derived from the contents of the response. + Deprecated: AutoDetect option is deprecated, Content-Type middleware is only meant to be used to enable the content-type detection, please remove any usage of this option. type: boolean type: object @@ -2213,8 +2218,9 @@ spec: description: |- IPWhiteList defines the IPWhiteList middleware configuration. This middleware accepts/refuses connections based on the client IP. - Deprecated: please use IPAllowList instead. More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/middlewares/ipwhitelist/ + + Deprecated: please use IPAllowList instead. properties: sourceRange: description: SourceRange defines the allowed IPs (or ranges of @@ -2371,6 +2377,7 @@ spec: rootCAsSecrets: description: |- RootCAsSecrets defines a list of CA secret used to validate self-signed certificate. + Deprecated: RootCAsSecrets is deprecated, please use the RootCAs option instead. items: type: string @@ -2525,6 +2532,7 @@ spec: rootCAsSecrets: description: |- RootCAsSecrets defines a list of CA secret used to validate self-signed certificate. + Deprecated: RootCAsSecrets is deprecated, please use the RootCAs option instead. items: type: string @@ -2660,6 +2668,7 @@ spec: description: |- PreferServerCipherSuites defines whether the server chooses a cipher suite among his own instead of among the client's. It is enabled automatically when minVersion or maxVersion is set. + Deprecated: https://github.com/golang/go/issues/45430 type: boolean sniStrict: diff --git a/integration/healthcheck_test.go b/integration/healthcheck_test.go index 6ab2ac618..08f009de2 100644 --- a/integration/healthcheck_test.go +++ b/integration/healthcheck_test.go @@ -19,6 +19,7 @@ import ( // HealthCheck test suites. type HealthCheckSuite struct { BaseSuite + whoami1IP string whoami2IP string whoami3IP string diff --git a/integration/helloworld/helloworld.pb.go b/integration/helloworld/helloworld.pb.go index d3f26398c..6c65d422b 100644 --- a/integration/helloworld/helloworld.pb.go +++ b/integration/helloworld/helloworld.pb.go @@ -187,7 +187,7 @@ func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) { s.RegisterService(&_Greeter_serviceDesc, srv) } -func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Greeter_SayHello_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) { in := new(HelloRequest) if err := dec(in); err != nil { return nil, err @@ -199,13 +199,13 @@ func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(in Server: srv, FullMethod: "/helloworld.Greeter/SayHello", } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { + handler := func(ctx context.Context, req any) (any, error) { return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest)) } return interceptor(ctx, in, info, handler) } -func _Greeter_StreamExample_Handler(srv interface{}, stream grpc.ServerStream) error { +func _Greeter_StreamExample_Handler(srv any, stream grpc.ServerStream) error { m := new(StreamExampleRequest) if err := stream.RecvMsg(m); err != nil { return err diff --git a/integration/https_test.go b/integration/https_test.go index 68dd1ed27..68319fea1 100644 --- a/integration/https_test.go +++ b/integration/https_test.go @@ -877,40 +877,6 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithTlsConfigurationDeletion() require.NoError(s.T(), err) } -// modifyCertificateConfFileContent replaces the content of a HTTPS configuration file. -func (s *HTTPSSuite) modifyCertificateConfFileContent(certFileName, confFileName string) { - file, err := os.OpenFile("./"+confFileName, os.O_WRONLY, os.ModeExclusive) - require.NoError(s.T(), err) - defer func() { - file.Close() - }() - err = file.Truncate(0) - require.NoError(s.T(), err) - - // If certificate file is not provided, just truncate the configuration file - if len(certFileName) > 0 { - tlsConf := dynamic.Configuration{ - TLS: &dynamic.TLSConfiguration{ - Certificates: []*traefiktls.CertAndStores{ - { - Certificate: traefiktls.Certificate{ - CertFile: types.FileOrContent("fixtures/https/" + certFileName + ".cert"), - KeyFile: types.FileOrContent("fixtures/https/" + certFileName + ".key"), - }, - }, - }, - }, - } - - var confBuffer bytes.Buffer - err := toml.NewEncoder(&confBuffer).Encode(tlsConf) - require.NoError(s.T(), err) - - _, err = file.Write(confBuffer.Bytes()) - require.NoError(s.T(), err) - } -} - func (s *HTTPSSuite) TestEntryPointHttpsRedirectAndPathModification() { file := s.adaptFile("fixtures/https/https_redirect.toml", struct{}{}) s.traefikCmd(withConfigFile(file)) @@ -1177,6 +1143,40 @@ func (s *HTTPSSuite) TestWithInvalidTLSOption() { } } +// modifyCertificateConfFileContent replaces the content of a HTTPS configuration file. +func (s *HTTPSSuite) modifyCertificateConfFileContent(certFileName, confFileName string) { + file, err := os.OpenFile("./"+confFileName, os.O_WRONLY, os.ModeExclusive) + require.NoError(s.T(), err) + defer func() { + file.Close() + }() + err = file.Truncate(0) + require.NoError(s.T(), err) + + // If certificate file is not provided, just truncate the configuration file + if len(certFileName) > 0 { + tlsConf := dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ + Certificates: []*traefiktls.CertAndStores{ + { + Certificate: traefiktls.Certificate{ + CertFile: types.FileOrContent("fixtures/https/" + certFileName + ".cert"), + KeyFile: types.FileOrContent("fixtures/https/" + certFileName + ".key"), + }, + }, + }, + }, + } + + var confBuffer bytes.Buffer + err := toml.NewEncoder(&confBuffer).Encode(tlsConf) + require.NoError(s.T(), err) + + _, err = file.Write(confBuffer.Bytes()) + require.NoError(s.T(), err) + } +} + func (s *SimpleSuite) TestMaxConcurrentStream() { file := s.adaptFile("fixtures/https/max_concurrent_stream.toml", struct{}{}) diff --git a/integration/integration_test.go b/integration/integration_test.go index 9ef4f8782..76ae5076d 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -71,45 +71,12 @@ type composeDeploy struct { type BaseSuite struct { suite.Suite + containers map[string]testcontainers.Container network *testcontainers.DockerNetwork hostIP string } -func (s *BaseSuite) waitForTraefik(containerName string) { - time.Sleep(1 * time.Second) - - // Wait for Traefik to turn ready. - req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/rawdata", nil) - require.NoError(s.T(), err) - - err = try.Request(req, 2*time.Second, try.StatusCodeIs(http.StatusOK), try.BodyContains(containerName)) - require.NoError(s.T(), err) -} - -func (s *BaseSuite) displayTraefikLogFile(path string) { - if s.T().Failed() { - if _, err := os.Stat(path); !os.IsNotExist(err) { - content, errRead := os.ReadFile(path) - // TODO TestName - // fmt.Printf("%s: Traefik logs: \n", c.TestName()) - fmt.Print("Traefik logs: \n") - if errRead == nil { - fmt.Println(string(content)) - } else { - fmt.Println(errRead) - } - } else { - // fmt.Printf("%s: No Traefik logs.\n", c.TestName()) - fmt.Print("No Traefik logs.\n") - } - errRemove := os.Remove(path) - if errRemove != nil { - fmt.Println(errRemove) - } - } -} - func (s *BaseSuite) SetupSuite() { if isDockerDesktop(s.T()) { _, err := os.Stat(tailscaleSecretFilePath) @@ -409,7 +376,7 @@ func (s *BaseSuite) displayTraefikLog(output *bytes.Buffer) { if output == nil || output.Len() == 0 { log.Info().Msg("No Traefik logs.") } else { - for _, line := range strings.Split(output.String(), "\n") { + for line := range strings.SplitSeq(output.String(), "\n") { log.Info().Msg(line) } } @@ -425,7 +392,7 @@ func (s *BaseSuite) getDockerHost() string { return dockerHost } -func (s *BaseSuite) adaptFile(path string, tempObjects interface{}) string { +func (s *BaseSuite) adaptFile(path string, tempObjects any) string { // Load file tmpl, err := template.ParseFiles(path) require.NoError(s.T(), err) @@ -513,3 +480,37 @@ func (s *BaseSuite) composeExec(service string, args ...string) string { return string(content) } + +func (s *BaseSuite) waitForTraefik(containerName string) { + time.Sleep(1 * time.Second) + + // Wait for Traefik to turn ready. + req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8080/api/rawdata", nil) + require.NoError(s.T(), err) + + err = try.Request(req, 2*time.Second, try.StatusCodeIs(http.StatusOK), try.BodyContains(containerName)) + require.NoError(s.T(), err) +} + +func (s *BaseSuite) displayTraefikLogFile(path string) { + if s.T().Failed() { + if _, err := os.Stat(path); !os.IsNotExist(err) { + content, errRead := os.ReadFile(path) + // TODO TestName + // fmt.Printf("%s: Traefik logs: \n", c.TestName()) + fmt.Print("Traefik logs: \n") + if errRead == nil { + fmt.Println(string(content)) + } else { + fmt.Println(errRead) + } + } else { + // fmt.Printf("%s: No Traefik logs.\n", c.TestName()) + fmt.Print("No Traefik logs.\n") + } + errRemove := os.Remove(path) + if errRemove != nil { + fmt.Println(errRemove) + } + } +} diff --git a/integration/log_rotation_test.go b/integration/log_rotation_test.go index c6ee5574f..90310a608 100644 --- a/integration/log_rotation_test.go +++ b/integration/log_rotation_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package integration diff --git a/integration/proxy_protocol_test.go b/integration/proxy_protocol_test.go index f30a641c7..893daa718 100644 --- a/integration/proxy_protocol_test.go +++ b/integration/proxy_protocol_test.go @@ -3,6 +3,7 @@ package integration import ( "bufio" "net" + "strings" "testing" "time" @@ -15,6 +16,7 @@ import ( type ProxyProtocolSuite struct { BaseSuite + whoamiIP string } @@ -124,15 +126,16 @@ func proxyProtoRequest(address string, version byte) (string, error) { } // Read the response from the server - var content string + var content strings.Builder scanner := bufio.NewScanner(conn) for scanner.Scan() { - content += scanner.Text() + "\n" + content.WriteString(scanner.Text()) + content.WriteString("\n") } if scanner.Err() != nil { return "", err } - return content, nil + return content.String(), nil } diff --git a/integration/ratelimit_test.go b/integration/ratelimit_test.go index c0f0c96b3..3bf8092a6 100644 --- a/integration/ratelimit_test.go +++ b/integration/ratelimit_test.go @@ -13,6 +13,7 @@ import ( type RateLimitSuite struct { BaseSuite + ServerIP string RedisEndpoint string } diff --git a/integration/redis_sentinel_test.go b/integration/redis_sentinel_test.go index 542a63728..4891c2a42 100644 --- a/integration/redis_sentinel_test.go +++ b/integration/redis_sentinel_test.go @@ -28,6 +28,7 @@ import ( // Redis test suites. type RedisSentinelSuite struct { BaseSuite + kvClient store.Store redisEndpoints []string } @@ -75,36 +76,6 @@ func (s *RedisSentinelSuite) TearDownSuite() { } } -func (s *RedisSentinelSuite) setupSentinelConfiguration(ports []string) { - for i, port := range ports { - templateValue := struct{ SentinelPort string }{SentinelPort: port} - - // Load file - templateFile := "resources/compose/config/sentinel_template.conf" - tmpl, err := template.ParseFiles(templateFile) - require.NoError(s.T(), err) - - folder, prefix := filepath.Split(templateFile) - - fileName := fmt.Sprintf("%s/sentinel%d.conf", folder, i+1) - tmpFile, err := os.Create(fileName) - require.NoError(s.T(), err) - defer tmpFile.Close() - - err = tmpFile.Chmod(0o666) - require.NoError(s.T(), err) - - model := structs.Map(templateValue) - model["SelfFilename"] = tmpFile.Name() - - err = tmpl.ExecuteTemplate(tmpFile, prefix, model) - require.NoError(s.T(), err) - - err = tmpFile.Sync() - require.NoError(s.T(), err) - } -} - func (s *RedisSentinelSuite) TestSentinelConfiguration() { file := s.adaptFile("fixtures/redis/sentinel.toml", struct{ RedisAddress string }{ RedisAddress: strings.Join(s.redisEndpoints, `","`), @@ -201,3 +172,33 @@ func (s *RedisSentinelSuite) TestSentinelConfiguration() { log.Info().Msg(text) } } + +func (s *RedisSentinelSuite) setupSentinelConfiguration(ports []string) { + for i, port := range ports { + templateValue := struct{ SentinelPort string }{SentinelPort: port} + + // Load file + templateFile := "resources/compose/config/sentinel_template.conf" + tmpl, err := template.ParseFiles(templateFile) + require.NoError(s.T(), err) + + folder, prefix := filepath.Split(templateFile) + + fileName := fmt.Sprintf("%s/sentinel%d.conf", folder, i+1) + tmpFile, err := os.Create(fileName) + require.NoError(s.T(), err) + defer tmpFile.Close() + + err = tmpFile.Chmod(0o666) + require.NoError(s.T(), err) + + model := structs.Map(templateValue) + model["SelfFilename"] = tmpFile.Name() + + err = tmpl.ExecuteTemplate(tmpFile, prefix, model) + require.NoError(s.T(), err) + + err = tmpFile.Sync() + require.NoError(s.T(), err) + } +} diff --git a/integration/redis_test.go b/integration/redis_test.go index e1ed10899..cf6cdf2c4 100644 --- a/integration/redis_test.go +++ b/integration/redis_test.go @@ -24,6 +24,7 @@ import ( // Redis test suites. type RedisSuite struct { BaseSuite + kvClient store.Store redisEndpoints []string } diff --git a/integration/rest_test.go b/integration/rest_test.go index 2600a08c9..467d9f118 100644 --- a/integration/rest_test.go +++ b/integration/rest_test.go @@ -18,6 +18,7 @@ import ( type RestSuite struct { BaseSuite + whoamiAddr string } diff --git a/integration/retry_test.go b/integration/retry_test.go index 12d0be8ac..fbd510833 100644 --- a/integration/retry_test.go +++ b/integration/retry_test.go @@ -15,6 +15,7 @@ import ( type RetrySuite struct { BaseSuite + whoamiIP string } diff --git a/integration/tcp_healthcheck_test.go b/integration/tcp_healthcheck_test.go index d79fb610b..13727b7b2 100644 --- a/integration/tcp_healthcheck_test.go +++ b/integration/tcp_healthcheck_test.go @@ -15,6 +15,7 @@ import ( // TCPHealthCheckSuite test suite for TCP health checks. type TCPHealthCheckSuite struct { BaseSuite + whoamitcp1IP string whoamitcp2IP string } diff --git a/integration/tracing_test.go b/integration/tracing_test.go index 71e0b1b36..d35d7ad62 100644 --- a/integration/tracing_test.go +++ b/integration/tracing_test.go @@ -21,6 +21,7 @@ import ( type TracingSuite struct { BaseSuite + whoamiIP string whoamiPort int tempoIP string diff --git a/integration/try/try.go b/integration/try/try.go index df3db0c9e..5a432a13d 100644 --- a/integration/try/try.go +++ b/integration/try/try.go @@ -19,6 +19,7 @@ const ( type timedAction func(timeout time.Duration, operation DoCondition) error // Sleep pauses the current goroutine for at least the duration d. +// // Deprecated: Use only when use another Try[...] functions is not possible. func Sleep(d time.Duration) { d = applyCIMultiplier(d) @@ -92,10 +93,7 @@ func Do(timeout time.Duration, operation DoCondition) error { panic("timeout must be larger than zero") } - interval := time.Duration(math.Ceil(float64(timeout) / 15.0)) - if interval > maxInterval { - interval = maxInterval - } + interval := min(time.Duration(math.Ceil(float64(timeout)/15.0)), maxInterval) timeout = applyCIMultiplier(timeout) diff --git a/integration/zk_test.go b/integration/zk_test.go index 8955c530e..ecee25275 100644 --- a/integration/zk_test.go +++ b/integration/zk_test.go @@ -24,6 +24,7 @@ import ( // Zk test suites. type ZookeeperSuite struct { BaseSuite + kvClient store.Store zookeeperAddr string } diff --git a/internal/gendoc.go b/internal/gendoc.go index 34c9e0002..df8098b0c 100644 --- a/internal/gendoc.go +++ b/internal/gendoc.go @@ -196,7 +196,7 @@ type errWriter struct { err error } -func (ew *errWriter) writeln(a ...interface{}) { +func (ew *errWriter) writeln(a ...any) { if ew.err != nil { return } diff --git a/pkg/api/criterion.go b/pkg/api/criterion.go index ba04c784e..f40b76aee 100644 --- a/pkg/api/criterion.go +++ b/pkg/api/criterion.go @@ -84,13 +84,7 @@ func (c *searchCriterion) filterMiddleware(mns []string) bool { return true } - for _, mn := range mns { - if c.MiddlewareName == mn { - return true - } - } - - return false + return slices.Contains(mns, c.MiddlewareName) } func pagination(request *http.Request, maximum int) (pageInfo, error) { @@ -109,10 +103,7 @@ func pagination(request *http.Request, maximum int) (pageInfo, error) { return pageInfo{}, fmt.Errorf("invalid request: page: %d, per_page: %d", page, perPage) } - endIndex := startIndex + perPage - if endIndex >= maximum { - endIndex = maximum - } + endIndex := min(startIndex+perPage, maximum) nextPage := 1 if page*perPage < maximum { diff --git a/pkg/api/debug.go b/pkg/api/debug.go index b207043ef..f5fdfb74c 100644 --- a/pkg/api/debug.go +++ b/pkg/api/debug.go @@ -15,7 +15,7 @@ func init() { expvar.Publish("Goroutines2", expvar.Func(goroutines)) } -func goroutines() interface{} { +func goroutines() any { return runtime.NumGoroutine() } diff --git a/pkg/api/handler.go b/pkg/api/handler.go index 0165da9e8..2cd9e2270 100644 --- a/pkg/api/handler.go +++ b/pkg/api/handler.go @@ -30,11 +30,13 @@ func writeError(rw http.ResponseWriter, msg string, code int) { type serviceInfoRepresentation struct { *runtime.ServiceInfo + ServerStatus map[string]string `json:"serverStatus,omitempty"` } type tcpServiceInfoRepresentation struct { *runtime.TCPServiceInfo + ServerStatus map[string]string `json:"serverStatus,omitempty"` } @@ -164,7 +166,7 @@ func getProviderName(id string) string { return strings.SplitN(id, "@", 2)[1] } -func extractType(element interface{}) string { +func extractType(element any) string { v := reflect.ValueOf(element).Elem() for i := range v.NumField() { field := v.Field(i) diff --git a/pkg/api/handler_entrypoint.go b/pkg/api/handler_entrypoint.go index 90dc66daa..2595d9faa 100644 --- a/pkg/api/handler_entrypoint.go +++ b/pkg/api/handler_entrypoint.go @@ -15,6 +15,7 @@ import ( type entryPointRepresentation struct { *static.EntryPoint + Name string `json:"name,omitempty"` } diff --git a/pkg/api/handler_entrypoint_test.go b/pkg/api/handler_entrypoint_test.go index 768cd3dcd..c4c2dccf8 100644 --- a/pkg/api/handler_entrypoint_test.go +++ b/pkg/api/handler_entrypoint_test.go @@ -235,7 +235,7 @@ func TestHandler_EntryPoints(t *testing.T) { require.NoError(t, err) if *updateExpected { - var results interface{} + var results any err := json.Unmarshal(contents, &results) require.NoError(t, err) diff --git a/pkg/api/handler_http.go b/pkg/api/handler_http.go index a0ca84ce7..24df129f1 100644 --- a/pkg/api/handler_http.go +++ b/pkg/api/handler_http.go @@ -16,6 +16,7 @@ import ( type routerRepresentation struct { *runtime.RouterInfo + Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } @@ -34,6 +35,7 @@ func newRouterRepresentation(name string, rt *runtime.RouterInfo) routerRepresen type serviceRepresentation struct { *runtime.ServiceInfo + Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` Type string `json:"type,omitempty"` @@ -52,6 +54,7 @@ func newServiceRepresentation(name string, si *runtime.ServiceInfo) serviceRepre type middlewareRepresentation struct { *runtime.MiddlewareInfo + Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` Type string `json:"type,omitempty"` diff --git a/pkg/api/handler_http_test.go b/pkg/api/handler_http_test.go index e34b1bfe2..4f736eed7 100644 --- a/pkg/api/handler_http_test.go +++ b/pkg/api/handler_http_test.go @@ -1028,7 +1028,7 @@ func TestHandler_HTTP(t *testing.T) { require.NoError(t, err) if *updateExpected { - var results interface{} + var results any err := json.Unmarshal(contents, &results) require.NoError(t, err) diff --git a/pkg/api/handler_overview_test.go b/pkg/api/handler_overview_test.go index 7b07106b9..8dabef1b1 100644 --- a/pkg/api/handler_overview_test.go +++ b/pkg/api/handler_overview_test.go @@ -239,7 +239,7 @@ func TestHandler_Overview(t *testing.T) { KubernetesCRD: &crd.Provider{}, Rest: &rest.Provider{}, Plugin: map[string]static.PluginConf{ - "test": map[string]interface{}{}, + "test": map[string]any{}, }, }, }, @@ -292,7 +292,7 @@ func TestHandler_Overview(t *testing.T) { require.NoError(t, err) if *updateExpected { - var results interface{} + var results any err := json.Unmarshal(contents, &results) require.NoError(t, err) diff --git a/pkg/api/handler_tcp.go b/pkg/api/handler_tcp.go index cc8f9aeed..470b1ecb6 100644 --- a/pkg/api/handler_tcp.go +++ b/pkg/api/handler_tcp.go @@ -15,6 +15,7 @@ import ( type tcpRouterRepresentation struct { *runtime.TCPRouterInfo + Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } @@ -29,6 +30,7 @@ func newTCPRouterRepresentation(name string, rt *runtime.TCPRouterInfo) tcpRoute type tcpServiceRepresentation struct { *runtime.TCPServiceInfo + Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` Type string `json:"type,omitempty"` @@ -47,6 +49,7 @@ func newTCPServiceRepresentation(name string, si *runtime.TCPServiceInfo) tcpSer type tcpMiddlewareRepresentation struct { *runtime.TCPMiddlewareInfo + Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` Type string `json:"type,omitempty"` diff --git a/pkg/api/handler_tcp_test.go b/pkg/api/handler_tcp_test.go index b0ee4cc2f..1cf829260 100644 --- a/pkg/api/handler_tcp_test.go +++ b/pkg/api/handler_tcp_test.go @@ -964,7 +964,7 @@ func TestHandler_TCP(t *testing.T) { require.NoError(t, err) if *updateExpected { - var results interface{} + var results any err := json.Unmarshal(contents, &results) require.NoError(t, err) diff --git a/pkg/api/handler_test.go b/pkg/api/handler_test.go index 3eb7f8aa0..3adfffe06 100644 --- a/pkg/api/handler_test.go +++ b/pkg/api/handler_test.go @@ -178,7 +178,7 @@ func TestHandler_GetMiddleware(t *testing.T) { middlewareName string conf runtime.Configuration expectedStatus int - expected interface{} + expected any }{ { desc: "Middleware not found", diff --git a/pkg/api/handler_udp.go b/pkg/api/handler_udp.go index 60f4b7178..db7185abd 100644 --- a/pkg/api/handler_udp.go +++ b/pkg/api/handler_udp.go @@ -15,6 +15,7 @@ import ( type udpRouterRepresentation struct { *runtime.UDPRouterInfo + Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } @@ -29,6 +30,7 @@ func newUDPRouterRepresentation(name string, rt *runtime.UDPRouterInfo) udpRoute type udpServiceRepresentation struct { *runtime.UDPServiceInfo + Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` Type string `json:"type,omitempty"` diff --git a/pkg/api/handler_udp_test.go b/pkg/api/handler_udp_test.go index bd8625dfe..547c328b0 100644 --- a/pkg/api/handler_udp_test.go +++ b/pkg/api/handler_udp_test.go @@ -594,7 +594,7 @@ func TestHandler_UDP(t *testing.T) { require.NoError(t, err) if *updateExpected { - var results interface{} + var results any err := json.Unmarshal(contents, &results) require.NoError(t, err) diff --git a/pkg/cli/deprecation.go b/pkg/cli/deprecation.go index 337434aed..233506c8e 100644 --- a/pkg/cli/deprecation.go +++ b/pkg/cli/deprecation.go @@ -82,7 +82,7 @@ func logDeprecations(arguments []string) (bool, error) { if filePath != "" { // We don't rely on the Parser file loader here to avoid issues with unknown fields. // Parse file content into a generic map. - var fileConfig map[string]interface{} + var fileConfig map[string]any if err := file.Decode(filePath, &fileConfig); err != nil { return false, fmt.Errorf("decoding configuration file %s: %w", filePath, err) } @@ -106,7 +106,7 @@ func logDeprecations(arguments []string) (bool, error) { if len(vars) > 0 { // We don't rely on the Parser env loader here to avoid issues with unknown fields. // Decode environment variables to a generic map. - var envConfig map[string]interface{} + var envConfig map[string]any if err := env.Decode(vars, env.DefaultNamePrefix, &envConfig); err != nil { return false, fmt.Errorf("decoding environment variables: %w", err) } @@ -130,9 +130,9 @@ func logDeprecations(arguments []string) (bool, error) { // flattenToLabels recursively flattens a nested map into label key-value pairs. // Example: {"experimental": {"http3": true}} -> {"traefik.experimental.http3": "true"}. -func flattenToLabels(config interface{}, currKey string, labels map[string]string) { +func flattenToLabels(config any, currKey string, labels map[string]string) { switch v := config.(type) { - case map[string]interface{}: + case map[string]any: for key, value := range v { newKey := key if currKey != "" { @@ -140,7 +140,7 @@ func flattenToLabels(config interface{}, currKey string, labels map[string]strin } flattenToLabels(value, newKey, labels) } - case []interface{}: + case []any: for i, item := range v { newKey := currKey + "[" + strconv.Itoa(i) + "]" flattenToLabels(item, newKey, labels) @@ -168,7 +168,7 @@ func parseDeprecatedConfig(labels map[string]string) (*configuration, error) { // Filter unknown nodes and check for deprecated options. config := &configuration{} - filterUnknownNodes(reflect.TypeOf(config), node) + filterUnknownNodes(reflect.TypeFor[*configuration](), node) // If no config remains we can return without error, to allow other loaders to proceed. if node == nil || len(node.Children) == 0 { diff --git a/pkg/cli/loader_file.go b/pkg/cli/loader_file.go index f5f11fa51..b33768b6a 100644 --- a/pkg/cli/loader_file.go +++ b/pkg/cli/loader_file.go @@ -62,7 +62,7 @@ func (f *FileLoader) Load(args []string, cmd *cli.Command) (bool, error) { // loadConfigFiles tries to decode the given configuration file and all default locations for the configuration file. // It stops as soon as decoding one of them is successful. -func loadConfigFiles(configFile string, element interface{}) (string, error) { +func loadConfigFiles(configFile string, element any) (string, error) { finder := cli.Finder{ BasePaths: []string{"/etc/traefik/traefik", "$XDG_CONFIG_HOME/traefik", "$HOME/.config/traefik", "./traefik"}, Extensions: []string{"toml", "yaml", "yml"}, diff --git a/pkg/collector/hydratation/hydration.go b/pkg/collector/hydratation/hydration.go index 74009817a..eff17ae58 100644 --- a/pkg/collector/hydratation/hydration.go +++ b/pkg/collector/hydratation/hydration.go @@ -18,7 +18,7 @@ const ( ) // Hydrate hydrates a configuration. -func Hydrate(element interface{}) error { +func Hydrate(element any) error { field := reflect.ValueOf(element) return fill(field) } @@ -81,7 +81,7 @@ func fill(field reflect.Value) error { return nil } -func setTyped(field reflect.Value, i interface{}) { +func setTyped(field reflect.Value, i any) { baseValue := reflect.ValueOf(i) if field.Kind().String() == field.Type().String() { field.Set(baseValue) diff --git a/pkg/config/dynamic/config_test.go b/pkg/config/dynamic/config_test.go index 4a04509c4..368a211da 100644 --- a/pkg/config/dynamic/config_test.go +++ b/pkg/config/dynamic/config_test.go @@ -21,7 +21,7 @@ func TestDeepCopy(t *testing.T) { cfgDeepCopy := cfg.DeepCopy() assert.NotEqual(t, reflect.ValueOf(cfgDeepCopy), reflect.ValueOf(cfg)) - assert.Equal(t, reflect.TypeOf(cfgDeepCopy), reflect.TypeOf(cfg)) + assert.Equal(t, reflect.TypeOf(cfgDeepCopy), reflect.TypeOf(cfg)) //nolint:modernize // Comparing runtime types of two values. assert.Equal(t, cfgDeepCopy, cfg) // Update cfg @@ -32,6 +32,6 @@ func TestDeepCopy(t *testing.T) { assert.Equal(t, cfgCopy, cfg) assert.NotEqual(t, reflect.ValueOf(cfgDeepCopy), reflect.ValueOf(cfg)) - assert.Equal(t, reflect.TypeOf(cfgDeepCopy), reflect.TypeOf(cfg)) + assert.Equal(t, reflect.TypeOf(cfgDeepCopy), reflect.TypeOf(cfg)) //nolint:modernize // Comparing runtime types of two values. assert.NotEqual(t, cfgDeepCopy, cfg) } diff --git a/pkg/config/dynamic/middlewares.go b/pkg/config/dynamic/middlewares.go index fa10c302b..5b2157d9b 100644 --- a/pkg/config/dynamic/middlewares.go +++ b/pkg/config/dynamic/middlewares.go @@ -69,6 +69,7 @@ type GrpcWeb struct { type ContentType struct { // AutoDetect specifies whether to let the `Content-Type` header, if it has not been set by the backend, // be automatically set to a value derived from the contents of the response. + // // Deprecated: AutoDetect option is deprecated, Content-Type middleware is only meant to be used to enable the content-type detection, please remove any usage of this option. AutoDetect *bool `json:"autoDetect,omitempty" toml:"autoDetect,omitempty" yaml:"autoDetect,omitempty" export:"true"` } @@ -481,6 +482,7 @@ func (s *IPStrategy) Get() (ip.Strategy, error) { // IPWhiteList holds the IP whitelist middleware configuration. // This middleware limits allowed requests based on the client IP. // More info: https://doc.traefik.io/traefik/v3.6/middlewares/http/ipwhitelist/ +// // Deprecated: please use IPAllowList instead. type IPWhiteList struct { // SourceRange defines the set of allowed IPs (or ranges of allowed IPs by using CIDR notation). Required. diff --git a/pkg/config/dynamic/plugins_test.go b/pkg/config/dynamic/plugins_test.go index 6021362dd..83b05dcc6 100644 --- a/pkg/config/dynamic/plugins_test.go +++ b/pkg/config/dynamic/plugins_test.go @@ -44,11 +44,11 @@ func TestPluginConf_DeepCopy_mapOfStruct(t *testing.T) { } func TestPluginConf_DeepCopy_map(t *testing.T) { - m := map[string]interface{}{ + m := map[string]any{ "name": "bar", } p := PluginConf{ - "config": map[string]interface{}{ + "config": map[string]any{ "foo": m, }, } @@ -64,7 +64,7 @@ func TestPluginConf_DeepCopy_map(t *testing.T) { func TestPluginConf_DeepCopy_panic(t *testing.T) { p := &PluginConf{ - "config": map[string]interface{}{ + "config": map[string]any{ "foo": &Foo{Name: "gigi"}, }, } diff --git a/pkg/config/dynamic/tcp_config.go b/pkg/config/dynamic/tcp_config.go index a68be77b9..51a96373a 100644 --- a/pkg/config/dynamic/tcp_config.go +++ b/pkg/config/dynamic/tcp_config.go @@ -88,6 +88,7 @@ type TCPServersLoadBalancer struct { Servers []TCPServer `json:"servers,omitempty" toml:"servers,omitempty" yaml:"servers,omitempty" label-slice-as-struct:"server" export:"true"` ServersTransport string `json:"serversTransport,omitempty" toml:"serversTransport,omitempty" yaml:"serversTransport,omitempty" export:"true"` // ProxyProtocol holds the PROXY Protocol configuration. + // // Deprecated: use ServersTransport to configure ProxyProtocol instead. ProxyProtocol *ProxyProtocol `json:"proxyProtocol,omitempty" toml:"proxyProtocol,omitempty" yaml:"proxyProtocol,omitempty" label:"allowEmpty" file:"allowEmpty" kv:"allowEmpty" export:"true"` // TerminationDelay, corresponds to the deadline that the proxy sets, after one @@ -95,6 +96,7 @@ type TCPServersLoadBalancer struct { // connection, to close the reading capability as well, hence fully terminating the // connection. It is a duration in milliseconds, defaulting to 100. A negative value // means an infinite deadline (i.e. the reading capability is never closed). + // // Deprecated: use ServersTransport to configure the TerminationDelay instead. TerminationDelay *int `json:"terminationDelay,omitempty" toml:"terminationDelay,omitempty" yaml:"terminationDelay,omitempty" export:"true"` HealthCheck *TCPServerHealthCheck `json:"healthCheck,omitempty" toml:"healthCheck,omitempty" yaml:"healthCheck,omitempty" label:"allowEmpty" file:"allowEmpty" kv:"allowEmpty" export:"true"` diff --git a/pkg/config/dynamic/tcp_middlewares.go b/pkg/config/dynamic/tcp_middlewares.go index 1f20e8ca2..cdc2163a0 100644 --- a/pkg/config/dynamic/tcp_middlewares.go +++ b/pkg/config/dynamic/tcp_middlewares.go @@ -26,6 +26,7 @@ type TCPInFlightConn struct { // +k8s:deepcopy-gen=true // TCPIPWhiteList holds the TCP IPWhiteList middleware configuration. +// // Deprecated: please use IPAllowList instead. type TCPIPWhiteList struct { // SourceRange defines the allowed IPs (or ranges of allowed IPs by using CIDR notation). diff --git a/pkg/config/kv/kv.go b/pkg/config/kv/kv.go index ad467b00d..eb71dee0c 100644 --- a/pkg/config/kv/kv.go +++ b/pkg/config/kv/kv.go @@ -13,7 +13,7 @@ import ( // KV pairs -> tree of untyped nodes // untyped nodes -> nodes augmented with metadata such as kind (inferred from element) // "typed" nodes -> typed element. -func Decode(pairs []*store.KVPair, element interface{}, rootName string) error { +func Decode(pairs []*store.KVPair, element any, rootName string) error { if element == nil { return nil } @@ -34,7 +34,7 @@ func Decode(pairs []*store.KVPair, element interface{}, rootName string) error { return parser.Fill(element, node, parser.FillerOpts{AllowSliceAsStruct: false}) } -func getRootFieldNames(rootName string, element interface{}) []string { +func getRootFieldNames(rootName string, element any) []string { if element == nil { return nil } diff --git a/pkg/config/label/label.go b/pkg/config/label/label.go index ed1e71ddf..3084778fd 100644 --- a/pkg/config/label/label.go +++ b/pkg/config/label/label.go @@ -31,6 +31,6 @@ func EncodeConfiguration(conf *dynamic.Configuration) (map[string]string, error) // Decode converts the labels to an element. // labels -> [ node -> node + metadata (type) ] -> element (node). -func Decode(labels map[string]string, element interface{}, filters ...string) error { +func Decode(labels map[string]string, element any, filters ...string) error { return parser.Decode(labels, element, parser.DefaultRootName, filters...) } diff --git a/pkg/config/runtime/runtime_http.go b/pkg/config/runtime/runtime_http.go index f8f33fcec..18a1cd850 100644 --- a/pkg/config/runtime/runtime_http.go +++ b/pkg/config/runtime/runtime_http.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "maps" "slices" "sort" "sync" @@ -74,6 +75,7 @@ func unique(src []string) []string { // RouterInfo holds information about a currently running HTTP router. type RouterInfo struct { *dynamic.Router // dynamic configuration + // Err contains all the errors that occurred during router's creation. Err []string `json:"error,omitempty"` // Status reports whether the router is disabled, in a warning state, or all good (enabled). @@ -91,10 +93,8 @@ type RouterInfo struct { // AddError adds err to r.Err, if it does not already exist. // If critical is set, r is marked as disabled. func (r *RouterInfo) AddError(err error, critical bool) { - for _, value := range r.Err { - if value == err.Error() { - return - } + if slices.Contains(r.Err, err.Error()) { + return } r.Err = append(r.Err, err.Error()) @@ -112,6 +112,7 @@ func (r *RouterInfo) AddError(err error, critical bool) { // MiddlewareInfo holds information about a currently running middleware. type MiddlewareInfo struct { *dynamic.Middleware // dynamic configuration + // Err contains all the errors that occurred during service creation. Err []string `json:"error,omitempty"` Status string `json:"status,omitempty"` @@ -121,10 +122,8 @@ type MiddlewareInfo struct { // AddError adds err to s.Err, if it does not already exist. // If critical is set, m is marked as disabled. func (m *MiddlewareInfo) AddError(err error, critical bool) { - for _, value := range m.Err { - if value == err.Error() { - return - } + if slices.Contains(m.Err, err.Error()) { + return } m.Err = append(m.Err, err.Error()) @@ -142,6 +141,7 @@ func (m *MiddlewareInfo) AddError(err error, critical bool) { // ServiceInfo holds information about a currently running service. type ServiceInfo struct { *dynamic.Service // dynamic configuration + // Err contains all the errors that occurred during service creation. Err []string `json:"error,omitempty"` // Status reports whether the service is disabled, in a warning state, or all good (enabled). @@ -157,10 +157,8 @@ type ServiceInfo struct { // AddError adds err to s.Err, if it does not already exist. // If critical is set, s is marked as disabled. func (s *ServiceInfo) AddError(err error, critical bool) { - for _, value := range s.Err { - if value == err.Error() { - return - } + if slices.Contains(s.Err, err.Error()) { + return } s.Err = append(s.Err, err.Error()) @@ -197,9 +195,5 @@ func (s *ServiceInfo) GetAllStatus() map[string]string { return nil } - allStatus := make(map[string]string, len(s.serverStatus)) - for k, v := range s.serverStatus { - allStatus[k] = v - } - return allStatus + return maps.Clone(s.serverStatus) } diff --git a/pkg/config/runtime/runtime_tcp.go b/pkg/config/runtime/runtime_tcp.go index 07473b51e..90b81fce7 100644 --- a/pkg/config/runtime/runtime_tcp.go +++ b/pkg/config/runtime/runtime_tcp.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "maps" "slices" "sync" @@ -49,8 +50,9 @@ func (c *Configuration) GetTCPRoutersByEntryPoints(ctx context.Context, entryPoi // TCPRouterInfo holds information about a currently running TCP router. type TCPRouterInfo struct { - *dynamic.TCPRouter // dynamic configuration - Err []string `json:"error,omitempty"` // initialization error + *dynamic.TCPRouter // dynamic configuration + + Err []string `json:"error,omitempty"` // initialization error // Status reports whether the router is disabled, in a warning state, or all good (enabled). // If not in "enabled" state, the reason for it should be in the list of Err. // It is the caller's responsibility to set the initial status. @@ -61,10 +63,8 @@ type TCPRouterInfo struct { // AddError adds err to r.Err, if it does not already exist. // If critical is set, r is marked as disabled. func (r *TCPRouterInfo) AddError(err error, critical bool) { - for _, value := range r.Err { - if value == err.Error() { - return - } + if slices.Contains(r.Err, err.Error()) { + return } r.Err = append(r.Err, err.Error()) @@ -81,8 +81,9 @@ func (r *TCPRouterInfo) AddError(err error, critical bool) { // TCPServiceInfo holds information about a currently running TCP service. type TCPServiceInfo struct { - *dynamic.TCPService // dynamic configuration - Err []string `json:"error,omitempty"` // initialization error + *dynamic.TCPService // dynamic configuration + + Err []string `json:"error,omitempty"` // initialization error // Status reports whether the service is disabled, in a warning state, or all good (enabled). // If not in "enabled" state, the reason for it should be in the list of Err. // It is the caller's responsibility to set the initial status. @@ -96,10 +97,8 @@ type TCPServiceInfo struct { // AddError adds err to s.Err, if it does not already exist. // If critical is set, s is marked as disabled. func (s *TCPServiceInfo) AddError(err error, critical bool) { - for _, value := range s.Err { - if value == err.Error() { - return - } + if slices.Contains(s.Err, err.Error()) { + return } s.Err = append(s.Err, err.Error()) @@ -135,15 +134,14 @@ func (s *TCPServiceInfo) GetAllStatus() map[string]string { } allStatus := make(map[string]string, len(s.serverStatus)) - for k, v := range s.serverStatus { - allStatus[k] = v - } + maps.Copy(allStatus, s.serverStatus) return allStatus } // TCPMiddlewareInfo holds information about a currently running middleware. type TCPMiddlewareInfo struct { *dynamic.TCPMiddleware // dynamic configuration + // Err contains all the errors that occurred during service creation. Err []string `json:"error,omitempty"` Status string `json:"status,omitempty"` @@ -153,10 +151,8 @@ type TCPMiddlewareInfo struct { // AddError adds err to s.Err, if it does not already exist. // If critical is set, m is marked as disabled. func (m *TCPMiddlewareInfo) AddError(err error, critical bool) { - for _, value := range m.Err { - if value == err.Error() { - return - } + if slices.Contains(m.Err, err.Error()) { + return } m.Err = append(m.Err, err.Error()) diff --git a/pkg/config/runtime/runtime_udp.go b/pkg/config/runtime/runtime_udp.go index 912f986f1..fd82e0495 100644 --- a/pkg/config/runtime/runtime_udp.go +++ b/pkg/config/runtime/runtime_udp.go @@ -54,8 +54,9 @@ func (c *Configuration) GetUDPRoutersByEntryPoints(ctx context.Context, entryPoi // UDPRouterInfo holds information about a currently running UDP router. type UDPRouterInfo struct { - *dynamic.UDPRouter // dynamic configuration - Err []string `json:"error,omitempty"` // initialization error + *dynamic.UDPRouter // dynamic configuration + + Err []string `json:"error,omitempty"` // initialization error // Status reports whether the router is disabled, in a warning state, or all good (enabled). // If not in "enabled" state, the reason for it should be in the list of Err. // It is the caller's responsibility to set the initial status. @@ -66,10 +67,8 @@ type UDPRouterInfo struct { // AddError adds err to r.Err, if it does not already exist. // If critical is set, r is marked as disabled. func (r *UDPRouterInfo) AddError(err error, critical bool) { - for _, value := range r.Err { - if value == err.Error() { - return - } + if slices.Contains(r.Err, err.Error()) { + return } r.Err = append(r.Err, err.Error()) @@ -86,8 +85,9 @@ func (r *UDPRouterInfo) AddError(err error, critical bool) { // UDPServiceInfo holds information about a currently running UDP service. type UDPServiceInfo struct { - *dynamic.UDPService // dynamic configuration - Err []string `json:"error,omitempty"` // initialization error + *dynamic.UDPService // dynamic configuration + + Err []string `json:"error,omitempty"` // initialization error // Status reports whether the service is disabled, in a warning state, or all good (enabled). // If not in "enabled" state, the reason for it should be in the list of Err. // It is the caller's responsibility to set the initial status. @@ -98,10 +98,8 @@ type UDPServiceInfo struct { // AddError adds err to s.Err, if it does not already exist. // If critical is set, s is marked as disabled. func (s *UDPServiceInfo) AddError(err error, critical bool) { - for _, value := range s.Err { - if value == err.Error() { - return - } + if slices.Contains(s.Err, err.Error()) { + return } s.Err = append(s.Err, err.Error()) diff --git a/pkg/config/static/plugins.go b/pkg/config/static/plugins.go index 5b2577e4e..ddf2f9cc1 100644 --- a/pkg/config/static/plugins.go +++ b/pkg/config/static/plugins.go @@ -1,4 +1,4 @@ package static // PluginConf holds the plugin configuration. -type PluginConf map[string]interface{} +type PluginConf map[string]any diff --git a/pkg/config/static/static_config.go b/pkg/config/static/static_config.go index 9311b9405..e921e8a5e 100644 --- a/pkg/config/static/static_config.go +++ b/pkg/config/static/static_config.go @@ -393,21 +393,6 @@ func (c *Configuration) SetEffectiveConfiguration() { c.initACMEProvider() } -func (c *Configuration) hasUserDefinedEntrypoint() bool { - return len(c.EntryPoints) != 0 -} - -func (c *Configuration) initACMEProvider() { - for _, resolver := range c.CertificatesResolvers { - if resolver.ACME != nil { - resolver.ACME.CAServer = getSafeACMECAServer(resolver.ACME.CAServer) - } - } - - logger := logs.NoLevel(log.Logger, zerolog.DebugLevel).With().Str("lib", "lego").Logger() - legolog.Logger = logs.NewLogrusWrapper(logger) -} - // ValidateConfiguration validate that configuration is coherent. func (c *Configuration) ValidateConfiguration() error { for name, resolver := range c.CertificatesResolvers { @@ -494,6 +479,21 @@ func (c *Configuration) ValidateConfiguration() error { return nil } +func (c *Configuration) hasUserDefinedEntrypoint() bool { + return len(c.EntryPoints) != 0 +} + +func (c *Configuration) initACMEProvider() { + for _, resolver := range c.CertificatesResolvers { + if resolver.ACME != nil { + resolver.ACME.CAServer = getSafeACMECAServer(resolver.ACME.CAServer) + } + } + + logger := logs.NoLevel(log.Logger, zerolog.DebugLevel).With().Str("lib", "lego").Logger() + legolog.Logger = logs.NewLogrusWrapper(logger) +} + func getSafeACMECAServer(caServerSrc string) string { if len(caServerSrc) == 0 { return DefaultAcmeCAServer diff --git a/pkg/healthcheck/healthcheck.go b/pkg/healthcheck/healthcheck.go index e1be3343e..a0d1a833a 100644 --- a/pkg/healthcheck/healthcheck.go +++ b/pkg/healthcheck/healthcheck.go @@ -391,7 +391,7 @@ func (p *PassiveServiceHealthChecker) WrapHandler(ctx context.Context, next http } // We need to guarantee that only one goroutine (request) will update the status and create a timer for the target. - _, _, _ = p.timersGroup.Do(targetURL, func() (interface{}, error) { + _, _, _ = p.timersGroup.Do(targetURL, func() (any, error) { // A timer is already running for this target; // it means that the target is already considered unhealthy. if _, ok := p.timers.Load(targetURL); ok { diff --git a/pkg/healthcheck/mock_test.go b/pkg/healthcheck/mock_test.go index 483a5385d..0adcf1b25 100644 --- a/pkg/healthcheck/mock_test.go +++ b/pkg/healthcheck/mock_test.go @@ -165,6 +165,7 @@ type testLoadBalancer struct { // RWMutex needed due to parallel test execution: Both the system-under-test // and the test assertions reference the counters. *sync.RWMutex + numRemovedServers int numUpsertedServers int } diff --git a/pkg/job/job.go b/pkg/job/job.go index 752f7b905..c16146fca 100644 --- a/pkg/job/job.go +++ b/pkg/job/job.go @@ -17,6 +17,7 @@ const ( // If operation() takes more than MinJobInterval, Reset() is called in NextBackOff(). type BackOff struct { *backoff.ExponentialBackOff + MinJobInterval time.Duration } diff --git a/pkg/middlewares/accesslog/field_middleware_test.go b/pkg/middlewares/accesslog/field_middleware_test.go index 50a8a3406..b39167a07 100644 --- a/pkg/middlewares/accesslog/field_middleware_test.go +++ b/pkg/middlewares/accesslog/field_middleware_test.go @@ -12,7 +12,7 @@ import ( func TestConcatFieldHandler_ServeHTTP(t *testing.T) { testCases := []struct { desc string - existingValue interface{} + existingValue any newValue string expectedResult string }{ diff --git a/pkg/middlewares/accesslog/logdata.go b/pkg/middlewares/accesslog/logdata.go index 19dc43d6c..451588b8a 100644 --- a/pkg/middlewares/accesslog/logdata.go +++ b/pkg/middlewares/accesslog/logdata.go @@ -129,7 +129,7 @@ func init() { } // CoreLogData holds the fields computed from the request/response. -type CoreLogData map[string]interface{} +type CoreLogData map[string]any // LogData is the data captured by the middleware so that it can be logged. type LogData struct { diff --git a/pkg/middlewares/accesslog/logger.go b/pkg/middlewares/accesslog/logger.go index 5f21afc09..9ab1e6bd5 100644 --- a/pkg/middlewares/accesslog/logger.go +++ b/pkg/middlewares/accesslog/logger.go @@ -74,20 +74,6 @@ type Handler struct { wg sync.WaitGroup } -// AliceConstructor returns an alice.Constructor that wraps the Handler (conditionally) in a middleware chain. -func (h *Handler) AliceConstructor() alice.Constructor { - return func(next http.Handler) (http.Handler, error) { - return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - if h == nil { - next.ServeHTTP(rw, req) - return - } - - h.ServeHTTP(rw, req, next) - }), nil - } -} - // NewHandler creates a new Handler. func NewHandler(ctx context.Context, config *otypes.AccessLog) (*Handler, error) { var file io.WriteCloser = noopCloser{os.Stdout} @@ -183,28 +169,18 @@ func NewHandler(ctx context.Context, config *otypes.AccessLog) (*Handler, error) return logHandler, nil } -func openAccessLogFile(filePath string) (*os.File, error) { - dir := filepath.Dir(filePath) +// AliceConstructor returns an alice.Constructor that wraps the Handler (conditionally) in a middleware chain. +func (h *Handler) AliceConstructor() alice.Constructor { + return func(next http.Handler) (http.Handler, error) { + return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { + if h == nil { + next.ServeHTTP(rw, req) + return + } - if err := os.MkdirAll(dir, 0o755); err != nil { - return nil, fmt.Errorf("failed to create log path %s: %w", dir, err) + h.ServeHTTP(rw, req, next) + }), nil } - - file, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0o664) - if err != nil { - return nil, fmt.Errorf("error opening file %s: %w", filePath, err) - } - - return file, nil -} - -// GetLogData gets the request context object that contains logging data. -// This creates data as the request passes through the middleware chain. -func GetLogData(req *http.Request) *LogData { - if ld, ok := req.Context().Value(DataTableKey).(*LogData); ok { - return ld - } - return nil } func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.Handler) { @@ -335,23 +311,6 @@ func (h *Handler) Rotate() error { return nil } -func silentSplitHostPort(value string) (host, port string) { - host, port, err := net.SplitHostPort(value) - if err != nil { - return value, "-" - } - return host, port -} - -func usernameIfPresent(theURL *url.URL) string { - if theURL.User != nil { - if name := theURL.User.Username(); name != "" { - return name - } - } - return "-" -} - // Logging handler to log frontend name, backend name, and elapsed time. func (h *Handler) logTheRoundTrip(ctx context.Context, logDataTable *LogData) { core := logDataTable.Core @@ -458,6 +417,47 @@ func (h *Handler) keepAccessLog(statusCode, retryAttempts int, duration time.Dur return false } +// GetLogData gets the request context object that contains logging data. +// This creates data as the request passes through the middleware chain. +func GetLogData(req *http.Request) *LogData { + if ld, ok := req.Context().Value(DataTableKey).(*LogData); ok { + return ld + } + return nil +} + +func openAccessLogFile(filePath string) (*os.File, error) { + dir := filepath.Dir(filePath) + + if err := os.MkdirAll(dir, 0o755); err != nil { + return nil, fmt.Errorf("failed to create log path %s: %w", dir, err) + } + + file, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0o664) + if err != nil { + return nil, fmt.Errorf("error opening file %s: %w", filePath, err) + } + + return file, nil +} + +func silentSplitHostPort(value string) (host, port string) { + host, port, err := net.SplitHostPort(value) + if err != nil { + return value, "-" + } + return host, port +} + +func usernameIfPresent(theURL *url.URL) string { + if theURL.User != nil { + if name := theURL.User.Username(); name != "" { + return name + } + } + return "-" +} + var requestCounter uint64 // Request ID func nextRequestCount() uint64 { diff --git a/pkg/middlewares/accesslog/logger_formatters.go b/pkg/middlewares/accesslog/logger_formatters.go index 3da18c239..ec1c04f05 100644 --- a/pkg/middlewares/accesslog/logger_formatters.go +++ b/pkg/middlewares/accesslog/logger_formatters.go @@ -81,7 +81,7 @@ func (f *GenericCLFLogFormatter) Format(entry *logrus.Entry) ([]byte, error) { return b.Bytes(), err } -func toLog(fields logrus.Fields, key, defaultValue string, quoted bool) interface{} { +func toLog(fields logrus.Fields, key, defaultValue string, quoted bool) any { if v, ok := fields[key]; ok { if v == nil { return defaultValue diff --git a/pkg/middlewares/accesslog/logger_formatters_test.go b/pkg/middlewares/accesslog/logger_formatters_test.go index a7e85c5d4..c1647a2a9 100644 --- a/pkg/middlewares/accesslog/logger_formatters_test.go +++ b/pkg/middlewares/accesslog/logger_formatters_test.go @@ -15,12 +15,12 @@ func TestCommonLogFormatter_Format(t *testing.T) { testCases := []struct { name string - data map[string]interface{} + data map[string]any expectedLog string }{ { name: "DownstreamStatus & DownstreamContentSize are nil", - data: map[string]interface{}{ + data: map[string]any{ StartUTC: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), Duration: 123 * time.Second, ClientHost: "10.0.0.1", @@ -41,7 +41,7 @@ func TestCommonLogFormatter_Format(t *testing.T) { }, { name: "all data", - data: map[string]interface{}{ + data: map[string]any{ StartUTC: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), Duration: 123 * time.Second, ClientHost: "10.0.0.1", @@ -62,7 +62,7 @@ func TestCommonLogFormatter_Format(t *testing.T) { }, { name: "all data with local time", - data: map[string]interface{}{ + data: map[string]any{ StartLocal: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), Duration: 123 * time.Second, ClientHost: "10.0.0.1", @@ -106,12 +106,12 @@ func TestGenericCLFLogFormatter_Format(t *testing.T) { testCases := []struct { name string - data map[string]interface{} + data map[string]any expectedLog string }{ { name: "DownstreamStatus & DownstreamContentSize are nil", - data: map[string]interface{}{ + data: map[string]any{ StartUTC: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), Duration: 123 * time.Second, ClientHost: "10.0.0.1", @@ -132,7 +132,7 @@ func TestGenericCLFLogFormatter_Format(t *testing.T) { }, { name: "all data", - data: map[string]interface{}{ + data: map[string]any{ StartUTC: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), Duration: 123 * time.Second, ClientHost: "10.0.0.1", @@ -153,7 +153,7 @@ func TestGenericCLFLogFormatter_Format(t *testing.T) { }, { name: "all data with local time", - data: map[string]interface{}{ + data: map[string]any{ StartLocal: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), Duration: 123 * time.Second, ClientHost: "10.0.0.1", @@ -199,7 +199,7 @@ func Test_toLog(t *testing.T) { fieldName string defaultValue string quoted bool - expectedLog interface{} + expectedLog any }{ { desc: "Should return int 1", diff --git a/pkg/middlewares/accesslog/logger_test.go b/pkg/middlewares/accesslog/logger_test.go index 8062f59eb..2ccbffb66 100644 --- a/pkg/middlewares/accesslog/logger_test.go +++ b/pkg/middlewares/accesslog/logger_test.go @@ -261,7 +261,7 @@ func lineCount(t *testing.T, fileName string) int { } count := 0 - for _, line := range strings.Split(string(fileContents), "\n") { + for line := range strings.SplitSeq(string(fileContents), "\n") { if strings.TrimSpace(line) == "" { continue } @@ -439,32 +439,32 @@ func TestLoggerGenericCLFWithBufferingSize(t *testing.T) { assertValidGenericCLFLogData(t, expectedLog, logData) } -func assertString(exp string) func(t *testing.T, actual interface{}) { - return func(t *testing.T, actual interface{}) { +func assertString(exp string) func(t *testing.T, actual any) { + return func(t *testing.T, actual any) { t.Helper() assert.Equal(t, exp, actual) } } -func assertNotEmpty() func(t *testing.T, actual interface{}) { - return func(t *testing.T, actual interface{}) { +func assertNotEmpty() func(t *testing.T, actual any) { + return func(t *testing.T, actual any) { t.Helper() assert.NotEmpty(t, actual) } } -func assertFloat64(exp float64) func(t *testing.T, actual interface{}) { - return func(t *testing.T, actual interface{}) { +func assertFloat64(exp float64) func(t *testing.T, actual any) { + return func(t *testing.T, actual any) { t.Helper() assert.InDelta(t, exp, actual, delta) } } -func assertFloat64NotZero() func(t *testing.T, actual interface{}) { - return func(t *testing.T, actual interface{}) { +func assertFloat64NotZero() func(t *testing.T, actual any) { + return func(t *testing.T, actual any) { t.Helper() assert.NotZero(t, actual) @@ -477,7 +477,7 @@ func TestLoggerJSON(t *testing.T) { config *otypes.AccessLog tls bool tracing bool - expected map[string]func(t *testing.T, value interface{}) + expected map[string]func(t *testing.T, value any) }{ { desc: "default config without tracing", @@ -485,7 +485,7 @@ func TestLoggerJSON(t *testing.T) { FilePath: "", Format: JSONFormat, }, - expected: map[string]func(t *testing.T, value interface{}){ + expected: map[string]func(t *testing.T, value any){ RequestContentSize: assertFloat64(0), RequestHost: assertString(testHostname), RequestAddr: assertString(testHostname), @@ -525,7 +525,7 @@ func TestLoggerJSON(t *testing.T) { Format: JSONFormat, }, tracing: true, - expected: map[string]func(t *testing.T, value interface{}){ + expected: map[string]func(t *testing.T, value any){ RequestContentSize: assertFloat64(0), RequestHost: assertString(testHostname), RequestAddr: assertString(testHostname), @@ -567,7 +567,7 @@ func TestLoggerJSON(t *testing.T) { Format: JSONFormat, }, tls: true, - expected: map[string]func(t *testing.T, value interface{}){ + expected: map[string]func(t *testing.T, value any){ RequestContentSize: assertFloat64(0), RequestHost: assertString(testHostname), RequestAddr: assertString(testHostname), @@ -612,7 +612,7 @@ func TestLoggerJSON(t *testing.T) { DefaultMode: "drop", }, }, - expected: map[string]func(t *testing.T, value interface{}){ + expected: map[string]func(t *testing.T, value any){ "level": assertString("info"), "msg": assertString(""), "time": assertNotEmpty(), @@ -633,7 +633,7 @@ func TestLoggerJSON(t *testing.T) { }, }, }, - expected: map[string]func(t *testing.T, value interface{}){ + expected: map[string]func(t *testing.T, value any){ "level": assertString("info"), "msg": assertString(""), "time": assertNotEmpty(), @@ -651,7 +651,7 @@ func TestLoggerJSON(t *testing.T) { }, }, }, - expected: map[string]func(t *testing.T, value interface{}){ + expected: map[string]func(t *testing.T, value any){ "level": assertString("info"), "msg": assertString(""), "time": assertNotEmpty(), @@ -678,7 +678,7 @@ func TestLoggerJSON(t *testing.T) { }, }, }, - expected: map[string]func(t *testing.T, value interface{}){ + expected: map[string]func(t *testing.T, value any){ RequestHost: assertString(testHostname), "level": assertString("info"), "msg": assertString(""), @@ -704,7 +704,7 @@ func TestLoggerJSON(t *testing.T) { }, }, }, - expected: map[string]func(t *testing.T, value interface{}){ + expected: map[string]func(t *testing.T, value any){ RequestHost: assertString(testHostname), "level": assertString("info"), "msg": assertString(""), @@ -730,7 +730,7 @@ func TestLoggerJSON(t *testing.T) { logData, err := os.ReadFile(logFilePath) require.NoError(t, err) - jsonData := make(map[string]interface{}) + jsonData := make(map[string]any) err = json.Unmarshal(logData, &jsonData) require.NoError(t, err) @@ -744,7 +744,7 @@ func TestLoggerJSON(t *testing.T) { } func TestLogger_AbortedRequest(t *testing.T) { - expected := map[string]func(t *testing.T, value interface{}){ + expected := map[string]func(t *testing.T, value any){ RequestContentSize: assertFloat64(0), RequestHost: assertString(testHostname), RequestAddr: assertString(testHostname), @@ -787,7 +787,7 @@ func TestLogger_AbortedRequest(t *testing.T) { logData, err := os.ReadFile(config.FilePath) require.NoError(t, err) - jsonData := make(map[string]interface{}) + jsonData := make(map[string]any) err = json.Unmarshal(logData, &jsonData) require.NoError(t, err) diff --git a/pkg/middlewares/auth/connectionheader.go b/pkg/middlewares/auth/connectionheader.go index 8b78b9430..d5d4e4653 100644 --- a/pkg/middlewares/auth/connectionheader.go +++ b/pkg/middlewares/auth/connectionheader.go @@ -22,7 +22,7 @@ func RemoveConnectionHeaders(req *http.Request) { } for _, f := range req.Header[connectionHeader] { - for _, sf := range strings.Split(f, ",") { + for sf := range strings.SplitSeq(f, ",") { if sf = textproto.TrimString(sf); sf != "" { req.Header.Del(sf) } diff --git a/pkg/middlewares/capture/capture.go b/pkg/middlewares/capture/capture.go index 04e411a20..669e24268 100644 --- a/pkg/middlewares/capture/capture.go +++ b/pkg/middlewares/capture/capture.go @@ -96,20 +96,6 @@ func (c *Capture) Reset(next http.Handler) http.Handler { }) } -func (c *Capture) renew(rw http.ResponseWriter, req *http.Request) (http.ResponseWriter, *http.Request) { - ctx := context.WithValue(req.Context(), capturedData, c) - newReq := req.WithContext(ctx) - - if newReq.Body != nil { - readCounter := &readCounter{source: newReq.Body} - c.rr = readCounter - newReq.Body = readCounter - } - c.crw = &captureResponseWriter{rw: rw} - - return c.crw, newReq -} - func (c *Capture) ResponseSize() int64 { return c.crw.Size() } @@ -127,6 +113,20 @@ func (c *Capture) RequestSize() int64 { return c.rr.size } +func (c *Capture) renew(rw http.ResponseWriter, req *http.Request) (http.ResponseWriter, *http.Request) { + ctx := context.WithValue(req.Context(), capturedData, c) + newReq := req.WithContext(ctx) + + if newReq.Body != nil { + readCounter := &readCounter{source: newReq.Body} + c.rr = readCounter + newReq.Body = readCounter + } + c.crw = &captureResponseWriter{rw: rw} + + return c.crw, newReq +} + type readCounter struct { // source ReadCloser from where the request body is read. source io.ReadCloser diff --git a/pkg/middlewares/compress/acceptencoding.go b/pkg/middlewares/compress/acceptencoding.go index a35362733..5222363b4 100644 --- a/pkg/middlewares/compress/acceptencoding.go +++ b/pkg/middlewares/compress/acceptencoding.go @@ -63,7 +63,7 @@ func parseAcceptableEncodings(acceptEncoding []string, supportedEncodings map[st var encodings []Encoding for _, line := range acceptEncoding { - for _, item := range strings.Split(strings.ReplaceAll(line, " ", ""), ",") { + for item := range strings.SplitSeq(strings.ReplaceAll(line, " ", ""), ",") { parsed := strings.SplitN(item, ";", 2) if len(parsed) == 0 { continue diff --git a/pkg/middlewares/compress/compress.go b/pkg/middlewares/compress/compress.go index 4ab312cc2..1d82e4a53 100644 --- a/pkg/middlewares/compress/compress.go +++ b/pkg/middlewares/compress/compress.go @@ -167,6 +167,10 @@ func (c *compress) ServeHTTP(rw http.ResponseWriter, req *http.Request) { c.chooseHandler(c.getCompressionEncoding(acceptEncoding), rw, req) } +func (c *compress) GetTracingInformation() (string, string) { + return c.name, typeName +} + func (c *compress) chooseHandler(typ string, rw http.ResponseWriter, req *http.Request) { switch typ { case zstdName: @@ -180,10 +184,6 @@ func (c *compress) chooseHandler(typ string, rw http.ResponseWriter, req *http.R } } -func (c *compress) GetTracingInformation() (string, string) { - return c.name, typeName -} - func (c *compress) newGzipHandler() (http.Handler, error) { var wrapper func(http.Handler) http.HandlerFunc var err error diff --git a/pkg/middlewares/compress/compression_handler.go b/pkg/middlewares/compress/compression_handler.go index 07583028b..95cce76ba 100644 --- a/pkg/middlewares/compress/compression_handler.go +++ b/pkg/middlewares/compress/compression_handler.go @@ -156,6 +156,7 @@ func (c *CompressionHandler) putCompressionWriter(writer *compressionWriterWrapp type compressionWriterWrapper struct { CompressionWriter + algo string } diff --git a/pkg/middlewares/compress/compression_handler_test.go b/pkg/middlewares/compress/compression_handler_test.go index 89bbe062b..62d9e5787 100644 --- a/pkg/middlewares/compress/compression_handler_test.go +++ b/pkg/middlewares/compress/compression_handler_test.go @@ -874,10 +874,7 @@ func Test_FlushExcludedContentTypes(t *testing.T) { for len(tb) > 0 { // Write 100 bytes per run // Detection should not be affected (we send 100 bytes) - toWrite := 100 - if toWrite > len(tb) { - toWrite = len(tb) - } + toWrite := min(100, len(tb)) _, err := rw.Write(tb[:toWrite]) require.NoError(t, err) @@ -998,10 +995,7 @@ func Test_FlushIncludedContentTypes(t *testing.T) { for len(tb) > 0 { // Write 100 bytes per run // Detection should not be affected (we send 100 bytes) - toWrite := 100 - if toWrite > len(tb) { - toWrite = len(tb) - } + toWrite := min(100, len(tb)) _, err := rw.Write(tb[:toWrite]) require.NoError(t, err) diff --git a/pkg/middlewares/customerrors/custom_errors.go b/pkg/middlewares/customerrors/custom_errors.go index 6c1a91c4b..193ad43ec 100644 --- a/pkg/middlewares/customerrors/custom_errors.go +++ b/pkg/middlewares/customerrors/custom_errors.go @@ -4,6 +4,7 @@ import ( "bufio" "context" "fmt" + "maps" "net" "net/http" "net/url" @@ -198,16 +199,6 @@ func (cc *codeCatcher) Header() http.Header { return cc.headerMap } -func (cc *codeCatcher) getCode() int { - return cc.code -} - -// isFilteredCode returns whether the codeCatcher received a response code among the ones it is watching, -// and for which the response should be deferred to the error handler. -func (cc *codeCatcher) isFilteredCode() bool { - return cc.caughtFilteredCode -} - func (cc *codeCatcher) Write(buf []byte) (int, error) { // If WriteHeader was already called from the caller, this is a NOOP. // Otherwise, cc.code is actually a 200 here. @@ -233,9 +224,7 @@ func (cc *codeCatcher) WriteHeader(code int) { if code >= 100 && code <= 199 { // Multiple informational status codes can be used, // so here the copy is not appending the values to not repeat them. - for k, v := range cc.Header() { - cc.responseWriter.Header()[k] = v - } + maps.Copy(cc.responseWriter.Header(), cc.Header()) cc.responseWriter.WriteHeader(code) return @@ -253,9 +242,8 @@ func (cc *codeCatcher) WriteHeader(code int) { // The copy is not appending the values, // to not repeat them in case any informational status code has been written. - for k, v := range cc.Header() { - cc.responseWriter.Header()[k] = v - } + maps.Copy(cc.responseWriter.Header(), cc.Header()) + cc.responseWriter.WriteHeader(cc.code) cc.headersSent = true } @@ -288,6 +276,16 @@ func (cc *codeCatcher) Flush() { } } +func (cc *codeCatcher) getCode() int { + return cc.code +} + +// isFilteredCode returns whether the codeCatcher received a response code among the ones it is watching, +// and for which the response should be deferred to the error handler. +func (cc *codeCatcher) isFilteredCode() bool { + return cc.caughtFilteredCode +} + // codeModifier forwards a response back to the client, // while enforcing a given response code. type codeModifier struct { @@ -343,17 +341,14 @@ func (r *codeModifier) WriteHeader(code int) { if code >= 100 && code <= 199 { // Multiple informational status codes can be used, // so here the copy is not appending the values to not repeat them. - for k, v := range r.headerMap { - r.responseWriter.Header()[k] = v - } + maps.Copy(r.responseWriter.Header(), r.headerMap) r.responseWriter.WriteHeader(code) return } - for k, v := range r.headerMap { - r.responseWriter.Header()[k] = v - } + maps.Copy(r.responseWriter.Header(), r.headerMap) + r.responseWriter.WriteHeader(r.code) r.headerSent = true } diff --git a/pkg/middlewares/forwardedheaders/forwarded_header.go b/pkg/middlewares/forwardedheaders/forwarded_header.go index d37d12d44..3f994b0a8 100644 --- a/pkg/middlewares/forwardedheaders/forwarded_header.go +++ b/pkg/middlewares/forwardedheaders/forwarded_header.go @@ -81,18 +81,11 @@ func NewXForwarded(insecure bool, trustedIPs []string, connectionHeaders []strin }, nil } -func (x *XForwarded) isTrustedIP(ip string) bool { - if x.ipChecker == nil { - return false - } - return x.ipChecker.IsAuthorized(ip) == nil -} - // removeIPv6Zone removes the zone if the given IP is an ipv6 address and it has {zone} information in it, // like "[fe80::d806:a55d:eb1b:49cc%vEthernet (vmxnet3 Ethernet Adapter - Virtual Switch)]:64692". func removeIPv6Zone(clientIP string) string { - if idx := strings.Index(clientIP, "%"); idx != -1 { - return clientIP[:idx] + if before, _, found := strings.Cut(clientIP, "%"); found { + return before } return clientIP } @@ -138,6 +131,28 @@ func forwardedPort(req *http.Request) string { return "80" } +// ServeHTTP implements http.Handler. +func (x *XForwarded) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if !x.insecure && !x.isTrustedIP(r.RemoteAddr) { + for _, h := range xHeaders { + unsafeHeader(r.Header).Del(h) + } + } + + x.rewrite(r) + + x.removeConnectionHeaders(r) + + x.next.ServeHTTP(w, r) +} + +func (x *XForwarded) isTrustedIP(ip string) bool { + if x.ipChecker == nil { + return false + } + return x.ipChecker.IsAuthorized(ip) == nil +} + func (x *XForwarded) rewrite(outreq *http.Request) { if clientIP, _, err := net.SplitHostPort(outreq.RemoteAddr); err == nil { clientIP = removeIPv6Zone(clientIP) @@ -186,21 +201,6 @@ func (x *XForwarded) rewrite(outreq *http.Request) { } } -// ServeHTTP implements http.Handler. -func (x *XForwarded) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if !x.insecure && !x.isTrustedIP(r.RemoteAddr) { - for _, h := range xHeaders { - unsafeHeader(r.Header).Del(h) - } - } - - x.rewrite(r) - - x.removeConnectionHeaders(r) - - x.next.ServeHTTP(w, r) -} - func (x *XForwarded) removeConnectionHeaders(req *http.Request) { var reqUpType string if httpguts.HeaderValuesContainsToken(req.Header[connection], upgrade) { @@ -209,7 +209,7 @@ func (x *XForwarded) removeConnectionHeaders(req *http.Request) { var connectionHopByHopHeaders []string for _, f := range req.Header[connection] { - for _, sf := range strings.Split(f, ",") { + for sf := range strings.SplitSeq(f, ",") { if sf = textproto.TrimString(sf); sf != "" { // Connection header cannot dictate to remove X- headers managed by Traefik, // as per rfc7230 https://datatracker.ietf.org/doc/html/rfc7230#section-6.1, diff --git a/pkg/middlewares/gatewayapi/headermodifier/request_header_modifier_test.go b/pkg/middlewares/gatewayapi/headermodifier/request_header_modifier_test.go index 36ebbd9db..791e15bf2 100644 --- a/pkg/middlewares/gatewayapi/headermodifier/request_header_modifier_test.go +++ b/pkg/middlewares/gatewayapi/headermodifier/request_header_modifier_test.go @@ -1,6 +1,7 @@ package headermodifier import ( + "maps" "net/http" "net/http/httptest" "testing" @@ -105,9 +106,7 @@ func TestRequestHeaderModifier(t *testing.T) { handler := NewRequestHeaderModifier(t.Context(), next, test.config, "foo-request-header-modifier") req := testhelpers.MustNewRequest(http.MethodGet, "http://localhost", nil) - for h, v := range test.requestHeaders { - req.Header[h] = v - } + maps.Copy(req.Header, test.requestHeaders) resp := httptest.NewRecorder() handler.ServeHTTP(resp, req) diff --git a/pkg/middlewares/gatewayapi/headermodifier/response_header_modifier_test.go b/pkg/middlewares/gatewayapi/headermodifier/response_header_modifier_test.go index 47a0f3c82..26b0ac8fa 100644 --- a/pkg/middlewares/gatewayapi/headermodifier/response_header_modifier_test.go +++ b/pkg/middlewares/gatewayapi/headermodifier/response_header_modifier_test.go @@ -1,6 +1,7 @@ package headermodifier import ( + "maps" "net/http" "net/http/httptest" "testing" @@ -107,9 +108,7 @@ func TestResponseHeaderModifier(t *testing.T) { req := testhelpers.MustNewRequest(http.MethodGet, "http://localhost", nil) resp := httptest.NewRecorder() - for k, v := range test.responseHeaders { - resp.Header()[k] = v - } + maps.Copy(resp.Header(), test.responseHeaders) handler.ServeHTTP(resp, req) diff --git a/pkg/middlewares/headers/header.go b/pkg/middlewares/headers/header.go index 6679ce2a8..374938571 100644 --- a/pkg/middlewares/headers/header.go +++ b/pkg/middlewares/headers/header.go @@ -64,27 +64,6 @@ func (s *Header) ServeHTTP(rw http.ResponseWriter, req *http.Request) { } } -// modifyCustomRequestHeaders sets or deletes custom request headers. -func (s *Header) modifyCustomRequestHeaders(req *http.Request) { - // Loop through Custom request headers - for header, value := range s.headers.CustomRequestHeaders { - switch { - // Handling https://github.com/golang/go/commit/ecdbffd4ec68b509998792f120868fec319de59b. - case value == "" && header == forward.XForwardedFor: - req.Header[header] = nil - - case value == "": - req.Header.Del(header) - - case strings.EqualFold(header, "Host"): - req.Host = value - - default: - req.Header.Set(header, value) - } - } -} - // PostRequestModifyResponseHeaders set or delete response headers. // This method is called AFTER the response is generated from the backend // and can merge/override headers from the backend response. @@ -134,6 +113,27 @@ func (s *Header) PostRequestModifyResponseHeaders(res *http.Response) error { return nil } +// modifyCustomRequestHeaders sets or deletes custom request headers. +func (s *Header) modifyCustomRequestHeaders(req *http.Request) { + // Loop through Custom request headers + for header, value := range s.headers.CustomRequestHeaders { + switch { + // Handling https://github.com/golang/go/commit/ecdbffd4ec68b509998792f120868fec319de59b. + case value == "" && header == forward.XForwardedFor: + req.Header[header] = nil + + case value == "": + req.Header.Del(header) + + case strings.EqualFold(header, "Host"): + req.Host = value + + default: + req.Header.Set(header, value) + } + } +} + // processCorsHeaders processes the incoming request, // and returns if it is a preflight request. // If not a preflight, it handles the preRequestModifyCorsResponseHeaders. diff --git a/pkg/middlewares/observability/observability.go b/pkg/middlewares/observability/observability.go index 1490a1e8e..a02ca292d 100644 --- a/pkg/middlewares/observability/observability.go +++ b/pkg/middlewares/observability/observability.go @@ -65,7 +65,7 @@ func DetailedTracingEnabled(ctx context.Context) bool { } // SetStatusErrorf flags the span as in error and log an event. -func SetStatusErrorf(ctx context.Context, format string, args ...interface{}) { +func SetStatusErrorf(ctx context.Context, format string, args ...any) { if span := trace.SpanFromContext(ctx); span != nil { span.SetStatus(codes.Error, fmt.Sprintf(format, args...)) } diff --git a/pkg/middlewares/observability/status_code.go b/pkg/middlewares/observability/status_code.go index ebada5579..3686dbad1 100644 --- a/pkg/middlewares/observability/status_code.go +++ b/pkg/middlewares/observability/status_code.go @@ -13,6 +13,7 @@ func newStatusCodeRecorder(rw http.ResponseWriter, status int) *statusCodeRecord type statusCodeRecorder struct { http.ResponseWriter + status int } diff --git a/pkg/middlewares/ratelimiter/lua.go b/pkg/middlewares/ratelimiter/lua.go index 47100629e..fcc84d16a 100644 --- a/pkg/middlewares/ratelimiter/lua.go +++ b/pkg/middlewares/ratelimiter/lua.go @@ -7,14 +7,14 @@ import ( ) type Rediser interface { - Eval(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd - EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *redis.Cmd + Eval(ctx context.Context, script string, keys []string, args ...any) *redis.Cmd + EvalSha(ctx context.Context, sha1 string, keys []string, args ...any) *redis.Cmd ScriptExists(ctx context.Context, hashes ...string) *redis.BoolSliceCmd ScriptLoad(ctx context.Context, script string) *redis.StringCmd Del(ctx context.Context, keys ...string) *redis.IntCmd - EvalRO(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd - EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...interface{}) *redis.Cmd + EvalRO(ctx context.Context, script string, keys []string, args ...any) *redis.Cmd + EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...any) *redis.Cmd } //nolint:dupword diff --git a/pkg/middlewares/ratelimiter/rate_limiter.go b/pkg/middlewares/ratelimiter/rate_limiter.go index fcc553e15..0f107a413 100755 --- a/pkg/middlewares/ratelimiter/rate_limiter.go +++ b/pkg/middlewares/ratelimiter/rate_limiter.go @@ -61,10 +61,7 @@ func New(ctx context.Context, next http.Handler, config dynamic.RateLimit, name return nil, fmt.Errorf("getting source extractor: %w", err) } - burst := config.Burst - if burst < 1 { - burst = 1 - } + burst := max(config.Burst, 1) period := time.Duration(config.Period) if period < 0 { diff --git a/pkg/middlewares/ratelimiter/rate_limiter_test.go b/pkg/middlewares/ratelimiter/rate_limiter_test.go index a724c6fe6..b1c6e38f1 100644 --- a/pkg/middlewares/ratelimiter/rate_limiter_test.go +++ b/pkg/middlewares/ratelimiter/rate_limiter_test.go @@ -300,11 +300,8 @@ func TestInMemoryRateLimit(t *testing.T) { stop := time.Now() elapsed := stop.Sub(start) - burst := test.config.Burst - if burst < 1 { - // actual default value - burst = 1 - } + // actual default value if burst < 1 + burst := max(test.config.Burst, 1) period := time.Duration(test.config.Period) if period == 0 { @@ -510,11 +507,8 @@ func TestRedisRateLimit(t *testing.T) { stop := time.Now() elapsed := stop.Sub(start) - burst := test.config.Burst - if burst < 1 { - // actual default value - burst = 1 - } + // actual default value + burst := max(test.config.Burst, 1) period := time.Duration(test.config.Period) if period == 0 { @@ -570,7 +564,7 @@ func newMockRedisClient(ttl int) Rediser { } } -func (m *mockRedisClient) EvalSha(ctx context.Context, _ string, keys []string, args ...interface{}) *redis.Cmd { +func (m *mockRedisClient) EvalSha(ctx context.Context, _ string, keys []string, args ...any) *redis.Cmd { state := lua.NewState() defer state.Close() @@ -641,7 +635,7 @@ func (m *mockRedisClient) EvalSha(ctx context.Context, _ string, keys []string, return cmd } - var resultSlice []interface{} + var resultSlice []any resultTable.ForEach(func(_ lua.LValue, value lua.LValue) { valueNbr, ok := value.(lua.LNumber) if !ok { @@ -661,7 +655,7 @@ func (m *mockRedisClient) EvalSha(ctx context.Context, _ string, keys []string, return cmd } -func (m *mockRedisClient) Eval(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd { +func (m *mockRedisClient) Eval(ctx context.Context, script string, keys []string, args ...any) *redis.Cmd { return m.EvalSha(ctx, script, keys, args...) } @@ -677,11 +671,11 @@ func (m *mockRedisClient) Del(ctx context.Context, keys ...string) *redis.IntCmd return nil } -func (m *mockRedisClient) EvalRO(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd { +func (m *mockRedisClient) EvalRO(ctx context.Context, script string, keys []string, args ...any) *redis.Cmd { return nil } -func (m *mockRedisClient) EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...interface{}) *redis.Cmd { +func (m *mockRedisClient) EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...any) *redis.Cmd { return nil } diff --git a/pkg/middlewares/ratelimiter/redis_limiter.go b/pkg/middlewares/ratelimiter/redis_limiter.go index 6bdf6c8fc..9c49c629a 100644 --- a/pkg/middlewares/ratelimiter/redis_limiter.go +++ b/pkg/middlewares/ratelimiter/redis_limiter.go @@ -91,7 +91,7 @@ func (r *redisLimiter) evaluateScript(ctx context.Context, key string) (bool, *t return true, nil, nil } - params := []interface{}{ + params := []any{ float64(r.rate / 1000000), r.burst, r.ttl, @@ -103,7 +103,7 @@ func (r *redisLimiter) evaluateScript(ctx context.Context, key string) (bool, *t return false, nil, fmt.Errorf("running script: %w", err) } - values := v.([]interface{}) + values := v.([]any) ok, err := strconv.ParseBool(values[0].(string)) if err != nil { return false, nil, fmt.Errorf("parsing ok value from redis rate lua script: %w", err) diff --git a/pkg/middlewares/recovery/recovery.go b/pkg/middlewares/recovery/recovery.go index 1d825a7ad..32c4e15f8 100644 --- a/pkg/middlewares/recovery/recovery.go +++ b/pkg/middlewares/recovery/recovery.go @@ -56,7 +56,7 @@ func recoverFunc(rw recoveryResponseWriter, req *http.Request) { // https://github.com/golang/go/blob/a0d6420d8be2ae7164797051ec74fa2a2df466a1/src/net/http/server.go#L1761-L1775 // https://github.com/golang/go/blob/c33153f7b416c03983324b3e8f869ce1116d84bc/src/net/http/httputil/reverseproxy.go#L284 -func shouldLogPanic(panicValue interface{}) bool { +func shouldLogPanic(panicValue any) bool { //nolint:errorlint // false-positive because panicValue is an interface. return panicValue != nil && panicValue != http.ErrAbortHandler } diff --git a/pkg/middlewares/retry/retry.go b/pkg/middlewares/retry/retry.go index de15a21b4..da1fbc543 100644 --- a/pkg/middlewares/retry/retry.go +++ b/pkg/middlewares/retry/retry.go @@ -5,6 +5,7 @@ import ( "context" "fmt" "io" + "maps" "math" "net" "net/http" @@ -249,10 +250,7 @@ func (r *responseWriter) WriteHeader(code int) { // to write headers to the backend : we are not going to perform any further retry. // So it is now safe to alter current response headers with headers collected during // the latest try before writing headers to client. - headers := r.responseWriter.Header() - for header, value := range r.headers { - headers[header] = value - } + maps.Copy(r.responseWriter.Header(), r.headers) r.responseWriter.WriteHeader(code) diff --git a/pkg/muxer/http/matcher.go b/pkg/muxer/http/matcher.go index 74f5d97f0..9794fdf94 100644 --- a/pkg/muxer/http/matcher.go +++ b/pkg/muxer/http/matcher.go @@ -184,13 +184,7 @@ func header(tree *matchersTree, headers ...string) error { key, value := http.CanonicalHeaderKey(headers[0]), headers[1] tree.matcher = func(req *http.Request) bool { - for _, headerValue := range req.Header[key] { - if headerValue == value { - return true - } - } - - return false + return slices.Contains(req.Header[key], value) } return nil @@ -205,13 +199,7 @@ func headerRegexp(tree *matchersTree, headers ...string) error { } tree.matcher = func(req *http.Request) bool { - for _, headerValue := range req.Header[key] { - if re.MatchString(headerValue) { - return true - } - } - - return false + return slices.ContainsFunc(req.Header[key], re.MatchString) } return nil diff --git a/pkg/muxer/http/mux.go b/pkg/muxer/http/mux.go index d3ab6a45d..7a936e5a8 100644 --- a/pkg/muxer/http/mux.go +++ b/pkg/muxer/http/mux.go @@ -22,7 +22,8 @@ type MatcherFunc func(*http.Request) bool // Muxer handles routing with rules. type Muxer struct { - routes routes + routes routes + parser SyntaxParser defaultHandler http.Handler } diff --git a/pkg/muxer/tcp/matcher.go b/pkg/muxer/tcp/matcher.go index 4ee55eb68..c3357028e 100644 --- a/pkg/muxer/tcp/matcher.go +++ b/pkg/muxer/tcp/matcher.go @@ -3,6 +3,7 @@ package tcp import ( "fmt" "regexp" + "slices" "strings" "unicode/utf8" @@ -37,13 +38,7 @@ func alpn(tree *matchersTree, protos ...string) error { } tree.matcher = func(meta ConnData) bool { - for _, alpnProto := range meta.alpnProtos { - if alpnProto == proto { - return true - } - } - - return false + return slices.Contains(meta.alpnProtos, proto) } return nil diff --git a/pkg/muxer/tcp/matcher_v2.go b/pkg/muxer/tcp/matcher_v2.go index 4fd0e3368..807159994 100644 --- a/pkg/muxer/tcp/matcher_v2.go +++ b/pkg/muxer/tcp/matcher_v2.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "regexp" + "slices" "strconv" "strings" @@ -56,10 +57,8 @@ func alpnV2(tree *matchersTree, protos ...string) error { tree.matcher = func(meta ConnData) bool { for _, proto := range meta.alpnProtos { - for _, filter := range protos { - if proto == filter { - return true - } + if slices.Contains(protos, proto) { + return true } } diff --git a/pkg/muxer/tcp/mux.go b/pkg/muxer/tcp/mux.go index 1266091ea..db80d8289 100644 --- a/pkg/muxer/tcp/mux.go +++ b/pkg/muxer/tcp/mux.go @@ -121,7 +121,7 @@ func GetRulePriority(rule string) int { // AddRoute adds a new route, associated to the given handler, at the given // priority, to the muxer. func (m *Muxer) AddRoute(rule string, syntax string, priority int, handler tcp.Handler) error { - var parse interface{} + var parse any var err error var matcherFuncs map[string]func(*matchersTree, ...string) error diff --git a/pkg/observability/logs/aws.go b/pkg/observability/logs/aws.go index f9040ba4b..13dc0dbf6 100644 --- a/pkg/observability/logs/aws.go +++ b/pkg/observability/logs/aws.go @@ -7,10 +7,10 @@ import ( func NewAWSWrapper(logger zerolog.Logger) logging.LoggerFunc { if logger.GetLevel() > zerolog.DebugLevel { - return func(classification logging.Classification, format string, args ...interface{}) {} + return func(classification logging.Classification, format string, args ...any) {} } - return func(classification logging.Classification, format string, args ...interface{}) { + return func(classification logging.Classification, format string, args ...any) { logger.Debug().CallerSkipFrame(2).MsgFunc(msgFunc(args...)) } } diff --git a/pkg/observability/logs/elastic.go b/pkg/observability/logs/elastic.go index 557ebf194..aef4e7385 100644 --- a/pkg/observability/logs/elastic.go +++ b/pkg/observability/logs/elastic.go @@ -10,10 +10,10 @@ func NewElasticLogger(logger zerolog.Logger) *ElasticLogger { return &ElasticLogger{logger: logger} } -func (l ElasticLogger) Debugf(format string, args ...interface{}) { +func (l ElasticLogger) Debugf(format string, args ...any) { l.logger.Debug().CallerSkipFrame(1).Msgf(format, args...) } -func (l ElasticLogger) Errorf(format string, args ...interface{}) { +func (l ElasticLogger) Errorf(format string, args ...any) { l.logger.Error().CallerSkipFrame(1).Msgf(format, args...) } diff --git a/pkg/observability/logs/gokit.go b/pkg/observability/logs/gokit.go index 1430f8e54..71ea96a95 100644 --- a/pkg/observability/logs/gokit.go +++ b/pkg/observability/logs/gokit.go @@ -7,10 +7,10 @@ import ( func NewGoKitWrapper(logger zerolog.Logger) kitlog.LoggerFunc { if logger.GetLevel() > zerolog.DebugLevel { - return func(args ...interface{}) error { return nil } + return func(args ...any) error { return nil } } - return func(args ...interface{}) error { + return func(args ...any) error { logger.Debug().CallerSkipFrame(2).MsgFunc(msgFunc(args...)) return nil } diff --git a/pkg/observability/logs/hclog.go b/pkg/observability/logs/hclog.go index 19d120d17..61de63c5e 100644 --- a/pkg/observability/logs/hclog.go +++ b/pkg/observability/logs/hclog.go @@ -21,26 +21,26 @@ func NewRetryableHTTPLogger(logger zerolog.Logger) *RetryableHTTPLogger { } // Error starts a new message with error level. -func (l RetryableHTTPLogger) Error(msg string, keysAndValues ...interface{}) { +func (l RetryableHTTPLogger) Error(msg string, keysAndValues ...any) { logWithLevel(l.logger.Error().CallerSkipFrame(2), msg, keysAndValues...) } // Info starts a new message with info level. -func (l RetryableHTTPLogger) Info(msg string, keysAndValues ...interface{}) { +func (l RetryableHTTPLogger) Info(msg string, keysAndValues ...any) { logWithLevel(l.logger.Info().CallerSkipFrame(2), msg, keysAndValues...) } // Debug starts a new message with debug level. -func (l RetryableHTTPLogger) Debug(msg string, keysAndValues ...interface{}) { +func (l RetryableHTTPLogger) Debug(msg string, keysAndValues ...any) { logWithLevel(l.logger.Debug().CallerSkipFrame(2), msg, keysAndValues...) } // Warn starts a new message with warn level. -func (l RetryableHTTPLogger) Warn(msg string, keysAndValues ...interface{}) { +func (l RetryableHTTPLogger) Warn(msg string, keysAndValues ...any) { logWithLevel(l.logger.Warn().CallerSkipFrame(2), msg, keysAndValues...) } -func logWithLevel(ev *zerolog.Event, msg string, kvs ...interface{}) { +func logWithLevel(ev *zerolog.Event, msg string, kvs ...any) { if len(kvs)%2 == 0 { for i := 0; i < len(kvs)-1; i += 2 { // The first item of the pair (the key) is supposed to be a string. diff --git a/pkg/observability/logs/instana.go b/pkg/observability/logs/instana.go index be4f522d6..cefee69dd 100644 --- a/pkg/observability/logs/instana.go +++ b/pkg/observability/logs/instana.go @@ -12,18 +12,18 @@ func NewInstanaLogger(logger zerolog.Logger) *InstanaLogger { return &InstanaLogger{logger: logger} } -func (l InstanaLogger) Debug(args ...interface{}) { +func (l InstanaLogger) Debug(args ...any) { l.logger.Debug().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } -func (l InstanaLogger) Info(args ...interface{}) { +func (l InstanaLogger) Info(args ...any) { l.logger.Info().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } -func (l InstanaLogger) Warn(args ...interface{}) { +func (l InstanaLogger) Warn(args ...any) { l.logger.Warn().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } -func (l InstanaLogger) Error(args ...interface{}) { +func (l InstanaLogger) Error(args ...any) { l.logger.Error().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } diff --git a/pkg/observability/logs/logrus.go b/pkg/observability/logs/logrus.go index 68de8555b..8e1b0ec33 100644 --- a/pkg/observability/logs/logrus.go +++ b/pkg/observability/logs/logrus.go @@ -12,38 +12,38 @@ func NewLogrusWrapper(logger zerolog.Logger) *LogrusStdWrapper { return &LogrusStdWrapper{logger: logger} } -func (l LogrusStdWrapper) Print(args ...interface{}) { +func (l LogrusStdWrapper) Print(args ...any) { l.logger.Debug().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } -func (l LogrusStdWrapper) Printf(s string, args ...interface{}) { +func (l LogrusStdWrapper) Printf(s string, args ...any) { l.logger.Debug().CallerSkipFrame(1).Msgf(s, args...) } -func (l LogrusStdWrapper) Println(args ...interface{}) { +func (l LogrusStdWrapper) Println(args ...any) { l.logger.Debug().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } -func (l LogrusStdWrapper) Fatal(args ...interface{}) { +func (l LogrusStdWrapper) Fatal(args ...any) { l.logger.Fatal().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } -func (l LogrusStdWrapper) Fatalf(s string, args ...interface{}) { +func (l LogrusStdWrapper) Fatalf(s string, args ...any) { l.logger.Fatal().CallerSkipFrame(1).Msgf(s, args...) } -func (l LogrusStdWrapper) Fatalln(args ...interface{}) { +func (l LogrusStdWrapper) Fatalln(args ...any) { l.logger.Fatal().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } -func (l LogrusStdWrapper) Panic(args ...interface{}) { +func (l LogrusStdWrapper) Panic(args ...any) { l.logger.Panic().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } -func (l LogrusStdWrapper) Panicf(s string, args ...interface{}) { +func (l LogrusStdWrapper) Panicf(s string, args ...any) { l.logger.Panic().CallerSkipFrame(1).Msgf(s, args...) } -func (l LogrusStdWrapper) Panicln(args ...interface{}) { +func (l LogrusStdWrapper) Panicln(args ...any) { l.logger.Panic().CallerSkipFrame(1).MsgFunc(msgFunc(args...)) } diff --git a/pkg/observability/logs/oxy.go b/pkg/observability/logs/oxy.go index 6f0f90aed..db615eff9 100644 --- a/pkg/observability/logs/oxy.go +++ b/pkg/observability/logs/oxy.go @@ -10,18 +10,18 @@ func NewOxyWrapper(logger zerolog.Logger) *OxyWrapper { return &OxyWrapper{logger: logger} } -func (l OxyWrapper) Debug(s string, i ...interface{}) { +func (l OxyWrapper) Debug(s string, i ...any) { l.logger.Debug().CallerSkipFrame(1).Msgf(s, i...) } -func (l OxyWrapper) Info(s string, i ...interface{}) { +func (l OxyWrapper) Info(s string, i ...any) { l.logger.Info().CallerSkipFrame(1).Msgf(s, i...) } -func (l OxyWrapper) Warn(s string, i ...interface{}) { +func (l OxyWrapper) Warn(s string, i ...any) { l.logger.Warn().CallerSkipFrame(1).Msgf(s, i...) } -func (l OxyWrapper) Error(s string, i ...interface{}) { +func (l OxyWrapper) Error(s string, i ...any) { l.logger.Error().CallerSkipFrame(1).Msgf(s, i...) } diff --git a/pkg/observability/metrics/headers.go b/pkg/observability/metrics/headers.go index 65443cd29..ed165ae96 100644 --- a/pkg/observability/metrics/headers.go +++ b/pkg/observability/metrics/headers.go @@ -36,16 +36,16 @@ func (c MultiCounterWithHeaders) With(headers http.Header, labelValues ...string return next } -// NewCounterWithNoopHeaders returns a CounterWithNoopHeaders. -func NewCounterWithNoopHeaders(counter metrics.Counter) CounterWithNoopHeaders { - return CounterWithNoopHeaders{counter: counter} -} - // CounterWithNoopHeaders is a counter that satisfies CounterWithHeaders but ignores the given http.Header. type CounterWithNoopHeaders struct { counter metrics.Counter } +// NewCounterWithNoopHeaders returns a CounterWithNoopHeaders. +func NewCounterWithNoopHeaders(counter metrics.Counter) CounterWithNoopHeaders { + return CounterWithNoopHeaders{counter: counter} +} + // Add adds the given delta value to the counter value. func (c CounterWithNoopHeaders) Add(delta float64) { c.counter.Add(delta) diff --git a/pkg/observability/metrics/otel.go b/pkg/observability/metrics/otel.go index eaf95e736..39fbde94e 100644 --- a/pkg/observability/metrics/otel.go +++ b/pkg/observability/metrics/otel.go @@ -506,7 +506,7 @@ func (lvs otelLabelNamesValues) With(labelValues ...string) otelLabelNamesValues // to the native attribute.KeyValue. func (lvs otelLabelNamesValues) ToLabels() []attribute.KeyValue { labels := make([]attribute.KeyValue, len(lvs)/2) - for i := 0; i < len(labels); i++ { + for i := range labels { labels[i] = attribute.String(lvs[2*i], lvs[2*i+1]) } return labels diff --git a/pkg/observability/tracing/tracing.go b/pkg/observability/tracing/tracing.go index bb38bc654..012d3dcd2 100644 --- a/pkg/observability/tracing/tracing.go +++ b/pkg/observability/tracing/tracing.go @@ -29,6 +29,15 @@ type Backend interface { Setup(ctx context.Context, serviceName string, sampleRate float64, resourceAttributes map[string]string) (trace.Tracer, io.Closer, error) } +// Tracer is trace.Tracer with additional properties. +type Tracer struct { + trace.Tracer + + safeQueryParams []string + capturedRequestHeaders []string + capturedResponseHeaders []string +} + // NewTracing Creates a Tracing. func NewTracing(ctx context.Context, conf *static.Tracing) (*Tracer, io.Closer, error) { var backend Backend @@ -57,76 +66,6 @@ func NewTracing(ctx context.Context, conf *static.Tracing) (*Tracer, io.Closer, return NewTracer(tr, conf.CapturedRequestHeaders, conf.CapturedResponseHeaders, conf.SafeQueryParams), closer, nil } -// TracerFromContext extracts the trace.Tracer from the given context. -func TracerFromContext(ctx context.Context) *Tracer { - // Prevent picking trace.noopSpan tracer. - if !trace.SpanContextFromContext(ctx).IsValid() { - return nil - } - - span := trace.SpanFromContext(ctx) - if span != nil && span.TracerProvider() != nil { - tracer := span.TracerProvider().Tracer("github.com/traefik/traefik") - if tracer, ok := tracer.(*Tracer); ok { - return tracer - } - - return nil - } - - return nil -} - -// ExtractCarrierIntoContext reads cross-cutting concerns from the carrier into a Context. -func ExtractCarrierIntoContext(ctx context.Context, headers http.Header) context.Context { - propagator := otel.GetTextMapPropagator() - return propagator.Extract(ctx, propagation.HeaderCarrier(headers)) -} - -// InjectContextIntoCarrier sets cross-cutting concerns from the request context into the request headers. -func InjectContextIntoCarrier(req *http.Request) { - propagator := otel.GetTextMapPropagator() - propagator.Inject(req.Context(), propagation.HeaderCarrier(req.Header)) -} - -// Span is trace.Span wrapping the Traefik TracerProvider. -type Span struct { - trace.Span - - tracerProvider *TracerProvider -} - -// TracerProvider returns the span's TraceProvider. -func (s Span) TracerProvider() trace.TracerProvider { - return s.tracerProvider -} - -// TracerProvider is trace.TracerProvider wrapping the Traefik Tracer implementation. -type TracerProvider struct { - trace.TracerProvider - - tracer *Tracer -} - -// Tracer returns the trace.Tracer for the given options. -// It returns specifically the Traefik Tracer when requested. -func (t TracerProvider) Tracer(name string, options ...trace.TracerOption) trace.Tracer { - if name == "github.com/traefik/traefik" { - return t.tracer - } - - return t.TracerProvider.Tracer(name, options...) -} - -// Tracer is trace.Tracer with additional properties. -type Tracer struct { - trace.Tracer - - safeQueryParams []string - capturedRequestHeaders []string - capturedResponseHeaders []string -} - // NewTracer builds and configures a new Tracer. func NewTracer(tracer trace.Tracer, capturedRequestHeaders, capturedResponseHeaders, safeQueryParams []string) *Tracer { return &Tracer{ @@ -299,6 +238,67 @@ func (t *Tracer) safeURL(originalURL *url.URL) *url.URL { return &redactedURL } +// Span is trace.Span wrapping the Traefik TracerProvider. +type Span struct { + trace.Span + + tracerProvider *TracerProvider +} + +// TracerProvider returns the span's TraceProvider. +func (s Span) TracerProvider() trace.TracerProvider { + return s.tracerProvider +} + +// TracerProvider is trace.TracerProvider wrapping the Traefik Tracer implementation. +type TracerProvider struct { + trace.TracerProvider + + tracer *Tracer +} + +// Tracer returns the trace.Tracer for the given options. +// It returns specifically the Traefik Tracer when requested. +func (t TracerProvider) Tracer(name string, options ...trace.TracerOption) trace.Tracer { + if name == "github.com/traefik/traefik" { + return t.tracer + } + + return t.TracerProvider.Tracer(name, options...) +} + +// TracerFromContext extracts the trace.Tracer from the given context. +func TracerFromContext(ctx context.Context) *Tracer { + // Prevent picking trace.noopSpan tracer. + if !trace.SpanContextFromContext(ctx).IsValid() { + return nil + } + + span := trace.SpanFromContext(ctx) + if span != nil && span.TracerProvider() != nil { + tracer := span.TracerProvider().Tracer("github.com/traefik/traefik") + if tracer, ok := tracer.(*Tracer); ok { + return tracer + } + + return nil + } + + return nil +} + +// ExtractCarrierIntoContext reads cross-cutting concerns from the carrier into a Context. +func ExtractCarrierIntoContext(ctx context.Context, headers http.Header) context.Context { + propagator := otel.GetTextMapPropagator() + return propagator.Extract(ctx, propagation.HeaderCarrier(headers)) +} + +// InjectContextIntoCarrier sets cross-cutting concerns from the request context into the request headers. +func InjectContextIntoCarrier(req *http.Request) { + propagator := otel.GetTextMapPropagator() + propagator.Inject(req.Context(), propagation.HeaderCarrier(req.Header)) +} + func proto(proto string) string { switch proto { case "HTTP/1.0": diff --git a/pkg/observability/tracing/tracing_test.go b/pkg/observability/tracing/tracing_test.go index 91dc19e60..698a1f435 100644 --- a/pkg/observability/tracing/tracing_test.go +++ b/pkg/observability/tracing/tracing_test.go @@ -492,6 +492,8 @@ func resourceAttributes(traces ptrace.Traces) map[string]string { } // mainSpan gets the main span from traces (assumes single span for testing). +// +//nolint:unqueryvet // False positive: This is OTel trace iteration, not SQLBoiler. func mainSpan(traces ptrace.Traces) ptrace.Span { for _, resourceSpans := range traces.ResourceSpans().All() { for _, scopeSpans := range resourceSpans.ScopeSpans().All() { diff --git a/pkg/plugins/builder.go b/pkg/plugins/builder.go index 96a4bf21e..cee4c9497 100644 --- a/pkg/plugins/builder.go +++ b/pkg/plugins/builder.go @@ -18,7 +18,7 @@ type pluginMiddleware interface { } type middlewareBuilder interface { - newMiddleware(config map[string]interface{}, middlewareName string) (pluginMiddleware, error) + newMiddleware(config map[string]any, middlewareName string) (pluginMiddleware, error) } // Builder is a plugin builder. @@ -110,7 +110,7 @@ func NewBuilder(manager *Manager, plugins map[string]Descriptor, localPlugins ma } // Build builds a middleware plugin. -func (b Builder) Build(pName string, config map[string]interface{}, middlewareName string) (Constructor, error) { +func (b Builder) Build(pName string, config map[string]any, middlewareName string) (Constructor, error) { if b.middlewareBuilders == nil { return nil, fmt.Errorf("no plugin definitions in the static configuration: %s", pName) } diff --git a/pkg/plugins/manager_test.go b/pkg/plugins/manager_test.go index 5100b2a6b..be5717c19 100644 --- a/pkg/plugins/manager_test.go +++ b/pkg/plugins/manager_test.go @@ -51,7 +51,7 @@ func TestPluginManager_ReadManifest(t *testing.T) { Type: "middleware", Import: "github.com/test/plugin", Summary: "A test plugin", - TestData: map[string]interface{}{ + TestData: map[string]any{ "test": "data", }, } diff --git a/pkg/plugins/middlewarewasm.go b/pkg/plugins/middlewarewasm.go index 48d179426..e72b53510 100644 --- a/pkg/plugins/middlewarewasm.go +++ b/pkg/plugins/middlewarewasm.go @@ -42,7 +42,7 @@ func newWasmMiddlewareBuilder(goPath, moduleName, wasmPath string, settings Sett return &wasmMiddlewareBuilder{path: path, cache: cache, settings: settings}, nil } -func (b wasmMiddlewareBuilder) newMiddleware(config map[string]interface{}, middlewareName string) (pluginMiddleware, error) { +func (b wasmMiddlewareBuilder) newMiddleware(config map[string]any, middlewareName string) (pluginMiddleware, error) { return &WasmMiddleware{ middlewareName: middlewareName, config: reflect.ValueOf(config), @@ -114,7 +114,7 @@ func (b *wasmMiddlewareBuilder) buildMiddleware(ctx context.Context, next http.H i := cfg.Interface() if i != nil { - config, ok := i.(map[string]interface{}) + config, ok := i.(map[string]any) if !ok { return nil, nil, fmt.Errorf("could not type assert config: %T", i) } diff --git a/pkg/plugins/middlewarewasm_test.go b/pkg/plugins/middlewarewasm_test.go index faa33942f..5f270952b 100644 --- a/pkg/plugins/middlewarewasm_test.go +++ b/pkg/plugins/middlewarewasm_test.go @@ -27,12 +27,12 @@ func TestSettingsWithoutSocket(t *testing.T) { testCases := []struct { desc string - getSettings func(t *testing.T) (Settings, map[string]interface{}) + getSettings func(t *testing.T) (Settings, map[string]any) expected string }{ { desc: "mounts path", - getSettings: func(t *testing.T) (Settings, map[string]interface{}) { + getSettings: func(t *testing.T) (Settings, map[string]any) { t.Helper() tempDir := t.TempDir() @@ -42,7 +42,7 @@ func TestSettingsWithoutSocket(t *testing.T) { return Settings{Mounts: []string{ tempDir, - }}, map[string]interface{}{ + }}, map[string]any{ "file": filePath, } }, @@ -50,7 +50,7 @@ func TestSettingsWithoutSocket(t *testing.T) { }, { desc: "mounts src to dest", - getSettings: func(t *testing.T) (Settings, map[string]interface{}) { + getSettings: func(t *testing.T) (Settings, map[string]any) { t.Helper() tempDir := t.TempDir() @@ -60,7 +60,7 @@ func TestSettingsWithoutSocket(t *testing.T) { return Settings{Mounts: []string{ tempDir + ":/tmp", - }}, map[string]interface{}{ + }}, map[string]any{ "file": "/tmp/hello.txt", } }, @@ -68,11 +68,11 @@ func TestSettingsWithoutSocket(t *testing.T) { }, { desc: "one env", - getSettings: func(t *testing.T) (Settings, map[string]interface{}) { + getSettings: func(t *testing.T) (Settings, map[string]any) { t.Helper() envs := []string{"PLUGIN_TEST"} - return Settings{Envs: envs}, map[string]interface{}{ + return Settings{Envs: envs}, map[string]any{ "envs": envs, } }, @@ -80,11 +80,11 @@ func TestSettingsWithoutSocket(t *testing.T) { }, { desc: "two env", - getSettings: func(t *testing.T) (Settings, map[string]interface{}) { + getSettings: func(t *testing.T) (Settings, map[string]any) { t.Helper() envs := []string{"PLUGIN_TEST", "PLUGIN_TEST_B"} - return Settings{Envs: envs}, map[string]interface{}{ + return Settings{Envs: envs}, map[string]any{ "envs": envs, } }, diff --git a/pkg/plugins/middlewareyaegi.go b/pkg/plugins/middlewareyaegi.go index 41d120158..77f642b4b 100644 --- a/pkg/plugins/middlewareyaegi.go +++ b/pkg/plugins/middlewareyaegi.go @@ -46,7 +46,7 @@ func newYaegiMiddlewareBuilder(i *interp.Interpreter, basePkg, imp string) (*yae }, nil } -func (b yaegiMiddlewareBuilder) newMiddleware(config map[string]interface{}, middlewareName string) (pluginMiddleware, error) { +func (b yaegiMiddlewareBuilder) newMiddleware(config map[string]any, middlewareName string) (pluginMiddleware, error) { vConfig, err := b.createConfig(config) if err != nil { return nil, err @@ -80,7 +80,7 @@ func (b yaegiMiddlewareBuilder) newHandler(ctx context.Context, next http.Handle return handler, nil } -func (b yaegiMiddlewareBuilder) createConfig(config map[string]interface{}) (reflect.Value, error) { +func (b yaegiMiddlewareBuilder) createConfig(config map[string]any) (reflect.Value, error) { results := b.fnCreateConfig.Call(nil) if len(results) != 1 { return reflect.Value{}, fmt.Errorf("invalid number of return for the CreateConfig function: %d", len(results)) diff --git a/pkg/plugins/middlewareyaegi_test.go b/pkg/plugins/middlewareyaegi_test.go index f9df8232d..0094da8c5 100644 --- a/pkg/plugins/middlewareyaegi_test.go +++ b/pkg/plugins/middlewareyaegi_test.go @@ -138,7 +138,7 @@ func verifyMiddlewareWorks(t *testing.T, builder *yaegiMiddlewareBuilder) { t.Helper() // Create a middleware instance - this will call the plugin's New() function // which uses unsafe/syscall, proving they work - middleware, err := builder.newMiddleware(map[string]interface{}{ + middleware, err := builder.newMiddleware(map[string]any{ "message": "test", }, "test-middleware") require.NoError(t, err, "Should be able to create middleware that uses unsafe/syscall") diff --git a/pkg/plugins/providers.go b/pkg/plugins/providers.go index 46c6df8cc..76df8c82e 100644 --- a/pkg/plugins/providers.go +++ b/pkg/plugins/providers.go @@ -25,7 +25,7 @@ type PP interface { } type _PP struct { - IValue interface{} + IValue any WInit func() error WProvide func(cfgChan chan<- json.Marshaler) error WStop func() error @@ -53,7 +53,7 @@ func ppSymbols() map[string]map[string]reflect.Value { } // BuildProvider builds a plugin's provider. -func (b Builder) BuildProvider(pName string, config map[string]interface{}) (provider.Provider, error) { +func (b Builder) BuildProvider(pName string, config map[string]any) (provider.Provider, error) { if b.providerBuilders == nil { return nil, fmt.Errorf("no plugin definition in the static configuration: %s", pName) } @@ -82,7 +82,7 @@ type Provider struct { pp PP } -func newProvider(builder providerBuilder, config map[string]interface{}, providerName string) (*Provider, error) { +func newProvider(builder providerBuilder, config map[string]any, providerName string) (*Provider, error) { basePkg := builder.BasePkg if basePkg == "" { basePkg = strings.ReplaceAll(path.Base(builder.Import), "-", "_") diff --git a/pkg/plugins/types.go b/pkg/plugins/types.go index aa05cc320..5be52eec7 100644 --- a/pkg/plugins/types.go +++ b/pkg/plugins/types.go @@ -42,16 +42,16 @@ type LocalDescriptor struct { // Manifest The plugin manifest. type Manifest struct { - DisplayName string `yaml:"displayName"` - Type string `yaml:"type"` - Runtime string `yaml:"runtime"` - WasmPath string `yaml:"wasmPath"` - Import string `yaml:"import"` - BasePkg string `yaml:"basePkg"` - Compatibility string `yaml:"compatibility"` - Summary string `yaml:"summary"` - UseUnsafe bool `yaml:"useUnsafe"` - TestData map[string]interface{} `yaml:"testData"` + DisplayName string `yaml:"displayName"` + Type string `yaml:"type"` + Runtime string `yaml:"runtime"` + WasmPath string `yaml:"wasmPath"` + Import string `yaml:"import"` + BasePkg string `yaml:"basePkg"` + Compatibility string `yaml:"compatibility"` + Summary string `yaml:"summary"` + UseUnsafe bool `yaml:"useUnsafe"` + TestData map[string]any `yaml:"testData"` } // IsYaegiPlugin returns true if the plugin is a Yaegi plugin. diff --git a/pkg/provider/acme/local_store.go b/pkg/provider/acme/local_store.go index dab258822..87b9f5475 100644 --- a/pkg/provider/acme/local_store.go +++ b/pkg/provider/acme/local_store.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "io" + "maps" "os" "sync" @@ -30,6 +31,52 @@ func NewLocalStore(filename string, routinesPool *safe.Pool) *LocalStore { return store } +// GetAccount returns ACME Account. +func (s *LocalStore) GetAccount(resolverName string) (*Account, error) { + storedData, err := s.get(resolverName) + if err != nil { + return nil, err + } + + return storedData.Account, nil +} + +// SaveAccount stores ACME Account. +func (s *LocalStore) SaveAccount(resolverName string, account *Account) error { + storedData, err := s.get(resolverName) + if err != nil { + return err + } + + storedData.Account = account + s.save(resolverName, storedData) + + return nil +} + +// GetCertificates returns ACME Certificates list. +func (s *LocalStore) GetCertificates(resolverName string) ([]*CertAndStore, error) { + storedData, err := s.get(resolverName) + if err != nil { + return nil, err + } + + return storedData.Certificates, nil +} + +// SaveCertificates stores ACME Certificates list. +func (s *LocalStore) SaveCertificates(resolverName string, certificates []*CertAndStore) error { + storedData, err := s.get(resolverName) + if err != nil { + return err + } + + storedData.Certificates = certificates + s.save(resolverName, storedData) + + return nil +} + func (s *LocalStore) save(resolverName string, storedData *StoredData) { s.lock.Lock() defer s.lock.Unlock() @@ -122,8 +169,7 @@ func (s *LocalStore) listenSaveAction(routinesPool *safe.Pool) { logger.Error().Err(err).Send() } - err = os.WriteFile(s.filename, data, 0o600) - if err != nil { + if err := os.WriteFile(s.filename, data, 0o600); err != nil { logger.Error().Err(err).Send() } } @@ -133,55 +179,5 @@ func (s *LocalStore) listenSaveAction(routinesPool *safe.Pool) { // unSafeCopyOfStoredData creates maps copy of storedData. Is not thread safe, you should use `s.lock`. func (s *LocalStore) unSafeCopyOfStoredData() map[string]*StoredData { - result := map[string]*StoredData{} - for k, v := range s.storedData { - result[k] = v - } - return result -} - -// GetAccount returns ACME Account. -func (s *LocalStore) GetAccount(resolverName string) (*Account, error) { - storedData, err := s.get(resolverName) - if err != nil { - return nil, err - } - - return storedData.Account, nil -} - -// SaveAccount stores ACME Account. -func (s *LocalStore) SaveAccount(resolverName string, account *Account) error { - storedData, err := s.get(resolverName) - if err != nil { - return err - } - - storedData.Account = account - s.save(resolverName, storedData) - - return nil -} - -// GetCertificates returns ACME Certificates list. -func (s *LocalStore) GetCertificates(resolverName string) ([]*CertAndStore, error) { - storedData, err := s.get(resolverName) - if err != nil { - return nil, err - } - - return storedData.Certificates, nil -} - -// SaveCertificates stores ACME Certificates list. -func (s *LocalStore) SaveCertificates(resolverName string, certificates []*CertAndStore) error { - storedData, err := s.get(resolverName) - if err != nil { - return err - } - - storedData.Certificates = certificates - s.save(resolverName, storedData) - - return nil + return maps.Clone(s.storedData) } diff --git a/pkg/provider/acme/local_store_unix.go b/pkg/provider/acme/local_store_unix.go index 163ecd7ae..60f85ce27 100644 --- a/pkg/provider/acme/local_store_unix.go +++ b/pkg/provider/acme/local_store_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package acme diff --git a/pkg/provider/acme/provider.go b/pkg/provider/acme/provider.go index f8ab4ca1f..fb181dd54 100644 --- a/pkg/provider/acme/provider.go +++ b/pkg/provider/acme/provider.go @@ -78,6 +78,7 @@ func (a *Configuration) SetDefaults() { // CertAndStore allows mapping a TLS certificate to a TLS store. type CertAndStore struct { Certificate + Store string } @@ -127,6 +128,7 @@ type TLSChallenge struct { // Provider holds configurations of the provider. type Provider struct { *Configuration + ResolverName string Store Store `json:"store,omitempty" toml:"store,omitempty" yaml:"store,omitempty"` @@ -1085,7 +1087,7 @@ func (p *Provider) certExists(validDomains []string) bool { func isDomainAlreadyChecked(domainToCheck string, existentDomains []string) bool { for _, certDomains := range existentDomains { - for _, certDomain := range strings.Split(certDomains, ",") { + for certDomain := range strings.SplitSeq(certDomains, ",") { if types.MatchDomain(domainToCheck, certDomain) { return true } diff --git a/pkg/provider/aggregator/aggregator.go b/pkg/provider/aggregator/aggregator.go index 95bb0b220..b68ef0551 100644 --- a/pkg/provider/aggregator/aggregator.go +++ b/pkg/provider/aggregator/aggregator.go @@ -150,13 +150,6 @@ func NewProviderAggregator(conf static.Providers) *ProviderAggregator { return p } -func (p *ProviderAggregator) quietAddProvider(provider provider.Provider) { - err := p.AddProvider(provider) - if err != nil { - log.Error().Err(err).Msgf("Error while initializing provider %T", provider) - } -} - // AddProvider adds a provider in the providers map. func (p *ProviderAggregator) AddProvider(provider provider.Provider) error { err := provider.Init() @@ -202,6 +195,13 @@ func (p *ProviderAggregator) Provide(configurationChan chan<- dynamic.Message, p return nil } +func (p *ProviderAggregator) quietAddProvider(provider provider.Provider) { + err := p.AddProvider(provider) + if err != nil { + log.Error().Err(err).Msgf("Error while initializing provider %T", provider) + } +} + func (p *ProviderAggregator) launchProvider(configurationChan chan<- dynamic.Message, pool *safe.Pool, prd provider.Provider) { jsonConf, err := redactor.RemoveCredentials(prd) if err != nil { diff --git a/pkg/provider/configuration.go b/pkg/provider/configuration.go index 2872ed7e3..d310881f8 100644 --- a/pkg/provider/configuration.go +++ b/pkg/provider/configuration.go @@ -401,9 +401,7 @@ func MakeDefaultRuleTemplate(defaultRule string, funcMap template.FuncMap) (*tem defaultFuncMap := sprig.TxtFuncMap() defaultFuncMap["normalize"] = Normalize - for k, fn := range funcMap { - defaultFuncMap[k] = fn - } + maps.Copy(defaultFuncMap, funcMap) return template.New("defaultRule").Funcs(defaultFuncMap).Parse(defaultRule) } @@ -458,7 +456,7 @@ func BuildUDPRouterConfiguration(ctx context.Context, configuration *dynamic.UDP } // BuildRouterConfiguration builds a router configuration. -func BuildRouterConfiguration(ctx context.Context, configuration *dynamic.HTTPConfiguration, defaultRouterName string, defaultRuleTpl *template.Template, model interface{}) { +func BuildRouterConfiguration(ctx context.Context, configuration *dynamic.HTTPConfiguration, defaultRouterName string, defaultRuleTpl *template.Template, model any) { if len(configuration.Routers) == 0 { if len(configuration.Services) > 1 { log.Ctx(ctx).Info().Msg("Could not create a router for the container: too many services") diff --git a/pkg/provider/constraints/constraints_labels.go b/pkg/provider/constraints/constraints_labels.go index 6d74bfbab..a8dd20aca 100644 --- a/pkg/provider/constraints/constraints_labels.go +++ b/pkg/provider/constraints/constraints_labels.go @@ -24,7 +24,7 @@ func MatchLabels(labels map[string]string, expr string) (bool, error) { NOT: notLabelFunc, OR: orLabelFunc, }, - Functions: map[string]interface{}{ + Functions: map[string]any{ "Label": labelFn, "LabelRegex": labelRegexFn, }, diff --git a/pkg/provider/constraints/constraints_tags.go b/pkg/provider/constraints/constraints_tags.go index b61f43c5d..ad8fa8fc9 100644 --- a/pkg/provider/constraints/constraints_tags.go +++ b/pkg/provider/constraints/constraints_tags.go @@ -25,7 +25,7 @@ func MatchTags(tags []string, expr string) (bool, error) { NOT: notTagFunc, OR: orTagFunc, }, - Functions: map[string]interface{}{ + Functions: map[string]any{ "Tag": tagFn, "TagRegex": tagRegexFn, }, diff --git a/pkg/provider/consulcatalog/consul_catalog.go b/pkg/provider/consulcatalog/consul_catalog.go index ec3fb64da..9da53ce26 100644 --- a/pkg/provider/consulcatalog/consul_catalog.go +++ b/pkg/provider/consulcatalog/consul_catalog.go @@ -248,6 +248,11 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. return nil } +// Namespace returns the namespace of the ConsulCatalog provider. +func (p *Provider) Namespace() string { + return p.namespace +} + func (p *Provider) loadConfiguration(ctx context.Context, certInfo *connectCert, configurationChan chan<- dynamic.Message) error { data, err := p.getConsulServicesData(ctx) if err != nil { @@ -388,12 +393,12 @@ func (p *Provider) fetchService(ctx context.Context, name string, connectEnabled // watchServices watches for update events of the services list and statuses, // and transmits them to the caller through the p.watchServicesChan. func (p *Provider) watchServices(ctx context.Context) error { - servicesWatcher, err := watch.Parse(map[string]interface{}{"type": "services"}) + servicesWatcher, err := watch.Parse(map[string]any{"type": "services"}) if err != nil { return fmt.Errorf("failed to create services watcher plan: %w", err) } - servicesWatcher.HybridHandler = func(_ watch.BlockingParamVal, _ interface{}) { + servicesWatcher.HybridHandler = func(_ watch.BlockingParamVal, _ any) { select { case <-ctx.Done(): case p.watchServicesChan <- struct{}{}: @@ -402,12 +407,12 @@ func (p *Provider) watchServices(ctx context.Context) error { } } - checksWatcher, err := watch.Parse(map[string]interface{}{"type": "checks"}) + checksWatcher, err := watch.Parse(map[string]any{"type": "checks"}) if err != nil { return fmt.Errorf("failed to create checks watcher plan: %w", err) } - checksWatcher.HybridHandler = func(_ watch.BlockingParamVal, _ interface{}) { + checksWatcher.HybridHandler = func(_ watch.BlockingParamVal, _ any) { select { case <-ctx.Done(): case p.watchServicesChan <- struct{}{}: @@ -447,66 +452,11 @@ func (p *Provider) watchServices(ctx context.Context) error { } } -func rootsWatchHandler(ctx context.Context, dest chan<- []string) func(watch.BlockingParamVal, interface{}) { - return func(_ watch.BlockingParamVal, raw interface{}) { - if raw == nil { - log.Ctx(ctx).Error().Msg("Root certificate watcher called with nil") - return - } - - v, ok := raw.(*api.CARootList) - if !ok || v == nil { - log.Ctx(ctx).Error().Msg("Invalid result for root certificate watcher") - return - } - - roots := make([]string, 0, len(v.Roots)) - for _, root := range v.Roots { - roots = append(roots, root.RootCertPEM) - } - - select { - case <-ctx.Done(): - case dest <- roots: - } - } -} - -type keyPair struct { - cert string - key string -} - -func leafWatcherHandler(ctx context.Context, dest chan<- keyPair) func(watch.BlockingParamVal, interface{}) { - return func(_ watch.BlockingParamVal, raw interface{}) { - if raw == nil { - log.Ctx(ctx).Error().Msg("Leaf certificate watcher called with nil") - return - } - - v, ok := raw.(*api.LeafCert) - if !ok || v == nil { - log.Ctx(ctx).Error().Msg("Invalid result for leaf certificate watcher") - return - } - - kp := keyPair{ - cert: v.CertPEM, - key: v.PrivateKeyPEM, - } - - select { - case <-ctx.Done(): - case dest <- kp: - } - } -} - // watchConnectTLS watches for updates of the root certificate or the leaf // certificate, and transmits them to the caller via p.certChan. func (p *Provider) watchConnectTLS(ctx context.Context) error { leafChan := make(chan keyPair) - leafWatcher, err := watch.Parse(map[string]interface{}{ + leafWatcher, err := watch.Parse(map[string]any{ "type": "connect_leaf", "service": p.ServiceName, }) @@ -516,7 +466,7 @@ func (p *Provider) watchConnectTLS(ctx context.Context) error { leafWatcher.HybridHandler = leafWatcherHandler(ctx, leafChan) rootsChan := make(chan []string) - rootsWatcher, err := watch.Parse(map[string]interface{}{ + rootsWatcher, err := watch.Parse(map[string]any{ "type": "connect_roots", }) if err != nil { @@ -596,6 +546,61 @@ func (p *Provider) includesHealthStatus(status string) bool { return false } +func rootsWatchHandler(ctx context.Context, dest chan<- []string) func(watch.BlockingParamVal, any) { + return func(_ watch.BlockingParamVal, raw any) { + if raw == nil { + log.Ctx(ctx).Error().Msg("Root certificate watcher called with nil") + return + } + + v, ok := raw.(*api.CARootList) + if !ok || v == nil { + log.Ctx(ctx).Error().Msg("Invalid result for root certificate watcher") + return + } + + roots := make([]string, 0, len(v.Roots)) + for _, root := range v.Roots { + roots = append(roots, root.RootCertPEM) + } + + select { + case <-ctx.Done(): + case dest <- roots: + } + } +} + +type keyPair struct { + cert string + key string +} + +func leafWatcherHandler(ctx context.Context, dest chan<- keyPair) func(watch.BlockingParamVal, any) { + return func(_ watch.BlockingParamVal, raw any) { + if raw == nil { + log.Ctx(ctx).Error().Msg("Leaf certificate watcher called with nil") + return + } + + v, ok := raw.(*api.LeafCert) + if !ok || v == nil { + log.Ctx(ctx).Error().Msg("Invalid result for leaf certificate watcher") + return + } + + kp := keyPair{ + cert: v.CertPEM, + key: v.PrivateKeyPEM, + } + + select { + case <-ctx.Done(): + case dest <- kp: + } + } +} + func createClient(namespace string, endpoint *EndpointConfig) (*api.Client, error) { config := api.Config{ Address: endpoint.Address, @@ -647,8 +652,3 @@ func repeatSend(ctx context.Context, interval time.Duration, c chan<- struct{}) } } } - -// Namespace returns the namespace of the ConsulCatalog provider. -func (p *Provider) Namespace() string { - return p.namespace -} diff --git a/pkg/provider/docker/config.go b/pkg/provider/docker/config.go index c0140655e..96133db4f 100644 --- a/pkg/provider/docker/config.go +++ b/pkg/provider/docker/config.go @@ -20,6 +20,7 @@ import ( type DynConfBuilder struct { Shared + apiClient client.APIClient swarm bool } diff --git a/pkg/provider/docker/pdocker.go b/pkg/provider/docker/pdocker.go index 684e97c11..937f6cdea 100644 --- a/pkg/provider/docker/pdocker.go +++ b/pkg/provider/docker/pdocker.go @@ -50,10 +50,6 @@ func (p *Provider) Init() error { return nil } -func (p *Provider) createClient(ctx context.Context) (*client.Client, error) { - return createClient(ctx, p.ClientConfig) -} - // Provide allows the docker provider to provide configurations to traefik using the given configuration channel. func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { pool.GoCtx(func(routineCtx context.Context) { @@ -160,6 +156,10 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. return nil } +func (p *Provider) createClient(ctx context.Context) (*client.Client, error) { + return createClient(ctx, p.ClientConfig) +} + func (p *Provider) listContainers(ctx context.Context, dockerClient client.ContainerAPIClient) ([]dockerData, error) { containerList, err := dockerClient.ContainerList(ctx, container.ListOptions{ All: true, diff --git a/pkg/provider/docker/pswarm.go b/pkg/provider/docker/pswarm.go index f596b9e67..d16df07f8 100644 --- a/pkg/provider/docker/pswarm.go +++ b/pkg/provider/docker/pswarm.go @@ -54,10 +54,6 @@ func (p *SwarmProvider) Init() error { return nil } -func (p *SwarmProvider) createClient(ctx context.Context) (*client.Client, error) { - return createClient(ctx, p.ClientConfig) -} - // Provide allows the docker provider to provide configurations to traefik using the given configuration channel. func (p *SwarmProvider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { pool.GoCtx(func(routineCtx context.Context) { @@ -154,6 +150,10 @@ func (p *SwarmProvider) Provide(configurationChan chan<- dynamic.Message, pool * return nil } +func (p *SwarmProvider) createClient(ctx context.Context) (*client.Client, error) { + return createClient(ctx, p.ClientConfig) +} + func (p *SwarmProvider) listServices(ctx context.Context, dockerClient client.APIClient) ([]dockerData, error) { logger := log.Ctx(ctx) diff --git a/pkg/provider/docker/pswarm_mock_test.go b/pkg/provider/docker/pswarm_mock_test.go index 8793982b9..d7af8f312 100644 --- a/pkg/provider/docker/pswarm_mock_test.go +++ b/pkg/provider/docker/pswarm_mock_test.go @@ -12,6 +12,7 @@ import ( type fakeTasksClient struct { dockerclient.APIClient + tasks []swarmtypes.Task container containertypes.InspectResponse err error @@ -27,6 +28,7 @@ func (c *fakeTasksClient) ContainerInspect(ctx context.Context, container string type fakeServicesClient struct { dockerclient.APIClient + dockerVersion string networks []networktypes.Summary nodes []swarmtypes.Node diff --git a/pkg/provider/ecs/ecs.go b/pkg/provider/ecs/ecs.go index 1204387d7..c8186fe7d 100644 --- a/pkg/provider/ecs/ecs.go +++ b/pkg/provider/ecs/ecs.go @@ -104,41 +104,6 @@ func (p *Provider) Init() error { return nil } -func (p *Provider) createClient(ctx context.Context, logger zerolog.Logger) (*awsClient, error) { - optFns := []func(*config.LoadOptions) error{ - config.WithLogger(logs.NewAWSWrapper(logger)), - } - if p.Region != "" { - optFns = append(optFns, config.WithRegion(p.Region)) - } else { - logger.Info().Msg("No region provided, will retrieve region from the EC2 Metadata service") - optFns = append(optFns, config.WithEC2IMDSRegion()) - } - - if p.AccessKeyID != "" && p.SecretAccessKey != "" { - // From https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-gosdk.html#specify-credentials-programmatically: - // "If you explicitly provide credentials, as in this example, the SDK uses only those credentials." - // this makes sure that user-defined credentials always have the highest priority - staticCreds := aws.NewCredentialsCache(credentials.NewStaticCredentialsProvider(p.AccessKeyID, p.SecretAccessKey, "")) - optFns = append(optFns, config.WithCredentialsProvider(staticCreds)) - - // If the access key and secret access key are not provided, config.LoadDefaultConfig - // will look for the credentials in the default credential chain. - // See https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-gosdk.html#specifying-credentials. - } - - cfg, err := config.LoadDefaultConfig(ctx, optFns...) - if err != nil { - return nil, err - } - - return &awsClient{ - ecs.NewFromConfig(cfg), - ec2.NewFromConfig(cfg), - ssm.NewFromConfig(cfg), - }, nil -} - // Provide configuration to traefik from ECS. func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { pool.GoCtx(func(routineCtx context.Context) { @@ -185,6 +150,41 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. return nil } +func (p *Provider) createClient(ctx context.Context, logger zerolog.Logger) (*awsClient, error) { + optFns := []func(*config.LoadOptions) error{ + config.WithLogger(logs.NewAWSWrapper(logger)), + } + if p.Region != "" { + optFns = append(optFns, config.WithRegion(p.Region)) + } else { + logger.Info().Msg("No region provided, will retrieve region from the EC2 Metadata service") + optFns = append(optFns, config.WithEC2IMDSRegion()) + } + + if p.AccessKeyID != "" && p.SecretAccessKey != "" { + // From https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-gosdk.html#specify-credentials-programmatically: + // "If you explicitly provide credentials, as in this example, the SDK uses only those credentials." + // this makes sure that user-defined credentials always have the highest priority + staticCreds := aws.NewCredentialsCache(credentials.NewStaticCredentialsProvider(p.AccessKeyID, p.SecretAccessKey, "")) + optFns = append(optFns, config.WithCredentialsProvider(staticCreds)) + + // If the access key and secret access key are not provided, config.LoadDefaultConfig + // will look for the credentials in the default credential chain. + // See https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-gosdk.html#specifying-credentials. + } + + cfg, err := config.LoadDefaultConfig(ctx, optFns...) + if err != nil { + return nil, err + } + + return &awsClient{ + ecs.NewFromConfig(cfg), + ec2.NewFromConfig(cfg), + ssm.NewFromConfig(cfg), + }, nil +} + func (p *Provider) loadConfiguration(ctx context.Context, client *awsClient, configurationChan chan<- dynamic.Message) error { instances, err := p.listInstances(ctx, client) if err != nil { diff --git a/pkg/provider/file/file.go b/pkg/provider/file/file.go index 5f0b08223..04395878e 100644 --- a/pkg/provider/file/file.go +++ b/pkg/provider/file/file.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "maps" "os" "os/signal" "path" @@ -112,6 +113,51 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. return nil } +// CreateConfiguration creates a provider configuration from content using templating. +func (p *Provider) CreateConfiguration(ctx context.Context, filename string, funcMap template.FuncMap, templateObjects any) (*dynamic.Configuration, error) { + tmplContent, err := readFile(filename) + if err != nil { + return nil, fmt.Errorf("error reading configuration file: %s - %w", filename, err) + } + + defaultFuncMap := sprig.TxtFuncMap() + defaultFuncMap["normalize"] = provider.Normalize + defaultFuncMap["split"] = strings.Split + maps.Copy(defaultFuncMap, funcMap) + + tmpl := template.New(p.Filename).Funcs(defaultFuncMap) + + _, err = tmpl.Parse(tmplContent) + if err != nil { + return nil, err + } + + var buffer bytes.Buffer + err = tmpl.Execute(&buffer, templateObjects) + if err != nil { + return nil, err + } + + renderedTemplate := buffer.String() + if p.DebugLogGeneratedTemplate { + logger := log.Ctx(ctx) + logger.Debug().Msgf("Template content: %s", tmplContent) + logger.Debug().Msgf("Rendering results: %s", renderedTemplate) + } + + return p.decodeConfiguration(filename, renderedTemplate) +} + +// DecodeConfiguration Decodes a *types.Configuration from a content. +func (p *Provider) DecodeConfiguration(filename string) (*dynamic.Configuration, error) { + content, err := readFile(filename) + if err != nil { + return nil, fmt.Errorf("error reading configuration file: %s - %w", filename, err) + } + + return p.decodeConfiguration(filename, content) +} + func (p *Provider) addWatcher(pool *safe.Pool, items []string, configurationChan chan<- dynamic.Message, callback func(chan<- dynamic.Message) error) error { watcher, err := fsnotify.NewWatcher() if err != nil { @@ -185,13 +231,6 @@ func (p *Provider) buildConfiguration() (*dynamic.Configuration, error) { return nil, errors.New("error using file configuration provider, neither filename nor directory is defined") } -func sendConfigToChannel(configurationChan chan<- dynamic.Message, configuration *dynamic.Configuration) { - configurationChan <- dynamic.Message{ - ProviderName: "file", - Configuration: configuration, - } -} - func (p *Provider) loadFileConfig(ctx context.Context, filename string, parseTemplate bool) (*dynamic.Configuration, error) { var err error var configuration *dynamic.Configuration @@ -337,29 +376,6 @@ func (p *Provider) loadFileConfig(ctx context.Context, filename string, parseTem return configuration, nil } -func flattenCertificates(ctx context.Context, tlsConfig *dynamic.TLSConfiguration) []*tls.CertAndStores { - var certs []*tls.CertAndStores - for _, cert := range tlsConfig.Certificates { - content, err := cert.Certificate.CertFile.Read() - if err != nil { - log.Ctx(ctx).Error().Err(err).Send() - continue - } - cert.Certificate.CertFile = types.FileOrContent(string(content)) - - content, err = cert.Certificate.KeyFile.Read() - if err != nil { - log.Ctx(ctx).Error().Err(err).Send() - continue - } - cert.Certificate.KeyFile = types.FileOrContent(string(content)) - - certs = append(certs, cert) - } - - return certs -} - func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory string, configuration *dynamic.Configuration) (*dynamic.Configuration, error) { fileList, err := os.ReadDir(directory) if err != nil { @@ -539,53 +555,6 @@ func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory st return configuration, nil } -// CreateConfiguration creates a provider configuration from content using templating. -func (p *Provider) CreateConfiguration(ctx context.Context, filename string, funcMap template.FuncMap, templateObjects interface{}) (*dynamic.Configuration, error) { - tmplContent, err := readFile(filename) - if err != nil { - return nil, fmt.Errorf("error reading configuration file: %s - %w", filename, err) - } - - defaultFuncMap := sprig.TxtFuncMap() - defaultFuncMap["normalize"] = provider.Normalize - defaultFuncMap["split"] = strings.Split - for funcID, funcElement := range funcMap { - defaultFuncMap[funcID] = funcElement - } - - tmpl := template.New(p.Filename).Funcs(defaultFuncMap) - - _, err = tmpl.Parse(tmplContent) - if err != nil { - return nil, err - } - - var buffer bytes.Buffer - err = tmpl.Execute(&buffer, templateObjects) - if err != nil { - return nil, err - } - - renderedTemplate := buffer.String() - if p.DebugLogGeneratedTemplate { - logger := log.Ctx(ctx) - logger.Debug().Msgf("Template content: %s", tmplContent) - logger.Debug().Msgf("Rendering results: %s", renderedTemplate) - } - - return p.decodeConfiguration(filename, renderedTemplate) -} - -// DecodeConfiguration Decodes a *types.Configuration from a content. -func (p *Provider) DecodeConfiguration(filename string) (*dynamic.Configuration, error) { - content, err := readFile(filename) - if err != nil { - return nil, fmt.Errorf("error reading configuration file: %s - %w", filename, err) - } - - return p.decodeConfiguration(filename, content) -} - func (p *Provider) decodeConfiguration(filePath, content string) (*dynamic.Configuration, error) { configuration := &dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ @@ -618,6 +587,36 @@ func (p *Provider) decodeConfiguration(filePath, content string) (*dynamic.Confi return configuration, nil } +func sendConfigToChannel(configurationChan chan<- dynamic.Message, configuration *dynamic.Configuration) { + configurationChan <- dynamic.Message{ + ProviderName: "file", + Configuration: configuration, + } +} + +func flattenCertificates(ctx context.Context, tlsConfig *dynamic.TLSConfiguration) []*tls.CertAndStores { + var certs []*tls.CertAndStores + for _, cert := range tlsConfig.Certificates { + content, err := cert.Certificate.CertFile.Read() + if err != nil { + log.Ctx(ctx).Error().Err(err).Send() + continue + } + cert.Certificate.CertFile = types.FileOrContent(string(content)) + + content, err = cert.Certificate.KeyFile.Read() + if err != nil { + log.Ctx(ctx).Error().Err(err).Send() + continue + } + cert.Certificate.KeyFile = types.FileOrContent(string(content)) + + certs = append(certs, cert) + } + + return certs +} + func readFile(filename string) (string, error) { if len(filename) > 0 { buf, err := os.ReadFile(filename) diff --git a/pkg/provider/kubernetes/crd/client.go b/pkg/provider/kubernetes/crd/client.go index dfaa7584a..19896b727 100644 --- a/pkg/provider/kubernetes/crd/client.go +++ b/pkg/provider/kubernetes/crd/client.go @@ -34,7 +34,7 @@ const resyncPeriod = 10 * time.Minute // WatchAll starts the watch of the Provider resources and updates the stores. // The stores can then be accessed via the Get* functions. type Client interface { - WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) + WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan any, error) GetIngressRoutes() []*traefikv1alpha1.IngressRoute GetIngressRouteTCPs() []*traefikv1alpha1.IngressRouteTCP GetIngressRouteUDPs() []*traefikv1alpha1.IngressRouteUDP @@ -157,8 +157,8 @@ func newExternalClusterClient(endpoint, caFilePath string, token types.FileOrCon } // WatchAll starts namespace-specific controllers for all relevant kinds. -func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) { - eventCh := make(chan interface{}, 1) +func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan any, error) { + eventCh := make(chan any, 1) eventHandler := &k8s.ResourceEventHandler{Ev: eventCh} if len(namespaces) == 0 { diff --git a/pkg/provider/kubernetes/crd/kubernetes.go b/pkg/provider/kubernetes/crd/kubernetes.go index 92b45a124..d2fc71306 100644 --- a/pkg/provider/kubernetes/crd/kubernetes.go +++ b/pkg/provider/kubernetes/crd/kubernetes.go @@ -68,55 +68,6 @@ type Provider struct { routerTransform k8s.RouterTransform } -func (p *Provider) SetRouterTransform(routerTransform k8s.RouterTransform) { - p.routerTransform = routerTransform -} - -func (p *Provider) applyRouterTransform(ctx context.Context, rt *dynamic.Router, ingress *traefikv1alpha1.IngressRoute) { - if p.routerTransform == nil { - return - } - - err := p.routerTransform.Apply(ctx, rt, ingress) - if err != nil { - log.Ctx(ctx).Error().Err(err).Msg("Apply router transform") - } -} - -func (p *Provider) newK8sClient(ctx context.Context) (*clientWrapper, error) { - _, err := labels.Parse(p.LabelSelector) - if err != nil { - return nil, fmt.Errorf("invalid label selector: %q", p.LabelSelector) - } - log.Ctx(ctx).Info().Msgf("label selector is: %q", p.LabelSelector) - - withEndpoint := "" - if p.Endpoint != "" { - withEndpoint = fmt.Sprintf(" with endpoint %s", p.Endpoint) - } - - var client *clientWrapper - switch { - case os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "": - log.Ctx(ctx).Info().Msgf("Creating in-cluster Provider client%s", withEndpoint) - client, err = newInClusterClient(p.Endpoint) - case os.Getenv("KUBECONFIG") != "": - log.Ctx(ctx).Info().Msgf("Creating cluster-external Provider client from KUBECONFIG %s", os.Getenv("KUBECONFIG")) - client, err = newExternalClusterClientFromFile(os.Getenv("KUBECONFIG")) - default: - log.Ctx(ctx).Info().Msgf("Creating cluster-external Provider client%s", withEndpoint) - client, err = newExternalClusterClient(p.Endpoint, p.CertAuthFilePath, p.Token) - } - - if err != nil { - return nil, err - } - - client.labelSelector = p.LabelSelector - client.disableClusterScopeInformer = p.DisableClusterScopeResources - return client, nil -} - // Init the provider. func (p *Provider) Init() error { return nil @@ -205,6 +156,73 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. return nil } +func (p *Provider) SetRouterTransform(routerTransform k8s.RouterTransform) { + p.routerTransform = routerTransform +} + +func (p *Provider) FillExtensionBuilderRegistry(registry gateway.ExtensionBuilderRegistry) { + registry.RegisterFilterFuncs(traefikv1alpha1.GroupName, "Middleware", func(name, namespace string) (string, *dynamic.Middleware, error) { + if len(p.Namespaces) > 0 && !slices.Contains(p.Namespaces, namespace) { + return "", nil, fmt.Errorf("namespace %q is not allowed", namespace) + } + + return makeID(namespace, name) + providerNamespaceSeparator + providerName, nil, nil + }) + + registry.RegisterBackendFuncs(traefikv1alpha1.GroupName, "TraefikService", func(name, namespace string) (string, *dynamic.Service, error) { + if len(p.Namespaces) > 0 && !slices.Contains(p.Namespaces, namespace) { + return "", nil, fmt.Errorf("namespace %q is not allowed", namespace) + } + + return makeID(namespace, name) + providerNamespaceSeparator + providerName, nil, nil + }) +} + +func (p *Provider) applyRouterTransform(ctx context.Context, rt *dynamic.Router, ingress *traefikv1alpha1.IngressRoute) { + if p.routerTransform == nil { + return + } + + err := p.routerTransform.Apply(ctx, rt, ingress) + if err != nil { + log.Ctx(ctx).Error().Err(err).Msg("Apply router transform") + } +} + +func (p *Provider) newK8sClient(ctx context.Context) (*clientWrapper, error) { + _, err := labels.Parse(p.LabelSelector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %q", p.LabelSelector) + } + log.Ctx(ctx).Info().Msgf("label selector is: %q", p.LabelSelector) + + withEndpoint := "" + if p.Endpoint != "" { + withEndpoint = fmt.Sprintf(" with endpoint %s", p.Endpoint) + } + + var client *clientWrapper + switch { + case os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "": + log.Ctx(ctx).Info().Msgf("Creating in-cluster Provider client%s", withEndpoint) + client, err = newInClusterClient(p.Endpoint) + case os.Getenv("KUBECONFIG") != "": + log.Ctx(ctx).Info().Msgf("Creating cluster-external Provider client from KUBECONFIG %s", os.Getenv("KUBECONFIG")) + client, err = newExternalClusterClientFromFile(os.Getenv("KUBECONFIG")) + default: + log.Ctx(ctx).Info().Msgf("Creating cluster-external Provider client%s", withEndpoint) + client, err = newExternalClusterClient(p.Endpoint, p.CertAuthFilePath, p.Token) + } + + if err != nil { + return nil, err + } + + client.labelSelector = p.LabelSelector + client.disableClusterScopeInformer = p.DisableClusterScopeResources + return client, nil +} + func (p *Provider) loadConfigurationFromCRD(ctx context.Context, client Client) *dynamic.Configuration { stores, tlsConfigs := buildTLSStores(ctx, client) if tlsConfigs == nil { @@ -580,6 +598,32 @@ func (p *Provider) loadConfigurationFromCRD(ctx context.Context, client Client) return conf } +func (p *Provider) createErrorPageMiddleware(client Client, namespace string, errorPage *traefikv1alpha1.ErrorPage) (*dynamic.ErrorPage, *dynamic.Service, error) { + if errorPage == nil { + return nil, nil, nil + } + + errorPageMiddleware := &dynamic.ErrorPage{ + Status: errorPage.Status, + StatusRewrites: errorPage.StatusRewrites, + Query: errorPage.Query, + } + + cb := configBuilder{ + client: client, + allowCrossNamespace: p.AllowCrossNamespace, + allowExternalNameServices: p.AllowExternalNameServices, + allowEmptyServices: p.AllowEmptyServices, + } + + balancerServerHTTP, err := cb.buildServersLB(namespace, errorPage.Service.LoadBalancerSpec) + if err != nil { + return nil, nil, err + } + + return errorPageMiddleware, balancerServerHTTP, nil +} + // getServicePort always returns a valid port, an error otherwise. func getServicePort(svc *corev1.Service, port intstr.IntOrString) (*corev1.ServicePort, error) { if svc == nil { @@ -651,7 +695,7 @@ func createPluginMiddleware(k8sClient Client, ns string, plugins map[string]apie return pcMap, nil } -func loadSecretKeys(k8sClient Client, ns string, i interface{}) (interface{}, error) { +func loadSecretKeys(k8sClient Client, ns string, i any) (any, error) { var err error switch iv := i.(type) { case string: @@ -661,14 +705,14 @@ func loadSecretKeys(k8sClient Client, ns string, i interface{}) (interface{}, er return getSecretValue(k8sClient, ns, iv) - case []interface{}: + case []any: for i := range iv { if iv[i], err = loadSecretKeys(k8sClient, ns, iv[i]); err != nil { return nil, err } } - case map[string]interface{}: + case map[string]any: for k := range iv { if iv[k], err = loadSecretKeys(k8sClient, ns, iv[k]); err != nil { return nil, err @@ -901,50 +945,6 @@ func createRetryMiddleware(retry *traefikv1alpha1.Retry) (*dynamic.Retry, error) return r, nil } -func (p *Provider) createErrorPageMiddleware(client Client, namespace string, errorPage *traefikv1alpha1.ErrorPage) (*dynamic.ErrorPage, *dynamic.Service, error) { - if errorPage == nil { - return nil, nil, nil - } - - errorPageMiddleware := &dynamic.ErrorPage{ - Status: errorPage.Status, - StatusRewrites: errorPage.StatusRewrites, - Query: errorPage.Query, - } - - cb := configBuilder{ - client: client, - allowCrossNamespace: p.AllowCrossNamespace, - allowExternalNameServices: p.AllowExternalNameServices, - allowEmptyServices: p.AllowEmptyServices, - } - - balancerServerHTTP, err := cb.buildServersLB(namespace, errorPage.Service.LoadBalancerSpec) - if err != nil { - return nil, nil, err - } - - return errorPageMiddleware, balancerServerHTTP, nil -} - -func (p *Provider) FillExtensionBuilderRegistry(registry gateway.ExtensionBuilderRegistry) { - registry.RegisterFilterFuncs(traefikv1alpha1.GroupName, "Middleware", func(name, namespace string) (string, *dynamic.Middleware, error) { - if len(p.Namespaces) > 0 && !slices.Contains(p.Namespaces, namespace) { - return "", nil, fmt.Errorf("namespace %q is not allowed", namespace) - } - - return makeID(namespace, name) + providerNamespaceSeparator + providerName, nil, nil - }) - - registry.RegisterBackendFuncs(traefikv1alpha1.GroupName, "TraefikService", func(name, namespace string) (string, *dynamic.Service, error) { - if len(p.Namespaces) > 0 && !slices.Contains(p.Namespaces, namespace) { - return "", nil, fmt.Errorf("namespace %q is not allowed", namespace) - } - - return makeID(namespace, name) + providerNamespaceSeparator + providerName, nil, nil - }) -} - func createForwardAuthMiddleware(k8sClient Client, namespace string, auth *traefikv1alpha1.ForwardAuth) (*dynamic.ForwardAuth, error) { if auth == nil { return nil, nil @@ -1507,12 +1507,12 @@ func getCABlocksFromConfigMap(configMap *corev1.ConfigMap, namespace, name strin return "", fmt.Errorf("config map %s/%s contains neither tls.ca nor ca.crt", namespace, name) } -func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan interface{}) chan interface{} { +func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan any) chan any { if throttleDuration == 0 { return nil } // Create a buffered channel to hold the pending event (if we're delaying processing the event due to throttling) - eventsChanBuffered := make(chan interface{}, 1) + eventsChanBuffered := make(chan any, 1) // Run a goroutine that reads events from eventChan and does a non-blocking write to pendingEvent. // This guarantees that writing to eventChan will never block, diff --git a/pkg/provider/kubernetes/crd/kubernetes_test.go b/pkg/provider/kubernetes/crd/kubernetes_test.go index 018a3dd43..7845f1d4a 100644 --- a/pkg/provider/kubernetes/crd/kubernetes_test.go +++ b/pkg/provider/kubernetes/crd/kubernetes_test.go @@ -4197,7 +4197,7 @@ func TestLoadIngressRoutes(t *testing.T) { Middlewares: map[string]*dynamic.Middleware{ "default-test-secret": { Plugin: map[string]dynamic.PluginConf{ - "test-secret": map[string]interface{}{ + "test-secret": map[string]any{ "user": "admin", "secret": "this_is_the_secret", }, @@ -4229,10 +4229,10 @@ func TestLoadIngressRoutes(t *testing.T) { Middlewares: map[string]*dynamic.Middleware{ "default-test-secret": { Plugin: map[string]dynamic.PluginConf{ - "test-secret": map[string]interface{}{ - "secret_0": map[string]interface{}{ - "secret_1": map[string]interface{}{ - "secret_2": map[string]interface{}{ + "test-secret": map[string]any{ + "secret_0": map[string]any{ + "secret_1": map[string]any{ + "secret_2": map[string]any{ "user": "admin", "secret": "this_is_the_very_deep_secret", }, @@ -4267,8 +4267,8 @@ func TestLoadIngressRoutes(t *testing.T) { Middlewares: map[string]*dynamic.Middleware{ "default-test-secret": { Plugin: map[string]dynamic.PluginConf{ - "test-secret": map[string]interface{}{ - "secret": []interface{}{"secret_data1", "secret_data2"}, + "test-secret": map[string]any{ + "secret": []any{"secret_data1", "secret_data2"}, }, }, }, @@ -4298,13 +4298,13 @@ func TestLoadIngressRoutes(t *testing.T) { Middlewares: map[string]*dynamic.Middleware{ "default-test-secret": { Plugin: map[string]dynamic.PluginConf{ - "test-secret": map[string]interface{}{ - "users": []interface{}{ - map[string]interface{}{ + "test-secret": map[string]any{ + "users": []any{ + map[string]any{ "name": "admin", "secret": "admin_password", }, - map[string]interface{}{ + map[string]any{ "name": "user", "secret": "user_password", }, diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go index 36c50286b..adb068b4b 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroute.go @@ -41,6 +41,7 @@ type Route struct { Priority int `json:"priority,omitempty"` // Syntax defines the router's rule syntax. // More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/http/routing/rules-and-priority/#rulesyntax + // // Deprecated: Please do not use this field and rewrite the router rules to use the v3 syntax. Syntax string `json:"syntax,omitempty"` // Services defines the list of Service. diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroutetcp.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroutetcp.go index 1d719ee9a..9a3333825 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroutetcp.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/ingressroutetcp.go @@ -33,6 +33,7 @@ type RouteTCP struct { // Syntax defines the router's rule syntax. // More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/routing/rules-and-priority/#rulesyntax // +kubebuilder:validation:Enum=v3;v2 + // // Deprecated: Please do not use this field and rewrite the router rules to use the v3 syntax. Syntax string `json:"syntax,omitempty"` // Services defines the list of TCP services. @@ -82,10 +83,12 @@ type ServiceTCP struct { // hence fully terminating the connection. // It is a duration in milliseconds, defaulting to 100. // A negative value means an infinite deadline (i.e. the reading capability is never closed). + // // Deprecated: TerminationDelay will not be supported in future APIVersions, please use ServersTransport to configure the TerminationDelay instead. TerminationDelay *int `json:"terminationDelay,omitempty"` // ProxyProtocol defines the PROXY protocol configuration. // More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/service/#proxy-protocol + // // Deprecated: ProxyProtocol will not be supported in future APIVersions, please use ServersTransport to configure ProxyProtocol instead. ProxyProtocol *dynamic.ProxyProtocol `json:"proxyProtocol,omitempty"` // ServersTransport defines the name of ServersTransportTCP resource to use. diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/middlewaretcp.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/middlewaretcp.go index cf0e2a648..c515a6126 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/middlewaretcp.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/middlewaretcp.go @@ -27,8 +27,9 @@ type MiddlewareTCPSpec struct { InFlightConn *dynamic.TCPInFlightConn `json:"inFlightConn,omitempty"` // IPWhiteList defines the IPWhiteList middleware configuration. // This middleware accepts/refuses connections based on the client IP. - // Deprecated: please use IPAllowList instead. // More info: https://doc.traefik.io/traefik/v3.6/reference/routing-configuration/tcp/middlewares/ipwhitelist/ + // + // Deprecated: please use IPAllowList instead. IPWhiteList *dynamic.TCPIPWhiteList `json:"ipWhiteList,omitempty"` // IPAllowList defines the IPAllowList middleware configuration. // This middleware accepts/refuses connections based on the client IP. diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransport.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransport.go index 8cfbb92be..48fce5881 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransport.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransport.go @@ -34,6 +34,7 @@ type ServersTransportSpec struct { // RootCAs defines a list of CA certificate Secrets or ConfigMaps used to validate server certificates. RootCAs []RootCA `json:"rootCAs,omitempty"` // RootCAsSecrets defines a list of CA secret used to validate self-signed certificate. + // // Deprecated: RootCAsSecrets is deprecated, please use the RootCAs option instead. RootCAsSecrets []string `json:"rootCAsSecrets,omitempty"` // CertificatesSecrets defines a list of secret storing client certificates for mTLS. diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransporttcp.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransporttcp.go index 374108d10..0345e65e2 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransporttcp.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/serverstransporttcp.go @@ -54,6 +54,7 @@ type TLSClientConfig struct { // RootCAs defines a list of CA certificate Secrets or ConfigMaps used to validate server certificates. RootCAs []RootCA `json:"rootCAs,omitempty"` // RootCAsSecrets defines a list of CA secret used to validate self-signed certificate. + // // Deprecated: RootCAsSecrets is deprecated, please use the RootCAs option instead. RootCAsSecrets []string `json:"rootCAsSecrets,omitempty"` // CertificatesSecrets defines a list of secret storing client certificates for mTLS. diff --git a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/tlsoption.go b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/tlsoption.go index b4eebf6b7..c556e8a0a 100644 --- a/pkg/provider/kubernetes/crd/traefikio/v1alpha1/tlsoption.go +++ b/pkg/provider/kubernetes/crd/traefikio/v1alpha1/tlsoption.go @@ -48,6 +48,7 @@ type TLSOptionSpec struct { DisableSessionTickets bool `json:"disableSessionTickets,omitempty"` // PreferServerCipherSuites defines whether the server chooses a cipher suite among his own instead of among the client's. // It is enabled automatically when minVersion or maxVersion is set. + // // Deprecated: https://github.com/golang/go/issues/45430 PreferServerCipherSuites *bool `json:"preferServerCipherSuites,omitempty"` } diff --git a/pkg/provider/kubernetes/gateway/client.go b/pkg/provider/kubernetes/gateway/client.go index 50cf789d3..fd383d89e 100644 --- a/pkg/provider/kubernetes/gateway/client.go +++ b/pkg/provider/kubernetes/gateway/client.go @@ -126,8 +126,8 @@ func newExternalClusterClient(endpoint, caFilePath string, token types.FileOrCon } // WatchAll starts namespace-specific controllers for all relevant kinds. -func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) { - eventCh := make(chan interface{}, 1) +func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan any, error) { + eventCh := make(chan any, 1) eventHandler := &k8s.ResourceEventHandler{Ev: eventCh} if len(namespaces) == 0 { diff --git a/pkg/provider/kubernetes/gateway/httproute.go b/pkg/provider/kubernetes/gateway/httproute.go index 863c2f093..158014af8 100644 --- a/pkg/provider/kubernetes/gateway/httproute.go +++ b/pkg/provider/kubernetes/gateway/httproute.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "maps" "net" "net/http" "regexp" @@ -911,28 +912,20 @@ func mergeHTTPConfiguration(from, to *dynamic.Configuration) { if to.HTTP.Routers == nil { to.HTTP.Routers = map[string]*dynamic.Router{} } - for routerName, router := range from.HTTP.Routers { - to.HTTP.Routers[routerName] = router - } + maps.Copy(to.HTTP.Routers, from.HTTP.Routers) if to.HTTP.Middlewares == nil { to.HTTP.Middlewares = map[string]*dynamic.Middleware{} } - for middlewareName, middleware := range from.HTTP.Middlewares { - to.HTTP.Middlewares[middlewareName] = middleware - } + maps.Copy(to.HTTP.Middlewares, from.HTTP.Middlewares) if to.HTTP.Services == nil { to.HTTP.Services = map[string]*dynamic.Service{} } - for serviceName, service := range from.HTTP.Services { - to.HTTP.Services[serviceName] = service - } + maps.Copy(to.HTTP.Services, from.HTTP.Services) if to.HTTP.ServersTransports == nil { to.HTTP.ServersTransports = map[string]*dynamic.ServersTransport{} } - for name, serversTransport := range from.HTTP.ServersTransports { - to.HTTP.ServersTransports[name] = serversTransport - } + maps.Copy(to.HTTP.ServersTransports, from.HTTP.ServersTransports) } diff --git a/pkg/provider/kubernetes/gateway/kubernetes.go b/pkg/provider/kubernetes/gateway/kubernetes.go index 0c50b76a8..59ef2e66b 100644 --- a/pkg/provider/kubernetes/gateway/kubernetes.go +++ b/pkg/provider/kubernetes/gateway/kubernetes.go @@ -165,49 +165,6 @@ func (p *Provider) SetRouterTransform(routerTransform k8s.RouterTransform) { p.routerTransform = routerTransform } -func (p *Provider) applyRouterTransform(ctx context.Context, rt *dynamic.Router, route *gatev1.HTTPRoute) { - if p.routerTransform == nil { - return - } - - if err := p.routerTransform.Apply(ctx, rt, route); err != nil { - log.Ctx(ctx).Error().Err(err).Msg("Apply router transform") - } -} - -func (p *Provider) newK8sClient(ctx context.Context) (*clientWrapper, error) { - // Label selector validation - _, err := labels.Parse(p.LabelSelector) - if err != nil { - return nil, fmt.Errorf("invalid label selector: %q", p.LabelSelector) - } - - logger := log.Ctx(ctx) - logger.Info().Msgf("Label selector is: %q", p.LabelSelector) - - var client *clientWrapper - switch { - case os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "": - logger.Info().Str("endpoint", p.Endpoint).Msg("Creating in-cluster Provider client") - client, err = newInClusterClient(p.Endpoint) - case os.Getenv("KUBECONFIG") != "": - logger.Info().Msgf("Creating cluster-external Provider client from KUBECONFIG %s", os.Getenv("KUBECONFIG")) - client, err = newExternalClusterClientFromFile(os.Getenv("KUBECONFIG")) - default: - logger.Info().Str("endpoint", p.Endpoint).Msg("Creating cluster-external Provider client") - client, err = newExternalClusterClient(p.Endpoint, p.CertAuthFilePath, p.Token) - } - - if err != nil { - return nil, err - } - - client.labelSelector = p.LabelSelector - client.experimentalChannel = p.ExperimentalChannel - - return client, nil -} - // Init the provider. func (p *Provider) Init() error { logger := log.With().Str(logs.ProviderName, providerName).Logger() @@ -290,6 +247,49 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. return nil } +func (p *Provider) applyRouterTransform(ctx context.Context, rt *dynamic.Router, route *gatev1.HTTPRoute) { + if p.routerTransform == nil { + return + } + + if err := p.routerTransform.Apply(ctx, rt, route); err != nil { + log.Ctx(ctx).Error().Err(err).Msg("Apply router transform") + } +} + +func (p *Provider) newK8sClient(ctx context.Context) (*clientWrapper, error) { + // Label selector validation + _, err := labels.Parse(p.LabelSelector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %q", p.LabelSelector) + } + + logger := log.Ctx(ctx) + logger.Info().Msgf("Label selector is: %q", p.LabelSelector) + + var client *clientWrapper + switch { + case os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "": + logger.Info().Str("endpoint", p.Endpoint).Msg("Creating in-cluster Provider client") + client, err = newInClusterClient(p.Endpoint) + case os.Getenv("KUBECONFIG") != "": + logger.Info().Msgf("Creating cluster-external Provider client from KUBECONFIG %s", os.Getenv("KUBECONFIG")) + client, err = newExternalClusterClientFromFile(os.Getenv("KUBECONFIG")) + default: + logger.Info().Str("endpoint", p.Endpoint).Msg("Creating cluster-external Provider client") + client, err = newExternalClusterClient(p.Endpoint, p.CertAuthFilePath, p.Token) + } + + if err != nil { + return nil, err + } + + client.labelSelector = p.LabelSelector + client.experimentalChannel = p.ExperimentalChannel + + return client, nil +} + // TODO Handle errors and update resources statuses (gatewayClass, gateway). func (p *Provider) loadConfigurationFromGateways(ctx context.Context) *dynamic.Configuration { conf := &dynamic.Configuration{ @@ -1227,12 +1227,12 @@ func getCertificateBlocks(secret *corev1.Secret, namespace, secretName string) ( return cert, key, nil } -func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan interface{}) chan interface{} { +func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan any) chan any { if throttleDuration == 0 { return nil } // Create a buffered channel to hold the pending event (if we're delaying processing the event due to throttling) - eventsChanBuffered := make(chan interface{}, 1) + eventsChanBuffered := make(chan any, 1) // Run a goroutine that reads events from eventChan and does a non-blocking write to pendingEvent. // This guarantees that writing to eventChan will never block, diff --git a/pkg/provider/kubernetes/gateway/tcproute.go b/pkg/provider/kubernetes/gateway/tcproute.go index 74a741909..04c84af5d 100644 --- a/pkg/provider/kubernetes/gateway/tcproute.go +++ b/pkg/provider/kubernetes/gateway/tcproute.go @@ -3,6 +3,7 @@ package gateway import ( "context" "fmt" + "maps" "net" "strconv" "strings" @@ -318,21 +319,15 @@ func mergeTCPConfiguration(from, to *dynamic.Configuration) { if to.TCP.Routers == nil { to.TCP.Routers = map[string]*dynamic.TCPRouter{} } - for routerName, router := range from.TCP.Routers { - to.TCP.Routers[routerName] = router - } + maps.Copy(to.TCP.Routers, from.TCP.Routers) if to.TCP.Middlewares == nil { to.TCP.Middlewares = map[string]*dynamic.TCPMiddleware{} } - for middlewareName, middleware := range from.TCP.Middlewares { - to.TCP.Middlewares[middlewareName] = middleware - } + maps.Copy(to.TCP.Middlewares, from.TCP.Middlewares) if to.TCP.Services == nil { to.TCP.Services = map[string]*dynamic.TCPService{} } - for serviceName, service := range from.TCP.Services { - to.TCP.Services[serviceName] = service - } + maps.Copy(to.TCP.Services, from.TCP.Services) } diff --git a/pkg/provider/kubernetes/ingress-nginx/annotations.go b/pkg/provider/kubernetes/ingress-nginx/annotations.go index 6536abed5..a9226729c 100644 --- a/pkg/provider/kubernetes/ingress-nginx/annotations.go +++ b/pkg/provider/kubernetes/ingress-nginx/annotations.go @@ -54,7 +54,7 @@ type ingressConfig struct { // parseIngressConfig parses the annotations from an Ingress object into an ingressConfig struct. func parseIngressConfig(ing *netv1.Ingress) (ingressConfig, error) { cfg := ingressConfig{} - cfgType := reflect.TypeOf(cfg) + cfgType := reflect.TypeFor[ingressConfig]() cfgValue := reflect.ValueOf(&cfg).Elem() for i := range cfgType.NumField() { @@ -86,8 +86,7 @@ func parseIngressConfig(ing *netv1.Ingress) (ingressConfig, error) { if field.Type.Elem().Elem().Kind() == reflect.String { // Handle slice of strings var slice []string - elements := strings.Split(val, ",") - for _, elt := range elements { + for elt := range strings.SplitSeq(val, ",") { slice = append(slice, strings.TrimSpace(elt)) } cfgValue.Field(i).Set(reflect.ValueOf(&slice)) diff --git a/pkg/provider/kubernetes/ingress-nginx/client.go b/pkg/provider/kubernetes/ingress-nginx/client.go index 93eae4a09..9851c8860 100644 --- a/pkg/provider/kubernetes/ingress-nginx/client.go +++ b/pkg/provider/kubernetes/ingress-nginx/client.go @@ -123,9 +123,9 @@ func newClient(clientSet kclientset.Interface) *clientWrapper { } // WatchAll starts namespace-specific controllers for all relevant kinds. -func (c *clientWrapper) WatchAll(ctx context.Context, namespace, namespaceSelector string) (<-chan interface{}, error) { +func (c *clientWrapper) WatchAll(ctx context.Context, namespace, namespaceSelector string) (<-chan any, error) { stopCh := ctx.Done() - eventCh := make(chan interface{}, 1) + eventCh := make(chan any, 1) eventHandler := &k8s.ResourceEventHandler{Ev: eventCh} c.ignoreIngressClasses = false diff --git a/pkg/provider/kubernetes/ingress-nginx/kubernetes.go b/pkg/provider/kubernetes/ingress-nginx/kubernetes.go index 268db6ef7..aff6f8bee 100644 --- a/pkg/provider/kubernetes/ingress-nginx/kubernetes.go +++ b/pkg/provider/kubernetes/ingress-nginx/kubernetes.go @@ -1039,8 +1039,7 @@ func basicAuthUsers(secret *corev1.Secret, authSecretType string) (dynamic.Users } // Trim lines and filter out blanks - rawLines := strings.Split(string(authFileContent), "\n") - for _, rawLine := range rawLines { + for rawLine := range strings.SplitSeq(string(authFileContent), "\n") { line := strings.TrimSpace(rawLine) if line != "" && !strings.HasPrefix(line, "#") { users = append(users, line) @@ -1101,13 +1100,13 @@ func buildPrefixRule(path string) string { return fmt.Sprintf("(Path(`%[1]s`) || PathPrefix(`%[1]s/`))", path) } -func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan interface{}) chan interface{} { +func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan any) chan any { if throttleDuration == 0 { return nil } // Create a buffered channel to hold the pending event (if we're delaying processing the event due to throttling). - eventsChanBuffered := make(chan interface{}, 1) + eventsChanBuffered := make(chan any, 1) // Run a goroutine that reads events from eventChan and does a // non-blocking write to pendingEvent. This guarantees that writing to diff --git a/pkg/provider/kubernetes/ingress/client.go b/pkg/provider/kubernetes/ingress/client.go index 00b5397da..9645409ac 100644 --- a/pkg/provider/kubernetes/ingress/client.go +++ b/pkg/provider/kubernetes/ingress/client.go @@ -36,7 +36,7 @@ const ( // WatchAll starts the watch of the Provider resources and updates the stores. // The stores can then be accessed via the Get* functions. type Client interface { - WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) + WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan any, error) GetIngresses() []*netv1.Ingress GetIngressClasses() ([]*netv1.IngressClass, error) GetService(namespace, name string) (*corev1.Service, bool, error) @@ -138,8 +138,8 @@ func newClientImpl(clientset kclientset.Interface) *clientWrapper { } // WatchAll starts namespace-specific controllers for all relevant kinds. -func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) { - eventCh := make(chan interface{}, 1) +func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan any, error) { + eventCh := make(chan any, 1) eventHandler := &k8s.ResourceEventHandler{Ev: eventCh} if len(namespaces) == 0 { diff --git a/pkg/provider/kubernetes/ingress/client_mock_test.go b/pkg/provider/kubernetes/ingress/client_mock_test.go index 28b0a3501..c331c263c 100644 --- a/pkg/provider/kubernetes/ingress/client_mock_test.go +++ b/pkg/provider/kubernetes/ingress/client_mock_test.go @@ -26,7 +26,7 @@ type clientMock struct { apiNodesError error apiIngressStatusError error - watchChan chan interface{} + watchChan chan any } func newClientMock(path string) clientMock { @@ -117,7 +117,7 @@ func (c clientMock) GetIngressClasses() ([]*netv1.IngressClass, error) { return c.ingressClasses, nil } -func (c clientMock) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) { +func (c clientMock) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan any, error) { return c.watchChan, nil } diff --git a/pkg/provider/kubernetes/ingress/kubernetes.go b/pkg/provider/kubernetes/ingress/kubernetes.go index 55d2ec6db..714aebdfb 100644 --- a/pkg/provider/kubernetes/ingress/kubernetes.go +++ b/pkg/provider/kubernetes/ingress/kubernetes.go @@ -70,62 +70,6 @@ func (p *Provider) SetRouterTransform(routerTransform k8s.RouterTransform) { p.routerTransform = routerTransform } -func (p *Provider) applyRouterTransform(ctx context.Context, rt *dynamic.Router, ingress *netv1.Ingress) { - if p.routerTransform == nil { - return - } - - err := p.routerTransform.Apply(ctx, rt, ingress) - if err != nil { - log.Ctx(ctx).Error().Err(err).Msg("Apply router transform") - } -} - -// EndpointIngress holds the endpoint information for the Kubernetes provider. -type EndpointIngress struct { - IP string `description:"IP used for Kubernetes Ingress endpoints." json:"ip,omitempty" toml:"ip,omitempty" yaml:"ip,omitempty"` - Hostname string `description:"Hostname used for Kubernetes Ingress endpoints." json:"hostname,omitempty" toml:"hostname,omitempty" yaml:"hostname,omitempty"` - PublishedService string `description:"Published Kubernetes Service to copy status from." json:"publishedService,omitempty" toml:"publishedService,omitempty" yaml:"publishedService,omitempty"` -} - -func (p *Provider) newK8sClient(ctx context.Context) (*clientWrapper, error) { - _, err := labels.Parse(p.LabelSelector) - if err != nil { - return nil, fmt.Errorf("invalid ingress label selector: %q", p.LabelSelector) - } - - logger := log.Ctx(ctx) - - logger.Info().Msgf("ingress label selector is: %q", p.LabelSelector) - - withEndpoint := "" - if p.Endpoint != "" { - withEndpoint = fmt.Sprintf(" with endpoint %v", p.Endpoint) - } - - var cl *clientWrapper - switch { - case os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "": - logger.Info().Msgf("Creating in-cluster Provider client%s", withEndpoint) - cl, err = newInClusterClient(p.Endpoint) - case os.Getenv("KUBECONFIG") != "": - logger.Info().Msgf("Creating cluster-external Provider client from KUBECONFIG %s", os.Getenv("KUBECONFIG")) - cl, err = newExternalClusterClientFromFile(os.Getenv("KUBECONFIG")) - default: - logger.Info().Msgf("Creating cluster-external Provider client%s", withEndpoint) - cl, err = newExternalClusterClient(p.Endpoint, p.CertAuthFilePath, p.Token) - } - - if err != nil { - return nil, err - } - - cl.ingressLabelSelector = p.LabelSelector - cl.disableIngressClassInformer = p.DisableIngressClassLookup || p.DisableClusterScopeResources - cl.disableClusterScopeInformer = p.DisableClusterScopeResources - return cl, nil -} - // Init the provider. func (p *Provider) Init() error { return nil @@ -213,6 +157,62 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. return nil } +func (p *Provider) applyRouterTransform(ctx context.Context, rt *dynamic.Router, ingress *netv1.Ingress) { + if p.routerTransform == nil { + return + } + + err := p.routerTransform.Apply(ctx, rt, ingress) + if err != nil { + log.Ctx(ctx).Error().Err(err).Msg("Apply router transform") + } +} + +// EndpointIngress holds the endpoint information for the Kubernetes provider. +type EndpointIngress struct { + IP string `description:"IP used for Kubernetes Ingress endpoints." json:"ip,omitempty" toml:"ip,omitempty" yaml:"ip,omitempty"` + Hostname string `description:"Hostname used for Kubernetes Ingress endpoints." json:"hostname,omitempty" toml:"hostname,omitempty" yaml:"hostname,omitempty"` + PublishedService string `description:"Published Kubernetes Service to copy status from." json:"publishedService,omitempty" toml:"publishedService,omitempty" yaml:"publishedService,omitempty"` +} + +func (p *Provider) newK8sClient(ctx context.Context) (*clientWrapper, error) { + _, err := labels.Parse(p.LabelSelector) + if err != nil { + return nil, fmt.Errorf("invalid ingress label selector: %q", p.LabelSelector) + } + + logger := log.Ctx(ctx) + + logger.Info().Msgf("ingress label selector is: %q", p.LabelSelector) + + withEndpoint := "" + if p.Endpoint != "" { + withEndpoint = fmt.Sprintf(" with endpoint %v", p.Endpoint) + } + + var cl *clientWrapper + switch { + case os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "": + logger.Info().Msgf("Creating in-cluster Provider client%s", withEndpoint) + cl, err = newInClusterClient(p.Endpoint) + case os.Getenv("KUBECONFIG") != "": + logger.Info().Msgf("Creating cluster-external Provider client from KUBECONFIG %s", os.Getenv("KUBECONFIG")) + cl, err = newExternalClusterClientFromFile(os.Getenv("KUBECONFIG")) + default: + logger.Info().Msgf("Creating cluster-external Provider client%s", withEndpoint) + cl, err = newExternalClusterClient(p.Endpoint, p.CertAuthFilePath, p.Token) + } + + if err != nil { + return nil, err + } + + cl.ingressLabelSelector = p.LabelSelector + cl.disableIngressClassInformer = p.DisableIngressClassLookup || p.DisableClusterScopeResources + cl.disableClusterScopeInformer = p.DisableClusterScopeResources + return cl, nil +} + func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Client) *dynamic.Configuration { conf := &dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ @@ -901,13 +901,13 @@ func buildStrictPrefixMatchingRule(path string) string { return fmt.Sprintf("(Path(`%[1]s`) || PathPrefix(`%[1]s/`))", path) } -func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan interface{}) chan interface{} { +func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan any) chan any { if throttleDuration == 0 { return nil } // Create a buffered channel to hold the pending event (if we're delaying processing the event due to throttling). - eventsChanBuffered := make(chan interface{}, 1) + eventsChanBuffered := make(chan any, 1) // Run a goroutine that reads events from eventChan and does a // non-blocking write to pendingEvent. This guarantees that writing to diff --git a/pkg/provider/kubernetes/k8s/event_handler.go b/pkg/provider/kubernetes/k8s/event_handler.go index 9b3babaa9..6097df1b9 100644 --- a/pkg/provider/kubernetes/k8s/event_handler.go +++ b/pkg/provider/kubernetes/k8s/event_handler.go @@ -7,38 +7,38 @@ import ( // ResourceEventHandler handles Add, Update or Delete Events for resources. type ResourceEventHandler struct { - Ev chan<- interface{} + Ev chan<- any } // OnAdd is called on Add Events. -func (reh *ResourceEventHandler) OnAdd(obj interface{}, _ bool) { +func (reh *ResourceEventHandler) OnAdd(obj any, _ bool) { eventHandlerFunc(reh.Ev, obj) } // OnUpdate is called on Update Events. // Ignores useless changes. -func (reh *ResourceEventHandler) OnUpdate(oldObj, newObj interface{}) { +func (reh *ResourceEventHandler) OnUpdate(oldObj, newObj any) { if objChanged(oldObj, newObj) { eventHandlerFunc(reh.Ev, newObj) } } // OnDelete is called on Delete Events. -func (reh *ResourceEventHandler) OnDelete(obj interface{}) { +func (reh *ResourceEventHandler) OnDelete(obj any) { eventHandlerFunc(reh.Ev, obj) } // eventHandlerFunc will pass the obj on to the events channel or drop it. // This is so passing the events along won't block in the case of high volume. // The events are only used for signaling anyway so dropping a few is ok. -func eventHandlerFunc(events chan<- interface{}, obj interface{}) { +func eventHandlerFunc(events chan<- any, obj any) { select { case events <- obj: default: } } -func objChanged(oldObj, newObj interface{}) bool { +func objChanged(oldObj, newObj any) bool { if oldObj == nil || newObj == nil { return true } diff --git a/pkg/provider/kubernetes/k8s/event_handler_test.go b/pkg/provider/kubernetes/k8s/event_handler_test.go index bcde5cc48..256ec6c1f 100644 --- a/pkg/provider/kubernetes/k8s/event_handler_test.go +++ b/pkg/provider/kubernetes/k8s/event_handler_test.go @@ -14,8 +14,8 @@ func Test_detectChanges(t *testing.T) { portB := int32(8080) tests := []struct { name string - oldObj interface{} - newObj interface{} + oldObj any + newObj any want bool }{ { diff --git a/pkg/provider/kubernetes/knative/client.go b/pkg/provider/kubernetes/knative/client.go index bfb87c332..a56b646ad 100644 --- a/pkg/provider/kubernetes/knative/client.go +++ b/pkg/provider/kubernetes/knative/client.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "os" + "slices" "time" "github.com/rs/zerolog/log" @@ -108,8 +109,8 @@ func newExternalClusterClient(endpoint, token, caFilePath string) (*clientWrappe } // WatchAll starts namespace-specific controllers for all relevant kinds. -func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) { - eventCh := make(chan interface{}, 1) +func (c *clientWrapper) WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan any, error) { + eventCh := make(chan any, 1) eventHandler := &k8s.ResourceEventHandler{Ev: eventCh} if len(namespaces) == 0 { @@ -210,12 +211,7 @@ func (c *clientWrapper) isWatchedNamespace(ns string) bool { if c.isNamespaceAll { return true } - for _, watchedNamespace := range c.watchedNamespaces { - if watchedNamespace == ns { - return true - } - } - return false + return slices.Contains(c.watchedNamespaces, ns) } // lookupNamespace returns the lookup namespace key for the given namespace. diff --git a/pkg/provider/kubernetes/knative/kubernetes.go b/pkg/provider/kubernetes/knative/kubernetes.go index ae9c636d3..a7842a6e0 100644 --- a/pkg/provider/kubernetes/knative/kubernetes.go +++ b/pkg/provider/kubernetes/knative/kubernetes.go @@ -338,9 +338,7 @@ func (p *Provider) buildRouters(ctx context.Context, ingress *knativenetworkingv } conf.Services[routerKey+"-wrr"] = &dynamic.Service{Weighted: wrr} - for k, v := range services { - conf.Services[k] = v - } + maps.Copy(conf.Services, services) } } @@ -485,27 +483,21 @@ func mergeHTTPConfigs(confs ...*dynamic.HTTPConfiguration) *dynamic.HTTPConfigur } for _, c := range confs { - for k, v := range c.Routers { - conf.Routers[k] = v - } - for k, v := range c.Middlewares { - conf.Middlewares[k] = v - } - for k, v := range c.Services { - conf.Services[k] = v - } + maps.Copy(conf.Routers, c.Routers) + maps.Copy(conf.Middlewares, c.Middlewares) + maps.Copy(conf.Services, c.Services) } return conf } -func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan interface{}) chan interface{} { +func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *safe.Pool, eventsChan <-chan any) chan any { logger := log.Ctx(ctx).With().Logger() if throttleDuration == 0 { return nil } // Create a buffered channel to hold the pending event (if we're delaying processing the event due to throttling) - eventsChanBuffered := make(chan interface{}, 1) + eventsChanBuffered := make(chan any, 1) // Run a goroutine that reads events from eventChan and does a non-blocking write to pendingEvent. // This guarantees that writing to eventChan will never block, diff --git a/pkg/provider/nomad/nomad.go b/pkg/provider/nomad/nomad.go index c9581a036..ec3b8e2d8 100644 --- a/pkg/provider/nomad/nomad.go +++ b/pkg/provider/nomad/nomad.go @@ -263,6 +263,11 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. return nil } +// Namespace returns the namespace of the Nomad provider. +func (p *Provider) Namespace() string { + return p.namespace +} + func (p *Provider) pollOrWatch(ctx context.Context) (<-chan *api.Events, error) { if p.Watch { return p.client.EventStream().Stream(ctx, @@ -571,8 +576,3 @@ func throttleEvents(ctx context.Context, throttleDuration time.Duration, pool *s return eventsChanBuffered } - -// Namespace returns the namespace of the Nomad provider. -func (p *Provider) Namespace() string { - return p.namespace -} diff --git a/pkg/proxy/fast/proxy.go b/pkg/proxy/fast/proxy.go index 76b44a1db..cf9b962b1 100644 --- a/pkg/proxy/fast/proxy.go +++ b/pkg/proxy/fast/proxy.go @@ -362,7 +362,7 @@ type fasthttpHeader interface { // See RFC 7230, section 6.1. func removeConnectionHeaders(h fasthttpHeader) { f := h.Peek(fasthttp.HeaderConnection) - for _, sf := range bytes.Split(f, []byte{','}) { + for sf := range bytes.SplitSeq(f, []byte{','}) { if sf = bytes.TrimSpace(sf); len(sf) > 0 { h.DelBytes(sf) } diff --git a/pkg/proxy/httputil/bufferpool.go b/pkg/proxy/httputil/bufferpool.go index 7fccd6bc4..2c3769c7b 100644 --- a/pkg/proxy/httputil/bufferpool.go +++ b/pkg/proxy/httputil/bufferpool.go @@ -13,7 +13,7 @@ func newBufferPool() *bufferPool { pool: sync.Pool{}, } - b.pool.New = func() interface{} { + b.pool.New = func() any { return make([]byte, bufferSize) } diff --git a/pkg/redactor/redactor.go b/pkg/redactor/redactor.go index cbe4a6c5c..c545d98d7 100644 --- a/pkg/redactor/redactor.go +++ b/pkg/redactor/redactor.go @@ -20,11 +20,11 @@ const ( // Anonymize redacts the configuration fields that do not have an export=true struct tag. // It returns the resulting marshaled configuration. -func Anonymize(baseConfig interface{}) (string, error) { +func Anonymize(baseConfig any) (string, error) { return anonymize(baseConfig, false) } -func anonymize(baseConfig interface{}, indent bool) (string, error) { +func anonymize(baseConfig any, indent bool) (string, error) { conf, err := do(baseConfig, tagExport, true, indent) if err != nil { return "", err @@ -34,17 +34,17 @@ func anonymize(baseConfig interface{}, indent bool) (string, error) { // RemoveCredentials redacts the configuration fields that have a loggable=false struct tag. // It returns the resulting marshaled configuration. -func RemoveCredentials(baseConfig interface{}) (string, error) { +func RemoveCredentials(baseConfig any) (string, error) { return removeCredentials(baseConfig, false) } -func removeCredentials(baseConfig interface{}, indent bool) (string, error) { +func removeCredentials(baseConfig any, indent bool) (string, error) { return do(baseConfig, tagLoggable, false, indent) } // do marshals the given configuration, while redacting some of the fields // respectively to the given tag. -func do(baseConfig interface{}, tag string, redactByDefault, indent bool) (string, error) { +func do(baseConfig any, tag string, redactByDefault, indent bool) (string, error) { anomConfig, err := copystructure.Copy(baseConfig) if err != nil { return "", err @@ -211,7 +211,7 @@ func isExported(f reflect.StructField) bool { return true } -func marshal(anomConfig interface{}, indent bool) ([]byte, error) { +func marshal(anomConfig any, indent bool) ([]byte, error) { if indent { return json.MarshalIndent(anomConfig, "", " ") } diff --git a/pkg/rules/parser.go b/pkg/rules/parser.go index 2555c01b9..e3adc53d6 100644 --- a/pkg/rules/parser.go +++ b/pkg/rules/parser.go @@ -2,6 +2,7 @@ package rules import ( "fmt" + "slices" "strings" "github.com/vulcand/predicate" @@ -28,7 +29,7 @@ type Tree struct { // NewParser constructs a parser for the given matchers. func NewParser(matchers []string) (predicate.Parser, error) { - parserFuncs := make(map[string]interface{}) + parserFuncs := make(map[string]any) for _, matcherName := range matchers { fn := func(value ...string) TreeBuilder { @@ -104,10 +105,8 @@ func (tree *Tree) ParseMatchers(matchers []string) []string { case and, or: return append(tree.RuleLeft.ParseMatchers(matchers), tree.RuleRight.ParseMatchers(matchers)...) default: - for _, matcher := range matchers { - if tree.Matcher == matcher { - return lower(tree.Value) - } + if slices.Contains(matchers, tree.Matcher) { + return lower(tree.Value) } return nil diff --git a/pkg/safe/routine.go b/pkg/safe/routine.go index ab6913c87..1c3abc631 100644 --- a/pkg/safe/routine.go +++ b/pkg/safe/routine.go @@ -49,7 +49,7 @@ func Go(goroutine func()) { } // GoWithRecover starts a recoverable goroutine using given customRecover() function. -func GoWithRecover(goroutine func(), customRecover func(err interface{})) { +func GoWithRecover(goroutine func(), customRecover func(err any)) { go func() { defer func() { if err := recover(); err != nil { @@ -60,7 +60,7 @@ func GoWithRecover(goroutine func(), customRecover func(err interface{})) { }() } -func defaultRecoverGoroutine(err interface{}) { +func defaultRecoverGoroutine(err any) { log.Error().Interface("error", err).Msg("Error in Go routine") log.Error().Msgf("Stack: %s", debug.Stack()) } diff --git a/pkg/safe/routine_test.go b/pkg/safe/routine_test.go index 3fa403e78..54c81bc1b 100644 --- a/pkg/safe/routine_test.go +++ b/pkg/safe/routine_test.go @@ -29,6 +29,7 @@ func TestNewPoolContext(t *testing.T) { type fakeRoutine struct { sync.Mutex + started bool startSig chan bool } diff --git a/pkg/safe/safe.go b/pkg/safe/safe.go index 8b44beb3f..822006cb8 100644 --- a/pkg/safe/safe.go +++ b/pkg/safe/safe.go @@ -6,24 +6,24 @@ import ( // Safe contains a thread-safe value. type Safe struct { - value interface{} + value any lock sync.RWMutex } // New create a new Safe instance given a value. -func New(value interface{}) *Safe { +func New(value any) *Safe { return &Safe{value: value, lock: sync.RWMutex{}} } // Get returns the value. -func (s *Safe) Get() interface{} { +func (s *Safe) Get() any { s.lock.RLock() defer s.lock.RUnlock() return s.value } // Set sets a new value. -func (s *Safe) Set(value interface{}) { +func (s *Safe) Set(value any) { s.lock.Lock() defer s.lock.Unlock() s.value = value diff --git a/pkg/server/middleware/plugins.go b/pkg/server/middleware/plugins.go index 0529ca190..109f559d4 100644 --- a/pkg/server/middleware/plugins.go +++ b/pkg/server/middleware/plugins.go @@ -13,16 +13,16 @@ const typeName = "Plugin" // PluginsBuilder the plugin's builder interface. type PluginsBuilder interface { - Build(pName string, config map[string]interface{}, middlewareName string) (plugins.Constructor, error) + Build(pName string, config map[string]any, middlewareName string) (plugins.Constructor, error) } -func findPluginConfig(rawConfig map[string]dynamic.PluginConf) (string, map[string]interface{}, error) { +func findPluginConfig(rawConfig map[string]dynamic.PluginConf) (string, map[string]any, error) { if len(rawConfig) != 1 { return "", nil, errors.New("invalid configuration: no configuration or too many plugin definition") } var pluginType string - var rawPluginConfig map[string]interface{} + var rawPluginConfig map[string]any for pType, pConfig := range rawConfig { pluginType = pType diff --git a/pkg/server/router/router.go b/pkg/server/router/router.go index a1bd011a0..fc9190e4b 100644 --- a/pkg/server/router/router.go +++ b/pkg/server/router/router.go @@ -67,12 +67,96 @@ func NewManager(conf *runtime.Configuration, } } -func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*runtime.RouterInfo { - if m.conf != nil { - return m.conf.GetRoutersByEntryPoints(ctx, entryPoints, tls) +// ParseRouterTree sets up router tree and validates router configuration. +// This function performs the following operations in order: +// +// 1. Populate ChildRefs: Uses ParentRefs to build the parent-child relationship graph +// 2. Root-first traversal: Starting from root routers (no ParentRefs), traverses the tree +// 3. Cycle detection: Detects circular dependencies and removes cyclic links +// 4. Reachability check: Marks routers unreachable from any root as disabled +// 5. Dead-end detection: Marks routers with no service and no children as disabled +// 6. Validation: Checks for configuration errors +// +// Router status is set during this process: +// - Enabled: Reachable routers with valid configuration +// - Disabled: Unreachable, dead-end, or routers with critical errors +// - Warning: Routers with non-critical errors (like cycles) +// +// The function modifies router.Status, router.ChildRefs, and adds errors to router.Err. +func (m *Manager) ParseRouterTree() { + if m.conf == nil || m.conf.Routers == nil { + return } - return make(map[string]map[string]*runtime.RouterInfo) + // Populate ChildRefs based on ParentRefs and find root routers. + var rootRouters []string + for routerName, router := range m.conf.Routers { + if len(router.ParentRefs) == 0 { + rootRouters = append(rootRouters, routerName) + continue + } + + for _, parentName := range router.ParentRefs { + if parentRouter, exists := m.conf.Routers[parentName]; exists { + // Add this router as a child of its parent + if !slices.Contains(parentRouter.ChildRefs, routerName) { + parentRouter.ChildRefs = append(parentRouter.ChildRefs, routerName) + } + } else { + router.AddError(fmt.Errorf("parent router %q does not exist", parentName), true) + } + } + + // Check for non-root router with TLS config. + if router.TLS != nil { + router.AddError(errors.New("non-root router cannot have TLS configuration"), true) + continue + } + + // Check for non-root router with Observability config. + if router.Observability != nil { + router.AddError(errors.New("non-root router cannot have Observability configuration"), true) + continue + } + + // Check for non-root router with Entrypoint config. + if len(router.EntryPoints) > 0 { + router.AddError(errors.New("non-root router cannot have Entrypoints configuration"), true) + continue + } + } + sort.Strings(rootRouters) + + // Root-first traversal with cycle detection. + visited := make(map[string]bool) + currentPath := make(map[string]bool) + var path []string + + for _, rootName := range rootRouters { + if !visited[rootName] { + m.traverse(rootName, visited, currentPath, path) + } + } + + for routerName, router := range m.conf.Routers { + // Set status for all routers based on reachability. + if !visited[routerName] { + router.AddError(errors.New("router is not reachable"), true) + continue + } + + // Detect dead-end routers (no service + no children) - AFTER cycle handling. + if router.Service == "" && len(router.ChildRefs) == 0 { + router.AddError(errors.New("router has no service and no child routers"), true) + continue + } + + // Check for router with service that is referenced as a parent. + if router.Service != "" && len(router.ChildRefs) > 0 { + router.AddError(errors.New("router has both a service and is referenced as a parent by other routers"), true) + continue + } + } } // BuildHandlers Builds handler for all entry points. @@ -132,6 +216,14 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string, t return entryPointHandlers } +func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*runtime.RouterInfo { + if m.conf != nil { + return m.conf.GetRoutersByEntryPoints(ctx, entryPoints, tls) + } + + return make(map[string]map[string]*runtime.RouterInfo) +} + func (m *Manager) buildEntryPointHandler(ctx context.Context, entryPointName string, configs map[string]*runtime.RouterInfo, config dynamic.RouterObservabilityConfig) (http.Handler, error) { muxer := httpmuxer.NewMuxer(m.parser) @@ -285,98 +377,6 @@ func (m *Manager) buildHTTPHandler(ctx context.Context, router *runtime.RouterIn return chain.Extend(*mHandler).Then(nextHandler) } -// ParseRouterTree sets up router tree and validates router configuration. -// This function performs the following operations in order: -// -// 1. Populate ChildRefs: Uses ParentRefs to build the parent-child relationship graph -// 2. Root-first traversal: Starting from root routers (no ParentRefs), traverses the tree -// 3. Cycle detection: Detects circular dependencies and removes cyclic links -// 4. Reachability check: Marks routers unreachable from any root as disabled -// 5. Dead-end detection: Marks routers with no service and no children as disabled -// 6. Validation: Checks for configuration errors -// -// Router status is set during this process: -// - Enabled: Reachable routers with valid configuration -// - Disabled: Unreachable, dead-end, or routers with critical errors -// - Warning: Routers with non-critical errors (like cycles) -// -// The function modifies router.Status, router.ChildRefs, and adds errors to router.Err. -func (m *Manager) ParseRouterTree() { - if m.conf == nil || m.conf.Routers == nil { - return - } - - // Populate ChildRefs based on ParentRefs and find root routers. - var rootRouters []string - for routerName, router := range m.conf.Routers { - if len(router.ParentRefs) == 0 { - rootRouters = append(rootRouters, routerName) - continue - } - - for _, parentName := range router.ParentRefs { - if parentRouter, exists := m.conf.Routers[parentName]; exists { - // Add this router as a child of its parent - if !slices.Contains(parentRouter.ChildRefs, routerName) { - parentRouter.ChildRefs = append(parentRouter.ChildRefs, routerName) - } - } else { - router.AddError(fmt.Errorf("parent router %q does not exist", parentName), true) - } - } - - // Check for non-root router with TLS config. - if router.TLS != nil { - router.AddError(errors.New("non-root router cannot have TLS configuration"), true) - continue - } - - // Check for non-root router with Observability config. - if router.Observability != nil { - router.AddError(errors.New("non-root router cannot have Observability configuration"), true) - continue - } - - // Check for non-root router with Entrypoint config. - if len(router.EntryPoints) > 0 { - router.AddError(errors.New("non-root router cannot have Entrypoints configuration"), true) - continue - } - } - sort.Strings(rootRouters) - - // Root-first traversal with cycle detection. - visited := make(map[string]bool) - currentPath := make(map[string]bool) - var path []string - - for _, rootName := range rootRouters { - if !visited[rootName] { - m.traverse(rootName, visited, currentPath, path) - } - } - - for routerName, router := range m.conf.Routers { - // Set status for all routers based on reachability. - if !visited[routerName] { - router.AddError(errors.New("router is not reachable"), true) - continue - } - - // Detect dead-end routers (no service + no children) - AFTER cycle handling. - if router.Service == "" && len(router.ChildRefs) == 0 { - router.AddError(errors.New("router has no service and no child routers"), true) - continue - } - - // Check for router with service that is referenced as a parent. - if router.Service != "" && len(router.ChildRefs) > 0 { - router.AddError(errors.New("router has both a service and is referenced as a parent by other routers"), true) - continue - } - } -} - // traverse performs a depth-first traversal starting from root routers, // detecting cycles and marking visited routers for reachability detection. func (m *Manager) traverse(routerName string, visited, currentPath map[string]bool, path []string) { diff --git a/pkg/server/router/router_test.go b/pkg/server/router/router_test.go index a10c597b7..eb334d183 100644 --- a/pkg/server/router/router_test.go +++ b/pkg/server/router/router_test.go @@ -865,7 +865,7 @@ func BenchmarkRouterServe(b *testing.B) { reqHost := requestdecorator.New(nil) b.ReportAllocs() - for range b.N { + for b.Loop() { reqHost.ServeHTTP(w, req, handlers["web"].ServeHTTP) } } @@ -900,7 +900,7 @@ func BenchmarkService(b *testing.B) { handler, _ := serviceManager.BuildHTTP(b.Context(), "foo-service") b.ReportAllocs() - for range b.N { + for b.Loop() { handler.ServeHTTP(w, req) } } diff --git a/pkg/server/router/tcp/manager.go b/pkg/server/router/tcp/manager.go index 788bf7cb0..c266e84d5 100644 --- a/pkg/server/router/tcp/manager.go +++ b/pkg/server/router/tcp/manager.go @@ -27,6 +27,16 @@ type middlewareBuilder interface { BuildChain(ctx context.Context, names []string) *tcp.Chain } +// Manager is a route/router manager. +type Manager struct { + serviceManager *tcpservice.Manager + middlewaresBuilder middlewareBuilder + httpHandlers map[string]http.Handler + httpsHandlers map[string]http.Handler + tlsManager *traefiktls.Manager + conf *runtime.Configuration +} + // NewManager Creates a new Manager. func NewManager(conf *runtime.Configuration, serviceManager *tcpservice.Manager, @@ -45,32 +55,6 @@ func NewManager(conf *runtime.Configuration, } } -// Manager is a route/router manager. -type Manager struct { - serviceManager *tcpservice.Manager - middlewaresBuilder middlewareBuilder - httpHandlers map[string]http.Handler - httpsHandlers map[string]http.Handler - tlsManager *traefiktls.Manager - conf *runtime.Configuration -} - -func (m *Manager) getTCPRouters(ctx context.Context, entryPoints []string) map[string]map[string]*runtime.TCPRouterInfo { - if m.conf != nil { - return m.conf.GetTCPRoutersByEntryPoints(ctx, entryPoints) - } - - return make(map[string]map[string]*runtime.TCPRouterInfo) -} - -func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*runtime.RouterInfo { - if m.conf != nil { - return m.conf.GetRoutersByEntryPoints(ctx, entryPoints, tls) - } - - return make(map[string]map[string]*runtime.RouterInfo) -} - // BuildHandlers builds the handlers for the given entrypoints. func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) map[string]*Router { entryPointsRouters := m.getTCPRouters(rootCtx, entryPoints) @@ -93,6 +77,22 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) m return entryPointHandlers } +func (m *Manager) getTCPRouters(ctx context.Context, entryPoints []string) map[string]map[string]*runtime.TCPRouterInfo { + if m.conf != nil { + return m.conf.GetTCPRoutersByEntryPoints(ctx, entryPoints) + } + + return make(map[string]map[string]*runtime.TCPRouterInfo) +} + +func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*runtime.RouterInfo { + if m.conf != nil { + return m.conf.GetRoutersByEntryPoints(ctx, entryPoints, tls) + } + + return make(map[string]map[string]*runtime.RouterInfo) +} + type nameAndConfig struct { routerName string // just so we have it as additional information when logging TLSConfig *tls.Config diff --git a/pkg/server/router/tcp/router.go b/pkg/server/router/tcp/router.go index 283f1364c..b2b4ec93f 100644 --- a/pkg/server/router/tcp/router.go +++ b/pkg/server/router/tcp/router.go @@ -216,27 +216,6 @@ func (r *Router) ServeTCP(conn tcp.WriteCloser) { conn.Close() } -// acmeTLSALPNHandler returns a special handler to solve ACME-TLS/1 challenges. -func (r *Router) acmeTLSALPNHandler() tcp.Handler { - if r.httpsTLSConfig == nil { - return &brokenTLSRouter{} - } - - return tcp.HandlerFunc(func(conn tcp.WriteCloser) { - tlsConn := tls.Server(conn, r.httpsTLSConfig) - defer tlsConn.Close() - - // This avoids stale connections when validating the ACME challenge, - // as we expect a validation request to complete in a short period of time. - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) - defer cancel() - - if err := tlsConn.HandshakeContext(ctx); err != nil { - log.Debug().Err(err).Msg("Error during ACME-TLS/1 handshake") - } - }) -} - // AddTCPRoute defines a handler for the given rule. func (r *Router) AddTCPRoute(rule string, priority int, target tcp.Handler) error { return r.muxerTCP.AddRoute(rule, "", priority, target) @@ -277,16 +256,6 @@ func (r *Router) SetHTTPForwarder(handler tcp.Handler) { r.httpForwarder = handler } -// brokenTLSRouter is associated to a Host(SNI) rule for which we know the TLS conf is broken. -// It is used to make sure any attempt to connect to that hostname is closed, -// since we cannot proceed with the intended TLS conf. -type brokenTLSRouter struct{} - -// ServeTCP instantly closes the connection. -func (t *brokenTLSRouter) ServeTCP(conn tcp.WriteCloser) { - _ = conn.Close() -} - // SetHTTPSForwarder sets the tcp handler that will forward the TLS connections to an HTTP handler. // It also sets up each TLS handler (with its TLS config) for each Host(SNI) rule we previously kept track of. // It sets up a special handler that closes the connection if a TLS config is nil. @@ -334,17 +303,48 @@ func (r *Router) EnableACMETLSPassthrough() { r.acmeTLSPassthrough = true } +// acmeTLSALPNHandler returns a special handler to solve ACME-TLS/1 challenges. +func (r *Router) acmeTLSALPNHandler() tcp.Handler { + if r.httpsTLSConfig == nil { + return &brokenTLSRouter{} + } + + return tcp.HandlerFunc(func(conn tcp.WriteCloser) { + tlsConn := tls.Server(conn, r.httpsTLSConfig) + defer tlsConn.Close() + + // This avoids stale connections when validating the ACME challenge, + // as we expect a validation request to complete in a short period of time. + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + + if err := tlsConn.HandshakeContext(ctx); err != nil { + log.Debug().Err(err).Msg("Error during ACME-TLS/1 handshake") + } + }) +} + +// brokenTLSRouter is associated to a Host(SNI) rule for which we know the TLS conf is broken. +// It is used to make sure any attempt to connect to that hostname is closed, +// since we cannot proceed with the intended TLS conf. +type brokenTLSRouter struct{} + +// ServeTCP instantly closes the connection. +func (t *brokenTLSRouter) ServeTCP(conn tcp.WriteCloser) { + _ = conn.Close() +} + // Conn is a connection proxy that handles Peeked bytes. type Conn struct { - // Peeked are the bytes that have been read from Conn for the purposes of route matching, - // but have not yet been consumed by Read calls. - // It set to nil by Read when fully consumed. - Peeked []byte - // Conn is the underlying connection. // It can be type asserted against *net.TCPConn or other types as needed. // It should not be read from directly unless Peeked is nil. tcp.WriteCloser + + // Peeked are the bytes that have been read from Conn for the purposes of route matching, + // but have not yet been consumed by Read calls. + // It set to nil by Read when fully consumed. + Peeked []byte } // Read reads bytes from the connection (using the buffer prior to actually reading). @@ -453,8 +453,9 @@ func getPeeked(br *bufio.Reader) string { // helloSniffConn is a net.Conn that reads from r, fails on Writes, // and crashes otherwise. type helloSniffConn struct { - r io.Reader net.Conn // nil; crash on any unexpected use + + r io.Reader } // Read reads from the underlying reader. diff --git a/pkg/server/router/tcp/router_test.go b/pkg/server/router/tcp/router_test.go index 768a78ea9..12bb4a378 100644 --- a/pkg/server/router/tcp/router_test.go +++ b/pkg/server/router/tcp/router_test.go @@ -32,6 +32,7 @@ type checkRouter func(addr string, timeout time.Duration) error type httpForwarder struct { net.Listener + connChan chan net.Conn errChan chan error } @@ -1112,6 +1113,11 @@ func TestPostgres(t *testing.T) { require.Equal(t, []byte("OK"), b) } +type MockConn struct { + dataRead chan []byte + dataWrite chan []byte +} + func NewMockConn() *MockConn { return &MockConn{ dataRead: make(chan []byte), @@ -1119,11 +1125,6 @@ func NewMockConn() *MockConn { } } -type MockConn struct { - dataRead chan []byte - dataWrite chan []byte -} - func (m *MockConn) Read(b []byte) (n int, err error) { temp := <-m.dataRead copy(b, temp) diff --git a/pkg/server/router/udp/router.go b/pkg/server/router/udp/router.go index 910efa499..51b7bc669 100644 --- a/pkg/server/router/udp/router.go +++ b/pkg/server/router/udp/router.go @@ -13,6 +13,12 @@ import ( "github.com/traefik/traefik/v3/pkg/udp" ) +// Manager is a route/router manager. +type Manager struct { + serviceManager *udpservice.Manager + conf *runtime.Configuration +} + // NewManager Creates a new Manager. func NewManager(conf *runtime.Configuration, serviceManager *udpservice.Manager, @@ -23,20 +29,6 @@ func NewManager(conf *runtime.Configuration, } } -// Manager is a route/router manager. -type Manager struct { - serviceManager *udpservice.Manager - conf *runtime.Configuration -} - -func (m *Manager) getUDPRouters(ctx context.Context, entryPoints []string) map[string]map[string]*runtime.UDPRouterInfo { - if m.conf != nil { - return m.conf.GetUDPRoutersByEntryPoints(ctx, entryPoints) - } - - return make(map[string]map[string]*runtime.UDPRouterInfo) -} - // BuildHandlers builds the handlers for the given entrypoints. func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) map[string]udp.Handler { entryPointsRouters := m.getUDPRouters(rootCtx, entryPoints) @@ -62,6 +54,14 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) m return entryPointHandlers } +func (m *Manager) getUDPRouters(ctx context.Context, entryPoints []string) map[string]map[string]*runtime.UDPRouterInfo { + if m.conf != nil { + return m.conf.GetUDPRoutersByEntryPoints(ctx, entryPoints) + } + + return make(map[string]map[string]*runtime.UDPRouterInfo) +} + func (m *Manager) buildEntryPointHandlers(ctx context.Context, configs map[string]*runtime.UDPRouterInfo) []udp.Handler { var rtNames []string for routerName := range configs { diff --git a/pkg/server/server_entrypoint_tcp.go b/pkg/server/server_entrypoint_tcp.go index 71f5fc2b3..16d03bb84 100644 --- a/pkg/server/server_entrypoint_tcp.go +++ b/pkg/server/server_entrypoint_tcp.go @@ -398,6 +398,7 @@ func (e *TCPEntryPoint) SwitchRouter(rt *tcprouter.Router) { // connection type that was found to satisfy WriteCloser. type writeCloserWrapper struct { net.Conn + writeCloser tcp.WriteCloser } @@ -566,23 +567,6 @@ func (c *connectionTracker) RemoveConnection(conn net.Conn) { c.connsMu.Unlock() } -// syncOpenConnectionGauge updates openConnectionsGauge value with the conns map length. -func (c *connectionTracker) syncOpenConnectionGauge() { - if c.openConnectionsGauge == nil { - return - } - - c.connsMu.RLock() - c.openConnectionsGauge.Set(float64(len(c.conns))) - c.connsMu.RUnlock() -} - -func (c *connectionTracker) isEmpty() bool { - c.connsMu.RLock() - defer c.connsMu.RUnlock() - return len(c.conns) == 0 -} - // Shutdown wait for the connection closing. func (c *connectionTracker) Shutdown(ctx context.Context) error { ticker := time.NewTicker(500 * time.Millisecond) @@ -611,6 +595,23 @@ func (c *connectionTracker) Close() { } } +// syncOpenConnectionGauge updates openConnectionsGauge value with the conns map length. +func (c *connectionTracker) syncOpenConnectionGauge() { + if c.openConnectionsGauge == nil { + return + } + + c.connsMu.RLock() + c.openConnectionsGauge.Set(float64(len(c.conns))) + c.connsMu.RUnlock() +} + +func (c *connectionTracker) isEmpty() bool { + c.connsMu.RLock() + defer c.connsMu.RUnlock() + return len(c.conns) == 0 +} + type stoppable interface { Shutdown(ctx context.Context) error Close() error @@ -758,8 +759,9 @@ func newTrackedConnection(conn tcp.WriteCloser, tracker *connectionTracker) *tra } type trackedConnection struct { - tracker *connectionTracker tcp.WriteCloser + + tracker *connectionTracker } func (t *trackedConnection) Close() error { diff --git a/pkg/server/server_entrypoint_tcp_http3.go b/pkg/server/server_entrypoint_tcp_http3.go index 59be11262..7a2b0cadf 100644 --- a/pkg/server/server_entrypoint_tcp_http3.go +++ b/pkg/server/server_entrypoint_tcp_http3.go @@ -94,14 +94,14 @@ func (e *http3server) Switch(rt *tcprouter.Router) { e.getter = rt.GetTLSGetClientInfo() } +func (e *http3server) Shutdown(_ context.Context) error { + // TODO: use e.Server.CloseGracefully() when available. + return e.Server.Close() +} + func (e *http3server) getGetConfigForClient(info *tls.ClientHelloInfo) (*tls.Config, error) { e.lock.RLock() defer e.lock.RUnlock() return e.getter(info) } - -func (e *http3server) Shutdown(_ context.Context) error { - // TODO: use e.Server.CloseGracefully() when available. - return e.Server.Close() -} diff --git a/pkg/server/server_signals.go b/pkg/server/server_signals.go index c582fce5c..be86925e7 100644 --- a/pkg/server/server_signals.go +++ b/pkg/server/server_signals.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package server diff --git a/pkg/server/server_signals_windows.go b/pkg/server/server_signals_windows.go index 8bfd91fcf..e2566f020 100644 --- a/pkg/server/server_signals_windows.go +++ b/pkg/server/server_signals_windows.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows package server diff --git a/pkg/server/service/loadbalancer/failover/failover_test.go b/pkg/server/service/loadbalancer/failover/failover_test.go index 3d357017e..8ca46e251 100644 --- a/pkg/server/service/loadbalancer/failover/failover_test.go +++ b/pkg/server/service/loadbalancer/failover/failover_test.go @@ -12,6 +12,7 @@ import ( type responseRecorder struct { *httptest.ResponseRecorder + save map[string]int sequence []string status []int diff --git a/pkg/server/service/loadbalancer/hrw/hrw.go b/pkg/server/service/loadbalancer/hrw/hrw.go index 51ca397fd..c011d3b23 100644 --- a/pkg/server/service/loadbalancer/hrw/hrw.go +++ b/pkg/server/service/loadbalancer/hrw/hrw.go @@ -17,6 +17,7 @@ var errNoAvailableServer = errors.New("no available server") type namedHandler struct { http.Handler + name string weight float64 } @@ -123,37 +124,6 @@ func (b *Balancer) RegisterStatusUpdater(fn func(up bool)) error { return nil } -func (b *Balancer) nextServer(ip string) (*namedHandler, error) { - b.handlersMu.RLock() - var healthy []*namedHandler - for _, h := range b.handlers { - if _, ok := b.status[h.name]; ok { - if _, fenced := b.fenced[h.name]; !fenced { - healthy = append(healthy, h) - } - } - } - b.handlersMu.RUnlock() - - if len(healthy) == 0 { - return nil, errNoAvailableServer - } - - var handler *namedHandler - score := 0.0 - for _, h := range healthy { - s := getNodeScore(h, ip) - if s > score { - handler = h - score = s - } - } - - log.Debug().Msgf("Service selected by HRW: %s", handler.name) - - return handler, nil -} - func (b *Balancer) ServeHTTP(w http.ResponseWriter, req *http.Request) { // give ip fetched to b.nextServer clientIP := b.strategy.GetIP(req) @@ -199,3 +169,34 @@ func (b *Balancer) Add(name string, handler http.Handler, weight *int, fenced bo } b.handlersMu.Unlock() } + +func (b *Balancer) nextServer(ip string) (*namedHandler, error) { + b.handlersMu.RLock() + var healthy []*namedHandler + for _, h := range b.handlers { + if _, ok := b.status[h.name]; ok { + if _, fenced := b.fenced[h.name]; !fenced { + healthy = append(healthy, h) + } + } + } + b.handlersMu.RUnlock() + + if len(healthy) == 0 { + return nil, errNoAvailableServer + } + + var handler *namedHandler + score := 0.0 + for _, h := range healthy { + s := getNodeScore(h, ip) + if s > score { + handler = h + score = s + } + } + + log.Debug().Msgf("Service selected by HRW: %s", handler.name) + + return handler, nil +} diff --git a/pkg/server/service/loadbalancer/hrw/hrw_test.go b/pkg/server/service/loadbalancer/hrw/hrw_test.go index a843fdb3d..68e07c24b 100644 --- a/pkg/server/service/loadbalancer/hrw/hrw_test.go +++ b/pkg/server/service/loadbalancer/hrw/hrw_test.go @@ -296,6 +296,7 @@ func Int(v int) *int { return &v } type responseRecorder struct { *httptest.ResponseRecorder + save map[string]int sequence []string status []int diff --git a/pkg/server/service/loadbalancer/leasttime/leasttime.go b/pkg/server/service/loadbalancer/leasttime/leasttime.go index 41f4f5218..fcff7f2cf 100644 --- a/pkg/server/service/loadbalancer/leasttime/leasttime.go +++ b/pkg/server/service/loadbalancer/leasttime/leasttime.go @@ -23,6 +23,7 @@ var errNoAvailableServer = errors.New("no available server") // Tracks response time (TTFB) and inflight request count for load balancing decisions. type namedHandler struct { http.Handler + name string weight float64 @@ -180,98 +181,6 @@ func (b *Balancer) RegisterStatusUpdater(fn func(up bool)) error { return nil } -// getHealthyServers returns the list of healthy, non-fenced servers. -func (b *Balancer) getHealthyServers() []*namedHandler { - b.handlersMu.RLock() - defer b.handlersMu.RUnlock() - - var healthy []*namedHandler - for _, h := range b.handlers { - if _, ok := b.status[h.name]; ok { - if _, fenced := b.fenced[h.name]; !fenced { - healthy = append(healthy, h) - } - } - } - return healthy -} - -// selectWRR selects a server from candidates using Weighted Round Robin (EDF scheduling). -// This is used for tie-breaking when multiple servers have identical scores. -func (b *Balancer) selectWRR(candidates []*namedHandler) *namedHandler { - if len(candidates) == 0 { - return nil - } - - selected := candidates[0] - minDeadline := math.MaxFloat64 - - // Find handler with earliest deadline. - for _, h := range candidates { - handlerDeadline := h.getDeadline() - if handlerDeadline < minDeadline { - minDeadline = handlerDeadline - selected = h - } - } - - // Update deadline based on when this server was selected (minDeadline), - // not the global curDeadline. This ensures proper weighted distribution. - newDeadline := minDeadline + 1/selected.weight - selected.setDeadline(newDeadline) - - // Track the maximum deadline assigned for initializing new servers. - b.curDeadlineMu.Lock() - if newDeadline > b.curDeadline { - b.curDeadline = newDeadline - } - b.curDeadlineMu.Unlock() - - return selected -} - -// Score = (avgResponseTime × (1 + inflightCount)) / weight. -func (b *Balancer) nextServer() (*namedHandler, error) { - healthy := b.getHealthyServers() - - if len(healthy) == 0 { - return nil, errNoAvailableServer - } - - if len(healthy) == 1 { - return healthy[0], nil - } - - // Calculate scores and find minimum. - minScore := math.MaxFloat64 - var candidates []*namedHandler - - for _, h := range healthy { - avgRT := h.getAvgResponseTime() - inflight := float64(h.inflightCount.Load()) - score := (avgRT * (1 + inflight)) / h.weight - - if score < minScore { - minScore = score - candidates = []*namedHandler{h} - } else if score == minScore { - candidates = append(candidates, h) - } - } - - if len(candidates) == 1 { - return candidates[0], nil - } - - // Multiple servers with same score: use WRR (EDF) tie-breaking. - selected := b.selectWRR(candidates) - if selected == nil { - return nil, errNoAvailableServer - } - - return selected, nil -} - func (b *Balancer) ServeHTTP(rw http.ResponseWriter, req *http.Request) { // Handle sticky sessions first. if b.sticky != nil { @@ -371,3 +280,95 @@ func (b *Balancer) Add(name string, handler http.Handler, weight *int, fenced bo b.sticky.AddHandler(name, handler) } } + +// getHealthyServers returns the list of healthy, non-fenced servers. +func (b *Balancer) getHealthyServers() []*namedHandler { + b.handlersMu.RLock() + defer b.handlersMu.RUnlock() + + var healthy []*namedHandler + for _, h := range b.handlers { + if _, ok := b.status[h.name]; ok { + if _, fenced := b.fenced[h.name]; !fenced { + healthy = append(healthy, h) + } + } + } + return healthy +} + +// selectWRR selects a server from candidates using Weighted Round Robin (EDF scheduling). +// This is used for tie-breaking when multiple servers have identical scores. +func (b *Balancer) selectWRR(candidates []*namedHandler) *namedHandler { + if len(candidates) == 0 { + return nil + } + + selected := candidates[0] + minDeadline := math.MaxFloat64 + + // Find handler with earliest deadline. + for _, h := range candidates { + handlerDeadline := h.getDeadline() + if handlerDeadline < minDeadline { + minDeadline = handlerDeadline + selected = h + } + } + + // Update deadline based on when this server was selected (minDeadline), + // not the global curDeadline. This ensures proper weighted distribution. + newDeadline := minDeadline + 1/selected.weight + selected.setDeadline(newDeadline) + + // Track the maximum deadline assigned for initializing new servers. + b.curDeadlineMu.Lock() + if newDeadline > b.curDeadline { + b.curDeadline = newDeadline + } + b.curDeadlineMu.Unlock() + + return selected +} + +// Score = (avgResponseTime × (1 + inflightCount)) / weight. +func (b *Balancer) nextServer() (*namedHandler, error) { + healthy := b.getHealthyServers() + + if len(healthy) == 0 { + return nil, errNoAvailableServer + } + + if len(healthy) == 1 { + return healthy[0], nil + } + + // Calculate scores and find minimum. + minScore := math.MaxFloat64 + var candidates []*namedHandler + + for _, h := range healthy { + avgRT := h.getAvgResponseTime() + inflight := float64(h.inflightCount.Load()) + score := (avgRT * (1 + inflight)) / h.weight + + if score < minScore { + minScore = score + candidates = []*namedHandler{h} + } else if score == minScore { + candidates = append(candidates, h) + } + } + + if len(candidates) == 1 { + return candidates[0], nil + } + + // Multiple servers with same score: use WRR (EDF) tie-breaking. + selected := b.selectWRR(candidates) + if selected == nil { + return nil, errNoAvailableServer + } + + return selected, nil +} diff --git a/pkg/server/service/loadbalancer/leasttime/leasttime_test.go b/pkg/server/service/loadbalancer/leasttime/leasttime_test.go index 53bb81505..d444b314f 100644 --- a/pkg/server/service/loadbalancer/leasttime/leasttime_test.go +++ b/pkg/server/service/loadbalancer/leasttime/leasttime_test.go @@ -23,6 +23,7 @@ func pointer[T any](v T) *T { return &v } // responseRecorder tracks which servers handled requests. type responseRecorder struct { *httptest.ResponseRecorder + save map[string]int } diff --git a/pkg/server/service/loadbalancer/mirror/mirror.go b/pkg/server/service/loadbalancer/mirror/mirror.go index 91cf364a3..9b4dbb804 100644 --- a/pkg/server/service/loadbalancer/mirror/mirror.go +++ b/pkg/server/service/loadbalancer/mirror/mirror.go @@ -45,38 +45,15 @@ func New(handler http.Handler, pool *safe.Pool, mirrorBody bool, maxBodySize int } } -func (m *Mirroring) inc() uint64 { - m.lock.Lock() - defer m.lock.Unlock() - m.total++ - return m.total -} - type mirrorHandler struct { http.Handler + percent int lock sync.RWMutex count uint64 } -func (m *Mirroring) getActiveMirrors() []http.Handler { - total := m.inc() - - var mirrors []http.Handler - for _, handler := range m.mirrorHandlers { - handler.lock.Lock() - if handler.count*100 < total*uint64(handler.percent) { - handler.count++ - handler.lock.Unlock() - mirrors = append(mirrors, handler) - } else { - handler.lock.Unlock() - } - } - return mirrors -} - func (m *Mirroring) ServeHTTP(rw http.ResponseWriter, req *http.Request) { mirrors := m.getActiveMirrors() if len(mirrors) == 0 { @@ -165,6 +142,30 @@ func (m *Mirroring) RegisterStatusUpdater(fn func(up bool)) error { return nil } +func (m *Mirroring) inc() uint64 { + m.lock.Lock() + defer m.lock.Unlock() + m.total++ + return m.total +} + +func (m *Mirroring) getActiveMirrors() []http.Handler { + total := m.inc() + + var mirrors []http.Handler + for _, handler := range m.mirrorHandlers { + handler.lock.Lock() + if handler.count*100 < total*uint64(handler.percent) { + handler.count++ + handler.lock.Unlock() + mirrors = append(mirrors, handler) + } else { + handler.lock.Unlock() + } + } + return mirrors +} + type blackHoleResponseWriter struct{} func (b blackHoleResponseWriter) Flush() {} diff --git a/pkg/server/service/loadbalancer/p2c/p2c.go b/pkg/server/service/loadbalancer/p2c/p2c.go index 948a7d5a1..5b51cfacb 100644 --- a/pkg/server/service/loadbalancer/p2c/p2c.go +++ b/pkg/server/service/loadbalancer/p2c/p2c.go @@ -134,50 +134,6 @@ func (b *Balancer) RegisterStatusUpdater(fn func(up bool)) error { return nil } -func (b *Balancer) nextServer() (*namedHandler, error) { - // We kept the same representation (map) as in the WRR strategy to improve maintainability. - // However, with the P2C strategy, we only need a slice of healthy servers. - b.handlersMu.RLock() - var healthy []*namedHandler - for _, h := range b.handlers { - if _, ok := b.status[h.name]; ok { - if _, fenced := b.fenced[h.name]; !fenced { - healthy = append(healthy, h) - } - } - } - b.handlersMu.RUnlock() - - if len(healthy) == 0 { - return nil, errNoAvailableServer - } - - // If there is only one healthy server, return it. - if len(healthy) == 1 { - return healthy[0], nil - } - // In order to not get the same backend twice, we make the second call to s.rand.Intn one fewer - // than the length of the slice. We then have to shift over the second index if it is equal or - // greater than the first index, wrapping round if needed. - b.randMu.Lock() - n1, n2 := b.rand.Intn(len(healthy)), b.rand.Intn(len(healthy)) - b.randMu.Unlock() - - if n2 == n1 { - n2 = (n2 + 1) % len(healthy) - } - - h1, h2 := healthy[n1], healthy[n2] - // Ensure h1 has fewer inflight requests than h2. - if h2.inflight.Load() < h1.inflight.Load() { - log.Debug().Msgf("Service selected by P2C: %s", h2.name) - return h2, nil - } - - log.Debug().Msgf("Service selected by P2C: %s", h1.name) - return h1, nil -} - func (b *Balancer) ServeHTTP(rw http.ResponseWriter, req *http.Request) { if b.sticky != nil { h, rewrite, err := b.sticky.StickyHandler(req) @@ -235,3 +191,47 @@ func (b *Balancer) AddServer(name string, handler http.Handler, server dynamic.S b.sticky.AddHandler(name, h) } } + +func (b *Balancer) nextServer() (*namedHandler, error) { + // We kept the same representation (map) as in the WRR strategy to improve maintainability. + // However, with the P2C strategy, we only need a slice of healthy servers. + b.handlersMu.RLock() + var healthy []*namedHandler + for _, h := range b.handlers { + if _, ok := b.status[h.name]; ok { + if _, fenced := b.fenced[h.name]; !fenced { + healthy = append(healthy, h) + } + } + } + b.handlersMu.RUnlock() + + if len(healthy) == 0 { + return nil, errNoAvailableServer + } + + // If there is only one healthy server, return it. + if len(healthy) == 1 { + return healthy[0], nil + } + // In order to not get the same backend twice, we make the second call to s.rand.Intn one fewer + // than the length of the slice. We then have to shift over the second index if it is equal or + // greater than the first index, wrapping round if needed. + b.randMu.Lock() + n1, n2 := b.rand.Intn(len(healthy)), b.rand.Intn(len(healthy)) + b.randMu.Unlock() + + if n2 == n1 { + n2 = (n2 + 1) % len(healthy) + } + + h1, h2 := healthy[n1], healthy[n2] + // Ensure h1 has fewer inflight requests than h2. + if h2.inflight.Load() < h1.inflight.Load() { + log.Debug().Msgf("Service selected by P2C: %s", h2.name) + return h2, nil + } + + log.Debug().Msgf("Service selected by P2C: %s", h1.name) + return h1, nil +} diff --git a/pkg/server/service/loadbalancer/p2c/p2c_test.go b/pkg/server/service/loadbalancer/p2c/p2c_test.go index bce6cc456..83fe559cd 100644 --- a/pkg/server/service/loadbalancer/p2c/p2c_test.go +++ b/pkg/server/service/loadbalancer/p2c/p2c_test.go @@ -246,6 +246,7 @@ func TestBalancerAllServersFenced(t *testing.T) { type responseRecorder struct { *httptest.ResponseRecorder + save map[string]int sequence []string status []int diff --git a/pkg/server/service/loadbalancer/wrr/wrr.go b/pkg/server/service/loadbalancer/wrr/wrr.go index 69bc2c498..719db519e 100644 --- a/pkg/server/service/loadbalancer/wrr/wrr.go +++ b/pkg/server/service/loadbalancer/wrr/wrr.go @@ -16,6 +16,7 @@ var errNoAvailableServer = errors.New("no available server") type namedHandler struct { http.Handler + name string weight float64 deadline float64 @@ -78,7 +79,7 @@ func (b *Balancer) Swap(i, j int) { } // Push implements heap.Interface for pushing an item into the heap. -func (b *Balancer) Push(x interface{}) { +func (b *Balancer) Push(x any) { h, ok := x.(*namedHandler) if !ok { return @@ -89,7 +90,7 @@ func (b *Balancer) Push(x interface{}) { // Pop implements heap.Interface for popping an item from the heap. // It panics if b.Len() < 1. -func (b *Balancer) Pop() interface{} { +func (b *Balancer) Pop() any { h := b.handlers[len(b.handlers)-1] b.handlers = b.handlers[0 : len(b.handlers)-1] return h @@ -147,36 +148,6 @@ func (b *Balancer) RegisterStatusUpdater(fn func(up bool)) error { return nil } -func (b *Balancer) nextServer() (*namedHandler, error) { - b.handlersMu.Lock() - defer b.handlersMu.Unlock() - - if len(b.handlers) == 0 || len(b.status) == 0 || len(b.fenced) == len(b.handlers) { - return nil, errNoAvailableServer - } - - var handler *namedHandler - for { - // Pick handler with closest deadline. - handler = heap.Pop(b).(*namedHandler) - - // curDeadline should be handler's deadline so that new added entry would have a fair competition environment with the old ones. - b.curDeadline = handler.deadline - handler.deadline += 1 / handler.weight - - heap.Push(b, handler) - if _, ok := b.status[handler.name]; ok { - if _, ok := b.fenced[handler.name]; !ok { - // do not select a fenced handler. - break - } - } - } - - log.Debug().Msgf("Service selected by WRR: %s", handler.name) - return handler, nil -} - func (b *Balancer) ServeHTTP(rw http.ResponseWriter, req *http.Request) { if b.sticky != nil { h, rewrite, err := b.sticky.StickyHandler(req) @@ -250,3 +221,33 @@ func (b *Balancer) Add(name string, handler http.Handler, weight *int, fenced bo b.sticky.AddHandler(name, handler) } } + +func (b *Balancer) nextServer() (*namedHandler, error) { + b.handlersMu.Lock() + defer b.handlersMu.Unlock() + + if len(b.handlers) == 0 || len(b.status) == 0 || len(b.fenced) == len(b.handlers) { + return nil, errNoAvailableServer + } + + var handler *namedHandler + for { + // Pick handler with closest deadline. + handler = heap.Pop(b).(*namedHandler) + + // curDeadline should be handler's deadline so that new added entry would have a fair competition environment with the old ones. + b.curDeadline = handler.deadline + handler.deadline += 1 / handler.weight + + heap.Push(b, handler) + if _, ok := b.status[handler.name]; ok { + if _, ok := b.fenced[handler.name]; !ok { + // do not select a fenced handler. + break + } + } + } + + log.Debug().Msgf("Service selected by WRR: %s", handler.name) + return handler, nil +} diff --git a/pkg/server/service/loadbalancer/wrr/wrr_test.go b/pkg/server/service/loadbalancer/wrr/wrr_test.go index 5260623be..7c936d47b 100644 --- a/pkg/server/service/loadbalancer/wrr/wrr_test.go +++ b/pkg/server/service/loadbalancer/wrr/wrr_test.go @@ -378,6 +378,7 @@ func TestBalancerBias(t *testing.T) { type responseRecorder struct { *httptest.ResponseRecorder + save map[string]int sequence []string status []int diff --git a/pkg/server/service/service.go b/pkg/server/service/service.go index e61820f3d..40b1ae474 100644 --- a/pkg/server/service/service.go +++ b/pkg/server/service/service.go @@ -171,6 +171,14 @@ func (m *Manager) BuildHTTP(rootCtx context.Context, serviceName string) (http.H return lb, nil } +// LaunchHealthCheck launches the health checks. +func (m *Manager) LaunchHealthCheck(ctx context.Context) { + for serviceName, hc := range m.healthCheckers { + logger := log.Ctx(ctx).With().Str(logs.ServiceName, serviceName).Logger() + go hc.Launch(logger.WithContext(ctx)) + } +} + func (m *Manager) getFailoverServiceHandler(ctx context.Context, serviceName string, config *dynamic.Failover) (http.Handler, error) { f := failover.New(config.HealthCheck) @@ -360,13 +368,6 @@ func (m *Manager) getHRWServiceHandler(ctx context.Context, serviceName string, return balancer, nil } -type serverBalancer interface { - http.Handler - healthcheck.StatusSetter - - AddServer(name string, handler http.Handler, server dynamic.Server) -} - func (m *Manager) getLoadBalancerServiceHandler(ctx context.Context, serviceName string, info *runtime.ServiceInfo) (http.Handler, error) { service := info.LoadBalancer @@ -494,12 +495,11 @@ func (m *Manager) getLoadBalancerServiceHandler(ctx context.Context, serviceName return lb, nil } -// LaunchHealthCheck launches the health checks. -func (m *Manager) LaunchHealthCheck(ctx context.Context) { - for serviceName, hc := range m.healthCheckers { - logger := log.Ctx(ctx).With().Str(logs.ServiceName, serviceName).Logger() - go hc.Launch(logger.WithContext(ctx)) - } +type serverBalancer interface { + http.Handler + healthcheck.StatusSetter + + AddServer(name string, handler http.Handler, server dynamic.Server) } func shuffle[T any](values []T, r *rand.Rand) []T { diff --git a/pkg/tcp/dialer.go b/pkg/tcp/dialer.go index da9a24569..82243d74e 100644 --- a/pkg/tcp/dialer.go +++ b/pkg/tcp/dialer.go @@ -74,6 +74,7 @@ func (d tcpDialer) DialContext(ctx context.Context, network, addr string, client type tcpTLSDialer struct { tcpDialer + tlsConfig *tls.Config } diff --git a/pkg/tcp/proxy_unix.go b/pkg/tcp/proxy_unix.go index 727074bcc..b78361416 100644 --- a/pkg/tcp/proxy_unix.go +++ b/pkg/tcp/proxy_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package tcp diff --git a/pkg/tcp/proxy_windows.go b/pkg/tcp/proxy_windows.go index 579d52063..8d9480135 100644 --- a/pkg/tcp/proxy_windows.go +++ b/pkg/tcp/proxy_windows.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows package tcp diff --git a/pkg/tcp/wrr_load_balancer.go b/pkg/tcp/wrr_load_balancer.go index c836af17d..4c080599d 100644 --- a/pkg/tcp/wrr_load_balancer.go +++ b/pkg/tcp/wrr_load_balancer.go @@ -12,6 +12,7 @@ var errNoServersInPool = errors.New("no servers in the pool") type server struct { Handler + name string weight int } diff --git a/pkg/testhelpers/metrics.go b/pkg/testhelpers/metrics.go index bc41c2c3f..2267ce98c 100644 --- a/pkg/testhelpers/metrics.go +++ b/pkg/testhelpers/metrics.go @@ -46,12 +46,12 @@ type CollectingHealthCheckMetrics struct { Gauge *CollectingGauge } -// BackendServerUpGauge is there to satisfy the healthcheck.metricsRegistry interface. -func (m *CollectingHealthCheckMetrics) BackendServerUpGauge() metrics.Gauge { - return m.Gauge -} - // NewCollectingHealthCheckMetrics creates a new CollectingHealthCheckMetrics instance. func NewCollectingHealthCheckMetrics() *CollectingHealthCheckMetrics { return &CollectingHealthCheckMetrics{&CollectingGauge{}} } + +// BackendServerUpGauge is there to satisfy the healthcheck.metricsRegistry interface. +func (m *CollectingHealthCheckMetrics) BackendServerUpGauge() metrics.Gauge { + return m.Gauge +} diff --git a/pkg/tls/certificate_store.go b/pkg/tls/certificate_store.go index 57979f45d..5321f98aa 100644 --- a/pkg/tls/certificate_store.go +++ b/pkg/tls/certificate_store.go @@ -102,7 +102,7 @@ func (c *CertificateStore) GetBestCertificate(clientHello *tls.ClientHelloInfo) matchedCerts := map[string]*CertificateData{} if c.DynamicCerts != nil && c.DynamicCerts.Get() != nil { for domains, cert := range c.DynamicCerts.Get().(map[string]*CertificateData) { - for _, certDomain := range strings.Split(domains, ",") { + for certDomain := range strings.SplitSeq(domains, ",") { if matchDomain(serverName, certDomain) { matchedCerts[certDomain] = cert } @@ -157,7 +157,7 @@ func (c *CertificateStore) GetCertificate(domains []string) *CertificateData { } var matchedDomains []string - for _, certDomain := range strings.Split(certDomains, ",") { + for certDomain := range strings.SplitSeq(certDomains, ",") { for _, checkDomain := range domains { if certDomain == checkDomain { matchedDomains = append(matchedDomains, certDomain) diff --git a/pkg/tls/tls.go b/pkg/tls/tls.go index d98fc9483..e3119e833 100644 --- a/pkg/tls/tls.go +++ b/pkg/tls/tls.go @@ -61,5 +61,6 @@ type GeneratedCert struct { // CertAndStores allows mapping a TLS certificate to a list of entry points. type CertAndStores struct { Certificate `yaml:",inline" export:"true"` - Stores []string `json:"stores,omitempty" toml:"stores,omitempty" yaml:"stores,omitempty" export:"true"` + + Stores []string `json:"stores,omitempty" toml:"stores,omitempty" yaml:"stores,omitempty" export:"true"` } diff --git a/pkg/tls/tlsmanager.go b/pkg/tls/tlsmanager.go index 54d2c4cbf..edd5987d9 100644 --- a/pkg/tls/tlsmanager.go +++ b/pkg/tls/tlsmanager.go @@ -333,6 +333,14 @@ func (m *Manager) GetServerCertificates() []*x509.Certificate { return certificates } +// GetStore gets the certificate store of a given name. +func (m *Manager) GetStore(storeName string) *CertificateStore { + m.lock.RLock() + defer m.lock.RUnlock() + + return m.getStore(storeName) +} + // getStore returns the store found for storeName, or nil otherwise. func (m *Manager) getStore(storeName string) *CertificateStore { st, ok := m.stores[storeName] @@ -342,14 +350,6 @@ func (m *Manager) getStore(storeName string) *CertificateStore { return st } -// GetStore gets the certificate store of a given name. -func (m *Manager) GetStore(storeName string) *CertificateStore { - m.lock.RLock() - defer m.lock.RUnlock() - - return m.getStore(storeName) -} - func (m *Manager) getDefaultCertificate(ctx context.Context, tlsStore Store, st *CertificateStore) (*CertificateData, error) { if tlsStore.DefaultCertificate != nil { cert, err := m.buildDefaultCertificate(tlsStore.DefaultCertificate) diff --git a/pkg/udp/conn.go b/pkg/udp/conn.go index 36778f648..5e50af39c 100644 --- a/pkg/udp/conn.go +++ b/pkg/udp/conn.go @@ -98,19 +98,6 @@ func (l *Listener) Close() error { return l.Shutdown(0) } -// close should not be called more than once. -func (l *Listener) close() error { - l.mu.Lock() - defer l.mu.Unlock() - err := l.pConn.Close() - for k, v := range l.conns { - v.close() - delete(l.conns, k) - } - close(l.acceptCh) - return err -} - // Shutdown closes the listener. // It immediately stops accepting new sessions, // and it waits for all existing sessions to terminate, @@ -125,10 +112,7 @@ func (l *Listener) Shutdown(graceTimeout time.Duration) error { l.accepting = false l.mu.Unlock() - retryInterval := closeRetryInterval - if retryInterval > graceTimeout { - retryInterval = graceTimeout - } + retryInterval := min(closeRetryInterval, graceTimeout) start := time.Now() end := start.Add(graceTimeout) for !time.Now().After(end) { @@ -144,6 +128,19 @@ func (l *Listener) Shutdown(graceTimeout time.Duration) error { return l.close() } +// close should not be called more than once. +func (l *Listener) close() error { + l.mu.Lock() + defer l.mu.Unlock() + err := l.pConn.Close() + for k, v := range l.conns { + v.close() + delete(l.conns, k) + } + close(l.acceptCh) + return err +} + // readLoop receives all packets from all remotes. // If a packet comes from a remote that is already known to us (i.e. a "session"), // we find that session, and otherwise we create a new one. @@ -224,6 +221,44 @@ type Conn struct { doneCh chan struct{} } +// Read reads up to len(p) bytes into p from the connection. +// Each call corresponds to at most one datagram. +// If p is smaller than the datagram, the extra bytes will be discarded. +func (c *Conn) Read(p []byte) (int, error) { + select { + case c.readCh <- p: + n := <-c.sizeCh + c.muActivity.Lock() + c.lastActivity = time.Now() + c.muActivity.Unlock() + return n, nil + + case <-c.doneCh: + return 0, io.EOF + } +} + +// Write writes len(p) bytes from p to the underlying connection. +// Each call sends at most one datagram. +// It is an error to send a message larger than the system's max UDP datagram size. +func (c *Conn) Write(p []byte) (n int, err error) { + c.muActivity.Lock() + c.lastActivity = time.Now() + c.muActivity.Unlock() + + return c.listener.pConn.WriteTo(p, c.rAddr) +} + +// Close releases resources related to the Conn. +func (c *Conn) Close() error { + c.close() + + c.listener.mu.Lock() + defer c.listener.mu.Unlock() + delete(c.listener.conns, c.rAddr.String()) + return nil +} + // readLoop waits for data to come from the listener's readLoop. // It then waits for a Read operation to be ready to consume said data, // that is to say it waits on readCh to receive the slice of bytes that the Read operation wants to read onto. @@ -269,46 +304,8 @@ func (c *Conn) readLoop() { } } -// Read reads up to len(p) bytes into p from the connection. -// Each call corresponds to at most one datagram. -// If p is smaller than the datagram, the extra bytes will be discarded. -func (c *Conn) Read(p []byte) (int, error) { - select { - case c.readCh <- p: - n := <-c.sizeCh - c.muActivity.Lock() - c.lastActivity = time.Now() - c.muActivity.Unlock() - return n, nil - - case <-c.doneCh: - return 0, io.EOF - } -} - -// Write writes len(p) bytes from p to the underlying connection. -// Each call sends at most one datagram. -// It is an error to send a message larger than the system's max UDP datagram size. -func (c *Conn) Write(p []byte) (n int, err error) { - c.muActivity.Lock() - c.lastActivity = time.Now() - c.muActivity.Unlock() - - return c.listener.pConn.WriteTo(p, c.rAddr) -} - func (c *Conn) close() { c.doneOnce.Do(func() { close(c.doneCh) }) } - -// Close releases resources related to the Conn. -func (c *Conn) Close() error { - c.close() - - c.listener.mu.Lock() - defer c.listener.mu.Unlock() - delete(c.listener.conns, c.rAddr.String()) - return nil -} diff --git a/pkg/udp/wrr_load_balancer.go b/pkg/udp/wrr_load_balancer.go index 19c1b0218..753acc8ce 100644 --- a/pkg/udp/wrr_load_balancer.go +++ b/pkg/udp/wrr_load_balancer.go @@ -9,6 +9,7 @@ import ( type server struct { Handler + weight int }