Skip to content

Latest commit

 

History

History
83 lines (61 loc) · 4.96 KB

File metadata and controls

83 lines (61 loc) · 4.96 KB

Next Build Status Release Build Status

Kubernetes Image Puller Operator

Contribute

An operator to install, configure, and manage a kubernetes-image-puller deployment.

The kubernetes-image-puller creates daemonsets that will run a list of images on your cluster, allowing Eclipse Che to start workspaces faster, because those images have been pre-pulled. For more information about the kubernetes-image-puller, consult the kubernetes-image-puller README.

The operator provides a KubernetesImagePuller custom resource definition (CRD) to install and configure a kubernetes-image-puller instance.

Example Custom Resource

apiVersion: che.eclipse.org/v1alpha1
kind: KubernetesImagePuller
metadata:
  name: image-puller
spec:
  deploymentName: kubernetes-image-puller # the name of the deployment the operator creates
  configMapName: k8s-image-puller # the name of the configmap the operator creates
  daemonsetName: k8s-image-puller # the name of subsequent daemonsets created by the kubernetes-image-puller
  images: >- # the list of images to pre-pull
  	che-theia=quay.io/eclipse/che-theia:next;java11-maven=quay.io/eclipse/che-java11-maven:nightly
  cachingIntervalHours: '2' # number of hours between health checks
  cachingMemoryRequest: '10Mi' # the memory request for each pre-pulled image
  cachingMemoryLimit: '20Mi' # the memory limit for each pre-pulled image
  nodeSelector: '{}' # node selector applied to pods created by the daemonset

Installing The Operator

Installing on OperatorHub

Installing Manually

kubectl apply -f deploy/
kubectl apply -f deploy/crds/

Development

Prequisites

  • Go >=1.15
  • Operator SDK v0.19.4 (recommended)

Building

operator-sdk build quay.io/eclipse/kubernetes-image-puller-operator:tag

Testing

go test -v ./pkg... ./cmd...

Releasing a new version of the operator to OperatorHub

A quirk of this project is that while the repository is named kubernetes-image-puller-operator, the operator bundle on OperatorHub is named kubernetes-imagepuller-operator. This was caused by the previous version of OLM deployment that required a Quay.io Application.

  1. Change the version in version/version.go to match your new operator bundle version. If your new bundle is v0.5.1, for example, this is what the Version var should be in version/version.go.
  2. Make a directory in deploy/olm-catalog/kubernetes-imagepuller-operator/VERSION
  3. Run operator-sdk generate k8s and operator-sdk generate crds --crd-version=v1
  4. Copy a previous version of kubernetes-imagepuller-operator.vX.X.X.clusterserviceversion.yaml to the new folder you made in step 2
  5. Edit the new kubernetes-imagepuller-operator.vX.X.X.clusterserviceversion.yaml and change the following fields:
  • name - replace the verison tag to the new version
  • containerImage: replace the version tag to the new version
  • version: replace to the new version
  • replaces: replace the version tag to the previous version that this one is intended to replace
  • deployments.spec.template.spec.containers[0].image: replace the image tag with the new version
  1. Copy the crd generated by operator-sdk generate crds into deploy/olm-catalog/kubernetes-imagepuller-operator/VERSION
  2. Update deploy/olm-catalog/kubernetes-imagepuller-operator/kubernetes-imagepuller-operator.package.yaml to reference the newly-created version

You now have a new version of the CSV and CRD, and can open a PR to kubernetes-image-puller-operator to keep everything in sync.

Then, to see these changes on OperatorHub:

  1. Clone the community-operators and community-operators-prod repositories.
  2. Copy deploy/olm-catalog/kubernetes-imagepuller-operator/ to the kubernetes-imagepuller-operator folder of those repositories.
  3. Optionally run some tests to confirm your changes are good (see testing operators)
  4. Open two separate pull requests to community-operators and community-operators-prod repositories. Examples of the PRs: