Merge branch 'kubernetes:main' into main

This commit is contained in:
bossm8 2024-03-09 00:00:44 +01:00 committed by GitHub
commit 6680b5059b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 338 additions and 169 deletions

View file

@ -1,4 +1,4 @@
FROM squidfunk/mkdocs-material:9.4.5 FROM squidfunk/mkdocs-material:9.4.5
COPY action.sh /action.sh COPY action.sh /action.sh

View file

@ -9,6 +9,10 @@ updates:
- "area/dependency" - "area/dependency"
- "release-note-none" - "release-note-none"
- "ok-to-test" - "ok-to-test"
groups:
all:
update-types:
- "patch"
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
directory: "/" directory: "/"
schedule: schedule:
@ -17,6 +21,11 @@ updates:
- "area/dependency" - "area/dependency"
- "release-note-none" - "release-note-none"
- "ok-to-test" - "ok-to-test"
groups:
all:
update-types:
- "minor"
- "patch"
- package-ecosystem: "docker" - package-ecosystem: "docker"
directory: "/images" directory: "/images"
schedule: schedule:
@ -25,3 +34,8 @@ updates:
- "area/dependency" - "area/dependency"
- "release-note-none" - "release-note-none"
- "ok-to-test" - "ok-to-test"
groups:
actions:
update-types:
- "minor"
- "patch"

View file

@ -78,10 +78,10 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Get go version - name: Get go version
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV
- name: Set up Go - name: Set up Go
id: go id: go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
@ -100,13 +100,13 @@ jobs:
golangversion: ${{ steps.golangversion.outputs.version }} golangversion: ${{ steps.golangversion.outputs.version }}
if: | if: |
(needs.changes.outputs.go == 'true') || (needs.changes.outputs.charts == 'true') || (needs.changes.outputs.baseimage == 'true') (needs.changes.outputs.go == 'true') || (needs.changes.outputs.charts == 'true') || (needs.changes.outputs.baseimage == 'true')
env: env:
PLATFORMS: linux/amd64 PLATFORMS: linux/amd64
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Get go version - name: Get go version
id: golangversion id: golangversion
run: | run: |
@ -124,7 +124,7 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0
with: with:
version: latest version: latest
@ -136,14 +136,14 @@ jobs:
curl -LO https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl curl -LO https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl
chmod +x ./kubectl chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl sudo mv ./kubectl /usr/local/bin/kubectl
- name: Build NGINX Base image - name: Build NGINX Base image
if: | if: |
needs.changes.outputs.baseimage == 'true' needs.changes.outputs.baseimage == 'true'
run: | run: |
export TAG=$(cat images/nginx-1.25/TAG) export TAG=$(cat images/nginx-1.25/TAG)
cd images/nginx-1.25/rootfs && docker buildx build --platform=${{ env.PLATFORMS }} --load -t registry.k8s.io/ingress-nginx/nginx-1.25:${TAG} . cd images/nginx-1.25/rootfs && docker buildx build --platform=${{ env.PLATFORMS }} --load -t registry.k8s.io/ingress-nginx/nginx-1.25:${TAG} .
- name: Build images - name: Build images
env: env:
TAG: 1.0.0-dev TAG: 1.0.0-dev
@ -200,7 +200,7 @@ jobs:
helm unittest charts/ingress-nginx -d helm unittest charts/ingress-nginx -d
- name: cache - name: cache
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with: with:
name: docker.tar.gz name: docker.tar.gz

View file

@ -2,10 +2,9 @@ name: golangci-lint
on: on:
pull_request: pull_request:
branches:
- "*"
paths: paths:
- '**/*.go' - '**/*.go'
- '.github/workflows/golangci-lint.yml'
permissions: permissions:
contents: read contents: read
@ -17,18 +16,18 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Get go version - name: Get go version
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV
- name: Set up Go - name: Set up Go
id: go id: go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with: with:
go-version: ${{ env.GOLANG_VERSION }} go-version: ${{ env.GOLANG_VERSION }}
check-latest: true check-latest: true
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0 uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
with: with:
version: v1.55.2 version: v1.56

View file

@ -69,7 +69,7 @@ jobs:
- 'images/opentelemetry/**' - 'images/opentelemetry/**'
nginx125: nginx125:
- 'images/nginx-1.25/TAG' - 'images/nginx-1.25/TAG'
#### TODO: Make the below jobs 'less dumb' and use the job name as parameter (the github.job context does not work here) #### TODO: Make the below jobs 'less dumb' and use the job name as parameter (the github.job context does not work here)
cfssl: cfssl:
needs: changes needs: changes
@ -89,7 +89,6 @@ jobs:
name: custom-error-pages name: custom-error-pages
secrets: inherit secrets: inherit
e2e-test-echo: e2e-test-echo:
needs: changes needs: changes
if: | if: |
@ -201,7 +200,7 @@ jobs:
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0
with: with:
version: latest version: latest
platforms: ${{ env.PLATFORMS }} platforms: ${{ env.PLATFORMS }}
@ -214,5 +213,3 @@ jobs:
run: | run: |
export TAG=$(cat images/nginx-1.25/TAG) export TAG=$(cat images/nginx-1.25/TAG)
cd images/nginx-1.25/rootfs && docker buildx build --platform=${{ env.PLATFORMS }} --push -t ingressnginx/nginx-1.25:${TAG} . cd images/nginx-1.25/rootfs && docker buildx build --platform=${{ env.PLATFORMS }} --push -t ingressnginx/nginx-1.25:${TAG} .

View file

@ -33,7 +33,7 @@ jobs:
args: release --snapshot --clean args: release --snapshot --clean
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser - name: Run GoReleaser
if: ${{ startsWith(github.ref, 'refs/tags/') }} if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0

View file

@ -13,7 +13,7 @@ jobs:
repository-projects: write repository-projects: write
issues: write issues: write
steps: steps:
- uses: actions/add-to-project@31b3f3ccdc584546fc445612dec3f38ff5edb41c # v0.5.0 - uses: actions/add-to-project@0609a2702eefb44781da00f8e04901d6e5cd2b92 # v0.6.0
with: with:
project-url: https://github.com/orgs/kubernetes/projects/104 project-url: https://github.com/orgs/kubernetes/projects/104
github-token: ${{ secrets.PROJECT_WRITER }} github-token: ${{ secrets.PROJECT_WRITER }}

View file

@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: cache - name: cache
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with: with:
name: docker.tar.gz name: docker.tar.gz

View file

@ -200,9 +200,7 @@ linters-settings:
- stringConcatSimplify - stringConcatSimplify
- stringsCompare - stringsCompare
- switchTrue - switchTrue
- timeCmpSimplify
- timeExprSimplify - timeExprSimplify
- todoCommentWithoutDetail
- tooManyResultsChecker - tooManyResultsChecker
- typeAssertChain - typeAssertChain
- typeDefFirst - typeDefFirst

View file

@ -1 +1 @@
1.22.0 1.22.1

View file

@ -12,7 +12,7 @@
ingress-nginx is an Ingress controller for Kubernetes using [NGINX](https://www.nginx.org/) as a reverse proxy and load ingress-nginx is an Ingress controller for Kubernetes using [NGINX](https://www.nginx.org/) as a reverse proxy and load
balancer. balancer.
[Learn more about Ingress on the main Kubernetes documentation site](https://kubernetes.io/docs/concepts/services-networking/ingress/). [Learn more about Ingress on the Kubernetes documentation site](https://kubernetes.io/docs/concepts/services-networking/ingress/).
## Get started ## Get started
@ -28,7 +28,7 @@ If you encounter issues, review the [troubleshooting docs](docs/troubleshooting.
See [the list of releases](https://github.com/kubernetes/ingress-nginx/releases) for all changes. See [the list of releases](https://github.com/kubernetes/ingress-nginx/releases) for all changes.
For detailed changes for each release, please check the [changelog-$version.md](./changelog) file for the release version. For detailed changes for each release, please check the [changelog-$version.md](./changelog) file for the release version.
For detailed changes on the `ingress-nginx` helm chart, please check the changelog folder for a specific version For detailed changes on the `ingress-nginx` helm chart, please check the changelog folder for a specific version.
[CHANGELOG-$current-version.md](./charts/ingress-nginx/changelog) file. [CHANGELOG-$current-version.md](./charts/ingress-nginx/changelog) file.
### Supported Versions table ### Supported Versions table
@ -45,17 +45,12 @@ the versions listed. Ingress-Nginx versions **may** work on older versions, but
| 🔄 | **v1.9.3** | 1.28, 1.27, 1.26, 1.25 | 3.18.4 | 1.21.6 | 4.8.* | | 🔄 | **v1.9.3** | 1.28, 1.27, 1.26, 1.25 | 3.18.4 | 1.21.6 | 4.8.* |
| 🔄 | **v1.9.1** | 1.28, 1.27, 1.26, 1.25 | 3.18.4 | 1.21.6 | 4.8.* | | 🔄 | **v1.9.1** | 1.28, 1.27, 1.26, 1.25 | 3.18.4 | 1.21.6 | 4.8.* |
| 🔄 | **v1.9.0** | 1.28, 1.27, 1.26, 1.25 | 3.18.2 | 1.21.6 | 4.8.* | | 🔄 | **v1.9.0** | 1.28, 1.27, 1.26, 1.25 | 3.18.2 | 1.21.6 | 4.8.* |
| | **v1.8.4** | 1.27, 1.26, 1.25, 1.24 | 3.18.2 | 1.21.6 | 4.7.* | | | v1.8.4 | 1.27, 1.26, 1.25, 1.24 | 3.18.2 | 1.21.6 | 4.7.* |
| | **v1.8.2** | 1.27, 1.26, 1.25, 1.24 | 3.18.2 | 1.21.6 | 4.7.* | | | v1.7.1 | 1.27, 1.26, 1.25, 1.24 | 3.17.2 | 1.21.6 | 4.6.* |
| | **v1.8.1** | 1.27, 1.26, 1.25, 1.24 | 3.18.2 | 1.21.6 | 4.7.* |
| | **v1.8.0** | 1.27, 1.26, 1.25, 1.24 | 3.18.0 | 1.21.6 | 4.7.* |
| | **v1.7.1** | 1.27, 1.26, 1.25, 1.24 | 3.17.2 | 1.21.6 | 4.6.* |
| | **v1.7.0** | 1.26, 1.25, 1.24 | 3.17.2 | 1.21.6 | 4.6.* |
| | v1.6.4 | 1.26, 1.25, 1.24, 1.23 | 3.17.0 | 1.21.6 | 4.5.* | | | v1.6.4 | 1.26, 1.25, 1.24, 1.23 | 3.17.0 | 1.21.6 | 4.5.* |
| | v1.5.1 | 1.25, 1.24, 1.23 | 3.16.2 | 1.21.6 | 4.4.* | | | v1.5.1 | 1.25, 1.24, 1.23 | 3.16.2 | 1.21.6 | 4.4.* |
| | v1.4.0 | 1.25, 1.24, 1.23, 1.22 | 3.16.2 | 1.19.10† | 4.3.0 | | | v1.4.0 | 1.25, 1.24, 1.23, 1.22 | 3.16.2 | 1.19.10† | 4.3.0 |
| | v1.3.1 | 1.24, 1.23, 1.22, 1.21, 1.20 | 3.16.2 | 1.19.10† | 4.2.5 | | | v1.3.1 | 1.24, 1.23, 1.22, 1.21, 1.20 | 3.16.2 | 1.19.10† | 4.2.5 |
| | v1.3.0 | 1.24, 1.23, 1.22, 1.21, 1.20 | 3.16.0 | 1.19.10† | 4.2.3 |
See [this article](https://kubernetes.io/blog/2021/07/26/update-with-ingress-nginx/) if you want upgrade to the stable See [this article](https://kubernetes.io/blog/2021/07/26/update-with-ingress-nginx/) if you want upgrade to the stable
Ingress API. Ingress API.

View file

@ -293,6 +293,7 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
| controller.containerSecurityContext | object | `{}` | Security context for controller containers | | controller.containerSecurityContext | object | `{}` | Security context for controller containers |
| controller.customTemplate.configMapKey | string | `""` | | | controller.customTemplate.configMapKey | string | `""` | |
| controller.customTemplate.configMapName | string | `""` | | | controller.customTemplate.configMapName | string | `""` | |
| controller.disableLeaderElection | bool | `false` | This configuration disable Nginx Controller Leader Election |
| controller.dnsConfig | object | `{}` | Optionally customize the pod dnsConfig. | | controller.dnsConfig | object | `{}` | Optionally customize the pod dnsConfig. |
| controller.dnsPolicy | string | `"ClusterFirst"` | Optionally change this to ClusterFirstWithHostNet in case you have 'hostNetwork: true'. By default, while using host network, name resolution uses the host's DNS. If you wish nginx-controller to keep resolving names inside the k8s network, use ClusterFirstWithHostNet. | | controller.dnsPolicy | string | `"ClusterFirst"` | Optionally change this to ClusterFirstWithHostNet in case you have 'hostNetwork: true'. By default, while using host network, name resolution uses the host's DNS. If you wish nginx-controller to keep resolving names inside the k8s network, use ClusterFirstWithHostNet. |
| controller.electionID | string | `""` | Election ID to use for status update, by default it uses the controller name combined with a suffix of 'leader' | | controller.electionID | string | `""` | Election ID to use for status update, by default it uses the controller name combined with a suffix of 'leader' |

View file

@ -60,6 +60,9 @@
{{- if .Values.controller.enableTopologyAwareRouting }} {{- if .Values.controller.enableTopologyAwareRouting }}
- --enable-topology-aware-routing=true - --enable-topology-aware-routing=true
{{- end }} {{- end }}
{{- if .Values.controller.disableLeaderElection }}
- --disable-leader-election=true
{{- end }}
{{- range $key, $value := .Values.controller.extraArgs }} {{- range $key, $value := .Values.controller.extraArgs }}
{{- /* Accept keys without values or with false as value */}} {{- /* Accept keys without values or with false as value */}}
{{- if eq ($value | quote | len) 2 }} {{- if eq ($value | quote | len) 2 }}

View file

@ -83,6 +83,8 @@ controller:
# -- This configuration enables Topology Aware Routing feature, used together with service annotation service.kubernetes.io/topology-mode="auto" # -- This configuration enables Topology Aware Routing feature, used together with service annotation service.kubernetes.io/topology-mode="auto"
# Defaults to false # Defaults to false
enableTopologyAwareRouting: false enableTopologyAwareRouting: false
# -- This configuration disable Nginx Controller Leader Election
disableLeaderElection: false
# -- This configuration defines if Ingress Controller should allow users to set # -- This configuration defines if Ingress Controller should allow users to set
# their own *-snippet annotations, otherwise this is forbidden / dropped # their own *-snippet annotations, otherwise this is forbidden / dropped
# when users add those annotations. # when users add those annotations.

View file

@ -47,7 +47,7 @@ func main() {
backendsAllCmd := &cobra.Command{ backendsAllCmd := &cobra.Command{
Use: "all", Use: "all",
Short: "Output the all dynamic backend information as a JSON array", Short: "Output the all dynamic backend information as a JSON array",
Run: func(cmd *cobra.Command, args []string) { Run: func(_ *cobra.Command, _ []string) {
backendsAll() backendsAll()
}, },
} }
@ -56,7 +56,7 @@ func main() {
backendsListCmd := &cobra.Command{ backendsListCmd := &cobra.Command{
Use: "list", Use: "list",
Short: "Output a newline-separated list of the backend names", Short: "Output a newline-separated list of the backend names",
Run: func(cmd *cobra.Command, args []string) { Run: func(_ *cobra.Command, _ []string) {
backendsList() backendsList()
}, },
} }
@ -66,7 +66,7 @@ func main() {
Use: "get [backend name]", Use: "get [backend name]",
Short: "Output the backend information only for the backend that has this name", Short: "Output the backend information only for the backend that has this name",
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) { Run: func(_ *cobra.Command, args []string) {
backendsGet(args[0]) backendsGet(args[0])
}, },
} }
@ -81,7 +81,7 @@ func main() {
Use: "get [hostname]", Use: "get [hostname]",
Short: "Get the dynamically-loaded certificate information for the given hostname", Short: "Get the dynamically-loaded certificate information for the given hostname",
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
certGet(args[0]) certGet(args[0])
return nil return nil
}, },
@ -93,7 +93,7 @@ func main() {
generalCmd := &cobra.Command{ generalCmd := &cobra.Command{
Use: "general", Use: "general",
Short: "Output the general dynamic lua state", Short: "Output the general dynamic lua state",
Run: func(cmd *cobra.Command, args []string) { Run: func(_ *cobra.Command, _ []string) {
general() general()
}, },
} }
@ -102,7 +102,7 @@ func main() {
confCmd := &cobra.Command{ confCmd := &cobra.Command{
Use: "conf", Use: "conf",
Short: "Dump the contents of /etc/nginx/nginx.conf", Short: "Dump the contents of /etc/nginx/nginx.conf",
Run: func(cmd *cobra.Command, args []string) { Run: func(_ *cobra.Command, _ []string) {
readNginxConf() readNginxConf()
}, },
} }

View file

@ -74,7 +74,7 @@ func main() {
handleFatalInitError(err) handleFatalInitError(err)
} }
if len(conf.DefaultService) > 0 { if conf.DefaultService != "" {
err := checkService(conf.DefaultService, kubeClient) err := checkService(conf.DefaultService, kubeClient)
if err != nil { if err != nil {
klog.Fatal(err) klog.Fatal(err)
@ -83,7 +83,7 @@ func main() {
klog.InfoS("Valid default backend", "service", conf.DefaultService) klog.InfoS("Valid default backend", "service", conf.DefaultService)
} }
if len(conf.PublishService) > 0 { if conf.PublishService != "" {
err := checkService(conf.PublishService, kubeClient) err := checkService(conf.PublishService, kubeClient)
if err != nil { if err != nil {
klog.Fatal(err) klog.Fatal(err)
@ -235,7 +235,6 @@ func createApiserverClient(apiserverHost, rootCAFile, kubeConfig string) (*kuber
retries++ retries++
return false, nil return false, nil
}) })
// err is returned in case of timeout in the exponential backoff (ErrWaitTimeout) // err is returned in case of timeout in the exponential backoff (ErrWaitTimeout)
if err != nil { if err != nil {
return nil, lastErr return nil, lastErr

View file

@ -34,7 +34,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "backends", Use: "backends",
Short: "Inspect the dynamic backend information of an ingress-nginx instance", Short: "Inspect the dynamic backend information of an ingress-nginx instance",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
backend, err := cmd.Flags().GetString("backend") backend, err := cmd.Flags().GetString("backend")
if err != nil { if err != nil {
return err return err

View file

@ -35,7 +35,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "certs", Use: "certs",
Short: "Output the certificate data stored in an ingress-nginx pod", Short: "Output the certificate data stored in an ingress-nginx pod",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
host, err := cmd.Flags().GetString("host") host, err := cmd.Flags().GetString("host")
if err != nil { if err != nil {
return err return err

View file

@ -36,7 +36,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "conf", Use: "conf",
Short: "Inspect the generated nginx.conf", Short: "Inspect the generated nginx.conf",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
host, err := cmd.Flags().GetString("host") host, err := cmd.Flags().GetString("host")
if err != nil { if err != nil {
return err return err

View file

@ -34,7 +34,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "exec", Use: "exec",
Short: "Execute a command inside an ingress-nginx pod", Short: "Execute a command inside an ingress-nginx pod",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
util.PrintError(exec(flags, *pod, *deployment, *selector, *container, args, opts)) util.PrintError(exec(flags, *pod, *deployment, *selector, *container, args, opts))
return nil return nil
}, },

View file

@ -34,7 +34,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "general", Use: "general",
Short: "Inspect the other dynamic ingress-nginx information", Short: "Inspect the other dynamic ingress-nginx information",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, _ []string) error {
util.PrintError(general(flags, *pod, *deployment, *selector, *container)) util.PrintError(general(flags, *pod, *deployment, *selector, *container))
return nil return nil
}, },

View file

@ -32,7 +32,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "info", Use: "info",
Short: "Show information about the ingress-nginx service", Short: "Show information about the ingress-nginx service",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
service, err := cmd.Flags().GetString("service") service, err := cmd.Flags().GetString("service")
if err != nil { if err != nil {
return err return err

View file

@ -36,7 +36,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
Use: "ingresses", Use: "ingresses",
Aliases: []string{"ingress", "ing"}, Aliases: []string{"ingress", "ing"},
Short: "Provide a short summary of all of the ingress definitions", Short: "Provide a short summary of all of the ingress definitions",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
host, err := cmd.Flags().GetString("host") host, err := cmd.Flags().GetString("host")
if err != nil { if err != nil {
return err return err
@ -139,14 +139,14 @@ func getIngressRows(ingresses *[]networking.Ingress) []ingressRow {
ing := &(*ingresses)[i] ing := &(*ingresses)[i]
address := "" address := ""
for _, lbIng := range ing.Status.LoadBalancer.Ingress { for _, lbIng := range ing.Status.LoadBalancer.Ingress {
if len(lbIng.IP) > 0 { if lbIng.IP != "" {
address = address + lbIng.IP + "," address = address + lbIng.IP + ","
} }
if len(lbIng.Hostname) > 0 { if lbIng.Hostname != "" {
address = address + lbIng.Hostname + "," address = address + lbIng.Hostname + ","
} }
} }
if len(address) > 0 { if address != "" {
address = address[:len(address)-1] address = address[:len(address)-1]
} }
@ -166,7 +166,7 @@ func getIngressRows(ingresses *[]networking.Ingress) []ingressRow {
} }
// Handle catch-all ingress // Handle catch-all ingress
if len(ing.Spec.Rules) == 0 && len(defaultBackendService) > 0 { if len(ing.Spec.Rules) == 0 && defaultBackendService != "" {
row := ingressRow{ row := ingressRow{
Namespace: ing.Namespace, Namespace: ing.Namespace,
IngressName: ing.Name, IngressName: ing.Name,

View file

@ -38,7 +38,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "lint", Use: "lint",
Short: "Inspect kubernetes resources for possible issues", Short: "Inspect kubernetes resources for possible issues",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, _ []string) error {
err := opts.Validate() err := opts.Validate()
if err != nil { if err != nil {
return err return err
@ -73,7 +73,7 @@ func createSubcommand(flags *genericclioptions.ConfigFlags, names []string, shor
Use: names[0], Use: names[0],
Aliases: names[1:], Aliases: names[1:],
Short: short, Short: short,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, _ []string) error {
err := opts.Validate() err := opts.Validate()
if err != nil { if err != nil {
return err return err

View file

@ -36,7 +36,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "logs", Use: "logs",
Short: "Get the kubernetes logs for an ingress-nginx pod", Short: "Get the kubernetes logs for an ingress-nginx pod",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, _ []string) error {
util.PrintError(logs(flags, *pod, *deployment, *selector, *container, o)) util.PrintError(logs(flags, *pod, *deployment, *selector, *container, o))
return nil return nil
}, },

View file

@ -32,7 +32,7 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "ssh", Use: "ssh",
Short: "ssh into a running ingress-nginx pod", Short: "ssh into a running ingress-nginx pod",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, _ []string) error {
util.PrintError(ssh(flags, *pod, *deployment, *selector, *container)) util.PrintError(ssh(flags, *pod, *deployment, *selector, *container))
return nil return nil
}, },

View file

@ -31,7 +31,7 @@ Rewriting can be controlled using the following annotations:
[Captured groups](https://www.regular-expressions.info/refcapture.html) are saved in numbered placeholders, chronologically, in the form `$1`, `$2` ... `$n`. These placeholders can be used as parameters in the `rewrite-target` annotation. [Captured groups](https://www.regular-expressions.info/refcapture.html) are saved in numbered placeholders, chronologically, in the form `$1`, `$2` ... `$n`. These placeholders can be used as parameters in the `rewrite-target` annotation.
!!! note !!! note
Please see the [FAQ](../faq.md#validation-of-path) for Validation Of __`path`__ Please see the [FAQ](../../faq.md#validation-of-path) for Validation Of __`path`__
Create an Ingress rule with a rewrite annotation: Create an Ingress rule with a rewrite annotation:

View file

@ -25,6 +25,7 @@ They are set in the container spec of the `ingress-nginx-controller` Deployment
| `--enable-metrics` | Enables the collection of NGINX metrics. (default true) | | `--enable-metrics` | Enables the collection of NGINX metrics. (default true) |
| `--enable-ssl-chain-completion` | Autocomplete SSL certificate chains with missing intermediate CA certificates. Certificates uploaded to Kubernetes must have the "Authority Information Access" X.509 v3 extension for this to succeed. (default false)| | `--enable-ssl-chain-completion` | Autocomplete SSL certificate chains with missing intermediate CA certificates. Certificates uploaded to Kubernetes must have the "Authority Information Access" X.509 v3 extension for this to succeed. (default false)|
| `--enable-ssl-passthrough` | Enable SSL Passthrough. (default false) | | `--enable-ssl-passthrough` | Enable SSL Passthrough. (default false) |
| `--disable-leader-election` | Disable Leader Election on Nginx Controller. (default false) |
| `--enable-topology-aware-routing` | Enable topology aware routing feature, needs service object annotation service.kubernetes.io/topology-mode sets to auto. (default false) | | `--enable-topology-aware-routing` | Enable topology aware routing feature, needs service object annotation service.kubernetes.io/topology-mode sets to auto. (default false) |
| `--exclude-socket-metrics` | Set of socket request metrics to exclude which won't be exported nor being calculated. The possible socket request metrics to exclude are documented in the monitoring guide e.g. 'nginx_ingress_controller_request_duration_seconds,nginx_ingress_controller_response_size'| | `--exclude-socket-metrics` | Set of socket request metrics to exclude which won't be exported nor being calculated. The possible socket request metrics to exclude are documented in the monitoring guide e.g. 'nginx_ingress_controller_request_duration_seconds,nginx_ingress_controller_response_size'|
| `--health-check-path` | URL path of the health check endpoint. Configured inside the NGINX status server. All requests received on the port defined by the healthz-port parameter are forwarded internally to this path. (default "/healthz") | | `--health-check-path` | URL path of the health check endpoint. Configured inside the NGINX status server. All requests received on the port defined by the healthz-port parameter are forwarded internally to this path. (default "/healthz") |

22
go.mod
View file

@ -14,19 +14,19 @@ require (
github.com/mitchellh/mapstructure v1.5.0 github.com/mitchellh/mapstructure v1.5.0
github.com/moul/pb v0.0.0-20220425114252-bca18df4138c github.com/moul/pb v0.0.0-20220425114252-bca18df4138c
github.com/ncabatoff/process-exporter v0.7.10 github.com/ncabatoff/process-exporter v0.7.10
github.com/onsi/ginkgo/v2 v2.15.0 github.com/onsi/ginkgo/v2 v2.16.0
github.com/opencontainers/runc v1.1.12 github.com/opencontainers/runc v1.1.12
github.com/pmezard/go-difflib v1.0.0 github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_golang v1.19.0
github.com/prometheus/client_model v0.6.0 github.com/prometheus/client_model v0.6.0
github.com/prometheus/common v0.48.0 github.com/prometheus/common v0.50.0
github.com/spf13/cobra v1.8.0 github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.9.0
github.com/yudai/gojsondiff v1.0.0 github.com/yudai/gojsondiff v1.0.0
github.com/zakjan/cert-chain-resolver v0.0.0-20221221105603-fcedb00c5b30 github.com/zakjan/cert-chain-resolver v0.0.0-20221221105603-fcedb00c5b30
golang.org/x/crypto v0.20.0 golang.org/x/crypto v0.21.0
google.golang.org/grpc v1.62.0 google.golang.org/grpc v1.62.1
google.golang.org/grpc/examples v0.0.0-20240223204917-5ccf176a08ab google.golang.org/grpc/examples v0.0.0-20240223204917-5ccf176a08ab
gopkg.in/go-playground/pool.v3 v3.1.1 gopkg.in/go-playground/pool.v3 v3.1.1
gopkg.in/mcuadros/go-syslog.v2 v2.3.0 gopkg.in/mcuadros/go-syslog.v2 v2.3.0
@ -104,17 +104,17 @@ require (
github.com/yudai/pp v2.0.1+incompatible // indirect github.com/yudai/pp v2.0.1+incompatible // indirect
go.starlark.net v0.0.0-20240123142251-f86470692795 // indirect go.starlark.net v0.0.0-20240123142251-f86470692795 // indirect
golang.org/x/mod v0.15.0 // indirect golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.6.0 // indirect golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.17.0 // indirect golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.18.0 // indirect golang.org/x/tools v0.18.0 // indirect
google.golang.org/appengine v1.6.8 // indirect google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect
google.golang.org/protobuf v1.32.0 // indirect google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/evanphx/json-patch.v5 v5.9.0 // indirect gopkg.in/evanphx/json-patch.v5 v5.9.0 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect

49
go.sum
View file

@ -247,6 +247,7 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc= github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
@ -287,8 +288,8 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= github.com/onsi/ginkgo/v2 v2.16.0 h1:7q1w9frJDzninhXxjZd+Y/x54XNjG/UlRLIYPZafsPM=
github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= github.com/onsi/ginkgo/v2 v2.16.0/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
@ -310,8 +311,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@ -322,8 +323,8 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ=
github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ=
github.com/prometheus/exporter-toolkit v0.7.0/go.mod h1:ZUBIj498ePooX9t/2xtDjeQYwvRpiPP2lh5u4iblj2g= github.com/prometheus/exporter-toolkit v0.7.0/go.mod h1:ZUBIj498ePooX9t/2xtDjeQYwvRpiPP2lh5u4iblj2g=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
@ -351,8 +352,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.1.3/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.1.3/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
@ -360,8 +361,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/urfave/cli v1.17.1-0.20160602030128-01a33823596e/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.17.1-0.20160602030128-01a33823596e/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ=
github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
@ -400,8 +401,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -471,16 +472,16 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 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-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -542,12 +543,12 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
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/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 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.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -683,8 +684,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk=
google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
google.golang.org/grpc/examples v0.0.0-20240223204917-5ccf176a08ab h1:tg8hvIl5RmFBuXlcJMuL0h4Psh1gx5Q5xEMwzBZIzWA= google.golang.org/grpc/examples v0.0.0-20240223204917-5ccf176a08ab h1:tg8hvIl5RmFBuXlcJMuL0h4Psh1gx5Q5xEMwzBZIzWA=
google.golang.org/grpc/examples v0.0.0-20240223204917-5ccf176a08ab/go.mod h1:liVNnGuZDITxuksuZ+BBvdy7FcJfeNk+efF9qgqNUmc= google.golang.org/grpc/examples v0.0.0-20240223204917-5ccf176a08ab/go.mod h1:liVNnGuZDITxuksuZ+BBvdy7FcJfeNk+efF9qgqNUmc=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
@ -699,8 +700,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View file

@ -74,7 +74,6 @@ func run() error {
return nil return nil
}) })
if err != nil { if err != nil {
return fmt.Errorf("failed to copy files: %w", err) return fmt.Errorf("failed to copy files: %w", err)
} }

View file

@ -416,7 +416,7 @@ func (a authReq) Parse(ing *networking.Ingress) (interface{}, error) {
harr := strings.Split(hstr, ",") harr := strings.Split(hstr, ",")
for _, header := range harr { for _, header := range harr {
header = strings.TrimSpace(header) header = strings.TrimSpace(header)
if len(header) > 0 { if header != "" {
if !ValidHeader(header) { if !ValidHeader(header) {
return nil, ing_errors.NewLocationDenied("invalid headers list") return nil, ing_errors.NewLocationDenied("invalid headers list")
} }
@ -505,7 +505,7 @@ func ParseStringToCacheDurations(input string) ([]string, error) {
arr := strings.Split(input, ",") arr := strings.Split(input, ",")
for _, duration := range arr { for _, duration := range arr {
duration = strings.TrimSpace(duration) duration = strings.TrimSpace(duration)
if len(duration) > 0 { if duration != "" {
if !ValidCacheDuration(duration) { if !ValidCacheDuration(duration) {
authCacheDuration = []string{DefaultCacheDuration} authCacheDuration = []string{DefaultCacheDuration}
return authCacheDuration, ing_errors.NewLocationDenied(fmt.Sprintf("invalid cache duration: %s", duration)) return authCacheDuration, ing_errors.NewLocationDenied(fmt.Sprintf("invalid cache duration: %s", duration))

View file

@ -177,8 +177,8 @@ func (c canary) Parse(ing *networking.Ingress) (interface{}, error) {
config.Cookie = "" config.Cookie = ""
} }
if !config.Enabled && (config.Weight > 0 || len(config.Header) > 0 || len(config.HeaderValue) > 0 || len(config.Cookie) > 0 || if !config.Enabled && (config.Weight > 0 || config.Header != "" || config.HeaderValue != "" || config.Cookie != "" ||
len(config.HeaderPattern) > 0) { config.HeaderPattern != "") {
return nil, errors.NewInvalidAnnotationConfiguration(canaryAnnotation, "configured but not enabled") return nil, errors.NewInvalidAnnotationConfiguration(canaryAnnotation, "configured but not enabled")
} }

View file

@ -104,7 +104,7 @@ func Test_checkAnnotation(t *testing.T) {
}, },
fields: AnnotationFields{ fields: AnnotationFields{
"otherannotation": AnnotationConfig{ "otherannotation": AnnotationConfig{
Validator: func(value string) error { return nil }, Validator: func(_ string) error { return nil },
}, },
}, },
}, },

View file

@ -53,7 +53,7 @@ func TestNginxCheck(t *testing.T) {
server := &httptest.Server{ server := &httptest.Server{
Listener: listener, Listener: listener,
Config: &http.Server{ Config: &http.Server{
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { Handler: http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "ok") fmt.Fprintf(w, "ok")
}), }),

View file

@ -100,6 +100,8 @@ type Configuration struct {
EnableSSLPassthrough bool EnableSSLPassthrough bool
DisableLeaderElection bool
EnableProfiling bool EnableProfiling bool
EnableMetrics bool EnableMetrics bool

View file

@ -170,7 +170,7 @@ func (fakeTemplate) Write(conf *ngx_config.TemplateConfig) ([]byte, error) {
func TestCheckIngress(t *testing.T) { func TestCheckIngress(t *testing.T) {
defer func() { defer func() {
err := filepath.Walk(os.TempDir(), func(path string, info os.FileInfo, err error) error { err := filepath.Walk(os.TempDir(), func(path string, info os.FileInfo, _ error) error {
if info.IsDir() && os.TempDir() != path { if info.IsDir() && os.TempDir() != path {
return filepath.SkipDir return filepath.SkipDir
} }
@ -1573,7 +1573,7 @@ func TestGetBackendServers(t *testing.T) {
}, },
}, },
}, },
Validate: func(ingresses []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) { Validate: func(_ []*ingress.Ingress, _ []*ingress.Backend, servers []*ingress.Server) {
if len(servers) != 1 { if len(servers) != 1 {
t.Errorf("servers count should be 1, got %d", len(servers)) t.Errorf("servers count should be 1, got %d", len(servers))
return return
@ -1640,7 +1640,7 @@ func TestGetBackendServers(t *testing.T) {
}, },
}, },
}, },
Validate: func(ingresses []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) { Validate: func(_ []*ingress.Ingress, _ []*ingress.Backend, servers []*ingress.Server) {
if len(servers) != 1 { if len(servers) != 1 {
t.Errorf("servers count should be 1, got %d", len(servers)) t.Errorf("servers count should be 1, got %d", len(servers))
return return
@ -1700,7 +1700,7 @@ func TestGetBackendServers(t *testing.T) {
}, },
}, },
}, },
Validate: func(ingresses []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) { Validate: func(_ []*ingress.Ingress, _ []*ingress.Backend, servers []*ingress.Server) {
if len(servers) != 1 { if len(servers) != 1 {
t.Errorf("servers count should be 1, got %d", len(servers)) t.Errorf("servers count should be 1, got %d", len(servers))
return return
@ -1799,7 +1799,7 @@ func TestGetBackendServers(t *testing.T) {
}, },
}, },
}, },
Validate: func(ingresses []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) { Validate: func(_ []*ingress.Ingress, _ []*ingress.Backend, servers []*ingress.Server) {
if len(servers) != 2 { if len(servers) != 2 {
t.Errorf("servers count should be 2, got %d", len(servers)) t.Errorf("servers count should be 2, got %d", len(servers))
return return
@ -2059,7 +2059,7 @@ func TestGetBackendServers(t *testing.T) {
}, },
}, },
}, },
Validate: func(ingresses []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) { Validate: func(_ []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) {
if len(servers) != 2 { if len(servers) != 2 {
t.Errorf("servers count should be 2, got %d", len(servers)) t.Errorf("servers count should be 2, got %d", len(servers))
return return
@ -2190,7 +2190,7 @@ func TestGetBackendServers(t *testing.T) {
}, },
}, },
}, },
Validate: func(ingresses []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) { Validate: func(ingresses []*ingress.Ingress, _ []*ingress.Backend, servers []*ingress.Server) {
if len(servers) != 2 { if len(servers) != 2 {
t.Errorf("servers count should be 2, got %d", len(servers)) t.Errorf("servers count should be 2, got %d", len(servers))
return return
@ -2298,7 +2298,7 @@ func TestGetBackendServers(t *testing.T) {
}, },
}, },
}, },
Validate: func(ingresses []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) { Validate: func(ingresses []*ingress.Ingress, _ []*ingress.Backend, servers []*ingress.Server) {
if len(servers) != 2 { if len(servers) != 2 {
t.Errorf("servers count should be 2, got %d", len(servers)) t.Errorf("servers count should be 2, got %d", len(servers))
return return
@ -2367,7 +2367,7 @@ func TestGetBackendServers(t *testing.T) {
}, },
}, },
}, },
Validate: func(ingresses []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) { Validate: func(_ []*ingress.Ingress, _ []*ingress.Backend, servers []*ingress.Server) {
if len(servers) != 2 { if len(servers) != 2 {
t.Errorf("servers count should be 1, got %d", len(servers)) t.Errorf("servers count should be 1, got %d", len(servers))
return return
@ -2437,7 +2437,7 @@ func TestGetBackendServers(t *testing.T) {
}, },
}, },
}, },
Validate: func(ingresses []*ingress.Ingress, upstreams []*ingress.Backend, servers []*ingress.Server) { Validate: func(_ []*ingress.Ingress, _ []*ingress.Backend, servers []*ingress.Server) {
if len(servers) != 2 { if len(servers) != 2 {
t.Errorf("servers count should be 2, got %d", len(servers)) t.Errorf("servers count should be 2, got %d", len(servers))
return return

View file

@ -100,7 +100,7 @@ func normalizePrefixPath(path string) string {
} }
func needsRewrite(location *ingress.Location) bool { func needsRewrite(location *ingress.Location) bool {
if len(location.Rewrite.Target) > 0 && location.Rewrite.Target != location.Path { if location.Rewrite.Target != "" && location.Rewrite.Target != location.Path {
return true return true
} }

View file

@ -197,7 +197,6 @@ func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXContro
filesToWatch = append(filesToWatch, path) filesToWatch = append(filesToWatch, path)
return nil return nil
}) })
if err != nil { if err != nil {
klog.Fatalf("Error creating file watchers: %v", err) klog.Fatalf("Error creating file watchers: %v", err)
} }
@ -271,26 +270,28 @@ func (n *NGINXController) Start() {
// TODO: For now, as the the IngressClass logics has changed, is up to the // TODO: For now, as the the IngressClass logics has changed, is up to the
// cluster admin to create different Leader Election IDs. // cluster admin to create different Leader Election IDs.
// Should revisit this in a future // Should revisit this in a future
electionID := n.cfg.ElectionID
setupLeaderElection(&leaderElectionConfig{ if !n.cfg.DisableLeaderElection {
Client: n.cfg.Client, electionID := n.cfg.ElectionID
ElectionID: electionID, setupLeaderElection(&leaderElectionConfig{
OnStartedLeading: func(stopCh chan struct{}) { Client: n.cfg.Client,
if n.syncStatus != nil { ElectionID: electionID,
go n.syncStatus.Run(stopCh) OnStartedLeading: func(stopCh chan struct{}) {
} if n.syncStatus != nil {
go n.syncStatus.Run(stopCh)
}
n.metricCollector.OnStartedLeading(electionID) n.metricCollector.OnStartedLeading(electionID)
// manually update SSL expiration metrics // manually update SSL expiration metrics
// (to not wait for a reload) // (to not wait for a reload)
n.metricCollector.SetSSLExpireTime(n.runningConfig.Servers) n.metricCollector.SetSSLExpireTime(n.runningConfig.Servers)
n.metricCollector.SetSSLInfo(n.runningConfig.Servers) n.metricCollector.SetSSLInfo(n.runningConfig.Servers)
}, },
OnStoppedLeading: func() { OnStoppedLeading: func() {
n.metricCollector.OnStoppedLeading(electionID) n.metricCollector.OnStoppedLeading(electionID)
}, },
}) })
}
cmd := n.command.ExecCommand() cmd := n.command.ExecCommand()

View file

@ -391,7 +391,7 @@ func TestCleanTempNginxCfg(t *testing.T) {
var files []string var files []string
err = filepath.Walk(os.TempDir(), func(path string, info os.FileInfo, err error) error { err = filepath.Walk(os.TempDir(), func(path string, info os.FileInfo, _ error) error {
if info.IsDir() && os.TempDir() != path { if info.IsDir() && os.TempDir() != path {
return filepath.SkipDir return filepath.SkipDir
} }

View file

@ -59,7 +59,7 @@ func setupLeaderElection(config *leaderElectionConfig) {
var stopCh chan struct{} var stopCh chan struct{}
callbacks := leaderelection.LeaderCallbacks{ callbacks := leaderelection.LeaderCallbacks{
OnStartedLeading: func(ctx context.Context) { OnStartedLeading: func(_ context.Context) {
klog.V(2).InfoS("I am the new leader") klog.V(2).InfoS("I am the new leader")
stopCh = make(chan struct{}) stopCh = make(chan struct{})

View file

@ -292,7 +292,7 @@ func New(
// the memory consumption of nginx-ingress-controller explode. // the memory consumption of nginx-ingress-controller explode.
// In order to avoid that we filter out labels OWNER=TILLER. // In order to avoid that we filter out labels OWNER=TILLER.
labelsTweakListOptionsFunc := func(options *metav1.ListOptions) { labelsTweakListOptionsFunc := func(options *metav1.ListOptions) {
if len(options.LabelSelector) > 0 { if options.LabelSelector != "" {
options.LabelSelector += ",OWNER!=TILLER" options.LabelSelector += ",OWNER!=TILLER"
} else { } else {
options.LabelSelector = "OWNER!=TILLER" options.LabelSelector = "OWNER!=TILLER"

View file

@ -497,7 +497,7 @@ func buildResolvers(res, disableIpv6 interface{}) string {
} }
func needsRewrite(location *ingress.Location) bool { func needsRewrite(location *ingress.Location) bool {
if len(location.Rewrite.Target) > 0 && location.Rewrite.Target != location.Path { if location.Rewrite.Target != "" && location.Rewrite.Target != location.Path {
return true return true
} }
return false return false
@ -771,10 +771,10 @@ func buildProxyPass(_ string, b, loc interface{}) string {
return defProxyPass return defProxyPass
} }
if len(location.Rewrite.Target) > 0 { if location.Rewrite.Target != "" {
var xForwardedPrefix string var xForwardedPrefix string
if len(location.XForwardedPrefix) > 0 { if location.XForwardedPrefix != "" {
xForwardedPrefix = fmt.Sprintf("%s X-Forwarded-Prefix %q;\n", proxySetHeader(location), location.XForwardedPrefix) xForwardedPrefix = fmt.Sprintf("%s X-Forwarded-Prefix %q;\n", proxySetHeader(location), location.XForwardedPrefix)
} }
@ -1738,7 +1738,7 @@ func buildCorsOriginRegex(corsOrigins []string) string {
originsRegex := "if ($http_origin ~* (" originsRegex := "if ($http_origin ~* ("
for i, origin := range corsOrigins { for i, origin := range corsOrigins {
originTrimmed := strings.TrimSpace(origin) originTrimmed := strings.TrimSpace(origin)
if len(originTrimmed) > 0 { if originTrimmed != "" {
builtOrigin := buildOriginRegex(originTrimmed) builtOrigin := buildOriginRegex(originTrimmed)
originsRegex += builtOrigin originsRegex += builtOrigin
if i != len(corsOrigins)-1 { if i != len(corsOrigins)-1 {

View file

@ -59,7 +59,7 @@ func TestAdmissionCounters(t *testing.T) {
}{ }{
{ {
name: "should return 0 as values on a fresh initiated collector", name: "should return 0 as values on a fresh initiated collector",
test: func(am *AdmissionCollector) { test: func(_ *AdmissionCollector) {
}, },
want: metadataFirst + ` want: metadataFirst + `
nginx_ingress_controller_admission_config_size{controller_class="nginx",controller_namespace="default",controller_pod="pod"} 0 nginx_ingress_controller_admission_config_size{controller_class="nginx",controller_namespace="default",controller_pod="pod"} 0

View file

@ -42,7 +42,7 @@ func TestControllerCounters(t *testing.T) {
}{ }{
{ {
name: "should return not increment in metrics if no operations are invoked", name: "should return not increment in metrics if no operations are invoked",
test: func(cm *Controller) { test: func(_ *Controller) {
}, },
want: metadata + ` want: metadata + `
nginx_ingress_controller_config_last_reload_successful{controller_class="nginx",controller_namespace="default",controller_pod="pod"} 0 nginx_ingress_controller_config_last_reload_successful{controller_class="nginx",controller_namespace="default",controller_pod="pod"} 0

View file

@ -329,7 +329,7 @@ func (sc *SocketCollector) handleMessage(msg []byte) {
continue continue
} }
if sc.reportStatusClasses && len(stats.Status) > 0 { if sc.reportStatusClasses && stats.Status != "" {
stats.Status = fmt.Sprintf("%cxx", stats.Status[0]) stats.Status = fmt.Sprintf("%cxx", stats.Status[0])
} }

View file

@ -30,8 +30,7 @@ import (
func TestNewUDPLogListener(t *testing.T) { func TestNewUDPLogListener(t *testing.T) {
var count uint64 var count uint64
//nolint:unparam // Unused `message` param is required by the handleMessages function fn := func(message []byte) { //nolint:unparam,revive // Unused `message` param is required by the handleMessages function
fn := func(message []byte) {
atomic.AddUint64(&count, 1) atomic.AddUint64(&count, 1)
} }

View file

@ -109,7 +109,7 @@ func removeUnusedWhitespace(s string) string {
for _, l := range lines { for _, l := range lines {
trimmedLine = strings.TrimSpace(l) trimmedLine = strings.TrimSpace(l)
if len(trimmedLine) > 0 { if trimmedLine != "" {
trimmedLines = append(trimmedLines, trimmedLine) trimmedLines = append(trimmedLines, trimmedLine)
} }
} }

View file

@ -400,7 +400,6 @@ func getFakeHostSSLCert(host string) (cert, key []byte) {
var err error var err error
priv, err = rsa.GenerateKey(rand.Reader, 2048) priv, err = rsa.GenerateKey(rand.Reader, 2048)
if err != nil { if err != nil {
klog.Fatalf("failed to generate fake private key: %v", err) klog.Fatalf("failed to generate fake private key: %v", err)
} }

View file

@ -446,7 +446,7 @@ func TestTLSKeyReloader(t *testing.T) {
} }
watcher.load() watcher.load()
s := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) s := httptest.NewUnstartedServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {}))
s.Config.TLSConfig = watcher.TLSConfig() s.Config.TLSConfig = watcher.TLSConfig()
s.Listener = tls.NewListener(s.Listener, s.Config.TLSConfig) s.Listener = tls.NewListener(s.Listener, s.Config.TLSConfig)
go s.Start() go s.Start()

View file

@ -132,7 +132,7 @@ func DownloadGeoLite2DB(attempts int, period time.Duration) error {
} }
func createURL(mirror, licenseKey, dbName string) string { func createURL(mirror, licenseKey, dbName string) string {
if len(mirror) > 0 { if mirror != "" {
return fmt.Sprintf("%s/%s.tar.gz", mirror, dbName) return fmt.Sprintf("%s/%s.tar.gz", mirror, dbName)
} }
return fmt.Sprintf(maxmindURL, licenseKey, dbName) return fmt.Sprintf(maxmindURL, licenseKey, dbName)

View file

@ -215,7 +215,6 @@ func (Release) LatestCommitLogs() {
} }
func commitsBetweenTags(newversion, oldversion string) []string { func commitsBetweenTags(newversion, oldversion string) []string {
var newTag, oldTag string var newTag, oldTag string
tags := getAllControllerTags() tags := getAllControllerTags()
newTag, oldTag = tags[0], tags[1] newTag, oldTag = tags[0], tags[1]

View file

@ -25,22 +25,19 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
"slices"
"strings" "strings"
"text/template" "text/template"
"slices"
) )
//go:embed templates/e2edocs.tpl //go:embed templates/e2edocs.tpl
var tplContent embed.FS var tplContent embed.FS
var ( var skipFiles = []string{
skipFiles = []string{ "test/e2e/framework/framework.go",
"test/e2e/framework/framework.go", "test/e2e/e2e.go",
"test/e2e/e2e.go", "test/e2e/e2e_test.go",
"test/e2e/e2e_test.go", }
}
)
const ( const (
testDir = "test/e2e" testDir = "test/e2e"
@ -48,9 +45,7 @@ const (
URL = "https://github.com/kubernetes/ingress-nginx/tree/main/" URL = "https://github.com/kubernetes/ingress-nginx/tree/main/"
) )
var ( var betweenquotes = regexp.MustCompile(`("|\')(?P<TestDescription>.*)("|\')`)
betweenquotes = regexp.MustCompile(`("|\')(?P<TestDescription>.*)("|\')`)
)
type E2ETemplate struct { type E2ETemplate struct {
URL string URL string
@ -102,7 +97,7 @@ func (t *E2ETemplate) walkE2eDir(path string, d fs.DirEntry, errAggregated error
fileScanner.Split(bufio.ScanLines) fileScanner.Split(bufio.ScanLines)
tests := make([]string, 0) tests := make([]string, 0)
var lineN = 0 lineN := 0
for fileScanner.Scan() { for fileScanner.Scan() {
lineN = lineN + 1 lineN = lineN + 1
if !containsGinkgoTest(fileScanner.Text()) { if !containsGinkgoTest(fileScanner.Text()) {
@ -136,5 +131,4 @@ func GenerateE2EDocs() (string, error) {
return "", err return "", err
} }
return tplBuff.String(), nil return tplBuff.String(), nil
} }

View file

@ -146,6 +146,9 @@ Requires the update-status parameter.`)
enableSSLPassthrough = flags.Bool("enable-ssl-passthrough", false, enableSSLPassthrough = flags.Bool("enable-ssl-passthrough", false,
`Enable SSL Passthrough.`) `Enable SSL Passthrough.`)
disableLeaderElection = flags.Bool("disable-leader-election", false,
`Disable Leader Election on NGINX Controller.`)
disableServiceExternalName = flags.Bool("disable-svc-external-name", false, disableServiceExternalName = flags.Bool("disable-svc-external-name", false,
`Disable support for Services of type ExternalName.`) `Disable support for Services of type ExternalName.`)
@ -333,6 +336,7 @@ https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-g
MonitorMaxBatchSize: *monitorMaxBatchSize, MonitorMaxBatchSize: *monitorMaxBatchSize,
DisableServiceExternalName: *disableServiceExternalName, DisableServiceExternalName: *disableServiceExternalName,
EnableSSLPassthrough: *enableSSLPassthrough, EnableSSLPassthrough: *enableSSLPassthrough,
DisableLeaderElection: *disableLeaderElection,
ResyncPeriod: *resyncPeriod, ResyncPeriod: *resyncPeriod,
DefaultService: *defaultSvc, DefaultService: *defaultSvc,
Namespace: *watchNamespace, Namespace: *watchNamespace,

View file

@ -109,3 +109,37 @@ func TestMaxmindRetryDownload(t *testing.T) {
t.Fatalf("Expected an error parsing flags but none returned") t.Fatalf("Expected an error parsing flags but none returned")
} }
} }
func TestDisableLeaderElectionFlag(t *testing.T) {
ResetForTesting(func() { t.Fatal("Parsing failed") })
oldArgs := os.Args
defer func() { os.Args = oldArgs }()
os.Args = []string{"cmd", "--disable-leader-election", "--http-port", "80", "--https-port", "443"}
_, conf, err := ParseFlags()
if err != nil {
t.Fatalf("Unexpected error parsing default flags: %v", err)
}
if !conf.DisableLeaderElection {
t.Fatalf("Expected --disable-leader-election and conf.DisableLeaderElection as true, but found: %v", conf.DisableLeaderElection)
}
}
func TestIfLeaderElectionDisabledFlagIsFalse(t *testing.T) {
ResetForTesting(func() { t.Fatal("Parsing failed") })
oldArgs := os.Args
defer func() { os.Args = oldArgs }()
os.Args = []string{"cmd", "--http-port", "80", "--https-port", "443"}
_, conf, err := ParseFlags()
if err != nil {
t.Fatalf("Unexpected error parsing default flags: %v", err)
}
if conf.DisableLeaderElection {
t.Fatalf("Expected --disable-leader-election and conf.DisableLeaderElection as false, but found: %v", conf.DisableLeaderElection)
}
}

View file

@ -0,0 +1,34 @@
# TODO: remove the need to use fullnameOverride
fullnameOverride: nginx-ingress
controller:
image:
repository: ingress-controller/controller
chroot: true
tag: 1.0.0-dev
digest:
digestChroot:
scope:
# Necessary to allow the ingress controller to get the topology information from the nodes
enabled: false
config:
worker-processes: "1"
readinessProbe:
initialDelaySeconds: 3
periodSeconds: 1
livenessProbe:
initialDelaySeconds: 3
periodSeconds: 1
service:
type: NodePort
extraArgs:
# e2e tests do not require information about ingress status
update-status: "false"
terminationGracePeriodSeconds: 1
admissionWebhooks:
enabled: false
disableLeaderElection: true
rbac:
create: true
scope: false

View file

@ -0,0 +1,93 @@
/*
Copyright 2024 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package disableleaderelection
import (
"net/http"
"strings"
"github.com/onsi/ginkgo/v2"
"k8s.io/ingress-nginx/test/e2e/framework"
)
var _ = framework.IngressNginxDescribe("[Disable Leader] Routing works when leader election was disabled", func() {
f := framework.NewDefaultFramework("disableleaderelection")
ginkgo.BeforeEach(func() {
f.NewEchoDeployment()
})
ginkgo.It("should create multiple ingress routings rules when leader election has disabled", func() {
host1 := "leader.election.disabled.com"
host2 := "leader.election.disabled2.com"
ing1 := framework.NewSingleIngress(host1, "/foo", host1, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing1)
ing2 := framework.NewSingleIngress(host2, "/ping", host2, f.Namespace, framework.EchoService, 80, nil)
f.EnsureIngress(ing2)
f.WaitForNginxServer(host1,
func(server string) bool {
return strings.Contains(server, host1) &&
strings.Contains(server, "location /foo")
})
f.WaitForNginxServer(host2,
func(server string) bool {
return strings.Contains(server, host2) &&
strings.Contains(server, "location /ping")
})
f.HTTPTestClient().
GET("/foo").
WithHeader("Host", host1).
Expect().
Status(http.StatusOK)
f.HTTPTestClient().
GET("/bar").
WithHeader("Host", host1).
Expect().
Status(http.StatusNotFound)
f.HTTPTestClient().
GET("/foo").
WithHeader("Host", host2).
Expect().
Status(http.StatusNotFound)
f.HTTPTestClient().
GET("/ping").
WithHeader("Host", host2).
Expect().
Status(http.StatusOK)
f.HTTPTestClient().
GET("/pong").
WithHeader("Host", host2).
Expect().
Status(http.StatusNotFound)
f.HTTPTestClient().
GET("/ping").
WithHeader("Host", host1).
Expect().
Status(http.StatusNotFound)
})
})

View file

@ -34,6 +34,7 @@ import (
_ "k8s.io/ingress-nginx/test/e2e/annotations/modsecurity" _ "k8s.io/ingress-nginx/test/e2e/annotations/modsecurity"
_ "k8s.io/ingress-nginx/test/e2e/dbg" _ "k8s.io/ingress-nginx/test/e2e/dbg"
_ "k8s.io/ingress-nginx/test/e2e/defaultbackend" _ "k8s.io/ingress-nginx/test/e2e/defaultbackend"
_ "k8s.io/ingress-nginx/test/e2e/disableleaderelection"
_ "k8s.io/ingress-nginx/test/e2e/endpointslices" _ "k8s.io/ingress-nginx/test/e2e/endpointslices"
_ "k8s.io/ingress-nginx/test/e2e/gracefulshutdown" _ "k8s.io/ingress-nginx/test/e2e/gracefulshutdown"
_ "k8s.io/ingress-nginx/test/e2e/ingress" _ "k8s.io/ingress-nginx/test/e2e/ingress"

View file

@ -102,7 +102,7 @@ func (f *Framework) NamespaceContent() (string, error) {
} }
eout := strings.TrimSpace(execErr.String()) eout := strings.TrimSpace(execErr.String())
if len(eout) > 0 { if eout != "" {
return "", fmt.Errorf("stderr: %v", eout) return "", fmt.Errorf("stderr: %v", eout)
} }

View file

@ -313,7 +313,7 @@ func (f *Framework) matchNginxConditions(name string, matcher func(cfg string) b
return false, nil return false, nil
} }
if klog.V(10).Enabled() && len(o) > 0 { if klog.V(10).Enabled() && o != "" {
klog.InfoS("NGINX", "configuration", o) klog.InfoS("NGINX", "configuration", o)
} }
@ -335,7 +335,7 @@ func (f *Framework) matchNginxCustomConditions(from, to string, matcher func(cfg
return false, nil return false, nil
} }
if klog.V(10).Enabled() && len(o) > 0 { if klog.V(10).Enabled() && o != "" {
klog.InfoS("NGINX", "configuration", o) klog.InfoS("NGINX", "configuration", o)
} }
@ -501,7 +501,7 @@ func (f *Framework) newHTTPTestClient(config *tls.Config, setIngressURL bool) *h
Transport: &http.Transport{ Transport: &http.Transport{
TLSClientConfig: config, TLSClientConfig: config,
}, },
CheckRedirect: func(req *http.Request, via []*http.Request) error { CheckRedirect: func(_ *http.Request, _ []*http.Request) error {
return http.ErrUseLastResponse return http.ErrUseLastResponse
}, },
}, httpexpect.NewAssertReporter()) }, httpexpect.NewAssertReporter())

View file

@ -93,7 +93,7 @@ func (h *HTTPRequest) ForceResolve(ip string, port uint16) *HTTPRequest {
return h return h
} }
newTransport := oldTransport.Clone() newTransport := oldTransport.Clone()
newTransport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) { newTransport.DialContext = func(ctx context.Context, network, _ string) (net.Conn, error) {
return dialer.DialContext(ctx, network, resolveAddr) return dialer.DialContext(ctx, network, resolveAddr)
} }
h.client.Transport = newTransport h.client.Transport = newTransport

View file

@ -133,7 +133,7 @@ var _ = framework.IngressNginxDescribe("[TCP] tcp-services", func() {
// Execute the test. Use the `external name` service to resolve a domain name. // Execute the test. Use the `external name` service to resolve a domain name.
resolver := net.Resolver{ resolver := net.Resolver{
PreferGo: true, PreferGo: true,
Dial: func(ctx context.Context, network, address string) (net.Conn, error) { Dial: func(ctx context.Context, _, _ string) (net.Conn, error) {
d := net.Dialer{} d := net.Dialer{}
return d.DialContext(ctx, "tcp", fmt.Sprintf("%v:5353", ip)) return d.DialContext(ctx, "tcp", fmt.Sprintf("%v:5353", ip))
}, },