
provider-helm
provider-helm is a Crossplane Provider that enables deployment and management
of Helm Releases on Kubernetes clusters typically provisioned by Crossplane, and
has the following functionality:
- A
Release resource type to manage Helm Releases.
- A managed resource controller that reconciles
Release objects and manages
Helm releases.
Install
If you would like to install the latest version of provider-helm without modifications, you may do
so using the Crossplane CLI in a Kubernetes cluster where Crossplane is
installed:
latest_tag=$(crane ls xpkg.crossplane.io/crossplane-contrib/provider-helm | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1)
crossplane xpkg install provider xpkg.crossplane.io/crossplane-contrib/provider-helm:$latest_tag
Then you will need to create a ProviderConfig that specifies the credentials
to connect to the Kubernetes API. This is commonly done within a Composition
by storing a kubeconfig into a secret that the ProviderConfig references. An
example of this approach can be found in
configuration-aws-eks.
Quick start
An alternative, that will get you started quickly, is to reuse existing
credentials from within the control plane.
First install provider-helm with additional
configuration to bind its
service account to an existing role in the cluster:
kubectl apply -f ./examples/cluster/provider-config/provider-incluster.yaml
Then simply create a
ProviderConfig
that uses an InjectedIdentity source:
kubectl apply -f ./examples/cluster/provider-config/provider-config-incluster.yaml
provider-helm will then be installed and ready to use within the cluster. You
can now create Release resources, such as sample
release.yaml.
kubectl create -f examples/cluster/sample/release.yaml
Chart versions and drift
spec.forProvider.chart.version accepts either an exact version or a semver
constraint:
- An exact version, such as
6.7.1 or v6.7.1, pins the chart. The Release
is reported as out of date whenever the deployed chart version differs.
- A constraint, such as
>=6, ~6.7.0, ^6.7.0 or 6.x, is resolved by Helm
when the chart is pulled. The Release is reported as out of date only when
the deployed chart version no longer satisfies the constraint. A newer chart
that also satisfies it is not picked up on its own; it is installed on the
next upgrade triggered by another change.
- A partial version, such as
6 or 6.7, is treated as an exact version
(6.0.0, 6.7.0). Helm may still resolve it to a newer chart such as
6.7.1, which is then reported as drift on every reconcile. Use explicit
range syntax to allow a range of versions.
- An empty version installs the latest chart. Unless late initialization is
disabled by the management policies, the spec is then set to the deployed
version, which is treated as an exact version from then on.
Design
See the design
document.
Developing locally
Pre-requisite: A Kubernetes cluster with Crossplane installed
To run the provider-helm controller against your existing local cluster,
simply run:
make run
Since the controller is running outside the local cluster, you need to make
the API server accessible (on a separate terminal):
sudo kubectl proxy --port=8081
Then we must prepare a ProviderConfig for the local cluster (assuming you are
using kind for local development):
KUBECONFIG=$(kind get kubeconfig | sed -e 's|server:\s*.*$|server: http://localhost:8081|g')
kubectl -n crossplane-system create secret generic cluster-config --from-literal=kubeconfig="${KUBECONFIG}"
kubectl apply -f examples/cluster/provider-config/provider-config-with-secret.yaml
Now you can create Release resources with this ProviderConfig, for example
sample release.yaml.
kubectl create -f examples/cluster/sample/release.yaml
评论