Skip to content

nodeshift-blog-examples/operator-in-JavaScript

Repository files navigation

An Example OpenShift Operator written in TypeScript.

Getting Started

To get started, start by creating all the OpenShift resources:

oc apply -k resources

This will create the ts-operator namespace and populate it with ImageStreams, a BuildConfig and a Deployment running the operator.

It will also create the Memcached Custom Resource Definition and the memcached-editor Role.

Move to the ts-operator project:

oc project ts-operator

Tail the logs of the operator by running:

oc logs -f deployment/ts-operator

In a different terminal, create an instance of the CRD by running:

oc create -f resources/memcached-sample.yaml

You will see a new Deployment called memcached-sample with pods starting.

Now modify the size property in your Custom Resource:

oc edit memcached memcached-sample

Replace the size value from 2 to 4, then save. You will see the size of your deployment go from 2 to 4 and new pods starting.

Cleaning up

You can delete all the resources created earlier by running:

oc delete -k resources

About

Example of creating an operator using JavaScript/TypeScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published