cocoon-common

module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT

README

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

meta

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:

  1. KUBECONFIG
  2. ~/.kube/config
  3. 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
Project Role
cocoon-operator CocoonSet and Hibernation controllers
cocoon-webhook Admission webhook for sticky scheduling
epoch Snapshot registry and storage backend
glance Browser dashboard for Cocoon VMs
vk-cocoon Virtual kubelet provider

License

MIT

Directories

Path Synopsis
Package log provides a shared log initialization function for cocoonstack projects.
Package log provides a shared log initialization function for cocoonstack projects.
Package meta defines shared metadata keys and naming rules used across Cocoon controllers, webhooks, dashboards, and providers.
Package meta defines shared metadata keys and naming rules used across Cocoon controllers, webhooks, dashboards, and providers.

Jump to

Keyboard shortcuts

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