crossplane-contrib / provider-civo

Apache License 2.0
22 stars 22 forks source link

Changing cluster manifest wouldn't change cluster scale #9

Closed exocode closed 2 years ago

exocode commented 2 years ago

Hi there, Hi @AnaisUrlichs ,

I’ve a Civo account and using UpBound managed (not self-hosted) profile.

After a fresh setup and connected to to the upbound cluster:

I add the Civo provider: kubectl crossplane install provider crossplane/provider-civo:main

Then I apply this manifest:

apiVersion: v1
kind: Secret
metadata:
  namespace: upbound-system
  name: civo-provider-secret
type: Opaque
data:
  credentials: MY_CIVO_TOKEN
---
apiVersion: civo.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
  name: provider-civo
spec:
  region: fra1
  credentials:
    source: Secret
    secretRef:
      namespace: upbound-system
      name: civo-provider-secret
      key: credentials

Then apply the server manifest:

apiVersion: cluster.civo.crossplane.io/v1alpha1
kind: CivoKubernetes
metadata:
  name: example-civo-cluster
spec:
  name: example-civo-cluster
  instances: 1
  size: g3.k3s.small
  applications:
    - prometheus-operator
  connectionDetails:
    connectionSecretNamePrefix: cluster-civo
    connectionSecretNamespace: upbound-system
  providerConfigRef:
    name: provider-civo

Apply it with:

k apply -f upbound/cluster-civo.yml

Wait till cluster is up, Now change in the Cluster manifest the instance count from 1 to 3

Then reapply with the same command:

k apply -f upbound/cluster-civo.yml

I expect that the cluster will increase it’s nodes, but it doesn’t What did I wrong? Or is this a bug?

AlexsJones commented 2 years ago

Hello, We have now moved to a pools model that will ultimately reconcile to your desired cluster shape.

kind: CivoKubernetes
apiVersion: cluster.civo.crossplane.io/v1alpha1
metadata: 
  name: test-crossplane
spec:
  name: test-crossplane
  pools:
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 4
      size: g3.k3s.small
    - id: "8482f422-dcdd-461g-afb4-2ab67f171c3e"
      count: 3
      size: g3.k3s.small
  applications: 
    - "argo-cd"
    - "prometheus-operator"
  connectionDetails:
    connectionSecretNamePrefix: "cluster-details"
    connectionSecretNamespace: "default"
  providerConfigRef:
    name: civo-provider

This will support resizing

Let us know how you get on 🥳

AnaisUrlichs commented 2 years ago

Hey both, I just checked and it worked for me to update the node pool -- used the default command to install the provider kubectl crossplane install provider crossplane/provider-civo:main

@exocode please let us know should you find any other issues/miss functionality

exocode commented 2 years ago

What's also curious is, that I've somehow reached quota limit: But there are no instances... In nor or the regions (FRA, NYC, LON)

WARNING QuotaLimitReachedError: Failed to perform this action due to a quota being at the limit

For me, it looks like something is not "cleaned up properly"

❯ k describe civokubernetes test-crossplane -n upbound-system
Name:         test-crossplane
Namespace:
Labels:       <none>
Annotations:  crossplane.io/external-name: test-crossplane
API Version:  cluster.civo.crossplane.io/v1alpha1
Kind:         CivoKubernetes
Metadata:
  Creation Timestamp:  2021-12-03T02:20:42Z
  Finalizers:
    finalizer.managedresource.crossplane.io
  Generation:  1
  Managed Fields:
    API Version:  cluster.civo.crossplane.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:applications:
        f:connectionDetails:
          .:
          f:connectionSecretNamePrefix:
          f:connectionSecretNamespace:
        f:name:
        f:pools:
        f:providerConfigRef:
          .:
          f:name:
    Manager:      kubectl-client-side-apply
    Operation:    Update
    Time:         2021-12-03T02:20:42Z
    API Version:  cluster.civo.crossplane.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          f:crossplane.io/external-name:
        f:finalizers:
          .:
          v:"finalizer.managedresource.crossplane.io":
      f:status:
        .:
        f:atProvider:
        f:conditions:
        f:message:
    Manager:         crossplane-civo-provider
    Operation:       Update
    Time:            2021-12-03T02:20:46Z
  Resource Version:  759589147
  Self Link:         /apis/cluster.civo.crossplane.io/v1alpha1/civokubernetes/test-crossplane
  UID:               18a84c00-54df-4478-ac68-9b6c8f336af8
Spec:
  Applications:
    argo-cd
    prometheus-operator
  Connection Details:
    Connection Secret Name Prefix:  cluster-details
    Connection Secret Namespace:    default
  Name:                             test-crossplane
  Pools:
    Count:  4
    Id:     8382e422-dcdd-461f-afb4-2ab67f171c3e
    Size:   g3.k3s.small
    Count:  3
    Id:     8482f422-dcdd-461g-afb4-2ab67f171c3e
    Size:   g3.k3s.small
  Provider Config Ref:
    Name:  civo-provider
Status:
  At Provider:
  Conditions:
    Last Transition Time:  2021-12-03T02:20:44Z
    Reason:                Creating
    Status:                False
    Type:                  Ready
    Last Transition Time:  2021-12-03T02:20:46Z
    Message:               create failed: QuotaLimitReachedError: Failed to perform this action due to a quota being at the limit
    Reason:                ReconcileError
    Status:                False
    Type:                  Synced
  Message:
Events:
  Type     Reason                        Age                   From                                               Message
  ----     ------                        ----                  ----                                               -------
  Warning  CannotCreateExternalResource  61s (x13 over 7m33s)  managed/civokubernetes.cluster.civo.crossplane.io  QuotaLimitReachedError: Failed to perform this action due to a quota being at the limit
exocode commented 2 years ago

And I have still 3 main problems: (not sure if it's a Civo or UpBound problem, I dont have a regular self-hosted Crossplane setup)

  1. Only FIRST node-pool is created
  2. Scaling doesn't work

1.) & 3.) Nodepool test

❯ kaf cluster-civo-nodepool.yml
civokubernetes.cluster.civo.crossplane.io/test-crossplane created
kind: CivoKubernetes
apiVersion: cluster.civo.crossplane.io/v1alpha1
metadata:
  name: test-crossplane
spec:
  name: test-crossplane
  pools:
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 1
      size: g3.k3s.small
    - id: "8482f422-dcdd-461g-afb4-2ab67f171c3e"
      count: 1
      size: g3.k3s.small
  applications:
    - "argo-cd"
    - "prometheus-operator"
  connectionDetails:
    connectionSecretNamePrefix: "cluster-details"
    connectionSecretNamespace: "default"
  providerConfigRef:
    name: civo-provider

result:

Bildschirmfoto 2021-12-03 um 10 56 12

As you can see only the first node-pool exist.

2.) Scaling

Now update the manifest and reapply:

❯ kaf cluster-civo-nodepool.yml
civokubernetes.cluster.civo.crossplane.io/test-crossplane configured # <<<
kind: CivoKubernetes
apiVersion: cluster.civo.crossplane.io/v1alpha1
metadata:
  name: test-crossplane
spec:
  name: test-crossplane
  pools:
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 3
      size: g3.k3s.small
    - id: "8482f422-dcdd-461g-afb4-2ab67f171c3e"
      count: 3
      size: g3.k3s.medium
  applications:
    - "argo-cd"
    - "prometheus-operator"
  connectionDetails:
    connectionSecretNamePrefix: "cluster-details"
    connectionSecretNamespace: "default"
  providerConfigRef:
    name: civo-provider

Now the interface looks the same as before

Bildschirmfoto 2021-12-03 um 10 56 12

This is the output after the two commands on the manifest:

❯ k describe civokubernetes test-crossplane -n upbound-system
Name:         test-crossplane
Namespace:
Labels:       <none>
Annotations:  crossplane.io/external-name: test-crossplane
API Version:  cluster.civo.crossplane.io/v1alpha1
Kind:         CivoKubernetes
Metadata:
  Creation Timestamp:  2021-12-03T09:52:54Z
  Finalizers:
    finalizer.managedresource.crossplane.io
  Generation:  3
  Managed Fields:
    API Version:  cluster.civo.crossplane.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          f:crossplane.io/external-name:
        f:finalizers:
          .:
          v:"finalizer.managedresource.crossplane.io":
      f:status:
        .:
        f:atProvider:
        f:conditions:
        f:message:
    Manager:      crossplane-civo-provider
    Operation:    Update
    Time:         2021-12-03T09:56:11Z
    API Version:  cluster.civo.crossplane.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:applications:
        f:connectionDetails:
          .:
          f:connectionSecretNamePrefix:
          f:connectionSecretNamespace:
        f:name:
        f:pools:
        f:providerConfigRef:
          .:
          f:name:
    Manager:         kubectl-client-side-apply
    Operation:       Update
    Time:            2021-12-03T09:59:44Z
  Resource Version:  760822352
  Self Link:         /apis/cluster.civo.crossplane.io/v1alpha1/civokubernetes/test-crossplane
  UID:               4c311b21-c6f0-4840-a19d-8de202f043bf
Spec:
  Applications:
    argo-cd
    prometheus-operator
  Connection Details:
    Connection Secret Name Prefix:  cluster-details
    Connection Secret Namespace:    default
  Name:                             test-crossplane
  Pools:
    Count:  3
    Id:     8382e422-dcdd-461f-afb4-2ab67f171c3e
    Size:   g3.k3s.small
    Count:  3
    Id:     8482f422-dcdd-461g-afb4-2ab67f171c3e
    Size:   g3.k3s.medium
  Provider Config Ref:
    Name:  civo-provider
Status:
  At Provider:
  Conditions:
    Last Transition Time:  2021-12-03T09:52:58Z
    Reason:                ReconcileSuccess
    Status:                True
    Type:                  Synced
    Last Transition Time:  2021-12-03T09:56:11Z
    Reason:                Available
    Status:                True
    Type:                  Ready
  Message:                 Cluster is active
Events:
  Type    Reason                   Age    From                                               Message
  ----    ------                   ----   ----                                               -------
  Normal  CreatedExternalResource  8m51s  managed/civokubernetes.cluster.civo.crossplane.io  Successfully requested creation of external resource

Now I delete the ressource:

❯ kdelf cluster-civo-nodepool.yml
civokubernetes.cluster.civo.crossplane.io "test-crossplane" deleted

The cluster is deleted successfully, except the network.

exocode commented 2 years ago

I also tried it it on a regular crossplane setup: But still one node-pool and not able to scale

helm upgrade --install crossplane crossplane-stable/crossplane --namespace crossplane-system --create-namespace --wait

with all the manifests from the examples folder After creation AND attempt to rescale: by reapplying the changed node count from

 pools:
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 1
      size: g3.k3s.small
    - id: "8482f422-dcdd-461g-afb4-2ab67f171c3e"
      count: 1
      size: g3.k3s.small

to

 pools:
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 3
      size: g3.k3s.small
    - id: "8482f422-dcdd-461g-afb4-2ab67f171c3e"
      count: 3
      size: g3.k3s.small

that is the output of describe civocluster

❯ k describe civokubernetes.cluster.civo.crossplane.io test-crossplane
Name:         test-crossplane
Namespace:
Labels:       <none>
Annotations:  crossplane.io/external-name: test-crossplane
API Version:  cluster.civo.crossplane.io/v1alpha1
Kind:         CivoKubernetes
Metadata:
  Creation Timestamp:  2021-12-03T19:55:57Z
  Finalizers:
    finalizer.managedresource.crossplane.io
  Generation:  2
  Managed Fields:
    API Version:  cluster.civo.crossplane.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:applications:
        f:connectionDetails:
          .:
          f:connectionSecretNamePrefix:
          f:connectionSecretNamespace:
        f:name:
        f:pools:
        f:providerConfigRef:
          .:
          f:name:
    Manager:      kubectl-client-side-apply
    Operation:    Update
    Time:         2021-12-03T19:55:57Z
    API Version:  cluster.civo.crossplane.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          f:crossplane.io/external-name:
        f:finalizers:
          .:
          v:"finalizer.managedresource.crossplane.io":
      f:status:
        .:
        f:atProvider:
        f:conditions:
        f:message:
    Manager:         crossplane-civo-provider
    Operation:       Update
    Time:            2021-12-03T19:56:00Z
  Resource Version:  291469
  UID:               3557247d-ccda-4884-8b14-24e7112bc3fb
Spec:
  Applications:
    argo-cd
    prometheus-operator
  Connection Details:
    Connection Secret Name Prefix:  cluster-details
    Connection Secret Namespace:    default
  Name:                             test-crossplane
  Pools:
    Count:  3
    Id:     8382e422-dcdd-461f-afb4-2ab67f171c3e
    Size:   g3.k3s.small
    Count:  3
    Id:     8482f422-dcdd-461g-afb4-2ab67f171c3e
    Size:   g3.k3s.small
  Provider Config Ref:
    Name:  civo-provider
Status:
  At Provider:
  Conditions:
    Last Transition Time:  2021-12-03T19:56:00Z
    Reason:                ReconcileSuccess
    Status:                True
    Type:                  Synced
    Last Transition Time:  2021-12-03T19:58:05Z
    Reason:                Available
    Status:                True
    Type:                  Ready
  Message:                 Cluster is active
Events:
  Type    Reason                   Age   From                                               Message
  ----    ------                   ----  ----                                               -------
  Normal  CreatedExternalResource  33m   managed/civokubernetes.cluster.civo.crossplane.io  Successfully requested creation of external resource
exocode commented 2 years ago

Also applications are installed but not listed in the UI... Like you show it in this video: https://youtu.be/pVCoLFC1Fc8?t=2928 (placed playhead to that position)

Bildschirmfoto 2021-12-05 um 10 36 18

And something "New"

Cant connect to the cluster anymore: if I download the kubeconfig and try to connect I get a timeout error:

❯ export KUBECONFIG=/Users/jan/Downloads/civo-test-crossplane-kubeconfig

❯ kubectl get ns
Unable to connect to the server: dial tcp 74.220.24.249:6443: i/o timeout

And I would suggest tagging this repo, so users can stick on a certain version.

AlexsJones commented 2 years ago

https://github.com/crossplane-contrib/provider-civo/issues/10

AnaisUrlichs commented 2 years ago

Here are the steps I took to try to recreate this issue:

spin up a small Kubernetes cluster on Civo Install the self-hosted Crossplane CRDs Add the provider from the examples repo with my Civo API Key

Install the cluster resource:

kind: CivoKubernetes
apiVersion: cluster.civo.crossplane.io/v1alpha1
metadata:
  name: test-crossplane
spec:
  name: test-crossplane
  pools:
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 2
      size: g3.k3s.small
  applications:
    - "argo-cd"
    - "prometheus-operator"
  connectionDetails:
    connectionSecretNamePrefix: "cluster-details"
    connectionSecretNamespace: "default"
  providerConfigRef:
    name: civo-provider

and then I updated the node pool with:

kind: CivoKubernetes
apiVersion: cluster.civo.crossplane.io/v1alpha1
metadata:
  name: test-crossplane
spec:
  name: test-crossplane
  pools:
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 4
      size: g3.k3s.small
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 3
      size: g3.k3s.small
  applications:
    - "argo-cd"
    - "prometheus-operator"
  connectionDetails:
    connectionSecretNamePrefix: "cluster-details"
    connectionSecretNamespace: "default"
  providerConfigRef:
    name: civo-provider

the second node pool got created but the first one did not scale up -- we created a PR to fix this & will merge it now

thank you for making us aware of the bug :)

exocode commented 2 years ago

I am not able to overcome the provider installation.

@AnaisUrlichs can you please try that with an Demo Upbound account? In my case the "installing-wheel" keeps spinning... :-( Look here:

Bildschirmfoto 2021-12-06 um 20 54 09

❯ kubectl get provider.pkg
NAME            INSTALLED   HEALTHY   PACKAGE                         AGE
provider-civo   True        False     crossplane/provider-civo:main   118s
❯ kubectl get providerrevision.pkg
NAME                         HEALTHY   REVISION   IMAGE                           STATE    DEP-FOUND   DEP-INSTALLED   AGE
provider-civo-16d81d2b3a05   False     1          crossplane/provider-civo:main   Active                               2m19s
❯ k describe providerrevisions.pkg.crossplane.io provider-civo-16d81d2b3a05
Name:         provider-civo-16d81d2b3a05
Namespace:
Labels:       pkg.crossplane.io/package=provider-civo
Annotations:  descriptionShort:
                The Crossplane Civo provider enables management of managing resources on
                Civo cloud.
API Version:  pkg.crossplane.io/v1
Kind:         ProviderRevision
Metadata:
  Creation Timestamp:  2021-12-06T19:48:06Z
  Finalizers:
    revision.pkg.crossplane.io
  Generation:  1
  Managed Fields:
    API Version:  pkg.crossplane.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:descriptionShort:
        f:finalizers:
          .:
          v:"revision.pkg.crossplane.io":
        f:labels:
          .:
          f:pkg.crossplane.io/package:
        f:ownerReferences:
          .:
          k:{"uid":"eaf6970b-14d4-4315-bd94-2b30256a64e6"}:
            .:
            f:apiVersion:
            f:blockOwnerDeletion:
            f:controller:
            f:kind:
            f:name:
            f:uid:
      f:spec:
        .:
        f:desiredState:
        f:ignoreCrossplaneConstraints:
        f:image:
        f:packagePullPolicy:
        f:revision:
        f:skipDependencyResolution:
      f:status:
        .:
        f:conditions:
        f:controllerRef:
          .:
          f:name:
    Manager:    crossplane
    Operation:  Update
    Time:       2021-12-06T19:48:08Z
  Owner References:
    API Version:           pkg.crossplane.io/v1
    Block Owner Deletion:  true
    Controller:            true
    Kind:                  Provider
    Name:                  provider-civo
    UID:                   eaf6970b-14d4-4315-bd94-2b30256a64e6
  Resource Version:        773436800
  Self Link:               /apis/pkg.crossplane.io/v1/providerrevisions/provider-civo-16d81d2b3a05
  UID:                     65e58b4e-8d7e-4dfc-975c-f0d4bc07df86
Spec:
  Desired State:                  Active
  Ignore Crossplane Constraints:  false
  Image:                          crossplane/provider-civo:main
  Package Pull Policy:            IfNotPresent
  Revision:                       1
  Skip Dependency Resolution:     false
Status:
  Conditions:
    Last Transition Time:  2021-12-06T19:48:08Z
    Reason:                UnhealthyPackageRevision
    Status:                False
    Type:                  Healthy
  Controller Ref:
    Name:
Events:
  Type     Reason             Age                    From                                         Message
  ----     ------             ----                   ----                                         -------
  Normal   BindClusterRole    2m32s (x5 over 2m33s)  rbac/providerrevision.pkg.crossplane.io      Bound system ClusterRole to provider ServiceAccount(s)
  Normal   ApplyClusterRoles  2m32s (x6 over 2m33s)  rbac/providerrevision.pkg.crossplane.io      Applied RBAC ClusterRoles
  Warning  SyncPackage        2m32s (x2 over 2m32s)  packages/providerrevision.pkg.crossplane.io  cannot update annotations for package revision: Operation cannot be fulfilled on providerrevisions.pkg.crossplane.io "provider-civo-16d81d2b3a05": the object has been modified; please apply your changes to the latest version and try again
  Warning  SyncPackage        0s (x8 over 2m32s)     packages/providerrevision.pkg.crossplane.io  cannot establish control of object: providerconfigs.civo.crossplane.io is already controlled by ProviderRevision provider-civo-db35a300fd24 (UID 3679d415-d25e-47ae-94d0-1cd8ded4e1af)

Also tried to reapply the provider kubectl apply -f provider.yml

provider.yml

apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-civo
spec:
  package: crossplane/provider-civo:main ### <-- stick to version

BTW: tags for this repo would be a nice to have: Bildschirmfoto 2021-12-06 um 19 16 47 Source: https://crossplane.slack.com/archives/C01TRKD4623/p1638479006077500?thread_ts=1638398663.059000&cid=C01TRKD4623

exocode commented 2 years ago

And that is on a Civo cluster with Crossplane installed:


❯ kubectl crossplane install provider crossplane/provider-civo:main
provider.pkg.crossplane.io/provider-civo created

❯ kubectl get provider.pkg
NAME                  INSTALLED   HEALTHY   PACKAGE                               AGE
provider-kubernetes   True        True      crossplane/provider-kubernetes:main   2d23h
provider-civo         True        False     crossplane/provider-civo:main         5s

❯ k delete provider-kubernetes
error: the server doesn't have a resource type "provider-kubernetes"

    ~/Coding/RubymineProjects/metashop/devops/cp-civo/upbound    master ⇡1 !2 ────────────────────────────────────────────────────────────────────────────────────────────────────────── 3s   civo-demo-kubeconfig ⎈
❯ k delete provider/provider-kubernetes
provider.pkg.crossplane.io "provider-kubernetes" deleted

❯ kubectl get provider.pkg
NAME            INSTALLED   HEALTHY   PACKAGE                         AGE
provider-civo   True        False     crossplane/provider-civo:main   33s

❯ k describe provider-civo
error: the server doesn't have a resource type "provider-civo"

❯ k describe provider.pkg provider-civo
Name:         provider-civo
Namespace:
Labels:       <none>
Annotations:  <none>
API Version:  pkg.crossplane.io/v1
Kind:         Provider
Metadata:
  Creation Timestamp:  2021-12-06T20:18:23Z
  Generation:          1
  Managed Fields:
    API Version:  pkg.crossplane.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:spec:
        .:
        f:ignoreCrossplaneConstraints:
        f:package:
        f:packagePullPolicy:
        f:revisionActivationPolicy:
        f:revisionHistoryLimit:
        f:skipDependencyResolution:
    Manager:      kubectl-crossplane
    Operation:    Update
    Time:         2021-12-06T20:18:23Z
    API Version:  pkg.crossplane.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        .:
        f:conditions:
        f:currentIdentifier:
        f:currentRevision:
    Manager:         crossplane
    Operation:       Update
    Time:            2021-12-06T20:18:25Z
  Resource Version:  1140223
  UID:               d695a091-373e-4283-a0cc-2e02e6f0e5d0
Spec:
  Ignore Crossplane Constraints:  false
  Package:                        crossplane/provider-civo:main
  Package Pull Policy:            IfNotPresent
  Revision Activation Policy:     Automatic
  Revision History Limit:         0
  Skip Dependency Resolution:     false
Status:
  Conditions:
    Last Transition Time:  2021-12-06T20:18:26Z
    Reason:                UnhealthyPackageRevision
    Status:                False
    Type:                  Healthy
    Last Transition Time:  2021-12-06T20:18:24Z
    Reason:                ActivePackageRevision
    Status:                True
    Type:                  Installed
  Current Identifier:      crossplane/provider-civo:main
  Current Revision:        provider-civo-16d81d2b3a05
Events:
  Type     Reason                  Age                From                                 Message
  ----     ------                  ----               ----                                 -------
  Warning  InstallPackageRevision  56s (x3 over 58s)  packages/provider.pkg.crossplane.io  current package revision health is unknown
  Warning  InstallPackageRevision  56s (x2 over 56s)  packages/provider.pkg.crossplane.io  current package revision is unhealthy

❯ kubectl get providerrevision.pkg
NAME                         HEALTHY   REVISION   IMAGE                           STATE    DEP-FOUND   DEP-INSTALLED   AGE
provider-civo-16d81d2b3a05   False     1          crossplane/provider-civo:main   Active                               71s

❯ kubectl describe providerrevision.pkg provider-civo-16d81d2b3a05
Name:         provider-civo-16d81d2b3a05
Namespace:
Labels:       pkg.crossplane.io/package=provider-civo
Annotations:  descriptionShort:
                The Crossplane Civo provider enables management of managing resources on
                Civo cloud.
API Version:  pkg.crossplane.io/v1
Kind:         ProviderRevision
Metadata:
  Creation Timestamp:  2021-12-06T20:18:24Z
  Finalizers:
    revision.pkg.crossplane.io
  Generation:  1
  Managed Fields:
    API Version:  pkg.crossplane.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:descriptionShort:
        f:finalizers:
          .:
          v:"revision.pkg.crossplane.io":
        f:labels:
          .:
          f:pkg.crossplane.io/package:
        f:ownerReferences:
          .:
          k:{"uid":"d695a091-373e-4283-a0cc-2e02e6f0e5d0"}:
            .:
            f:apiVersion:
            f:blockOwnerDeletion:
            f:controller:
            f:kind:
            f:name:
            f:uid:
      f:spec:
        .:
        f:desiredState:
        f:ignoreCrossplaneConstraints:
        f:image:
        f:packagePullPolicy:
        f:revision:
        f:skipDependencyResolution:
      f:status:
        .:
        f:conditions:
        f:controllerRef:
          .:
          f:name:
    Manager:    crossplane
    Operation:  Update
    Time:       2021-12-06T20:18:26Z
  Owner References:
    API Version:           pkg.crossplane.io/v1
    Block Owner Deletion:  true
    Controller:            true
    Kind:                  Provider
    Name:                  provider-civo
    UID:                   d695a091-373e-4283-a0cc-2e02e6f0e5d0
  Resource Version:        1140219
  UID:                     0662cb10-ec40-48ed-bb8a-e9d685f25cac
Spec:
  Desired State:                  Active
  Ignore Crossplane Constraints:  false
  Image:                          crossplane/provider-civo:main
  Package Pull Policy:            IfNotPresent
  Revision:                       1
  Skip Dependency Resolution:     false
Status:
  Conditions:
    Last Transition Time:  2021-12-06T20:18:26Z
    Reason:                UnhealthyPackageRevision
    Status:                False
    Type:                  Healthy
  Controller Ref:
    Name:
Events:
  Type     Reason             Age                From                                         Message
  ----     ------             ----               ----                                         -------
  Warning  SyncPackage        91s                packages/providerrevision.pkg.crossplane.io  cannot update annotations for package revision: Operation cannot be fulfilled on providerrevisions.pkg.crossplane.io "provider-civo-16d81d2b3a05": the object has been modified; please apply your changes to the latest version and try again
  Normal   BindClusterRole    91s (x4 over 92s)  rbac/providerrevision.pkg.crossplane.io      Bound system ClusterRole to provider ServiceAccount(s)
  Normal   ApplyClusterRoles  90s (x3 over 91s)  rbac/providerrevision.pkg.crossplane.io      Applied RBAC ClusterRoles
  Warning  SyncPackage        1s (x6 over 91s)   packages/providerrevision.pkg.crossplane.io  cannot establish control of object: providerconfigs.civo.crossplane.io is already controlled by ProviderRevision provider-civo-db35a300fd24 (UID 3e366c6b-8b02-4a6e-8ff8-d42c5c091d74)

❯ kaf provider.yml
Warning: resource providers/provider-civo is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
provider.pkg.crossplane.io/provider-civo configured

And again describe:

❯ k describe provider.pkg provider-civo
Name:         provider-civo
Namespace:
Labels:       <none>
Annotations:  <none>
API Version:  pkg.crossplane.io/v1
Kind:         Provider
Metadata:
  Creation Timestamp:  2021-12-06T20:18:23Z
  Generation:          1
  Managed Fields:
    API Version:  pkg.crossplane.io/v1beta1
    Fields Type:  FieldsV1
    fieldsV1:
      f:spec:
        .:
        f:ignoreCrossplaneConstraints:
        f:package:
        f:packagePullPolicy:
        f:revisionActivationPolicy:
        f:revisionHistoryLimit:
        f:skipDependencyResolution:
    Manager:      kubectl-crossplane
    Operation:    Update
    Time:         2021-12-06T20:18:23Z
    API Version:  pkg.crossplane.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        .:
        f:conditions:
        f:currentIdentifier:
        f:currentRevision:
    Manager:      crossplane
    Operation:    Update
    Time:         2021-12-06T20:18:25Z
    API Version:  pkg.crossplane.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
    Manager:         kubectl-client-side-apply
    Operation:       Update
    Time:            2021-12-06T20:20:13Z
  Resource Version:  1140616
  UID:               d695a091-373e-4283-a0cc-2e02e6f0e5d0
Spec:
  Ignore Crossplane Constraints:  false
  Package:                        crossplane/provider-civo:main
  Package Pull Policy:            IfNotPresent
  Revision Activation Policy:     Automatic
  Revision History Limit:         0
  Skip Dependency Resolution:     false
Status:
  Conditions:
    Last Transition Time:  2021-12-06T20:18:26Z
    Reason:                UnhealthyPackageRevision
    Status:                False
    Type:                  Healthy
    Last Transition Time:  2021-12-06T20:18:24Z
    Reason:                ActivePackageRevision
    Status:                True
    Type:                  Installed
  Current Identifier:      crossplane/provider-civo:main
  Current Revision:        provider-civo-16d81d2b3a05
Events:
  Type     Reason                  Age                    From                                 Message
  ----     ------                  ----                   ----                                 -------
  Warning  InstallPackageRevision  3m40s (x3 over 3m42s)  packages/provider.pkg.crossplane.io  current package revision health is unknown
  Warning  InstallPackageRevision  113s (x3 over 3m40s)   packages/provider.pkg.crossplane.io  current package revision is unhealthy

  ❯ kubectl describe providerrevision.pkg provider-civo-16d81d2b3a05
Name:         provider-civo-16d81d2b3a05
Namespace:
Labels:       pkg.crossplane.io/package=provider-civo
Annotations:  descriptionShort:
                The Crossplane Civo provider enables management of managing resources on
                Civo cloud.
API Version:  pkg.crossplane.io/v1
Kind:         ProviderRevision
Metadata:
  Creation Timestamp:  2021-12-06T20:18:24Z
  Finalizers:
    revision.pkg.crossplane.io
  Generation:  1
  Managed Fields:
    API Version:  pkg.crossplane.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:descriptionShort:
        f:finalizers:
          .:
          v:"revision.pkg.crossplane.io":
        f:labels:
          .:
          f:pkg.crossplane.io/package:
        f:ownerReferences:
          .:
          k:{"uid":"d695a091-373e-4283-a0cc-2e02e6f0e5d0"}:
            .:
            f:apiVersion:
            f:blockOwnerDeletion:
            f:controller:
            f:kind:
            f:name:
            f:uid:
      f:spec:
        .:
        f:desiredState:
        f:ignoreCrossplaneConstraints:
        f:image:
        f:packagePullPolicy:
        f:revision:
        f:skipDependencyResolution:
      f:status:
        .:
        f:conditions:
        f:controllerRef:
          .:
          f:name:
    Manager:    crossplane
    Operation:  Update
    Time:       2021-12-06T20:18:26Z
  Owner References:
    API Version:           pkg.crossplane.io/v1
    Block Owner Deletion:  true
    Controller:            true
    Kind:                  Provider
    Name:                  provider-civo
    UID:                   d695a091-373e-4283-a0cc-2e02e6f0e5d0
  Resource Version:        1140219
  UID:                     0662cb10-ec40-48ed-bb8a-e9d685f25cac
Spec:
  Desired State:                  Active
  Ignore Crossplane Constraints:  false
  Image:                          crossplane/provider-civo:main
  Package Pull Policy:            IfNotPresent
  Revision:                       1
  Skip Dependency Resolution:     false
Status:
  Conditions:
    Last Transition Time:  2021-12-06T20:18:26Z
    Reason:                UnhealthyPackageRevision
    Status:                False
    Type:                  Healthy
  Controller Ref:
    Name:
Events:
  Type     Reason             Age                    From                                         Message
  ----     ------             ----                   ----                                         -------
  Warning  SyncPackage        3m27s                  packages/providerrevision.pkg.crossplane.io  cannot update annotations for package revision: Operation cannot be fulfilled on providerrevisions.pkg.crossplane.io "provider-civo-16d81d2b3a05": the object has been modified; please apply your changes to the latest version and try again
  Normal   BindClusterRole    3m27s (x4 over 3m28s)  rbac/providerrevision.pkg.crossplane.io      Bound system ClusterRole to provider ServiceAccount(s)
  Normal   ApplyClusterRoles  3m26s (x3 over 3m27s)  rbac/providerrevision.pkg.crossplane.io      Applied RBAC ClusterRoles
  Warning  SyncPackage        26s (x9 over 3m27s)    packages/providerrevision.pkg.crossplane.io  cannot establish control of object: providerconfigs.civo.crossplane.io is already controlled by ProviderRevision provider-civo-db35a300fd24 (UID 3e366c6b-8b02-4a6e-8ff8-d42c5c091d74)
exocode commented 2 years ago

Hi there, Its me again. the error above relied on the Upbound system:

https://crossplane.slack.com/archives/C01TRKD4623/p1638865981083700?thread_ts=1638398663.059000&cid=C01TRKD4623

and here: https://crossplane.slack.com/archives/C01TRKD4623/p1638871465084100?thread_ts=1638398663.059000&cid=C01TRKD4623

Yes the node-pools are now created as expected. BUT If you try to create first with count: 1 and then raise to count: 3 nothing happens.

So the scaling stil wont work.

Try for yourself: first apply that:

kind: CivoKubernetes
apiVersion: cluster.civo.crossplane.io/v1alpha1
metadata:
  name: test-crossplane
spec:
  name: test-crossplane
  pools:
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 1 ######
      size: g3.k3s.small
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 3 ######## 
      size: g3.k3s.medium
  applications:
    - "argo-cd"
    - "prometheus-operator"
  connectionDetails:
    connectionSecretNamePrefix: "cluster-details"
    connectionSecretNamespace: "default"
  providerConfigRef:
    name: civo-provider

then this:

kind: CivoKubernetes
apiVersion: cluster.civo.crossplane.io/v1alpha1
metadata:
  name: test-crossplane
spec:
  name: test-crossplane
  pools:
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 3 ##### RAISE
      size: g3.k3s.small
    - id: "8382e422-dcdd-461f-afb4-2ab67f171c3e"
      count: 1 ###### lower
      size: g3.k3s.medium
  applications:
    - "argo-cd"
    - "prometheus-operator"
  connectionDetails:
    connectionSecretNamePrefix: "cluster-details"
    connectionSecretNamespace: "default"
  providerConfigRef:
    name: civo-provider
exocode commented 2 years ago

hmm. somehow it's working at the moment 🎉 Thank you very much🙏🏻