Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

104 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

butane-operator

CodeQL OpenSSF Scorecard

Description

The Butane Operator is a Kubernetes operator that automates the conversion of Butane configuration files from specific CRD into Ignition configurations into a secret. For example to give this secret to a KubeVirt CoreOS Machine. The operator watches for custom ButaneConfig resources and automatically translates them into Ignition JSON, storing the results in Kubernetes secrets for secure and easy access.

Butane is a tool that simplifies the creation of Ignition files, which are essential for provisioning CoreOS-based systems.

Documenations Links : Butane | Ignition

Features

  • Automatic Conversion: Watches for ButaneConfig custom resources and automatically converts them to Ignition configurations.
  • Secure Storage: Stores the resulting Ignition JSON in Kubernetes secrets.
  • Kubernetes-Native: Leverages Kubernetes' native capabilities for managing and storing configurations.
  • Extensible: Can be extended to support additional features or custom workflows.

Usage

Create a ButaneConfig Resource:

Define your Butane configuration in a YAML file and apply it to your cluster.

apiVersion: butane.operators.naval-group.com/v1alpha1
kind: ButaneConfig
metadata:
  name: my-butane-config
  namespace: default
spec:
  config:
    variant: fcos
    version: 1.5.0
    storage:
      files:
        - path: /etc/motd
          contents:
            inline: |
              Hello, CoreOS!

Apply the resource:

kubectl apply -f my-butane-config.yaml

Check the Generated Secret: The operator will generate a Kubernetes secret containing the Ignition configuration.

kubectl get secret my-butane-config-ignition -o yaml

You can directly use secret inside KubeVirt VirtualMachine

apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  name: my-fcos
spec:
  runStrategy: Always
  template:
    spec:
      domain:
        devices:
          disks:
            - name: containerdisk
              disk:
                bus: virtio
            - name: cloudinitdisk
              disk:
                bus: virtio
          rng: {}
        resources:
          requests:
            memory: 2048M
      volumes:
        - name: containerdisk
          containerDisk:
            image: quay.io/fedora/fedora-coreos-kubevirt:stable
            imagePullPolicy: Always
        - name: cloudinitdisk
          cloudInitConfigDrive:
            secretRef:
              name: my-butane-config-ignition

Getting Started

Prerequisites

  • go version v1.22.0+
  • docker version 17.03+ (or podman)
  • kubectl version v1.11.3+
  • Access to a Kubernetes v1.11.3+ cluster

Quick Install

Install the latest version directly from GitHub:

kubectl apply -f https://github.com/naval-group/butane-operator/releases/latest/download/install.yaml

Or install a specific version:

kubectl apply -f https://github.com/naval-group/butane-operator/releases/download/v0.0.1/install.yaml

To Deploy on the cluster (from source)

Build and push your image to the location specified by IMG:

make docker-build docker-push IMG=ghcr.io/naval-group/butane-operator:tag

NOTE: This image ought to be published in the registry you specified. And it is required to have access to pull the image from the working environment. Make sure you have the proper permission to the registry if the above commands don't work.

Install the CRDs into the cluster:

make install

Deploy the Manager to the cluster with the image specified by IMG:

make deploy IMG=ghcr.io/naval-group/butane-operator:tag

NOTE: If you encounter RBAC errors, you may need to grant yourself cluster-admin privileges or be logged in as admin.

Create instances of your solution

You can apply the samples (examples) from the examples folder:

kubectl apply -k examples/

NOTE: See the examples directory for various use cases including:

  • Basic MOTD configuration
  • Systemd service management
  • User management with SSH keys
  • Docker Compose deployment
  • Network configuration

To Uninstall

Delete the instances (CRs) from the cluster:

kubectl delete -k examples/

Delete the APIs(CRDs) from the cluster:

make uninstall

UnDeploy the controller from the cluster:

make undeploy

Project Distribution

Following are the steps to build the installer and distribute this project to users.

  1. Build the installer for the image built and published in the registry:
make build-installer IMG=ghcr.io/naval-group/butane-operator:v0.0.1

NOTE: The makefile target mentioned above generates an install.yaml file in the dist directory. This file contains all the resources built with Kustomize, which are necessary to install this project without its dependencies.

  1. Using the installer

Users can install the project directly from GitHub releases:

# Install latest release
kubectl apply -f https://github.com/naval-group/butane-operator/releases/latest/download/install.yaml

# Or install a specific version
kubectl apply -f https://github.com/naval-group/butane-operator/releases/download/v0.0.1/install.yaml

Container Images

Official container images are available at:

ghcr.io/naval-group/butane-operator:latest
ghcr.io/naval-group/butane-operator:v0.0.1

Images are signed with cosign. Verify with:

cosign verify ghcr.io/naval-group/butane-operator:v0.0.1 \
  --certificate-identity-regexp="https://github.com/naval-group/butane-operator" \
  --certificate-oidc-issuer="https://token.actions.githubusercontent.com"

Examples

Comprehensive examples are available in the examples/ directory:

See the examples README for detailed usage instructions.

Contributing

Contributions are welcome! Please see our Contributing Guide for details on:

  • Development setup and workflow
  • Coding standards and best practices
  • Testing requirements
  • Submitting pull requests
  • Reporting issues and feature requests

NOTE: Run make help for more information on all potential make targets

Resources

License

This project is licensed under the LGPL-3.0-or-later - see the LICENSE file for details.

About

Butane Operator is a Kubernetes operator that automates the conversion of Butane configuration files from specific CRD into Ignition configurations into a secret.

Resources

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages