kubernetes-sigs / cluster-api-provider-cloudstack

A Kubernetes Cluster API Provider implementation for Apache CloudStack.
https://cluster-api-cloudstack.sigs.k8s.io/
Apache License 2.0
37 stars 35 forks source link

Unable to deploy a capc cluster if there are templates present with the same name #386

Open kiranchavala opened 4 months ago

kiranchavala commented 4 months ago

/kind bug

What steps did you take and what happened:

  1. Register a template as admin user , provide the name as "ubuntu-2004-kube-v1.27.2-kvm"
  2. Create a normal user in cloudstack
  3. Login as normal user and register a template provide the same name "ubuntu-2004-kube-v1.27.2-kvm"
  4. Create Capc cluster with user credentials and mention the template name

export CLOUDSTACK_TEMPLATE_NAME=ubuntu-2004-kube-v1.27.2-kvm

  1. Capc cluster creation fails with the following exception
E0703 05:57:57.511717      14 controller.go:329]  "msg"="Reconciler error" "error"="1 error occurred:\n\t* expected 1 Template with name ubuntu-2004-kube-v1.27.2-kvm, but got 2\n\n" "CloudStackMachine"={"name":"capc-cluster-control-plane-wz57x","namespace":"default"} "controller"="cloudstackmachine" "controllerGroup"="infrastructure.cluster.x-k8s.io" "controllerKind"="CloudStackMachine" "name"="capc-cluster-control-plane-wz57x" "namespace"="default" "reconcileID"="9f2c304f-d233-46c3-995c-87fa22b9095a"

What did you expect to happen:

Capc Cluster should get created successfully

Expected behaviour Anything else you would like to add:

When you execute the cloudstack list template API call with user credentials capc should give importance to the template which is registered by the user

https://cloudstack.apache.org/api/apidocs-4.19/apis/listTemplates.html

(cmk) list templates name=ubuntu-2004-kube-v1.27.2-kvm templatefilter=community account=ACSUser
{
  "count": 2,
  "template": [
    {
      "account": "admin",
      "bits": 0,
      "checksum": "e6a7d37d8b8c368bee63d6977f37328cbd6a2cc936a56ff55051fb9e9572053aca10807ebeb81e55e4eb2163d5a895c40e616e52a9d016af807661cb594998fe",
      "created": "2024-06-19T07:40:05+0000",
      "crossZones": true,
      "deployasis": false,
      "details": {
        "rootDiskController": "osdefault"
      },
      "directdownload": false,
      "displaytext": "ubuntu-2004-kube-v1.27.2-kvm",
      "domain": "ROOT",
      "domainid": "55144035-2e06-11ef-8b84-1e0078000175",
      "downloaddetails": [
        {
          "datastore": "nfs://10.0.32.4/acs/secondary/ref-trl-6871-k-M7-vishesh-jindal/ref-trl-6871-k-M7-vishesh-jindal-sec1",
          "downloadPercent": "100",
          "downloadState": "DOWNLOADED"
        },
        {
          "datastore": "ref-trl-6871-k-M7-vishesh-jindal-kvm-pri1",
          "downloadPercent": "100",
          "downloadState": "DOWNLOADED"
        },
        {
          "datastore": "ref-trl-6871-k-M7-vishesh-jindal-kvm-pri2",
          "downloadPercent": "100",
          "downloadState": "DOWNLOADED"
        }
      ],
      "format": "QCOW2",
      "hasannotations": false,
      "hypervisor": "KVM",
      "id": "1d5162ed-ee37-4354-ad38-f3563da93925",
      "isdynamicallyscalable": false,
      "isextractable": false,
      "isfeatured": false,
      "ispublic": true,
      "isready": true,
      "name": "ubuntu-2004-kube-v1.27.2-kvm",
      "ostypeid": "5531b910-2e06-11ef-8b84-1e0078000175",
      "ostypename": "Other Linux (64-bit)",
      "passwordenabled": false,
      "physicalsize": 4399300608,
      "requireshvm": true,
      "size": 21474836480,
      "sshkeyenabled": false,
      "tags": [],
      "templatetype": "USER",
      "zoneid": "52cfb5ce-e58e-40d0-a06f-c373dd86c2be",
      "zonename": "ref-trl-6871-k-M7-vishesh-jindal"
    },
    {
      "account": "ACSUser",
      "bits": 0,
      "checksum": "e6a7d37d8b8c368bee63d6977f37328cbd6a2cc936a56ff55051fb9e9572053aca10807ebeb81e55e4eb2163d5a895c40e616e52a9d016af807661cb594998fe",
      "created": "2024-07-03T05:28:31+0000",
      "crossZones": false,
      "deployasis": false,
      "details": {
        "rootDiskController": "osdefault"
      },
      "directdownload": false,
      "displaytext": "ubuntu-2004-kube-v1.27.2-kvm",
      "domain": "ROOT",
      "domainid": "55144035-2e06-11ef-8b84-1e0078000175",
      "downloaddetails": [
        {
          "datastore": "nfs://10.0.32.4/acs/secondary/ref-trl-6871-k-M7-vishesh-jindal/ref-trl-6871-k-M7-vishesh-jindal-sec1",
          "downloadPercent": "100",
          "downloadState": "DOWNLOADED"
        },
        {
          "datastore": "ref-trl-6871-k-M7-vishesh-jindal-kvm-pri2",
          "downloadPercent": "100",
          "downloadState": "DOWNLOADED"
        },
        {
          "datastore": "ref-trl-6871-k-M7-vishesh-jindal-kvm-pri1",
          "downloadPercent": "100",
          "downloadState": "DOWNLOADED"
        }
      ],
      "format": "QCOW2",
      "hasannotations": false,
      "hypervisor": "KVM",
      "id": "1e8297ed-3798-4eac-8ee2-f56687604a8f",
      "isdynamicallyscalable": false,
      "isextractable": false,
      "isfeatured": false,
      "ispublic": true,
      "isready": true,
      "name": "ubuntu-2004-kube-v1.27.2-kvm",
      "ostypeid": "55327b1c-2e06-11ef-8b84-1e0078000175",
      "ostypename": "Other (64-bit)",
      "passwordenabled": false,
      "physicalsize": 4399300608,
      "requireshvm": true,
      "size": 21474836480,
      "sshkeyenabled": false,
      "status": "Download Complete",
      "tags": [],
      "templatetype": "USER",
      "url": "http://10.0.3.130/capi/images/kvm/ubuntu-2004-kube-v1.27.2-kvm.qcow2.bz2",
      "zoneid": "52cfb5ce-e58e-40d0-a06f-c373dd86c2be",
      "zonename": "ref-trl-6871-k-M7-vishesh-jindal"
    }
  ]
}

Environment:

Cloudstack version : 4.19

k8s-triage-robot commented 1 month ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 4 weeks ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten