{"id":19915191,"url":"https://github.com/change-metrics/monocle-operator","last_synced_at":"2026-01-03T16:04:41.050Z","repository":{"id":99432753,"uuid":"601637504","full_name":"change-metrics/monocle-operator","owner":"change-metrics","description":"Monocle k8s OpenShift operator","archived":false,"fork":false,"pushed_at":"2023-10-13T12:26:33.000Z","size":287,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T23:14:09.508Z","etag":null,"topics":["gerrit","github","gitlab","kubernetes","kubernetes-operator","metrics","openshift","operator","operator-framework","operator-sdk"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/change-metrics.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-14T13:53:14.000Z","updated_at":"2023-11-07T19:04:27.000Z","dependencies_parsed_at":"2024-06-20T00:18:22.635Z","dependency_job_id":"1ecbe5b6-da3c-4082-8c98-e9da471723e2","html_url":"https://github.com/change-metrics/monocle-operator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/change-metrics%2Fmonocle-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/change-metrics%2Fmonocle-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/change-metrics%2Fmonocle-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/change-metrics%2Fmonocle-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/change-metrics","download_url":"https://codeload.github.com/change-metrics/monocle-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243858066,"owners_count":20359269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gerrit","github","gitlab","kubernetes","kubernetes-operator","metrics","openshift","operator","operator-framework","operator-sdk"],"created_at":"2024-11-12T21:39:04.269Z","updated_at":"2026-01-03T16:04:41.044Z","avatar_url":"https://github.com/change-metrics.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# monocle-operator\n\nA k8s/OpenShift operator for [Monocle](https://github.com/change-metrics/monocle).\n\n## Status\n\nThe operator is currently in alpha version and should not be used in production.\n\nThe status is: Work In Progress.\n\nWe use [Microshift](https://github.com/openshift/microshift) as development sandbox and for CI.\n\nThus the operator might have some adherences to OpenShift regarding:\n\n- The Security Context Contraints\n\n## Installation\n\n### Vanilla installation\n\nBy default the Monocle operator watches all namespaces, but can be scoped to a specified namespace via the\n`WATCH_NAMESPACE` environment variable.\n\nTo install the CRDs and the operator:\n\n```\nkubectl create -f https://raw.githubusercontent.com/change-metrics/monocle-operator/master/install/crds.yml\nkubectl create -f https://raw.githubusercontent.com/change-metrics/monocle-operator/master/install/operator.yml\n```\n\nfinally, reclaim a Monocle instance by running the following command:\n\n```\nkubectl create -f https://raw.githubusercontent.com/change-metrics/monocle-operator/master/config/samples/monocle_v1alpha1_monocle-alt.yaml\n```\n\nThe role `monocle-operator-monocle-editor-role` is installed by the `operator.yml`. This role can be assigned via\na `RoleBinding` to users.\n\n### Via OLM\n\n`monocle-operator` is packaged into an OLM package available on [operatorshub.io](https://operatorhub.io/operator/monocle-operator).\n\n## Status\n\n### Phase 1 - Basic Install\n\nAutomatic application provisioning and config management\n\ntasks:\n\n- [X] Elastic / API / Crawler deployment support\n- [X] Validate config ConfigMap update\n- [X] Handle secret data update\n- [X] Set Monocle Resource Status\n- [X] Refresh elastic database in Monocle API Resource when ConfigMap is modified\n- [X] Produce and publish the operator container image\n- [X] Document operator deployment\n\n\n### Phase 2 - Seamless Upgrades\n\nSupport minor version upgrade\n\n- [] Enable upgrade test in CI\n\n### Phase 3 - Full lifecycle\n\nApplication and storage lifecycle (backup and failure recovery)\n\ntasks: TBD\n\n### Phase 4 - Deep insights\n\nMetrics, alerts, log processing\n\ntasks: TBD\n\n### Phase 5 - Auto-pilot\n\ntasks: TBD\n\n## Hack on the operator\n\n### Dependencies\n\nThe operator code is managed via the [Operator SDK](https://sdk.operatorframework.io/). Please follow [installation instructions](https://sdk.operatorframework.io/docs/building-operators/golang/installation/) to install the `operator-sdk` CLI tool.\n\n`kubectl` and `go` are required tools.\n\nOptionaly the project provides a `flake` file for nix users. See [flake.nix](./flake.nix)\nand run `nix develop`.\n\n### Start the operator in dev mode\n\nAssuming is properly configured `~/.kube/config` file simply run:\n\n```bash\n# Install the CRD\n$ make install\n# Set the WATCH_NAMESPACE env var\n$ export WATCH_NAMESPACE=$(kubectl config view -o jsonpath=\"{.contexts[?(@.name == '$(kubectl config current-context)')].context.namespace}\")\n# Start the manager in dev mode\n$ go run ./main.go\n```\n\nIn another terminal apply the Custom Resource:\n\n```bash\n$ cp config/samples/monocle_v1alpha1_monocle.yaml monocle-sample.yaml\n# Update the monoclePublicFQDN to a FQDN to contact the deployment\n# You might need to update the /etc/hosts\n$ kubectl apply -f config/samples/monocle_v1alpha1_monocle.yaml\n# The reconcile loop should stop shortly and you should see in\n# the other terminal:\n# 1.676629527659292e+09   INFO    monocle operand reconcile terminated\n```\n\nAccess the Monocle Web UI:\n\n```bash\n$ firefox https://\u003cFQDN\u003e\n```\n\nEdit the Monocle config:\n\n```bash\n$ kubectl edit cm monocle-sample-api\n```\n\nThe Monocle API and Crawler process detect that the config data (exposed via a ConfigMap mounted\nas a volume) changed and automatically handle the change.\n\nThe \"janitor update-idents\" command is run automatically after the Moncole config update.\nThe Monocle operator starts a Job \"update-idents-job\" to handle that task.\n\nEdit the Monocle Secrets (mainly used by the crawler process):\n\n```bash\n$ kubectl edit secret monocle-sample-api\n```\n\nThe Monocle controller detects the secret change and force a rollout for the api and crawler\ndeployments.\n\nElastic volume is persistant so you might want to wipe the Elastic data to\nstart a fresh deployment.\n\n```bash\n$ kubectl delete pvc monocle-sample-elastic-data-volume-monocle-sample-elastic-0\n```\n\n### Run the operator in standalone dev mode\n\nThis mode does not require the CRD to be installed on the cluster thus you don't\nneed the cluster-admin right to run the `monocle-operator`. This mode is for development\npurpose only.\n\nThe following command takes as paramaters a `Namespace` and a `YAML file that describe the Monocle Custom Resource`.\n\n```Shell\ngo run ./main.go --cr config/sample/monocle_v1alpha1_monocle.yaml --ns monocle\n```\n\nRunning with those paramaters triggers the `standalone` mode which does not start the controller-runtime's Manager\nbut instead uses the controller-runtime's Client. This mode prevents the `Reconcile` function to look at any\n`Monocle` Custom Resource set in any `Namespace` but only relies on the Custom Resource passed as the YAML file.\n\nThis command performs one or more `Reconcile` calls until the Monocle resources (deployment, statefulset, ...) are\ndetected as ready, then exits.\n\nMost of the code involved to reconcile the state is covered by this mode and it make it useful to facilitate\nthe operator development.\n\n## Generate assets\n\nA CI post job build and publish the operator and OLM bundle container images\nin the [quay.io organization](https://quay.io/organization/change-metrics).\n\nThese commands can be use build assets bases on an alternative `IMAGE_TAG_BASE` environment variable.\n\n### Build and publish the operator image\n\n```\nmake container-build\nmake container-push\n```\n\n### Build resources for the vanilla installation\n\n```\nmake gen-operator-install\n```\n\n### Build the OLM bundle image\n\n```\nmake bundle\nmake bundle-container-build\nmake bundle-container-push\n```\n\n### Deploy the OLM bundle via operator-sdk run bundle\n\n```\n# Create a new namespace\nkubectl create ns bundle-catalog-ns\n# It seems that a batch job fails if not added to privileged\noc adm policy add-scc-to-user privileged system:serviceaccount:bundle-catalog-ns:default\noperator-sdk --verbose run bundle quay.io/change-metrics/monocle-operator-bundle:v0.0.2 \\\n    --namespace bundle-catalog-ns --security-context-config restricted\n```\n\nThe command creates an index based on the opm image, defines a catalogsource resources,\ndefines a subscription to the monocle-operator, then accepts the installplan.\n\n```\nkubectl -n bundle-catalog-ns get calalogsource\nkubectl -n bundle-catalog-ns get sub\nkubectl -n bundle-catalog-ns get csv\nkubectl -n bundle-catalog-ns get all\n# The operator should be deployed in that namespace\n# Another namespace can be created to request a Monocle instance to the operator\n```\n\n## License\n\nCopyright 2023 Monocle developers.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchange-metrics%2Fmonocle-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchange-metrics%2Fmonocle-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchange-metrics%2Fmonocle-operator/lists"}