Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crd-check.go invocation should be idempotent in case of exising CRDs #630

Open
eugenebzht opened this issue Mar 13, 2024 · 4 comments
Open
Labels
bug Something isn't working

Comments

@eugenebzht
Copy link

eugenebzht commented Mar 13, 2024

Currently multiple executions of /haproxy-ingress-controller --job-check-crd on the same cluster leads to an error as follows:

2024/03/13 13:37:19 ERROR runtime/proc.go:271 customresourcedefinitions.apiextensions.k8s.io "defaults.ingress.v1.haproxy.org" already exists

As this job also included into Helm chart and executed on every ArgoCD sync, all next sync operations failing after initial install.

Kubernetes version: 1.26.5
HAproxy version:

2024/03/13 13:43:56 maxprocs: Leaving GOMAXPROCS=4: CPU quota undefined
HAProxy Ingress Controller v1.11.0 13fc60b9.dirty
Build from: github.com/haproxytech/kubernetes-ingress
Git commit date: 2024-03-08T10:47:39Z

Full command output:

2024/03/13 13:44:49 runtime/proc.go:271  
 _   _    _    ____
| | | |  / \  |  _ \ _ __ _____  ___   _
| |_| | / _ \ | |_) | '__/ _ \ \/ / | | |
|  _  |/ ___ \|  __/| | | (_) >  <| |_| |
|_| |_/_/   \_\_|   |_|  \___/_/\_\\__, |
 _  __     _                       |___/             ___ ____
| |/ /   _| |__   ___ _ __ _ __   ___| |_ ___  ___  |_ _/ ___|
| ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __|  | | |
| . \ |_| | |_) |  __/ |  | | | |  __/ ||  __/\__ \  | | |___
|_|\_\__,_|_.__/ \___|_|  |_| |_|\___|\__\___||___/ |___\____|


2024/03/13 13:44:49 runtime/proc.go:271  
  ____ ____  ____    _   _           _       _
 / ___|  _ \|  _ \  | | | |_ __   __| | __ _| |_ ___ _ __
| |   | |_) | | | | | | | | '_ \ / _` |/ _` | __/ _ \ '__|
| |___|  _ <| |_| | | |_| | |_) | (_| | (_| | ||  __/ |
 \____|_| \_\____/   \___/| .__/ \__,_|\__,_|\__\___|_|
                          |_|


2024/03/13 13:44:49 INFO    src/main.go:85  HAProxy Ingress Controller CRD Updater v1.11.0 13fc60b9.dirty
2024/03/13 13:44:49 INFO    src/main.go:86  Build from: github.com/haproxytech/kubernetes-ingress
2024/03/13 13:44:49 INFO    src/main.go:87  Build date: 2024-03-08T10:47:39Z

2024/03/13 13:44:49 INFO    src/main.go:89  checking CRDS
2024/03/13 13:44:49 INFO    src/main.go:89  
2024/03/13 13:44:49 INFO    job/crd-check.go:50  checking CRD ingress.v1.haproxy.org_globals.yaml
2024/03/13 13:44:49 INFO    job/crd-check.go:57  CRD ingress.v1.haproxy.org_globals.yaml does not exist
2024/03/13 13:44:49 ERROR   runtime/proc.go:271  customresourcedefinitions.apiextensions.k8s.io "globals.ingress.v1.haproxy.org" already exists
@eugenebzht
Copy link
Author

eugenebzht commented Mar 13, 2024

Also this is not happens with previous version of HAProxy ingress controller with v1alpha2 CRD api version:

                                                                                                                            Autoscroll:On      FullScreen:Off     Timestamps:Off     Wrap:Off                                                                                                                              │
│ 2024/03/13 14:04:00 maxprocs: Leaving GOMAXPROCS=4: CPU quota undefined                                                                                                                                                                                                                                                    │
│ 2024/03/13 14:04:00 src/main.go:75                                                                                                                                                                                                                                                                                         │
│  _   _    _    ____                                                                                                                                                                                                                                                                                                        │
│ | | | |  / \  |  _ \ _ __ _____  ___   _                                                                                                                                                                                                                                                                                   │
│ | |_| | / _ \ | |_) | '__/ _ \ \/ / | | |                                                                                                                                                                                                                                                                                  │
│ |  _  |/ ___ \|  __/| | | (_) >  <| |_| |                                                                                                                                                                                                                                                                                  │
│ |_| |_/_/   \_\_|   |_|  \___/_/\_\\__, |                                                                                                                                                                                                                                                                                  │
│  _  __     _                       |___/             ___ ____                                                                                                                                                                                                                                                              │
│ | |/ /   _| |__   ___ _ __ _ __   ___| |_ ___  ___  |_ _/ ___|                                                                                                                                                                                                                                                             │
│ | ' / | | | '_ \ / _ \ '__| '_ \ / _ \ __/ _ \/ __|  | | |                                                                                                                                                                                                                                                                 │
│ | . \ |_| | |_) |  __/ |  | | | |  __/ ||  __/\__ \  | | |___                                                                                                                                                                                                                                                              │
│ |_|\_\__,_|_.__/ \___|_|  |_| |_|\___|\__\___||___/ |___\____|                                                                                                                                                                                                                                                             │
│                                                                                                                                                                                                                                                                                                                            │
│                                                                                                                                                                                                                                                                                                                            │
│ 2024/03/13 14:04:00 src/main.go:76                                                                                                                                                                                                                                                                                         │
│   ____ ____  ____    _   _           _       _                                                                                                                                                                                                                                                                             │
│  / ___|  _ \|  _ \  | | | |_ __   __| | __ _| |_ ___ _ __                                                                                                                                                                                                                                                                  │
│ | |   | |_) | | | | | | | | '_ \ / _` |/ _` | __/ _ \ '__|                                                                                                                                                                                                                                                                 │
│ | |___|  _ <| |_| | | |_| | |_) | (_| | (_| | ||  __/ |                                                                                                                                                                                                                                                                    │
│  \____|_| \_\____/   \___/| .__/ \__,_|\__,_|\__\___|_|                                                                                                                                                                                                                                                                    │
│                           |_|                                                                                                                                                                                                                                                                                              │
│                                                                                                                                                                                                                                                                                                                            │
│                                                                                                                                                                                                                                                                                                                            │
│ 2024/03/13 14:04:00 INFO    src/main.go:77 HAProxy Ingress Controller CRD Updater v1.10.11 dfa911b.dirty                                                                                                                                                                                                                   │
│ 2024/03/13 14:04:00 INFO    src/main.go:78 Build from: https://github.com/haproxytech/kubernetes-ingress                                                                                                                                                                                                                   │
│ 2024/03/13 14:04:00 INFO    src/main.go:79 Build date: 2024/02/13 15:55:08                                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                            │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:30 checking CRDS                                                                                                                                                                                                                                                              │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:49                                                                                                                                                                                                                                                                            │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:50 checking CRD defaults.core.haproxy.org                                                                                                                                                                                                                                     │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:66 CRD defaults.core.haproxy.org exists                                                                                                                                                                                                                                       │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:75 CRD defaults.core.haproxy.org exists as v1alpha2, nothing to do                                                                                                                                                                                                            │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:49                                                                                                                                                                                                                                                                            │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:50 checking CRD globals.core.haproxy.org                                                                                                                                                                                                                                      │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:66 CRD globals.core.haproxy.org exists                                                                                                                                                                                                                                        │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:75 CRD globals.core.haproxy.org exists as v1alpha2, nothing to do                                                                                                                                                                                                             │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:49                                                                                                                                                                                                                                                                            │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:50 checking CRD backends.core.haproxy.org                                                                                                                                                                                                                                     │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:66 CRD backends.core.haproxy.org exists                                                                                                                                                                                                                                       │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:75 CRD backends.core.haproxy.org exists as v1alpha2, nothing to do                                                                                                                                                                                                            │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:89                                                                                                                                                                                                                                                                            │
│ 2024/03/13 14:04:00 INFO    job/crd-check.go:90 CRD update done   

I suppose that this may be an incorrect handling during CRD versions comparison after switching to API v1.

@tkcontiant
Copy link

Description of the problem

I am using haproxy-ingress via helm-chart.
After the initial deployment, I notice CRD Checker JOB exit with an ERROR state.
A version of the image: haproxytech/kubernetes-ingress:1.11.0

Expected behavior

After that Kubernetes evaluated this batch job as failed, it's not the end of the world everything works correctly.
But I think a simple EXIT code change could prevent many people from wondering if and how there is a problem with CDS's.

│ 2024/03/13 20:08:40 INFO    src/main.go:85  HAProxy Ingress Controller CRD Updater v1.11.0 13fc60b9.dirty                                                 
│ 2024/03/13 20:08:40 INFO    src/main.go:86  Build from: github.com/haproxytech/kubernetes-ingress                                                         
│ 2024/03/13 20:08:40 INFO    src/main.go:87  Build date: 2024-03-08T10:47:39Z                                                                                                                                                                                                                                    
│ 2024/03/13 20:08:40 INFO    src/main.go:89  checking CRDS                                                                                                 
│ 2024/03/13 20:08:40 INFO    src/main.go:89                                                                                                                
│ 2024/03/13 20:08:40 INFO    job/crd-check.go:50  checking CRD ingress.v1.haproxy.org_defaults.yaml                                                        
│ 2024/03/13 20:08:40 INFO    job/crd-check.go:57  CRD ingress.v1.haproxy.org_defaults.yaml does not exist                                                  
│ 2024/03/13 20:08:40 ERROR   runtime/proc.go:271  customresourcedefinitions.apiextensions.k8s.io "defaults.ingress.v1.haproxy.org" already exists

│ 2024/03/13 20:26:34 INFO    job/crd-check.go:50  checking CRD ingress.v1.haproxy.org_globals.yaml                                                         
│ 2024/03/13 20:26:34 INFO    job/crd-check.go:57  CRD ingress.v1.haproxy.org_globals.yaml does not exist                                                   
│ 2024/03/13 20:26:34 ERROR   runtime/proc.go:271  customresourcedefinitions.apiextensions.k8s.io "globals.ingress.v1.haproxy.org" already exists 


Steps to reproduce the problem

  1. helm upgrade --install haproxy-ingress . -n haproxy-ingress --create-namespace
  2. repeated the command and watch the pod's statuses in k9s or lens

Environment information

haproxytech/kubernetes-ingress:1.11.0

name: kubernetes-ingress
sources:
- https://github.com/haproxytech/kubernetes-ingress
type: application
version: 1.38.2

@apalmatier
Copy link

Encountering this same issue on k8s 1.28.5, same helm version.

@oktalz oktalz added the bug Something isn't working label Mar 14, 2024
@oktalz
Copy link
Member

oktalz commented Mar 14, 2024

hi @eugenebzht thx for reporting, fix incoming with next version of ingress controller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants