Skip to content

enonic/xp-operator

Repository files navigation

Enonic XP Kubernetes Operator

The Enonic XP Kubernetes Operator is a piece of software runs on top of Kubernetes to help you manage your XP deployments.

Documentation

The official documentation is available on the Developer portal: https://developer.enonic.com/docs/kubernetes-operator-for-xp

Contents of this repository

This repository contains these various parts relating to the operator:

Development

Requirements for local development

Building operator

make build

Running and installing operator to kind cluster

Simply run:

make test
...
...
# Cluster setup done!

Then verify the operator is running:

make verify-kind
{
  "gitCommit": "2a2abb974a0c8ae75a23d79ed02236df1b04cc15",
  "gitTags": "",
  "buildDate": "2021-03-04T15:32:53+0100",
  "version": "0.16.0",
  "gitTreeState": "dirty"
}

Cluster need some time to start. After that you can apply a simple example:

kubectl apply -f kubernetes/example-simple.yaml

When you are done testing, you can delete the kind cluster:

make clean-kind

Using custom XP docker image

If you need to specify a custom XP docker image, you can do so by setting the operator.charts.values.image.nameTemplate property in values.yaml

operator.charts.values.image.nameTemplate=europe-north1-docker.pkg.dev/my-gcp-project/my-gcp-registry/enonic-xp@%s
operator.charts.values.image.pullPolicy=Always

%s will be replaced with the .spec.xpVersion value of Xp7Deployment resource.

Running operator in IDE

Start kind cluster in dev mode:

export MY_IP=192.?.?.?
make dev

Start operator.

Use your IDE to run the com.enonic.kubernetes.operator.helpers.Main class and set the VM options to:

-Doperator.charts.path=java-operator/src/main/helm -Doperator.charts.values.storage.shared.storageClassName=nfs -Dquarkus.http.ssl.certificate.file=kubernetes/kind/certs/tls.crt -Dquarkus.http.ssl.certificate.key-file=kubernetes/kind/certs/tls.key

Then verify it all works:

make verify-kind 
{
  "gitCommit": "2a2abb974a0c8ae75a23d79ed02236df1b04cc15",
  "gitTags": "",
  "buildDate": "2021-03-04T15:32:53+0100",
  "version": "0.16.0",
  "gitTreeState": "dirty"
}

Spoof hosts for SSE events

Add to your hosts file:

127.0.0.1 all.mycloud-mysolution-myenv-myservice.svc.cluster.local

And run proxy:

kubectl -n mycloud-mysolution-myenv-myservice port-forward main-0 4848

Release

Make sure you workspace contains no uncommitted changes and then run:

VERSION=0.18.0 make release

That will update gradle.properties version to 0.18.0 and push to GitHub. That will trigger a build. If that build succeeds, tag it for release:

git tag -a v0.18.0 -m "v0.18.0"
git push origin v0.18.0

This will trigger a release!

You now should update the version to next SNAPSHOT in gradle.properties

yq -i -p=props -o=props '.version = "0.19.0-SNAPSHOT"' gradle.properties

About

Enonic XP Kubernetes Operator

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 8