Skip to content

A Kubernetes operator to create and maintain highly-available Xrootd clusters

License

Notifications You must be signed in to change notification settings

xrootd/xrootd-k8s-operator

Repository files navigation

Xrootd Operator

Xrootd operator CI Xrootd operator OLM
GitHub release (latest by date) Go Report Card codecov

A Kubernetes operator to deploy Xrootd at scale, in order to ease and fully automate deployment and management of XRootD clusters.

Installation

Prerequisites

  • Docker
  • kubectl
  • Access to a Kubernetes cluster:
    • For production, use bare-metal clusters or public cloud platforms.
    • For development, use local K8S Cluster
  • Configure kubectl to use relevant K8S Cluster

Using OLM (Recommended)

  • Browse operatorhub.io and install xrootd-operator.
  • Click on the "Install" button and follow the instructions.

Using Deploy script (Alternative)

  • You can also install the operator using a release script, downloadable as an asset with each release.
  • Either:
    • Download the script, install.sh, manually and run it in a shell.
    • Run the script directly in bash:
    OP_VERSION=0.2.1 # specify the intended version here
    bash <(curl -L https://github.com/xrootd/xrootd-k8s-operator/releases/download/$OP_VERSION/install.sh)

Development

Prerequisites

Build operator

  • Run make manager to locally build operator binary and make run to run it against the configured Kubernetes cluster.
  • Run make build to build operator image from scratch and loads it in the k8s cluster.
  • The build command can be configured with the cluster's name and provider to target where the built operator image will be loaded. Set the following environment variables:
    • CLUSTER_PROVIDER=(kind/k3s/minishift)
    • CLUSTER_NAME=<cluster name>

Install operator

  • Run make deploy to deploy the operator image in the cluster, along with applying the required roles, service accounts etc.
  • To uninstall the CRDs, run make uninstall. To cleanup everything, including the operator deployment, run make undeploy.

Bundle

Xrootd Operator is integrated with OLM and configured to use Bundle format.

  • To generate OLM CSV manifests and bundle metadata, run make bundle.
  • To build the operator bundle image, run make bundle-build.

Testing

  • Unit Tests: Run the unit tests with make test.
  • Integration Tests: Run the suite of e2e tests with make test-e2e.

OpenShift Cluster

  • For local development, it's recommended to use CodeReady Containers since it supports Openshift v4+. Minishift is a suitable alternative, however it only supports till OpenShift v3.
  • To test operator via scripted approach, make deploy works.
  • To test operator using OLM, follow testing guide for deployment using custom images.

    TODO: Testing bundles is still not officially supported.

NOTE: Minishift uses Kubernetes v1.11.x, so it only supports till OLM v0.14.x (because later OLM versions uses apiextensions.k8s.io/v1 for CRD manifests)


Usage

  • Make sure the xrootd-operator is up and runnning in your K8S cluster (otherwise follow Installation/Development steps):
    • To check the status, run kubectl describe pod -l name=xrootd-operator
  • Example manifests to deploy Xrootd instance are at manifests folder.
  • To apply any manifest, simply use kubectl apply:
    • For example, to apply base sample manifest, run kubectl apply -k manifests/base

Troubleshooting

  • Check operator logs: kubectl logs -l name=xrootd-operator
  • Create issue and if needed, provide operator logs too.

Useful Links