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

Fix panic on SSO Keycloak conversion #1384

Merged

Conversation

jgwest
Copy link
Member

@jgwest jgwest commented May 28, 2024

What type of PR is this?
/kind bug

What does this PR do / why we need it:

Fix nil dereference in conversion of SSO.Keycloak field from v1alpha1 to v1beta1:

2024/05/27 23:31:07 http: panic serving 10.130.0.2:48878: runtime error: invalid memory address or nil pointer dereference
goroutine 900 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1868 +0xb9
panic({0x1a9be80?, 0x2eb0b90?})
	/usr/local/go/src/runtime/panic.go:920 +0x270
github.com/argoproj-labs/argocd-operator/api/v1alpha1.(*ArgoCD).ConvertTo(0xc002eb2900, {0x2031020?, 0xc00216b500})
	/go/pkg/mod/github.com/argoproj-labs/[email protected]/api/v1alpha1/argocd_conversion.go:39 +0x443
sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*webhook).convertObject(0xc00041c650?, {0x202a1c0, 0xc002eb2900}, {0x202a210, 0xc00216b500})
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/webhook/conversion/conversion.go:142 +0x3e3
sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*webhook).handleConvertRequest(0xc00041c650, 0xc00353b400)
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/webhook/conversion/conversion.go:105 +0x1c5
sigs.k8s.io/controller-runtime/pkg/webhook/conversion.(*webhook).ServeHTTP(0x20261e0?, {0x7f381bc561e8?, 0xc001a7afa0}, 0xc0037b7d00)
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/webhook/conversion/conversion.go:72 +0xf6
sigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics.InstrumentedHook.InstrumentHandlerInFlight.func1({0x7f381bc561e8, 0xc001a7afa0}, 0x2036e00?)
	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:60 +0xcb
net/http.HandlerFunc.ServeHTTP(0x2036ee0?, {0x7f381bc561e8?, 0xc001a7afa0?}, 0xc0006258a0?)
	/usr/local/go/src/net/http/server.go:2136 +0x29
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x2036ee0?, 0xc001df75e0?}, 0xc0037b7d00)
	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:147 +0xb6
net/http.HandlerFunc.ServeHTTP(0x70e946?, {0x2036ee0?, 0xc001df75e0?}, 0xc0030fd680?)
	/usr/local/go/src/net/http/server.go:2136 +0x29
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x2036ee0, 0xc001df75e0}, 0xc0037b7d00)
	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/promhttp/instrument_server.go:109 +0xc2
net/http.HandlerFunc.ServeHTTP(0x10?, {0x2036ee0?, 0xc001df75e0?}, 0xc00353b3ec?)
	/usr/local/go/src/net/http/server.go:2136 +0x29
net/http.(*ServeMux).ServeHTTP(0x410945?, {0x2036ee0, 0xc001df75e0}, 0xc0037b7d00)
	/usr/local/go/src/net/http/server.go:2514 +0x142
net/http.serverHandler.ServeHTTP({0x202ce98?}, {0x2036ee0?, 0xc001df75e0?}, 0x6?)
	/usr/local/go/src/net/http/server.go:2938 +0x8e
net/http.(*conn).serve(0xc00102d560, {0x203f408, 0xc0004a5d40})
	/usr/local/go/src/net/http/server.go:2009 +0x5f4
created by net/http.(*Server).Serve in goroutine 47
	/usr/local/go/src/net/http/server.go:3086 +0x5cb

Have you updated the necessary documentation?

  • Documentation update is required by this PR.
  • Documentation has been updated.

Which issue(s) this PR fixes:

Fixes #?

How to test changes / Special notes to the reviewer:

Copy link
Collaborator

@chetan-rns chetan-rns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@jgwest jgwest force-pushed the fix-panic-on-conversion-may-2024 branch from 0d6503c to f8780b2 Compare May 28, 2024 10:40
@jgwest
Copy link
Member Author

jgwest commented May 28, 2024

Thanks @chetan-rns and @svghadi for reviewing!

@jgwest jgwest merged commit cc67ce1 into argoproj-labs:master May 28, 2024
7 checks passed
reginapizza pushed a commit to reginapizza/argocd-operator that referenced this pull request Jun 5, 2024
@svghadi svghadi added the backport-to-redesign Changes which need to be backported to operator-redesign branch label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-redesign Changes which need to be backported to operator-redesign branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants