Creates namespaces in RDB pools and configures storage classes for them.
  • Go 95.6%
  • Makefile 3.7%
  • Dockerfile 0.7%
Find a file
Adrian Noland b92199fd7c
All checks were successful
Main Branch Release / Test & Validate (push) Successful in 5m22s
Main Branch Release / Semantic Release & Publish (push) Successful in 11m1s
ci: bump semantic-version action to v6.0.2
2026-10-09 10:55:37 -05:00
.forgejo/workflows ci: bump semantic-version action to v6.0.2 2026-10-09 10:55:37 -05:00
apis ci: adding extra workflows 2026-10-09 10:05:19 -05:00
cmd/provider feat: scaffold provider-ceph-rbd-namespace controller and composite resource notes 2026-10-04 11:55:43 -05:00
docs feat: provision Ceph auth user with namespace caps, publish CSI secret, and add forceDelete to composite resource blueprint 2026-10-06 14:40:14 -05:00
examples ci: adding extra workflows 2026-10-09 10:05:19 -05:00
internal ci: adding extra workflows 2026-10-09 10:05:19 -05:00
package ci: adding extra workflows 2026-10-09 10:05:19 -05:00
.gitignore feat: scaffold provider-ceph-rbd-namespace controller and composite resource notes 2026-10-04 11:55:43 -05:00
.pre-commit-config.yaml ci: adding extra workflows 2026-10-09 10:05:19 -05:00
Dockerfile feat: scaffold provider-ceph-rbd-namespace controller and composite resource notes 2026-10-04 11:55:43 -05:00
go.mod feat: using GetOrCreate mechanics for users 2026-10-08 08:31:58 -05:00
go.sum feat: scaffold provider-ceph-rbd-namespace controller and composite resource notes 2026-10-04 11:55:43 -05:00
LICENSE Initial commit 2026-10-04 15:12:43 +00:00
Makefile ci: adding extra workflows 2026-10-09 10:05:19 -05:00
README.md ci: adding extra workflows 2026-10-09 10:05:19 -05:00

provider-ceph-rbd-namespace

provider-ceph-rbd-namespace is a Crossplane provider that manages Ceph RBD (RADOS Block Device) namespaces and scoped Ceph auth users via the Ceph REST API.

Features

  • RBD Namespace Lifecycle: Create, observe, and delete Ceph RBD namespaces in any Ceph block pool.
  • Ceph Client User & Auth Provisioning: Automatically generates a dedicated Ceph user (using the cluster name from ProviderConfig) with least-privilege profile rbd capabilities restricted to the specific pool and namespace.
  • Connection Secret Publishing: Publishes userID and userKey (auth key) to a Kubernetes Secret consumed directly by the Ceph-CSI Operator and StorageClass.
  • Ceph REST API Authentication: Manages authentication and session tokens against Ceph REST / Dashboard endpoints.
  • Forgejo CI/CD & OCI Packaging: Self-contained build pipeline for generating Crossplane .xpkg packages and controller container images hosted on git.tokentechnology.net.

Getting Started

Prerequisites

  • Go 1.24+
  • Docker or Podman
  • pre-commit
  • Kubernetes cluster with Crossplane v1.16+

Development & Pre-Commit Setup

This repository uses pre-commit to maintain code quality, formatting, schema generation cleanliness, and to enforce commit message standards.

To install the hooks into your local git repository:

pre-commit install --hook-type pre-commit --hook-type commit-msg

You can run the checks manually across all files at any time:

pre-commit run --all-files

Conventional Commits & Semantic Versioning

All commit messages must follow the Conventional Commits specification:

<type>(<scope>): <short summary>

[optional body]

[optional footer(s)]

How Automated Releases Work

When changes are merged into the main branch, the Forgejo Actions release pipeline automatically inspects the commit history since the last release tag to determine the next Semantic Version (vX.Y.Z):

Commit Type SemVer Component Description / Effect
feat: Minor (0.X.0) Introduces new functionality or resources
fix: Patch (0.0.X) Bug fixes, patch-level corrections
perf:, refactor: Patch (0.0.X) Performance or internal improvements
BREAKING CHANGE: or feat!: / fix!: Major (X.0.0) Breaking changes to API schemas or behavior
docs:, chore:, ci:, test: No release bump Non-release metadata or documentation changes

The pipeline then:

  1. Tags the commit with the calculated version (e.g. v0.2.0).
  2. Builds and pushes the controller container image and Crossplane .xpkg package tagged with both v0.2.0 and latest.
  3. Publishes a Forgejo release attaching the compiled .xpkg artifact.

Example

# 1. Start on a development feature branch
git checkout -b feat/add-quota-support

# 2. Make changes and commit using conventional commit syntax
git commit -m "feat(rbd): add namespace quota support"

# 3. Open a Pull Request targeting main (runs CI validation)
# 4. Once merged to main, the CI automatically tags v0.2.0 (if prior was v0.1.0),
#    pushes :v0.2.0 and :latest images, and creates the Forgejo release.

Building Locally

# Verify code generation and check for schema drift
make check-clean

# Run unit tests
make test

# Build controller binary
make build

# Build container image
make docker-build

# Build Crossplane .xpkg package
make xpkg-build

Cluster Installation

To install the provider onto a Crossplane-enabled Kubernetes cluster, apply the Provider resource:

apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-ceph-rbd-namespace
spec:
  package: git.tokentechnology.net/crossplane-contrib/provider-ceph-rbd-namespace:latest

(See examples/install/provider.yaml)

Quick Usage Example

  1. Create Provider Credentials & ProviderConfig:

    apiVersion: v1
    kind: Secret
    metadata:
      name: ceph-creds
      namespace: crossplane-system
    type: Opaque
    stringData:
      username: "admin"
      password: "secretpassword"
    ---
    apiVersion: ceph.tokentechnology.net/v1alpha1
    kind: ProviderConfig
    metadata:
      name: default
    spec:
      clusterName: "ceph"
      endpoint: "https://ceph-dashboard.storage.svc:8443"
      insecureSkipTLSVerify: true
      credentials:
        - source: Secret
          secretRef:
            namespace: crossplane-system
            name: ceph-creds
    
  2. Create an RBD Namespace:

    apiVersion: ceph.tokentechnology.net/v1alpha1
    kind: RBDNamespace
    metadata:
      name: tenant-a-rbd
    spec:
      forProvider:
        poolName: replicapool
        namespaceName: tenant-a
      providerConfigRef:
        name: default
      writeConnectionSecretToRef:
        name: tenant-a-csi-rbd-secret
        namespace: ceph-csi-operator-system
    

Upon creation, the controller:

  • Creates the tenant-a namespace in the replicapool pool.
  • Creates Ceph user client.csi-rbd-ceph-tenant-a with capabilities:
    • mon: profile rbd
    • osd: profile rbd pool=replicapool namespace=tenant-a
    • mgr: profile rbd pool=replicapool
  • Emits userID and userKey into the Secret tenant-a-csi-rbd-secret in namespace ceph-csi-operator-system for use by Ceph-CSI operator StorageClasses.

Composite Resource Architecture

For information on composing this provider with Ceph-CSI Operator resources (ClientProfile, StorageClass) using provider-kubernetes, see docs/composite-resource-notes.md.