Skip to content

Commit 8869826

Browse files
authored
Improve helm chart deployment (#199)
1 parent 929ca37 commit 8869826

18 files changed

+1075
-154
lines changed

operator/DEVELOPER.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
## Getting Started
2+
3+
### Prerequisites
4+
5+
- go version v1.23.0+
6+
- docker version 17.03+.
7+
- kubectl version v1.11.3+.
8+
- Access to a Kubernetes v1.11.3+ cluster.
9+
10+
### To Deploy on the cluster
11+
12+
**Build and push your image to the location specified by `IMG`:**
13+
14+
```sh
15+
make docker-build docker-push IMG=<some-registry>/operator:tag
16+
```
17+
18+
**NOTE:** This image ought to be published in the personal registry you specified.
19+
And it is required to have access to pull the image from the working environment.
20+
Make sure you have the proper permission to the registry if the above commands don't work.
21+
22+
**Install the CRDs into the cluster:**
23+
24+
```sh
25+
make install
26+
```
27+
28+
**Deploy the Manager to the cluster with the image specified by `IMG`:**
29+
30+
```sh
31+
make deploy IMG=<some-registry>/operator:tag
32+
```
33+
34+
> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin
35+
> privileges or be logged in as admin.
36+
37+
**Create instances of your solution**
38+
You can apply the samples (examples) from the config/sample:
39+
40+
```sh
41+
kubectl apply -k config/samples/
42+
```
43+
44+
> **NOTE**: Ensure that the samples has default values to test it out.
45+
46+
### To Uninstall
47+
48+
**Delete the instances (CRs) from the cluster:**
49+
50+
```sh
51+
kubectl delete -k config/samples/
52+
```
53+
54+
**Delete the APIs(CRDs) from the cluster:**
55+
56+
```sh
57+
make uninstall
58+
```
59+
60+
**UnDeploy the controller from the cluster:**
61+
62+
```sh
63+
make undeploy
64+
```
65+
66+
## Project Distribution
67+
68+
Following the options to release and provide this solution to the users.
69+
70+
### By providing a bundle with all YAML files
71+
72+
1. Build the installer for the image built and published in the registry:
73+
74+
```sh
75+
make build-installer IMG=<some-registry>/operator:tag
76+
```
77+
78+
**NOTE:** The makefile target mentioned above generates an 'install.yaml'
79+
file in the dist directory. This file contains all the resources built
80+
with Kustomize, which are necessary to install this project without its
81+
dependencies.
82+
83+
2. Using the installer
84+
85+
Users can just run 'kubectl apply -f <URL for YAML BUNDLE>' to install
86+
the project, i.e.:
87+
88+
```sh
89+
kubectl apply -f https://raw.githubusercontent.com/<org>/operator/<tag or branch>/dist/install.yaml
90+
```
91+
92+
### By providing a Helm Chart
93+
94+
1. Build the chart using the optional helm plugin
95+
96+
```sh
97+
kubebuilder edit --plugins=helm/v1-alpha
98+
```
99+
100+
2. See that a chart was generated under 'dist/chart', and users
101+
can obtain this solution from there.
102+
103+
**NOTE:** If you change the project, you need to update the Helm Chart
104+
using the same command above to sync the latest changes. Furthermore,
105+
if you create webhooks, you need to use the above command with
106+
the '--force' flag and manually ensure that any custom configuration
107+
previously added to 'dist/chart/values.yaml' or 'dist/chart/manager/manager.yaml'
108+
is manually re-applied afterwards.
109+
110+
**NOTE:** Run `make help` for more information on all potential `make` targets
111+
112+
More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html)

operator/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN go mod download
1515
COPY cmd/main.go cmd/main.go
1616
COPY api/ api/
1717
COPY internal/ internal/
18+
COPY utils/ utils/
1819

1920
# Build
2021
# the GOARCH has not a default value to allow the binary be built according to the host where the command

0 commit comments

Comments
 (0)