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

[bug] nil pointer panic error if spec.core.kcm value is not set in custom Management object #939

Closed
Algeran opened this issue Jan 22, 2025 · 0 comments · Fixed by #1058
Closed
Assignees
Labels
bug Something isn't working

Comments

@Algeran
Copy link

Algeran commented Jan 22, 2025

Describe the bug
I disabled creation of the default Management object by kcm controller and created the custom object. It mostly the same as the default one but without the spec.core values. Validation webhook allows to create it, but kcm controller starts failing and restarting with nil pointer panics on this line:
https://github.com/k0rdent/kcm/blob/v0.0.7/internal/controller/management_controller.go#L528

To Reproduce
Steps to reproduce the behavior:

  1. bootstrap kcm controller with controller.createManagement: false
  2. apply the custom management object:
    apiVersion: k0rdent.mirantis.com/v1alpha1
    kind: Management
    metadata:
      labels:
        k0rdent.mirantis.com/component: kcm
      name: kcm
    spec:
      providers:
      - name: k0smotron
      - name: cluster-api-provider-aws
      - name: cluster-api-provider-azure
      - name: cluster-api-provider-vsphere
      - name: cluster-api-provider-openstack
      - name: projectsveltos
      release: kcm-0-0-7
    

Expected behavior
Forbid to create objects without the .spec.core.kcm value or fill it with default values

Additional context

@Algeran Algeran added the bug Something isn't working label Jan 22, 2025
@github-project-automation github-project-automation bot moved this to Todo in k0rdent Jan 22, 2025
@eromanova eromanova self-assigned this Feb 3, 2025
@eromanova eromanova moved this from Todo to In Progress in k0rdent Feb 10, 2025
eromanova added a commit to eromanova/kcm that referenced this issue Feb 10, 2025
* Fix panic on `enableAdditionalComponents` when `spec.core` is unset
* Update `getWrappedComponents` to handle the case when `spec.core` is
  unset without breaking

Closes k0rdent#939
@github-project-automation github-project-automation bot moved this from Todo to Done in Project 2A Feb 10, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in k0rdent Feb 10, 2025
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
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants