crossplane-contrib / provider-jet-equinix

Crossplane Provider for Equinix Metal, Fabric, and Network Edge
https://marketplace.upbound.io/providers/equinix/provider-jet-equinix/
Apache License 2.0
8 stars 4 forks source link

fix provider definition #59

Closed displague closed 3 months ago

displague commented 4 months ago

Description of your changes

Fixes #56

reproducing the stack traces is possible with minimal setup (and no real account/creds needed):

# from a kind cluster with crossplane installed
$ cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-jet-equinix
spec:
  package: xpkg.upbound.io/equinix/provider-jet-equinix:v0.8.0
  runtimeConfigRef:
    name: no-replicas
---
apiVersion: v1
kind: Secret
metadata:
  name: example-equinix-creds
  namespace: crossplane-system
type: Opaque
stringData:
  credentials: |
    {
      "client_id": "",
      "client_secret": "",
      "auth_token": "fake-token",
      "request_timeout": "30",
      "response_max_page_size": "100",
      "endpoint": "https://api.equinix.com"
    }
---
apiVersion: equinix.jet.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
  name: default
spec:
  credentials:
    source: Secret
    secretRef:
      name: example-equinix-creds
      namespace: crossplane-system
      key: credentials
---
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
  name: no-replicas
spec:
  deploymentTemplate:
    spec:
      replicas: 0
      selector: {}
      template: {}
EOF
# from a checkout of this branch
tilt up
$ cat <<EOF | kubectl apply -f -
apiVersion: metal.equinix.jet.crossplane.io/v1alpha1
kind: Project
metadata:
 name: upjet-example-project
spec:
 forProvider:
   name: upjet-example-project
 providerConfigRef:
   name: default
EOF

Monitor the tilt output.

v1beta1 providerconfig is also added because it is the upstream default and allows us to remove some code. I don't think this change is required other than for the reduction of a few lines of provider setup code.

Fixes #

I have:

How has this code been tested

displague commented 3 months ago

Currently failing repeatedly for all resources (as seen with tilt up / make run):

crossplane-p… │ goroutine 882 [running]:
crossplane-p… │ k8s.io/apimachinery/pkg/util/runtime.logPanic({0x254c0e0, 0x43630a0})
crossplane-p… │     k8s.io/apimachinery@v0.29.1/pkg/util/runtime/runtime.go:75 +0x85
crossplane-p… │ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
crossplane-p… │     sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:108 +0xb2
crossplane-p… │ panic({0x254c0e0?, 0x43630a0?})
crossplane-p… │     runtime/panic.go:770 +0x132
crossplane-p… │ github.com/crossplane/upjet/pkg/terraform.(*WorkspaceStore).Workspace(0x0, {0x2dab560, 0xc000ab1030}, {0x2d93ed0, 0xc0019955f0}, {0x72698216d2f8, 0xc000a0d208}, {{0xc000058072, 0x5}, {{0xc00005e16a, ...}, ...}, ...}, ...)
crossplane-p… │     github.com/crossplane/upjet@v1.4.0/pkg/terraform/store.go:220 +0x5d
crossplane-p… │ github.com/crossplane/upjet/pkg/controller.(*Connector).Connect(0xc0009dc540, {0x2dab560, 0xc000ab1030}, {0x2dd27c0, 0xc000a0d208})
crossplane-p… │     github.com/crossplane/upjet@v1.4.0/pkg/controller/external.go:116 +0x1a2
crossplane-p… │ github.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*NopDisconnecter).Connect(0xc0009e4430?, {0x2dab560?, 0xc000ab1030?}, {0x2dd27c0?, 0xc000a0d208?})
crossplane-p… │     github.com/crossplane/crossplane-runtime@v1.16.0/pkg/reconciler/managed/reconciler.go:246 +0x2f
crossplane-p… │ github.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile(0xc0009d6a00, {0x2dab4b8, 0xc000cebb90}, {{{0x0, 0x0}, {0xc0009823d8, 0x16}}})
crossplane-p… │     github.com/crossplane/crossplane-runtime@v1.16.0/pkg/reconciler/managed/reconciler.go:892 +0x1e6b
crossplane-p… │ github.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile(0xc00017e140, {0x2dab4b8, 0xc000cebb90}, {{{0x0?, 0x5?}, {0xc0009823d8?, 0xc000b5ed10?}}})
crossplane-p… │     github.com/crossplane/crossplane-runtime@v1.16.0/pkg/ratelimiter/reconciler.go:54 +0x151
crossplane-p… │ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x2db26e0?, {0x2dab4b8?, 0xc000cebb90?}, {{{0x0?, 0xb?}, {0xc0009823d8?, 0x0?}}})
crossplane-p… │     sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:119 +0xb7
crossplane-p… │ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0009e83c0, {0x2dab4f0, 0xc000183b30}, {0x2638000, 0xc000c99ea0})
crossplane-p… │     sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:316 +0x3bc
crossplane-p… │ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0009e83c0, {0x2dab4f0, 0xc000183b30})
crossplane-p… │     sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:266 +0x1be
crossplane-p… │ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
crossplane-p… │     sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:227 +0x79
crossplane-p… │ created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 239
crossplane-p… │     sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:223 +0x50c
crossplane-p… │ 2024-07-23T20:26:53-04:00   ERROR   Reconciler error    {"controller": "managed/metal.equinix.jet.crossplane.io/v1alpha1, kind=vlan", "namespace": "", "name": "vrf-via-crossplane-xrd", "reconcileID": "a272b3c1-71ce-43de-8d15-c92a22480125", "error": "panic: runtime error: invalid memory address or nil pointer dereference [recovered]"}
crossplane-p… │ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
crossplane-p… │     sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:329
crossplane-p… │ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
crossplane-p… │     sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:266
crossplane-p… │ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
crossplane-p… │     sigs.k8s.io/controller-runtime@v0.17.0/pkg/internal/controller/controller.go:227
crossplane-p… │ E0723 20:26:53.718234 2324822 runtime.go:79] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)