digitalocean-floating-ip-controller

command module
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 12 Imported by: 0

README

digitalocean-floating-ip-controller

Assigns Kubernetes nodes to Digitalocean floating IPs

This project is intended to be run as a Kubernetes pod inside a DOKS (DigitalOcean Kubernetes) cluster.

It was inspired by a similar bash controller by @mwthink.

Getting Started

The controller will assign a Kubernetes node to a floating IP using the DigitalOcean API. A Custom Resource Definition called a FloatingIPBinding is created for each floating IP that should be managed by the controller.

apiVersion: digitalocean.smirlwebs.com/v1beta1
kind: FloatingIPBinding
metadata:
  name: main
spec:
  floatingIP: 123.10.10.10
  nodeSelectorPolicy: Newest
  nodeSelector:
    matchLabels:
      role: ingres

Full CRD API docs can be found at docs.crds.dev.

Node Selection

By default the Newest of all nodes is assigned to the floating IP as the controller watches Nodes as well as FloatingIPBinding. This can be changed by specifying a nodeSelector and/or a nodeSelectorPolicy in the object.

Currently supported policies are:

  • Newest (default) - The newest node matching the selector
  • Oldest - The oldest node matching the selector
  • Random - A random node matching the selector

Controller Deployment

Installation

The controller can be deployed from this repo with:

IMG=ghcr.io/smirl/digitalocean-floating-ip-controller:v0.1.0 make deploy
Controller Configuration

You must provide the following as environment variables:

  • DO_TOKEN
    • DigitalOcean API token

This is taken from a secret called do-floating-ip-controller which must be added to the cluster.

Contributing

Please feel free to raise an issue or pull request. Releases automatically build and deploy to a test cluster. The github workflow requires the ServiceAccount to be deployed into the cluster and the token added as a repository secret.

kubectl apply -f serviceaccount.yaml

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
apis
digitalocean/v1beta1
Package v1beta1 contains API Schema definitions for the digitalocean v1beta1 API group +kubebuilder:object:generate=true +groupName=digitalocean.smirlwebs.com
Package v1beta1 contains API Schema definitions for the digitalocean v1beta1 API group +kubebuilder:object:generate=true +groupName=digitalocean.smirlwebs.com
controllers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL