From e75e920d459cd9a57b60443e7f43f08d764b0dd5 Mon Sep 17 00:00:00 2001 From: ricoberger <mail@ricoberger.de> Date: Mon, 14 Sep 2020 23:00:44 +0200 Subject: [PATCH] Add support for the Prometheus plugin --- README.md | 7 +++++-- helm/Chart.yaml | 2 +- helm/templates/deployment.yaml | 5 ++++- helm/values.yaml | 9 ++++++--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a8c761b..5744cff 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ kubectl port-forward --namespace kubenav svc/kubenav 14122 ### Configure Access to Multiple Clusters +> **Attention:** When kubenav runs inside a Kubernetes cluster with the `--kubeconfig` flag and the Prometheus plugin enabled (`--plugin.prometheus.enabled`) it will only use the Prometheus instance, which is running in the same cluster. + The deployment shown in this repository deploys kubenav with the `--incluster` flag. This means kubenav has only access to the cluster were it is deployed in. To deploy kubenav with access to multiple cluster you have to mount a Kubeconfig file into the kubenav container and add the `--kubeconfig` flag. The following example shows the changes you have to made to the `deployment.yaml` file to access multiple clusters from the same kubenav instance: @@ -73,14 +75,15 @@ helm upgrade --install --namespace kubenav kubenav kubenav/kubenav | ----- | ----------- | ------- | | `replicaCount` | Number of replicas which should be created. | `1` | | `image.repository` | The repository of the Docker image. | `kubenav/kubenav` | -| `image.tag` | The tag of the Docker image which should be used. | `4a5f72c1` | +| `image.tag` | The tag of the Docker image which should be used. | `d74a11da` | | `image.pullPolicy` | The pull policy for the Docker image, | `IfNotPresent` | | `imagePullSecrets` | Secrets which can be used to pull the Docker image. | `[]` | | `nameOverride` | Expand the name of the chart. | `""` | | `fullnameOverride` | Override the name of the app. | `""` | | `deployment.mode` | Set the mode how kubenav should be deployed. This must be `incluster` or `kubeconfig`. | `incluster` | -| `deployment.clusterName` | The name which should be in the frontend, when the `incluster` mode is used. | `kubenav` | | `deployment.kubeconfig` | When the `kubeconfig` mode is used. This must be a base64 encoded Kubeconfig file. | `""` | +| `plugins.prometheus.enabled` | Enables the Prometheus plugin. | `false` | +| `plugins.prometheus.address` | The address of Prometheus. | `""` | | `rbac.create` | Create the cluster role and cluster role binding. | `true` | | `rbac.name` | The name of the cluster role and cluster role binding, which should be created/used by kubenav. | `kubenav` | | `rbac.name` | The permissions which kubenav should have. This must be `admin` or `viewer`. | `admin` | diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 8311413..9bac414 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: kubenav description: kubenav is the navigator for your Kubernetes clusters right in your pocket. type: application -version: 0.1.1 +version: 0.1.2 appVersion: 2.2.0 diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 84305b2..b9b1ac1 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -32,7 +32,10 @@ spec: - --kubeconfig=/kubenav/kubeconfig/kubeconfig {{- else }} - --incluster - - --incluster.name={{ .Values.deployment.clusterName }} + {{- end }} + {{- if .Values.plugins.prometheus.enabled }} + - --plugin.prometheus.enabled + - --plugin.prometheus.address={{ .Values.plugins.prometheus.address }} {{- end }} ports: - name: http diff --git a/helm/values.yaml b/helm/values.yaml index 7790dcb..a5828c9 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -4,7 +4,7 @@ replicaCount: 1 image: repository: kubenav/kubenav - tag: 4a5f72c1 + tag: d74a11da pullPolicy: IfNotPresent imagePullSecrets: [] @@ -15,11 +15,14 @@ deployment: # Specifies whether kubenav should in the incluster mode or with a mounted Kubeconfig. # This must be "incluster" or "kubeconfig" mode: incluster - # The cluster name which should be displayed in the frontend, when using the "incluster" mode. - clusterName: kubenav # When the "kubeconfig" mode is used the kubeconfig value must contain a base64 encoded Kubeconfig file. kubeconfig: +plugins: + prometheus: + enabled: false + address: + rbac: # Specifies whether a cluster role and cluster role binding should be created. create: true -- GitLab