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

Never ending reconciliation on a Deployment due to env expected to be '[]' vs null #289

Open
Manny2014 opened this issue Feb 11, 2025 · 1 comment
Labels
kind/bug Something isn't working

Comments

@Manny2014
Copy link

Description

I've created a simple ResourceGraph (below) and not thinking much about i set the spec.template.containers[0].env to equal to '[]' in the definition. The controller never reconciled b/c it kept finding and issue with the value of 'env' (desired '[]' vs. observed null).

apiVersion: kro.run/v1alpha1
kind: ResourceGraphDefinition
metadata:
...
spec:
  schema:
    apiVersion: v1alpha1
    kind: SimpleApp
    spec:
      # Basic types
      name: string | required=true description="Application name"
      replicas: integer | default=1 # minimum=1 maximum=100
      namespace: string | required=true
      image: string | required=true
      port: integer | default=8080
    status:
      # Status fields with auto-inferred types
      deploymentConditions: ${deployment.status.conditions}
      availableReplicas: ${deployment.status.availableReplicas}
      workloadKsa: ${ksa.metadata.name}
  resources:
  - id: ksa
    template:
      apiVersion: v1
      kind: ServiceAccount
      metadata:
        name: sv-${schema.spec.name}-ksa
        namespace: ${schema.spec.namespace}
 
  - id: deployment
    readyWhen:
      - ${deployment.spec.replicas == deployment.status.availableReplicas}
    template:
      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: ${schema.spec.name}
        namespace: ${schema.spec.namespace}
        labels:
          app.kubernetes.io/name: ${schema.spec.name}
      spec:
        replicas: ${schema.spec.replicas}
        selector:
          matchLabels:
            app.kubernetes.io/name: ${schema.spec.name}
            app: ${schema.spec.name}
        template:
          metadata:
            labels:
              app.kubernetes.io/name: ${schema.spec.name}
              app: ${schema.spec.name}
          spec:
            serviceAccountName: ${ksa.metadata.name}
            containers:
            - name: main
              image: ${schema.spec.image}
              imagePullPolicy: Always
              ports:
              - containerPort: ${schema.spec.port}
              resources:
                requests:
                  memory: "64Mi"
                  cpu: "250m"
                limits:
                  memory: "1Gi"
                  cpu: "1"
              env: []
            restartPolicy: Always

Observed Behavior:
The controller never reconciled and the Instance never made it past IN_PROGRESS although all objects were created successfully.

Watching the object:

NAME                         STATE         SYNCED   AGE
simpleapp.kro.run/simple-1   IN_PROGRESS   False    2m58s

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/simple-1   1/1     1            1           2m55s
[2]  + done       ~/local/google-cloud-sdk/bin/kubectl.1.30 get simpleapp,deploy -n rg-instance
[2] 30970
NAME                         STATE         SYNCED   AGE
simpleapp.kro.run/simple-1   IN_PROGRESS   False    3m1s

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/simple-1   1/1     1            1           2m58s

After removing 'env: []' from ResourceGraph the Instance reconciled in seconds:

NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/simple-1 1/1 1 1 3s
[2] + done ~/local/google-cloud-sdk/bin/kubectl.1.30 get simpleapp,deploy -n rg-instance
[2] 34541
NAME STATE SYNCED AGE
simpleapp.kro.run/simple-1 ACTIVE True 9s

NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/simple-1 1/1 1 1 6s

Expected Behavior:
I did not expect that such a small thing would put the controller in this state.

Reproduction Steps (Please include ResourceGraphDefinition and Instances files):

Versions:

  • kro version: 0.2.1
  • Kubernetes Version (kubectl version):
    Client Version: v1.30.8
    Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
    Server Version: v1.30.6+k3s1

Involved Controllers:

  • Controller URLs and Versions (if applicable):

Error Logs (if applicable)**:

2025-02-11T03:36:58.790Z	DEBUG	controller.simpleapps	Found deltas for resource	{"namespace": "rg-instances", "name": "simple-1", "resourceID": "deployment", "delta": [{"path":"spec.template.spec.containers[0].env","desired":[],"observed":null}]}
2025-02-11T03:36:58.815Z	DEBUG	dynamic-controller	Finished syncing resourcegraphdefinition instance request	{"gvr": "kro.run/v1alpha1/simpleapps", "namespacedKey": "rg-instances/simple-1", "duration": "45.484577ms"}
  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Which option describes the most your issue?

No response

@Manny2014 Manny2014 added the kind/bug Something isn't working label Feb 11, 2025
@Manny2014 Manny2014 changed the title Never ending reconciliation on a Deployment due to env expected to be '[]' vs None Never ending reconciliation on a Deployment due to env expected to be '[]' vs null Feb 11, 2025
barney-s added a commit to barney-s/kro that referenced this issue Feb 12, 2025
barney-s added a commit to barney-s/kro that referenced this issue Feb 12, 2025
barney-s added a commit to barney-s/kro that referenced this issue Feb 12, 2025
@barney-s
Copy link
Member

Fix proposed

barney-s added a commit to barney-s/kro that referenced this issue Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants