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: Stop reconciling if K8sGPT CR is not in the operator namespace #480

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yeahdongcn
Copy link
Contributor

@yeahdongcn yeahdongcn commented Jul 23, 2024

Closes #

📑 Description

I accidentally applied K8sGPT CR to the default namespace while the operator was installed in another namespace. This causes the newly created deployment can't be scaled to the minimum replicas (sa k8sgpt not found).

apiVersion: apps/v1
kind: Deployment
metadata:
  generation: 1
  name: k8sgpt-local-ai
  namespace: default
...
status:
  conditions:
  - lastTransitionTime: "2024-07-23T05:32:23Z"
    lastUpdateTime: "2024-07-23T05:32:23Z"
    message: Deployment does not have minimum availability.
    reason: MinimumReplicasUnavailable
    status: "False"
    type: Available
  - lastTransitionTime: "2024-07-23T05:32:23Z"
    lastUpdateTime: "2024-07-23T05:32:23Z"
    message: 'pods "k8sgpt-local-ai-546d874f59-" is forbidden: error looking up service
      account default/k8sgpt: serviceaccount "k8sgpt" not found'
    reason: FailedCreate
    status: "True"
    type: ReplicaFailure

So I updated the controller-manager deployment env and added an early check before creating the needed resources in the reconciling process.

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

Testing done:
Screenshot 2024-07-23 at 15 32 35
Screenshot 2024-07-23 at 15 32 09

@yeahdongcn yeahdongcn reopened this Jul 23, 2024
@AlexsJones
Copy link
Member

created deployment can't be scaled to the minimum replicas (sa k8sgpt not found)

so the real issue here is the Service Account is installed in the k8sgpt-operator-system namespace or not at all?

@yeahdongcn
Copy link
Contributor Author

created deployment can't be scaled to the minimum replicas (sa k8sgpt not found)

so the real issue here is the Service Account is installed in the k8sgpt-operator-system namespace or not at all?

Yes. This PR can prevent further resource creation.

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.

2 participants