Skip to content

exoscale/provider-exoscale

Repository files navigation

Provider Exoscale

provider-exoscale is a Crossplane provider that is built using Upjet code generation tools and exposes XRM-conformant managed resources for the Exoscale API.

It enables you to manage Exoscale cloud infrastructure declaratively from Kubernetes using the Crossplane ecosystem. Define compute instances, managed databases, network resources, and more as Kubernetes custom resources, and let Crossplane handle provisioning and lifecycle management.

Supported Resources

Category Resources
Compute Instance, InstancePool, SKSCluster, SKSNodepool, SecurityGroup, SecurityGroupRules, SSHKey, ElasticIP, PrivateNetwork, NLB, NLBService, BlockStorageVolume, AntiAffinityGroup
Database (DBaaS) DBAASService (PostgreSQL, MySQL, Kafka, OpenSearch, Grafana, Valkey), DBAASUserPG, DBAASDatabasePG, DBAASUserMySQL, DBAASDatabaseMySQL, DBAASUserKafka, DBAASUserOpenSearch
IAM IAMRole, IAMAPIKey, IAMOrgPolicy

Getting Started

Prerequisites

  • An existing Kubernetes cluster
  • kubectl installed and configured
  • Helm installed
  • An Exoscale account with API credentials

Install Crossplane

$> helm repo add crossplane-stable https://charts.crossplane.io/stable
$> helm repo update

$> helm install crossplane crossplane-stable/crossplane \
   --namespace crossplane-system \
   --create-namespace

$> kubectl wait deployment crossplane \
   --namespace crossplane-system \
   --for=condition=Available \
   --timeout=120s

Install the Exoscale Provider

$> cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-exoscale
spec:
  package: xpkg.upbound.io/exoscale/provider-exoscale:<latest-version>
EOF

$> kubectl wait provider provider-exoscale \
   --for=condition=Healthy \
   --timeout=120s

Verify the installation:

$> kubectl get providers
$> kubectl get crds | grep exoscale

Configure the Provider

Create an IAM API Key in the Exoscale console, then configure the provider with your credentials:

$> export EXOSCALE_API_KEY=<your-api-key>
$> export EXOSCALE_API_SECRET=<your-api-secret>

$> kubectl create secret generic exoscale-credentials \
   --namespace crossplane-system \
   --from-literal=credentials="{\"key\": \"$EXOSCALE_API_KEY\", \"secret\": \"$EXOSCALE_API_SECRET\"}"

$> cat <<EOF | kubectl apply -f -
apiVersion: exoscale.m.exoscale.ch/v1beta1
kind: ClusterProviderConfig
metadata:
  name: default
spec:
  credentials:
    source: Secret
    secretRef:
      name: exoscale-credentials
      namespace: crossplane-system
      key: credentials
EOF

Create Your First Resource

Once the provider is configured, you can start provisioning Exoscale resources. Ready-to-use examples for every supported resource are available in the examples/namespaced/ directory.

Monitor the status of your managed resources:

$> watch kubectl get managed -A

To create an instance:

$> kubectl apply -f examples/namespaced/compute/v1alpha1/instance.yaml
$> kubectl wait instance.compute.exoscale.m.exoscale.ch/my-instance \
   --namespace crossplane-system \
   --for=condition=Ready \
   --timeout=120s

$> VM_PUBLIC_IP=$(kubectl get instance.compute.exoscale.m.exoscale.ch/my-instance -n crossplane-system -o json | jq '.status.atProvider.publicIpAddress' -r)
$> watch curl $VM_PUBLIC_IP ## might need 1-2 min

## clean up
$> kubectl delete -f examples/namespaced/compute/v1alpha1/instance.yaml

Developing

Based on the Upjet documentation.

Run the code-generation pipeline:

$> make generate

Run the provider locally against an existing Kubernetes cluster:

$> make run

Check deployed resources:

$> watch kubectl get managed -A

Updating Examples and Tests

When making changes to resource definitions in the apis/ directory (e.g. adding a new resource, renaming a field, or changing defaults), make sure to:

  1. Update the corresponding example manifests in examples/namespaced/ so they stay in sync with the current API schema.
  2. Review and update the end-to-end test manifests in cluster/test/ to cover the changes. These manifests are used by make e2e and must reflect the latest resource specifications.

Don't forget to describe your changes in the release note

End-to-End Tests

$> export EXOSCALE_API_KEY=<your-api-key>
$> export EXOSCALE_API_SECRET=<your-api-secret>

$> mkdir -p .work
$> cat > .work/uptest_datasource.yaml << EOF
zone: ch-gva-2
suffix: local
EOF

$> make e2e \
   PROVIDER_NAME=provider-exoscale \
   UPTEST_EXAMPLE_LIST=$(find cluster/test/*/*.yaml | tr '\n' ',') \
   UPTEST_CLOUD_CREDENTIALS="{\"key\": \"$EXOSCALE_API_KEY\", \"secret\": \"$EXOSCALE_API_SECRET\"}" \
   UPTEST_DATASOURCE_PATH=./.work/uptest_datasource.yaml

Report a Bug

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