Skip to content

fserucas/monocle-operator

 
 

Repository files navigation

monocle-operator

A k8s operator for Monocle.

Description

The operator is currently in alpha version and should not be used in production.

The status is: Work In Progress.

Installation

Vanilla installation

To install the CRDs and the operator:

kubectl create -f https://raw.githubusercontent.com/change-metrics/monocle-operator/master/install/crds.yml
kubectl create -f https://raw.githubusercontent.com/change-metrics/monocle-operator/master/install/operator.yml

finally, reclaim a Monocle instance by running the following command:

kubectl create -f https://raw.githubusercontent.com/change-metrics/monocle-operator/master/config/samples/monocle_v1alpha1_monocle-alt.yaml

Status

Phase 1 - Basic Install

Automatic application provisioning and config management

tasks:

  • Elastic / API / Crawler deployment support
  • Validate config ConfigMap update
  • Handle secret data update
  • Set Monocle Resource Status
  • Refresh elastic database in Monocle API Resource when ConfigMap is modified
  • [] Produce and publish the operator container image
  • [] Document operator deployment

Phase 2 - Seamless Upgrades

Support minor version upgrade

tasks: TBD

Phase 3 - Full lifecycle

Application and storage lifecycle (backup and failure recovery)

tasks: TBD

Phase 4 - Deep insights

Metrics, alerts, log processing

tasks: TBD

Phase 5 - Auto-pilot

tasks: TBD

Hack on the operator

Dependencies

The operator code is managed via the Operator SDK. Please follow installation instructions to install the operator-sdk CLI tool.

kubectl and go are required tools.

Optionaly the project provides a flake file for nix users. See flake.nix and run nix develop.

Start the operator in dev mode

Assuming is properly configured ~/.kube/config file simply run:

# Install the CRD
$ make install
# Set the WATCH_NAMESPACE env var
$ export WATCH_NAMESPACE=$(kubectl config view -o jsonpath="{.contexts[?(@.name == '$(kubectl config current-context)')].context.namespace}")
# Start the manager in dev mode
$ go run ./main.go

In another terminal apply the Custom Resource:

$ kubectl apply -f config/samples/monocle_v1alpha1_monocle-alt.yaml
# The reconcile loop should stop shortly and you should see in
# the other terminal:
# 1.676629527659292e+09   INFO    monocle operand reconcile terminated

Setup a port forward to access the Monocle Web UI:

$ kubectl port-forward service/monocle-sample-api 8090:8080
$ firefox http://localhost:8090

Edit the Monocle config:

$ kubectl edit cm monocle-sample-api

The Monocle API and Crawler process detect that the config data (exposed via a ConfigMap mounted as a volume) changed and automatically handle the change.

The "janitor update-idents" command is run automatically after the Moncole config update. The Monocle operator starts a Job "update-idents-job" to handle that task.

Edit the Monocle Secrets (mainly used by the crawler process):

$ kubectl edit secret monocle-sample-api

The Monocle controller detects the secret change and force a rollout for the api and crawler deployments.

Elastic volume is persistant so you might want to wipe the Elastic data to start a fresh deployment.

$ kubectl delete pvc monocle-sample-elastic-data-volume-monocle-sample-elastic-0

License

Copyright 2023 Monocle developers.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 72.2%
  • Makefile 22.6%
  • Dockerfile 4.0%
  • Nix 1.2%