Skip to content

Krane is unable to fully deploy resources when there are duplicate Kinds #895

@renescheepers

Description

@renescheepers

Bug report

When a CRD installed with for kind "Deployment", Krane will be unable to deploy those resources if the scoping is different on the CRD. It will check the state of the wrong resource and in the wrong scope, cluster instead of namespace.

Expected behavior: deployment to succeed.

Actual behavior: Krane constantly checks if deployment is succeeded but eventually times out.

Version(s) affected: probably all versions.

Steps to Reproduce

  1. Start a new KinD cluster.
  2. Deploy the CRD in the collapsible below.
  3. kubectl create ns example.
  4. DEBUG=1 bundle exec exe/krane deploy example kind-krane -f krane-manifest.yaml --global-timeout=1m.
  5. Krane does deploy the resource but will be unable to check the status.

In debug mode you can see that it uses the wrong command to get the resource status:

kubectl get Deployment --chunk-size=0 --context=kind-kind-krane --output=json --request-timeout=30
CRD Deployment
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: deployments.stable.example.com
spec:
group: stable.example.com
versions:
- name: v1
  served: true
  storage: true
  schema:
    openAPIV3Schema:
      type: object
      properties:
        test:
          type: string
scope: Cluster
names:
  plural: deployments
  singular: deployment
  kind: Deployment
Deployment
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: nginx-deployment
spec:
selector:
  matchLabels:
    deploy: example
template:
  metadata:
    labels:
      deploy: example
  spec:
    containers:
      - name: nginx
        image: nginx

Related to:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions