clastix / cluster-api-control-plane-provider-kamaji

The Kamaji Control Plane provider implementation of the Cluster Management API
Apache License 2.0
81 stars 29 forks source link

Provider seems to ignore KamajiControlPlane objects #126

Closed tsde closed 1 month ago

tsde commented 1 month ago

Hi,

I'm trying to give the Kamaji capi provider a shot and so far with no luck.

When applying the following manifest (based on the IONOS Cloud example), nothing happens

---
apiVersion: controlplane.cluster.x-k8s.io/v1alpha1
kind: KamajiControlPlane
metadata:
  name: test-cp
  labels:
    cluster.x-k8s.io/cluster-name: test-cp
spec:
  replicas: 1
  version: 1.29.2
  dataStoreName: default
  addons:
    coreDNS: {}
    kubeProxy: {}
  network:
    serviceType: ClusterIP

The controller doesn't even emit any log indicating something is wrong with the config. The only log are those emitted at startup

2024-09-14T15:33:51Z    INFO    setup   starting manager
2024-09-14T15:33:51Z    INFO    controller-runtime.metrics  Starting metrics server
2024-09-14T15:33:51Z    INFO    starting server {"name": "health probe", "addr": "[::]:8081"}
2024-09-14T15:33:51Z    INFO    controller-runtime.metrics  Serving metrics server  {"bindAddress": ":8080", "secure": false}
I0914 15:33:51.559393       1 leaderelection.go:250] attempting to acquire leader lease kamaji-system/kamaji.controlplane.cluster.x-k8s.io...
I0914 15:34:15.955831       1 leaderelection.go:260] successfully acquired lease kamaji-system/kamaji.controlplane.cluster.x-k8s.io
2024-09-14T15:34:15Z    INFO    Starting EventSource    {"controller": "kamajicontrolplane", "controllerGroup": "controlplane.cluster.x-k8s.io", "controllerKind": "KamajiControlPlane", "source": "kind source: *v1alpha1.KamajiControlPlane"}
2024-09-14T15:34:15Z    INFO    Starting EventSource    {"controller": "kamajicontrolplane", "controllerGroup": "controlplane.cluster.x-k8s.io", "controllerKind": "KamajiControlPlane", "source": "kind source: *v1.Secret"}
2024-09-14T15:34:15Z    INFO    Starting EventSource    {"controller": "kamajicontrolplane", "controllerGroup": "controlplane.cluster.x-k8s.io", "controllerKind": "KamajiControlPlane", "source": "kind source: *v1alpha1.TenantControlPlane"}
2024-09-14T15:34:15Z    INFO    Starting EventSource    {"controller": "kamajicontrolplane", "controllerGroup": "controlplane.cluster.x-k8s.io", "controllerKind": "KamajiControlPlane", "source": "channel source: 0xc0004cef50"}
2024-09-14T15:34:15Z    INFO    Starting Controller {"controller": "kamajicontrolplane", "controllerGroup": "controlplane.cluster.x-k8s.io", "controllerKind": "KamajiControlPlane"}
2024-09-14T15:34:15Z    DEBUG   events  capi-kamaji-controller-manager-55b9dcdd4c-lcqd5_58837a47-e76d-48e4-86fd-162a04bb25b1 became leader  {"type": "Normal", "object": {"kind":"Lease","namespace":"kamaji-system","name":"kamaji.controlplane.cluster.x-k8s.io","uid":"8af4b04e-d061-47a8-abaa-14442d2562e3","apiVersion":"coordination.k8s.io/v1","resourceVersion":"132510"}, "reason": "LeaderElection"}
2024-09-14T15:34:16Z    INFO    Starting workers    {"controller": "kamajicontrolplane", "controllerGroup": "controlplane.cluster.x-k8s.io", "controllerKind": "KamajiControlPlane", "worker count": 1}

Here is the test environment I use

K8s management cluster version: 1.30.3
Kamaji version: latest (which means the latest "edge" version if I'm not mistaken)
Kamaji CAPI CP provider version: 0.11.0 (either installed using clusterctl or CAPI operator, same behavior)

Also note that manually creating a plain TenantControlPlane object does create the associated control plane pods correctly so Kamaji seems to work fine on its own. The CAPI provider on the other hand seems to completely ignore the KamajiControlPlane CR I create.

I may be missing some important config as my experience with CAPI in general is quite new, but at least I'd expect the controller to give some hints as soon as a KamajiControlPlane gets created.

prometherion commented 1 month ago

Thanks @tsde, I'll poke also @avorima since the one providing this support.

The Kamaji Control Plane object will be ignored until the infrastructure provider hasn't completed its tasks, so I would suggest you share its logs since it could be the root cause.

avorima commented 1 month ago

@tsde what version of CAPIC are you running?

tsde commented 1 month ago

Thanks for your quick reply @prometherion and @avorima

The Kamaji Control Plane object will be ignored until the infrastructure provider hasn't completed its tasks

Ok, so I think I'm indeed doing something wrong (or at least incomplete). I deployed the following CAPI controllers:

But, I was only trying to create a KamajiControlPlane to see how it works/behave and didn't create the whole infrastructure objects (Cluster, VSphereCluster, etc...). If I understand correctly, it appears I need the whole infrastructure declaration to trigger the CP creation. I will give it a try asap.

prometherion commented 1 month ago

I'm a bit confused, here, mostly because I took for granted you were using IONOS as an infrastructure provider, but the last message refers to vSphere.

Anyway, with Cluster API all the objects must be defined, only the KamajiControlPlane will no take any effect since we wait for the Infrastructure Provider's Cluster to assign its owner reference to it.

If you don't mind, I'll close this issue since it's not a bug per se, if you're looking for support I'd suggest using the Discussion section here on GitHub, or even better, the #kamaji channel on Kubernetes' Slack workspace.

tsde commented 1 month ago

Sorry for the confusion, I simply used the IONOS cloud example for the KamajiControlPlane object definition as it was the most recent piece of documentation.

Anyway, sorry for the noise as this was definitely some misunderstanding on my part of the inner working of the CAPI ecosystem

Thanks again for your time