Skip to content

Crossplane provider for gridscale generated with Upjet from terraform-provider-gridscale

License

Notifications You must be signed in to change notification settings

dNationCloud/provider-gridscale

Repository files navigation

Provider gridscale

CI GitHub tag Go Report Card Contributors

Overview

The provider-gridscale is a Crossplane provider that is built using Upjet code generation tools from terraform-provider-gridscale and exposes XRM-conformant managed resources for the gridscale API.

Getting Started

Install the provider by using the following command after changing the image tag to the latest tag:

up ctp provider install registry.dnation.cloud/crossplane/provider-gridscale:vX.Y.Z --name provider-gridscale

Alternatively, you can use declarative installation:

cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-gridscale
spec:
  package: registry.dnation.cloud/crossplane/provider-gridscale:vX.Y.Z
  runtimeConfigRef:
    name: enable-debug
---
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
  name: enable-debug
spec:
  deploymentTemplate:
    spec:
      selector: {}
      template:
        spec:
          containers:
          - name: package-runtime
            args:
            - --debug
EOF

Notice that in this example Provider resource is referencing DeploymentRuntimeConfig with debug enabled.

You can see the API reference here.

Configuration

# Providerconfig that referers to the secret
apiVersion: gridscale.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
  name: default
spec:
  credentials:
    source: Secret
    secretRef:
      name: example-creds
      namespace: crossplane-system
      key: credentials
---
# Secret that stores credentials
apiVersion: v1
kind: Secret
metadata:
  name: example-creds
  namespace: crossplane-system
type: Opaque
stringData:
  credentials: |
    {
      "token": "my-token",
      "uuid": "my-uuid"
    }

The secret key must contain a json dictionary that provides the authentication data. You can create the secret via this command:

kubectl create secret generic example-creds --from-file=credentials=credentials.json --namespace crossplane-system

// credentials.json
{
  "token": "my-token",
  "uuid": "my-uuid",
}

If the URL for the gridscale API is different from https://api.gridscale.io, you can set it via api_url.

Developing

Install the required submodules to build and run:

make submodules

Apply the Current CRDs and a providerConfig:

kubectl apply -f package/crds
kubectl apply -f examples/providerconfig/

Run against a Kubernetes cluster:

make run

Run code-generation pipeline:

make generate

Prepare for code review:

make reviewable

Build binary:

make build

Report a Bug

For filing bugs, suggesting improvements, or requesting new features, please open an issue.