compose-operator

command module
v0.0.0-...-5aaaf02 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: MIT Imports: 11 Imported by: 0

README

Compose-operator

PoC of trying to handle compose-spec "as-is" inside Kubernetes using an Operator.

All boilerplate/utilities is generated using operator-framework for convenience, but everything could be done without if necessary.

Most of the logic is located at reconcile loop in compose_controller.go

Usage

Install CRD
make deploy

Note: You can check if it runs correctly by looking at the following namespace.

k get pod -n compose-operator-system
NAME                                                   READY   STATUS    RESTARTS   AGE
compose-operator-controller-manager-594654d948-w6ls4   2/2     Running   0          9m33s
Create one Compose resource

k8s.compose.yaml

apiVersion: docker.com/v1alpha1
kind: Compose
metadata:
  name: test-compose
spec:
  spec: |
    name: maxcleme
    services:
      api:
        image: nginx:latest
        deploy:
          replicas: 5
      unknown:
        image: nginx:latest
        deploy:
          replicas: 2
k apply -f k8s.compose.yaml
k get pods -l project=maxcleme
NAME                                        READY   STATUS    RESTARTS   AGE
compose-maxcleme-api-67556d789d-98s5q       1/1     Running   0          11m
compose-maxcleme-api-67556d789d-bcrdk       1/1     Running   0          11m
compose-maxcleme-api-67556d789d-gplpm       1/1     Running   0          11m
compose-maxcleme-api-67556d789d-gq7qm       1/1     Running   0          11m
compose-maxcleme-api-67556d789d-t7zd4       1/1     Running   0          11m
compose-maxcleme-unknown-5d75546f7d-dkvbn   1/1     Running   0          11m
compose-maxcleme-unknown-5d75546f7d-xs5rl   1/1     Running   0          11m

Limitation

For PoC sake, it only handles adding/removing services and replicas numbers.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the docker.com v1alpha1 API group +kubebuilder:object:generate=true +groupName=docker.com
Package v1alpha1 contains API Schema definitions for the docker.com v1alpha1 API group +kubebuilder:object:generate=true +groupName=docker.com

Jump to

Keyboard shortcuts

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