generated from Cloudzero/template-cloudzero-open-source
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CP-22731: add insights-controller chart #97
Merged
Merged
Changes from 8 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
b929523
CP-22731: include cz-insights-controller as subchart
dmepham 05567b6
remove example file
dmepham 761b05a
remove duplicate files
dmepham 6037074
use 0.0.1 for image version
dmepham 35d7ee7
clean up
dmepham 56957ad
fix readme resource list
dmepham 95553eb
increase replicacount for tag server
dmepham 388a435
typo
dmepham 78eb403
CP-22731: add beta testing
josephbarnett d098434
update release process for insights controller
josephbarnett 7d362df
update release workflow
josephbarnett 829906d
merge from develop
josephbarnett 4ed1119
fix linting and test using beta channel
josephbarnett 8c08084
disable for now for testing
josephbarnett a95d9f9
test
josephbarnett 383ca15
fix test 2
josephbarnett e76ff75
fix test 3
josephbarnett 0616655
make most resources off by default
dmepham f0341b1
update readme
dmepham dd3c8a9
use global for secret names
dmepham ebed240
incorporate changes from 0.0.30-beta
dmepham d12e3b1
add beta release doc
dmepham d838b49
add beta release installation link
dmepham d67725e
update example config file
dmepham 9037d46
minor doc changes
dmepham b4aba8d
use global in chart test
dmepham 655679b
update test chart step, add chart version updates
dmepham a51b275
fix typo in release notes
dmepham 3677b92
remove test file
dmepham 8a9631f
use local chart for testing
dmepham 9addbab
lint issues
dmepham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -- Account ID of the account the cluster is running in. This must be a string - even if it is a number in your system. | ||
cloudAccountId: null | ||
# -- Name of the clusters. | ||
clusterName: null | ||
# -- Region the cluster is running in. | ||
region: null | ||
# -- CloudZero API key. Required if useExistingSecret is false. | ||
apiKey: null | ||
# -- If set, the agent will use the API key in this Secret to authenticate with CloudZero. | ||
existingSecretName: null | ||
|
||
# label and annotation configuration: | ||
tags: | ||
# -- By default, a ValidatingAdmissionWebhook will be deployed that records all created labels and annotations | ||
enabled: true | ||
labels: | ||
# -- This value MUST be set to either true or false. The installation will fail otherwise | ||
enabled: null | ||
# -- This value MUST be set to a list of regular expressions which wil lbe used to gather labels from pods, deployments, statefulsets, daemonsets, cronjobs, jobs, nodes, and namespaces | ||
patterns: | ||
# - '.*' # -- This option enables gathering ALL labels from the above resources. Use with caution, as the number of labels can be large. | ||
annotations: | ||
# -- By default, the gathering of annotations is not enabled. To enable, set this field to true | ||
enabled: false | ||
patterns: | ||
- '.*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dependencies: | ||
- name: cert-manager | ||
repository: https://charts.jetstack.io | ||
version: v1.15.3 | ||
digest: sha256:9027951628db45ef674f00e5baeca157f95755de9818a9d1e78396b86971f527 | ||
generated: "2024-08-29T11:00:51.842705-04:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v2 | ||
name: insights-controller | ||
description: Provides telemetry to the CloudZero platform to enabling complex cost allocation and analysis. | ||
type: application | ||
version: 0.0.1 | ||
appVersion: "0.0.1" | ||
dependencies: | ||
- name: cert-manager | ||
version: v1.15.3 | ||
repository: https://charts.jetstack.io | ||
alias: cert-manager | ||
condition: cert-manager.enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
# Cloudzero Insights Controller Helm Chart | ||
|
||
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE-OF-CONDUCT.md) | ||
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) | ||
![GitHub release](https://img.shields.io/github/release/Cloudzero/cloudzero-charts.svg) | ||
|
||
A Helm chart for a validating admission webhook to send cluster metrics to the CloudZero platform. | ||
|
||
## Overview | ||
|
||
This Validating Admission Webhook monitors and intercepts `CREATE` and `UPDATE` operations on the following Kubernetes resources: | ||
|
||
- `Pod` | ||
- `Deployment` | ||
- `StatefulSet` | ||
- `Daemonset` | ||
- `Job` | ||
- `CronJob` | ||
- `Node` | ||
- `Namespace` | ||
|
||
The webhook captures the labels from these resources and uploads them to the CloudZero API endpoint. For both `CREATE` and `UPDATE` operations, the full set of labels is sent to the API, ensuring that the most up-to-date labels are always uploaded. For `Deployment` and `Statefulset` resources, annotations are also uploaded. | ||
|
||
|
||
## Prerequisites | ||
|
||
- Kubernetes 1.23+ | ||
- Helm 3+ | ||
- A CloudZero API key | ||
|
||
## Installation | ||
|
||
This helm chart is best used alongside the [cloudzero-agent](https://github.com/Cloudzero/cloudzero-charts/tree/develop/charts/cloudzero-agent) chart. In this case, the same API key can be used for both installations. | ||
|
||
### Get Helm Repository Info | ||
|
||
```console | ||
helm repo add cloudzero https://cloudzero.github.io/cloudzero-charts | ||
helm repo update | ||
``` | ||
|
||
_See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._ | ||
|
||
The chart can be installed directly with Helm or any other common Kubernetes deployment tools. See the next section for different deployment configurations. | ||
|
||
### Deployment Configurations and Certificate Management | ||
|
||
This chart contains a `ValidatingWebhookConfiguration` resource, which uses a certificate in order validate requests to the webhook server. See related Kubernetes documentation [here](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#configure-admission-webhooks-on-the-fly). | ||
|
||
|
||
**There are two ways to install the chart as it relates to certificate management:** | ||
|
||
1. (Default) Manage certificates using [cert-manager](https://github.com/cert-manager/cert-manager/tree/master). | ||
By default, the chart installs [cert-manager](https://github.com/cert-manager/cert-manager/tree/master) as a subchart. `cert-manager` handles the creation of the certificate and injects the CA bundle into the `ValidatingWebhookConfiguration` resource. For details on how cert-manager does this, see [here](https://cert-manager.io/docs/concepts/ca-injector/). | ||
|
||
To install the chart with this configuration, install the chart with the following helm command. The default configuration uses cert-manager to create the certificate: | ||
|
||
```console | ||
helm install <RELEASE_NAME> cloudzero/insights-controller \ | ||
--set existingSecretName=<NAME_OF_SECRET> \ | ||
--set clusterName=<CLUSTER_NAME> \ | ||
--set-string cloudAccountId=<CLOUD_ACCOUNT_ID> \ | ||
--set region=<REGION> | ||
``` | ||
|
||
If `cert-manager` CRDs are not already installed, the installation may fail with the error message that contains: | ||
```console | ||
no matches for kind "Certificate" in version "cert-manager.io/v1" | ||
``` | ||
|
||
If this happens, run the following: | ||
|
||
```bash | ||
helm install <RELEASE_NAME> cloudzero/insights-controller \ | ||
--set webhook.issuer.enabled=false \ | ||
--set webhook.certificate.enabled=false \ | ||
--set cert-manager.installCRDs=true | ||
``` | ||
Or, alternatively, [install the cert-manager CRDs yourself](https://cert-manager.io/docs/installation/helm/). | ||
Then rerun the original command: | ||
```console | ||
helm install <RELEASE_NAME> cloudzero/insights-controller \ | ||
--set existingSecretName=<NAME_OF_SECRET> \ | ||
--set clusterName=<CLUSTER_NAME> \ | ||
--set-string cloudAccountId=<CLOUD_ACCOUNT_ID> \ | ||
--set region=<REGION> | ||
``` | ||
|
||
2. The second option is to bring your own certificate. In this case, the tls information must be mounted to the server Deployment at the `/etc/certs/` path in a file formatted as: | ||
``` | ||
ca.crt: <CA_CRT> | ||
tls.crt: <TLS_CERT> | ||
tls.key: <TLS_KEY> | ||
``` | ||
An example command would be: | ||
```bash | ||
helm install <RELEASE_NAME> cloudzero/insights-controller \ | ||
--set existingSecretName=<NAME_OF_SECRET> \ | ||
--set clusterName=<CLUSTER_NAME> \ | ||
--set-string cloudAccountId=<CLOUD_ACCOUNT_ID> \ | ||
--set region=<REGION> \ | ||
-f config.yaml | ||
``` | ||
where `config.yaml` is: | ||
``` | ||
server: | ||
tls: | ||
useManagedSecret: false | ||
volumeMounts: | ||
- name: your-tls-volume | ||
mountPath: /etc/certs | ||
readOnly: true | ||
volumes: | ||
- name: tls-certs | ||
secret: | ||
secretName: your-tls-secret-name | ||
webhook: | ||
issuer: | ||
enabled: false | ||
certificate: | ||
enabled: false | ||
caBundle: '<YOUR_CA_BUNDLE>' | ||
|
||
cert-manager: | ||
enabled: false | ||
``` | ||
|
||
## Troubleshooting | ||
|
||
### `<RELEASE-NAME>-server` pod stuck in `Pending` state | ||
The server pod, which handles incoming webhook requests, may be stuck in this state if the TLS secret is not available. Confirm this is the case by describing the server pod: | ||
```console | ||
kubectl describe pod -l app.kubernetes.io/name=insights-controller | ||
``` | ||
If the event log shows that the pod cannot be created due to a missing volume, check that the TLS secret has been created successfully: | ||
```console | ||
kubectl get secret -l app.kubernetes.io/name=insights-controller | ||
``` | ||
If no secrets are returned by that command, then cert-manager did not provision a certificate. Consult the `cert-manager` pod logs and/or the cert-manager CRDs for more infomration: | ||
```console | ||
kubectl get certificaterequests | ||
kubectl get certificates | ||
kubectl get certificatesigningrequests | ||
kubectl get issuers | ||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this use the
beta
channel for now? Not sure if we need to add the--devel
flag somehow