Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
✨ Cleanups after removing BundleAPI
Browse files Browse the repository at this point in the history
This PR makes the follwing changes:
1. Fixes the reference to v1alpha1 APIs in the linter.
2. TypeHasValidBundle was being set to false only when the
   bundle load errored. Switching the condition to be
   TypeInstalled instead.
3. Fix documentation on provisioners.

Signed-off-by: Varsha Prasad Narsing <[email protected]>
  • Loading branch information
varshaprasad96 committed Jan 22, 2024
1 parent 6a8a84c commit 22e60eb
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 258 deletions.
4 changes: 2 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ linters-settings:
alias: $1$2
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
- pkg: github.com/operator-framework/rukpak/api/v1alpha1
alias: rukpakv1alpha1
- pkg: github.com/operator-framework/rukpak/api/v1alpha2
alias: rukpakv1alpha2
goimports:
local-prefixes: github.com/operator-framework/rukpak

Expand Down
5 changes: 2 additions & 3 deletions api/v1alpha2/bundledeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ var (
)

const (
TypeHasValidBundle = "HasValidBundle"
TypeHealthy = "Healthy"
TypeInstalled = "Installed"
TypeHealthy = "Healthy"
TypeInstalled = "Installed"

ReasonBundleLoadFailed = "BundleLoadFailed"
ReasonCreateDynamicWatchFailed = "CreateDynamicWatchFailed"
Expand Down
135 changes: 50 additions & 85 deletions docs/provisioners/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Summary

The `helm` provisioner is one of the [provisioners](https://github.com/operator-framework/rukpak/tree/main/internal/provisioner) of RukPak.
It is able to instantiate a given `helm+v3` bundle with a specified helm chart onto a cluster where it then installs the content. It does so by reconciling `Bundle` and `BundleDeployment` types that have
It is able to instantiate a given `helm+v3` bundle with a specified helm chart onto a cluster where it then installs the content. It does so by reconciling `BundleDeployment` types that have
the `spec.provisionerClassName` field set to `core-rukpak-io-helm`. This field must be set to the correct provisioner
name in order for the `helm` provisioner to see and interact with the bundle.

Expand All @@ -25,7 +25,7 @@ all present the same content, a directory containing a helm chart, in a differen
The `helm` provisioner can install and make available a specific `helm+v3` bundle in the cluster. To do this, the `helm` provisioner will retrieve the configured helm chart, instantiate a Bundle onto the cluster, and eventually install the desired helm chart on the cluster.

```yaml
apiVersion: core.rukpak.io/v1alpha1
apiVersion: core.rukpak.io/v1alpha2
kind: BundleDeployment
metadata:
name: my-ahoy
Expand Down Expand Up @@ -55,30 +55,21 @@ spec:
service:
type: ClusterIP
port: 80
template:
metadata:
labels:
app: my-ahoy
spec:
provisionerClassName: core-rukpak-io-helm
source:
http:
url: https://github.com/helm/examples/releases/download/hello-world-0.1.0/hello-world-0.1.0.tgz
type: http
source:
http:
url: https://github.com/helm/examples/releases/download/hello-world-0.1.0/hello-world-0.1.0.tgz
type: http
```
For the helm chart, the values file embedded in the `config` can be applied during the installation of the chart.

> Note: the generated Bundle will contain the BundleDeployment's metadata.Name as a prefix, followed by
> the hash of the provided template.

As the bundle content is retrieved and stored onto the cluster via the defined storage mechanism, the bundle status
will be updated to Unpacked, indicating that all its contents have been stored on-cluster.

```console
$ kubectl get bundle -l app=my-ahoy
$ kubectl get bundledeployment -l app=my-ahoy
NAME TYPE PHASE AGE
my-ahoy-5764594dc8 http Unpacked 33s
my-ahoy http Unpacked 33s
```

Now that the bundle has been unpacked, the provisioner is able to create the resources in the bundle on the cluster.
Expand All @@ -91,8 +82,6 @@ NAME ACTIVE BUNDLE INSTALL STATE AGE
my-ahoy my-ahoy-5764594dc8 InstallationSucceeded 48s
```

> Note: Creation of more than one BundleDeployment from the same Bundle will likely result in an error.

## Quick Start

### Setup
Expand Down Expand Up @@ -127,33 +116,27 @@ make run

### Installing the sample chart

From there, create some Bundles and BundleDeployment types to see the provisioner in action. For an example helm chart to
From there, create some BundleDeployment types to see the provisioner in action. For an example helm chart to
use, the [helm/examples](https://github.com/helm/examples) is a good example.

Create the sample BundleDeployment referencing the desired sample helm chart in Bundle configuration:

```bash
kubectl apply -f -<<EOF
apiVersion: core.rukpak.io/v1alpha1
apiVersion: core.rukpak.io/v1alpha2
kind: BundleDeployment
metadata:
name: my-ahoy
spec:
provisionerClassName: core-rukpak-io-helm
template:
metadata:
labels:
app: my-ahoy
spec:
provisionerClassName: core-rukpak-io-helm
source:
http:
git:
ref:
branch: main
repository: https://github.com/akihikokuroda/examples
directory: ./charts
type: git
source:
http:
git:
ref:
branch: main
repository: https://github.com/akihikokuroda/examples
directory: ./charts
type: git
EOF
```

Expand All @@ -166,18 +149,18 @@ EOF
bundledeployment.core.rukpak.io/my-ahoy created
```

Next, check the Bundle status via:
Next, check the BundleDeployment status via:

```bash
kubectl get bundle -l app=my-ahoy
kubectl get bundledeployment -l app=my-ahoy
```

Eventually the Bundle should show up as Unpacked:
Eventually the BundleDeployment should show up as Unpacked:

```console
$ kubectl get bundle -l app=my-ahoy
NAME TYPE PHASE AGE
my-ahoy-5764594dc8 git Unpacked 33s
$ kubectl get bundledeployment -l app=my-ahoy
NAME PHASE AGE
my-ahoy Unpacked 33s
```

Check the BundleDeployment status to ensure that the installation was successful:
Expand All @@ -190,8 +173,8 @@ A successful installation will show InstallationSucceeded as the `INSTALL STATE`

```console
$ kubectl get bundledeployment my-ahoy
NAME ACTIVE BUNDLE INSTALL STATE AGE
my-ahoy my-ahoy-5764594dc8 InstallationSucceeded 48s
NAME INSTALL STATE AGE
my-ahoy InstallationSucceeded 48s
```

From there, ensure that the helm chart is installed and the operator is present on the cluster:
Expand Down Expand Up @@ -239,7 +222,7 @@ Add a values file into the BundleDeployment to override some default values:

```bash
kubectl apply -f -<<EOF
apiVersion: core.rukpak.io/v1alpha1
apiVersion: core.rukpak.io/v1alpha2
kind: BundleDeployment
metadata:
name: my-ahoy
Expand Down Expand Up @@ -269,19 +252,13 @@ spec:
service:
type: ClusterIP
port: 80
template:
metadata:
labels:
app: my-ahoy
spec:
provisionerClassName: core-rukpak-io-helm
source:
git:
ref:
branch: main
repository: https://github.com/akihikokuroda/examples
directory: ./charts
type: git
source:
git:
ref:
branch: main
repository: https://github.com/akihikokuroda/examples
directory: ./charts
type: git
EOF
```

Expand Down Expand Up @@ -313,7 +290,7 @@ Change this a value in the values file. Update the `nameOverride` to `name1`

```bash
kubectl apply -f -<<EOF
apiVersion: core.rukpak.io/v1alpha1
apiVersion: core.rukpak.io/v1alpha2
kind: BundleDeployment
metadata:
name: my-ahoy
Expand Down Expand Up @@ -343,19 +320,13 @@ spec:
service:
type: ClusterIP
port: 80
template:
metadata:
labels:
app: my-ahoy
spec:
provisionerClassName: core-rukpak-io-helm
source:
git:
ref:
branch: main
repository: https://github.com/akihikokuroda/examples
directory: ./charts
type: git
source:
git:
ref:
branch: main
repository: https://github.com/akihikokuroda/examples
directory: ./charts
type: git
EOF
```

Expand Down Expand Up @@ -397,7 +368,7 @@ Now the helm chart version is `hello-world-0.1.0`. Change the git branch to `v0

```bash
kubectl apply -f -<<EOF
apiVersion: core.rukpak.io/v1alpha1
apiVersion: core.rukpak.io/v1alpha2
kind: BundleDeployment
metadata:
name: my-ahoy
Expand Down Expand Up @@ -427,19 +398,13 @@ spec:
service:
type: ClusterIP
port: 80
template:
metadata:
labels:
app: my-ahoy
spec:
provisionerClassName: core-rukpak-io-helm
source:
git:
ref:
branch: v0.1.1
repository: https://github.com/akihikokuroda/examples
directory: ./charts
type: git
source:
git:
ref:
branch: v0.1.1
repository: https://github.com/akihikokuroda/examples
directory: ./charts
type: git
EOF
```

Expand Down
Loading

0 comments on commit 22e60eb

Please sign in to comment.