CleverCloud / clever-operator

A kubernetes operator that expose clerver cloud's resources through custom resource definition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clever operator

Continuous integration

A kubernetes operator that exposes clever cloud's resources through custom resource definition

How it works

This project is based on the operator pattern to provide Custom Resources. Those resources will match Clever-Cloud's add-ons.

Status

The operator is under development, you can use it, but it may have bugs or unimplemented features. You could see missing features by checking issues with the label enhancement.

Install

There are multiple ways to install the operator, you can built it from sources and deploy it through your own registry or use an already built operator hosted on dockerhub or operatorhub.

From source

You will need some tools on your computer to build and deploy the operator, at least you will git, rust toolchain and docker. To deploy the operator, you will also need the kubectl command and a kubernetes cluster.

So, firstly, you will need to retrieve the source. You can clone them directly from GitHub using the following command.

$ git clone https://github.com/CleverCloud/clever-operator.git

or

$ gh repo clone CleverCloud/clever-operator

Then, you will need to go into the new created folder where are located the source code.

$ cd clever-operator

At this step, you can choose to build the binary and use it directly or build the docker image and push it to your registry and then deploy it into your kubernetes cluster.

Build the binary

To build the binary, you can use the following command:

$ make build

The operator binary will be located under the folder target/release/clever-operator. Then, you can run it.

$ target/release/clever-operator

Build the docker image and deploy it

To build the docker image, you can use the following command:

$ DOCKER_IMG=<your-registry>/<your-namespace>/clever-operator:latest make docker-build

Then, push it to your registry.

$ DOCKER_IMG=<your-registry>/<your-namespace>/clever-operator:latest make docker-push

Then, update the kubernetes deployment script located in deployments/kubernetes/v1.24.0/20-deployment.yaml to deploy your docker image in your kubernetes cluster. Finally, apply the deployment script.

$ make deploy-kubernetes

or

$ kubectl apply -f deployments/kubernetes/v1.24.0

From the helm chart

You can also use the available Helm chart. Configure the values.yaml file in deployments/kubernetes/helm with your own values, then run:

$ helm install clever-operator -n clever-operator --create-namespace -f values.yaml .

From dockerhub

The docker image will be provided by the dockerhub account of Clever-Cloud and you only need to apply the deployment script.

$ make deploy-kubernetes

or

$ kubectl apply -f https://raw.githubusercontent.com/CleverCloud/clever-operator/main/deployments/kubernetes/v1.24.0/10-custom-resource-definition.yaml
$ kubectl apply -f https://raw.githubusercontent.com/CleverCloud/clever-operator/main/deployments/kubernetes/v1.24.0/20-deployment.yaml

Configuration

Global

To work properly the operator need to be configured with at least credentials to connect the Clever Cloud's API. Those configurations could be provided through a ConfigMap, a Secret or by the environment.

Environment variables are:

Name Kind Default Required Description
CLEVER_OPERATOR_OPERATOR_LISTEN SocketAddress 0.0.0.0:7080 yes
CLEVER_OPERATOR_API_ENDPOINT Url https://api.clever-cloud.com yes
CLEVER_OPERATOR_API_SECRET String none yes
CLEVER_OPERATOR_API_TOKEN String none yes
CLEVER_OPERATOR_API_CONSUMER_KEY String none yes
CLEVER_OPERATOR_API_CONSUMER_SECRET String none yes
CLEVER_OPERATOR_SENTRY_DSN Url none no
CLEVER_OPERATOR_JAEGER_ENDPOINT Url none no
CLEVER_OPERATOR_JAEGER_USER String none no
CLEVER_OPERATOR_JAEGER_PASSWORD String none no

By default, if the --config flag is not provided to the binary, the operator will look at the following paths to retrieve its configuration:

  • /usr/share/clever-operator/config.{toml,yaml,json}
  • /etc/clever-operator/config.{toml,yaml,json}
  • $HOME/.config/clever-operator/config.{toml,yaml,json}
  • $HOME/.local/share/clever-operator/config.{toml,yaml,json}
  • config.{toml,yaml,json}

Namespace

It is possible to override configuration to connect the Clever Cloud's api through a Secret named clever-operator and using the config key. Only available configuration keys are api and proxy from the Configuration.

License

See the license.

Getting in touch

About

A kubernetes operator that expose clerver cloud's resources through custom resource definition

License:MIT License


Languages

Language:Rust 91.1%Language:Dockerfile 6.1%Language:Makefile 2.7%Language:Smarty 0.1%