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 dynconfig with nodeSets panic error #252

Merged
merged 3 commits into from
Oct 2, 2024

Conversation

kobzonega
Copy link
Contributor

@kobzonega kobzonega commented Oct 1, 2024

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

process panic error with usage dynconfig inside .spec.configuration and nodeSet

2024-10-01T12:28:46Z	INFO	Observed a panic in reconciler: invalid argument to Intn	{"controller": "storage", "controllerGroup": "ydb.tech", "controllerKind": "Storage", "Storage": {"name":"s-c0ftkh5nihim1ivcopu1","namespace":"ydb-cluster-c0ftkh5nihim1ivcopu1"}, "namespace": "ydb-cluster-c0ftkh5nihim1ivcopu1", "name": "s-c0ftkh5nihim1ivcopu1", "reconcileID": "545dfc05-5e8e-4e34-9465-6e7659b58ae8"}
panic: invalid argument to Intn [recovered]
	panic: invalid argument to Intn

goroutine 700 [running]:
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.1/pkg/internal/controller/controller.go:119 +0x1fa
panic({0x1a93420, 0x20d0ef0})
	/usr/local/go/src/runtime/panic.go:884 +0x213
math/rand.(*Rand).Intn(0xc000f14000?, 0x53?)
	/usr/local/go/src/math/rand/rand.go:179 +0x65
math/rand.Intn(...)
	/usr/local/go/src/math/rand/rand.go:358
github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1.(*Storage).GetHostFromConfigEndpoint(0xc001f06840?)
	/workspace/api/v1alpha1/storage_webhook.go:70 +0xa5
github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1.(*Storage).GetStorageEndpoint(0xc001f06840)
	/workspace/api/v1alpha1/storage_webhook.go:50 +0x65
github.com/ydb-platform/ydb-kubernetes-operator/api/v1alpha1.(*Storage).GetStorageEndpointWithProto(0xc0032086c0?)
	/workspace/api/v1alpha1/storage_webhook.go:35 +0x65
github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage.(*Reconciler).setConfigPipelineStatus(0xc00055a9b0, {0x20f2b40, 0xc002b2d980}, 0xc00058c370)
	/workspace/internal/controllers/storage/config.go:187 +0x225
github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage.(*Reconciler).Sync(0x0?, {0x20f2b40, 0xc002b2d980}, 0x0?)
	/workspace/internal/controllers/storage/sync.go:55 +0x305
github.com/ydb-platform/ydb-kubernetes-operator/internal/controllers/storage.(*Reconciler).Reconcile(0xc00055a9b0, {0x20f2b40, 0xc002b2d980}, {{{0xc000059a60?, 0x0?}, {0xc0008538a8?, 0x40de67?}}})
	/workspace/internal/controllers/storage/controller.go:118 +0x4e5
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x20f2b40?, {0x20f2b40?, 0xc002b2d980?}, {{{0xc000059a60?, 0x1a928a0?}, {0xc0008538a8?, 0x40f926?}}})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.1/pkg/internal/controller/controller.go:122 +0xc8
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc000440be0, {0x20f2a98, 0xc00055a500}, {0x1bdc960?, 0xc0001bcd80?})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.1/pkg/internal/controller/controller.go:323 +0x377
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000440be0, {0x20f2a98, 0xc00055a500})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.1/pkg/internal/controller/controller.go:274 +0x1d9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.1/pkg/internal/controller/controller.go:235 +0x85
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.1/pkg/internal/controller/controller.go:231 +0x587

What is the new behavior?

  • fix error by parse dynconfig inside webhook
  • additional test suite to prevent this in feature

Other information

@kobzonega kobzonega merged commit 170361a into master Oct 2, 2024
4 checks passed
@kobzonega kobzonega deleted the fix-dynconfig-with-nodesets-panic branch October 2, 2024 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant