crossplane-contrib / provider-civo

Apache License 2.0
22 stars 22 forks source link

Update Kubernetes Cluster controller and add support for meta.externalName #43

Open vladfr opened 1 year ago

vladfr commented 1 year ago

I ran into this problem that cluster updates are never performed. While trying to debug I actually made good headway.

The problem is that the Kubernetes Civo API changed quite a bit, and now only works via Cluster ID (which makes a ton of sense). The current controller for clusters has two problems:

Changes:

Fixes #41

I have:

Tests

Open issues

NOTE: I've bumped /build to latest, since I couldn't run make generate anymore.

vladfr commented 1 year ago

Applications are being installed on Create, but not added on Update.

App name is civo-cluster-autoscaler. If it's specified when Creating, it works and the app appears on the CIVO Dashboard. If you then do an Update, this is the API error:

{"level":"warning","msg":"update error:Error: Unknown error response - status: 404 Not Found, code: 404, reason: {\"code\":\"database_kubernetes_aplication_not_found\",\"reason\":\"Failed to find the Kubernetes application for installation\"}\n ","time":"2023-03-21T16:56:28+02:00"}
vladfr commented 1 year ago

I'd like to leave a note here. The Observe() cycle should not trigger any modifications. It should return an ExternalObservation, and the reconciler will call Update when needed.

Previously the code would call Update and trigger resource updates. This made it so that the reconciler never issued proper log messages. With this change, you can clearly see when the reconciler requests a Create or Update; or whenever it sees an error.