Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ARG ARCH
ENV ARCH=$ARCH
RUN apk add --no-cache bash git gcc musl-dev curl
RUN GOPROXY=direct go install golang.org/x/tools/cmd/goimports@gopls/v0.18.1
RUN GOPROXY=direct go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.17.3
RUN if [ "${ARCH}" != "arm" ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.64.7; \
fi
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
helm-controller
========

_NOTE: this repository has been recently (2020-10-06) moved out of the github.com/rancher org to github.com/k3s-io
supporting the [acceptance of K3s as a CNCF sandbox project](https://github.com/cncf/toc/pull/447)_.

---

A simple way to manage helm charts (v2 and v3) with Custom Resource Definitions in k8s.
A simple way to manage helm charts with Custom Resource Definitions in k8s.

## Manifests and Deploying
The `./manifests` folder contains useful YAML manifests to use for deploying and developing the Helm Controller. This simple YAML deployment creates a HelmChart CRD + a Deployment using the `rancher/helm-controller` container. The YAML might need some modifications for your environment so read below for Namespaced vs Cluster deployments and how to use them properly.
Expand All @@ -17,6 +12,10 @@ Use the `deploy-namespaced.yaml` to create a namespace and add the Helm Controll
#### Cluster Scoped Deploys
If you'd like your helm controller to watch the entire cluster for HelmChart CRD changes use the `deploy-cluster-scoped.yaml` deploy manifest. By default it will add the helm-controller to the `kube-system` so update `metadata.namespace` for your needs.

## API Documentation

Autogenerated API docs for `helm.cattle.io/v1 HelmChart` and `HelmChartConfig` are available at [doc/helmchart.md](doc/helmchart.md#HelmChart)

## Uninstalling
To remove the Helm Controller run `kubectl delete` and pass the deployment YAML used using to create the Deployment `-f` parameter.

Expand Down
5 changes: 5 additions & 0 deletions crd-ref-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
processor:
ignoreFields:
- "TypeMeta$"
render:
kubernetesVersion: 1.32
199 changes: 199 additions & 0 deletions doc/helmchart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# API Reference

## Packages
- [helm.cattle.io/v1](#helmcattleiov1)


## helm.cattle.io/v1






#### FailurePolicy

_Underlying type:_ _string_



_Validation:_
- Enum: [abort reinstall]

_Appears in:_
- [HelmChartConfigSpec](#helmchartconfigspec)
- [HelmChartSpec](#helmchartspec)



#### HelmChart



HelmChart represents configuration and state for the deployment of a Helm chart.



_Appears in:_
- [HelmChartList](#helmchartlist)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
| `spec` _[HelmChartSpec](#helmchartspec)_ | | | |
| `status` _[HelmChartStatus](#helmchartstatus)_ | | | |


#### HelmChartCondition







_Appears in:_
- [HelmChartStatus](#helmchartstatus)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `type` _[HelmChartConditionType](#helmchartconditiontype)_ | Type of job condition. | | |
| `status` _[ConditionStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#conditionstatus-v1-core)_ | Status of the condition, one of True, False, Unknown. | | |
| `reason` _string_ | (brief) reason for the condition's last transition. | | |
| `message` _string_ | Human readable message indicating details about last transition. | | |


#### HelmChartConditionType

_Underlying type:_ _string_





_Appears in:_
- [HelmChartCondition](#helmchartcondition)

| Field | Description |
| --- | --- |
| `JobCreated` | |
| `Failed` | |


#### HelmChartConfig



HelmChartConfig represents additional configuration for the installation of Helm chart release.
This resource is intended for use when additional configuration needs to be passed to a HelmChart
that is managed by an external system.



_Appears in:_
- [HelmChartConfigList](#helmchartconfiglist)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
| `spec` _[HelmChartConfigSpec](#helmchartconfigspec)_ | | | |




#### HelmChartConfigSpec



HelmChartConfigSpec represents additional user-configurable details of an installed and configured Helm chart release.
These fields are merged with or override the corresponding fields on the related HelmChart resource.



_Appears in:_
- [HelmChartConfig](#helmchartconfig)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `valuesContent` _string_ | Override complex Chart values via inline YAML content.<br />Helm CLI positional argument/flag: `--values` | | |
| `valuesSecrets` _[SecretSpec](#secretspec) array_ | Override complex Chart values via references to external Secrets.<br />Helm CLI positional argument/flag: `--values` | | |
| `failurePolicy` _[FailurePolicy](#failurepolicy)_ | Configures handling of failed chart installation or upgrades.<br />- `reinstall` will perform a clean uninstall and reinstall of the chart.<br />- `abort` will take no action and leave the chart in a failed state so that the administrator can manually resolve the error. | reinstall | Enum: [abort reinstall] <br /> |




#### HelmChartSpec



HelmChartSpec represents the user-configurable details for installation and upgrade of a Helm chart release.



_Appears in:_
- [HelmChart](#helmchart)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `targetNamespace` _string_ | Helm Chart target namespace.<br />Helm CLI positional argument/flag: `--namespace` | | |
| `createNamespace` _boolean_ | Create target namespace if not present.<br />Helm CLI positional argument/flag: `--create-namespace` | | |
| `chart` _string_ | Helm Chart name in repository, or complete HTTPS URL to chart archive (.tgz)<br />Helm CLI positional argument/flag: `CHART` | | |
| `version` _string_ | Helm Chart version. Only used when installing from repository; ignored when .spec.chart or .spec.chartContent is used to install a specific chart archive.<br />Helm CLI positional argument/flag: `--version` | | |
| `repo` _string_ | Helm Chart repository URL.<br />Helm CLI positional argument/flag: `--repo` | | |
| `repoCA` _string_ | Verify certificates of HTTPS-enabled servers using this CA bundle. Should be a string containing one or more PEM-encoded CA Certificates.<br />Helm CLI positional argument/flag: `--ca-file` | | |
| `repoCAConfigMap` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#localobjectreference-v1-core)_ | Reference to a ConfigMap containing CA Certificates to be be trusted by Helm. Can be used along with or instead of `.spec.repoCA`<br />Helm CLI positional argument/flag: `--ca-file` | | |
| `set` _object (keys:string, values:[IntOrString](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#intorstring-intstr-util))_ | Override simple Chart values. These take precedence over options set via valuesContent.<br />Helm CLI positional argument/flag: `--set`, `--set-string` | | |
| `valuesContent` _string_ | Override complex Chart values via inline YAML content.<br />Helm CLI positional argument/flag: `--values` | | |
| `valuesSecrets` _[SecretSpec](#secretspec) array_ | Override complex Chart values via references to external Secrets.<br />Helm CLI positional argument/flag: `--values` | | |
| `helmVersion` _string_ | DEPRECATED. Helm version to use. Only v3 is currently supported. | | |
| `bootstrap` _boolean_ | Set to True if this chart is needed to bootstrap the cluster (Cloud Controller Manager, CNI, etc) | | |
| `chartContent` _string_ | Base64-encoded chart archive .tgz; overides `.spec.chart` and `.spec.version`<br />Helm CLI positional argument/flag: `CHART` | | |
| `jobImage` _string_ | Specify the image to use for tht helm job pod when installing or upgrading the helm chart. | | |
| `backOffLimit` _integer_ | Specify the number of retries before considering the helm job failed. | | |
| `timeout` _[Duration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#duration-v1-meta)_ | Timeout for Helm operations.<br />Helm CLI positional argument/flag: `--timeout` | | |
| `failurePolicy` _[FailurePolicy](#failurepolicy)_ | Configures handling of failed chart installation or upgrades.<br />- `reinstall` will perform a clean uninstall and reinstall of the chart.<br />- `abort` will take no action and leave the chart in a failed state so that the administrator can manually resolve the error. | reinstall | Enum: [abort reinstall] <br /> |
| `authSecret` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#localobjectreference-v1-core)_ | Reference to Secret of type kubernetes.io/basic-auth holding Basic auth credentials for the Chart repo. | | |
| `authPassCredentials` _boolean_ | Pass Basic auth credentials to all domains.<br />Helm CLI positional argument/flag: `--pass-credentials` | | |
| `insecureSkipTLSVerify` _boolean_ | Skip TLS certificate checks for the chart download.<br />Helm CLI positional argument/flag: `--insecure-skip-tls-verify` | | |
| `plainHTTP` _boolean_ | Use insecure HTTP connections for the chart download.<br />Helm CLI positional argument/flag: `--plain-http` | | |
| `dockerRegistrySecret` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#localobjectreference-v1-core)_ | Reference to Secret of type kubernetes.io/dockerconfigjson holding Docker auth credentials for the OCI-based registry acting as the Chart repo. | | |
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#podsecuritycontext-v1-core)_ | Custom PodSecurityContext for the helm job pod. | | |
| `securityContext` _[SecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#securitycontext-v1-core)_ | custom SecurityContext for the helm job pod. | | |


#### HelmChartStatus



HelmChartStatus represents the resulting state from processing HelmChart events



_Appears in:_
- [HelmChart](#helmchart)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `jobName` _string_ | The name of the job created to install or upgrade the chart. | | |
| `conditions` _[HelmChartCondition](#helmchartcondition) array_ | `JobCreated` indicates that a job has been created to install or upgrade the chart.<br />`Failed` indicates that the helm job has failed and the failure policy is set to `abort`. | | |


#### SecretSpec



SecretSpec describes a key in a secret to load chart values from.



_Appears in:_
- [HelmChartConfigSpec](#helmchartconfigspec)
- [HelmChartSpec](#helmchartspec)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `name` _string_ | Name of the secret. Must be in the same namespace as the HelmChart resource. | | |
| `keys` _string array_ | Keys to read values content from. If no keys are specified, the secret is not used. | | |
| `ignoreUpdates` _boolean_ | Ignore changes to the secret, and mark the secret as optional.<br />By default, the secret must exist, and changes to the secret will trigger an upgrade of the chart to apply the updated values.<br />If `ignoreUpdates` is true, the secret is optional, and changes to the secret will not trigger an upgrade of the chart. | | |


4 changes: 0 additions & 4 deletions generate.go

This file was deleted.

13 changes: 0 additions & 13 deletions hack/crdgen.go

This file was deleted.

6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//go:generate go run pkg/codegen/cleanup/main.go
//go:generate rm -rf pkg/generated pkg/crds/yaml/generated
//go:generate go run pkg/codegen/main.go
//go:generate controller-gen crd:generateEmbeddedObjectMeta=true paths=./pkg/apis/... output:crd:dir=./pkg/crds/yaml/generated
//go:generate crd-ref-docs --config=crd-ref-docs.yaml --renderer=markdown --output-path=doc/helmchart.md

package main

import (
Expand Down
Loading