- Notifications
You must be signed in to change notification settings - Fork0
codefresh-contrib/vcluster-prometheus-operator-plugin
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repository contains avCluster plugin that syncsPrometheus operator resources from virtual clusters to the host cluster.
Currently only the very basic functionality is implemented so the plugin only supports syncing ofPodMonitor andServiceMonitor resources. This is to allow scraping of metrics from workloads running on virtual clusters from a signle Prometheus or Open Telemetry collector on the host (withtarget allocator that supports Prometheus operator CRDs).
This plugin in it's latest version is compatibe with vCluster version0.30.0
For more information how to develop plugins in vcluster, please refer to theofficial vcluster docs.
To use the plugin, create a new vcluster with theplugin.yaml:
# Deploy Prometheus operator on host cluster with Helm:For more info see -https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack?modal=install# Create vcluster with pluginvcluster create my-vcluster -n my-vcluster -f https://raw.githubusercontent.com/codefresh-contrib/vcluster-prometheus-operator-plugin/main/plugin.yamlThis will create a new vcluster with the plugin installed. Then test the plugin with:
# Apply example ServicerMonitorvcluster connect my-vcluster -n my-vcluster -- kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/user-guides/getting-started/example-app-service-monitor.yaml# Check if car got correctly syncedkubectl get servicemonitor -n my-vclusterTo just build the plugin image and push it to the registry, run:
# Builddocker build . -t my-repo/my-plugin:0.0.1# Pushdocker push my-repo/my-plugin:0.0.1Then exchange the image in theplugin.yaml
General vcluster plugin project structure:
.├── go.mod # Go module definition├── go.sum├── devspace.yaml # Development environment definition├── devspace_start.sh # Development entrypoint script├── Dockerfile # Production Dockerfile├── main.go # Go Entrypoint├── plugin.yaml # Plugin Helm Values├── syncers/ # Plugin Syncers└── manifests/ # Additional plugin resourcesBefore starting to develop, make sure you have installed the following tools on your computer:
- docker
- kubectl with a valid kube context configured
- helm, which is used to deploy vcluster and the plugin
- vcluster CLI v0.20.0 or higher
- DevSpace, which is used to spin up a development environment
After successfully setting up the tools, start the development environment with:
devspace dev -n vclusterAfter a while a terminal should show up with additional instructions. Enter the following command to start the plugin:
go build -mod vendor -o plugin main.go && /vcluster/syncer startYou can now change a file locally in your IDE and then restart the command in the terminal to apply the changes to the plugin.
Delete the development environment with:
devspace purge -n vclusterAbout
Plugin for vCluster (by loft.sh) that enables syncing Prometheus operator resources (ServiceMonitors and PodMonitors) from virtual clusters to host cluster
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.