cocoon-common
Shared Go packages for cocoonstack services.
Overview
meta -- shared annotation keys, label keys, toleration keys, and VM naming rules
k8s -- Kubernetes client config bootstrap with the standard kubeconfig fallback chain
log -- common log setup for cocoonstack binaries using projecteru2/core/log
This repository keeps cross-project contracts in one place instead of re-exporting them from cocoon-operator. cocoon-operator, cocoon-webhook, glance, and vk-cocoon all consume the same package set directly.
Installation
Add dependency
go get github.com/cocoonstack/cocoon-common@latest
Build from source
git clone https://github.com/cocoonstack/cocoon-common.git
cd cocoon-common
make build
Packages
Use meta for:
- Cocoon annotation and label constants
- stable VM naming helpers
- slot extraction and role inference
- toolbox connection type detection
k8s
Use k8s.LoadConfig() to resolve cluster configuration from:
KUBECONFIG
~/.kube/config
- in-cluster config
log
Use log.Setup(ctx, envVar) to initialize the shared logger from an environment variable, defaulting to info.
Development
make build # build all packages
make test # run tests with coverage
make lint # run golangci-lint
make fmt # format code
make help # show all targets
License
MIT