@@ -31,22 +31,15 @@ Specifications:
3131## Usage
3232
3333The kustomize-controller is part of a composable GitOps toolkit and depends on
34- [ source-controller] ( https://github.com/fluxcd/source-controller ) to provide the raw Kubernetes
35- manifests and ` kustomization.yaml ` file .
34+ [ source-controller] ( https://github.com/fluxcd/source-controller ) to acquire the Kubernetes
35+ manifests from Git repositories .
3636
3737### Install the controllers
3838
39- Install source-controller with :
39+ Install the source and kustomize controllers in the ` kustomize-system ` namespace :
4040
4141``` bash
42- kustomize build https://github.com/fluxcd/source-controller//config/default? ref=v0.0.1-alpha.4 \
43- kubectl apply -f-
44- ```
45-
46- Install kustomize-controller with:
47-
48- ``` bash
49- kustomize build https://github.com/fluxcd/kustomize-controller//config/default? ref=v0.0.1-alpha.7 \
42+ kustomize build https://github.com/fluxcd/kustomize-controller//config/default? ref=master \
5043kubectl apply -f-
5144```
5245
@@ -62,7 +55,7 @@ metadata:
6255 namespace : kustomize-system
6356spec :
6457 interval : 1m
65- url : https://github.com/stefanprodan/podinfo-deploy
58+ url : https://github.com/stefanprodan/podinfo
6659 ref :
6760 branch : master
6861` ` `
@@ -95,29 +88,31 @@ metadata:
9588 namespace : kustomize-system
9689spec :
9790 interval : 5m
98- path : " ./overlays/dev/"
91+ path : " ./deploy/ overlays/dev/"
9992 prune : true
10093 sourceRef :
10194 kind : GitRepository
10295 name : podinfo
10396 validation : client
10497 healthChecks :
10598 - kind : Deployment
106- name : podinfo
99+ name : frontend
100+ namespace : dev
101+ - kind : Deployment
102+ name : backend
107103 namespace : dev
108104 timeout : 80s
109105` ` `
110106
111- > **Note** that if your repository contains only plain Kubernetes manifests,
112- > the controller will
107+ > **Note** that if your repository contains only plain Kubernetes manifests, the controller will
113108> [automatically generate](docs/spec/v1alpha1/kustomization.md#generate-kustomizationyaml)
114109> a kustomization.yaml file inside the specified path.
115110
116111A detailed explanation of the Kustomization object and its fields
117112can be found in the [specification doc](docs/spec/v1alpha1/README.md).
118113
119114Based on the above definition, the kustomize-controller fetches the Git repository content from source-controller,
120- generates Kubernetes manifests by running kustomize build inside ` ./overlays/dev/`,
115+ generates Kubernetes manifests by running kustomize build inside ` ./deploy/ overlays/dev/`,
121116and validates them with a dry-run apply. If the manifests pass validation, the controller will apply them
122117on the cluster and starts the health assessment of the deployed workload. If the health checks are passing, the
123118Kustomization object status transitions to a ready state.
@@ -127,7 +122,7 @@ Kustomization object status transitions to a ready state.
127122You can wait for the kustomize controller to complete the deployment with :
128123
129124` ` ` bash
130- kubectl wait kustomization/podinfo-dev --for=condition=ready
125+ kubectl -n kustomize-system wait kustomization/podinfo-dev --for=condition=ready
131126` ` `
132127
133128When the controller finishes the reconciliation, it will log the applied objects :
@@ -142,20 +137,24 @@ kubectl -n kustomize-system logs deploy/kustomize-controller | jq .
142137 "ts": 1587195448.071468,
143138 "logger": "controllers.Kustomization",
144139 "msg": "Kustomization applied in 1.436096591s",
145- "kustomization": "default /podinfo-dev",
140+ "kustomization": "kustomize-system /podinfo-dev",
146141 "output": {
147142 "namespace/dev": "created",
148- "service/podinfo": "created",
149- "deployment.apps/podinfo": "created",
150- "horizontalpodautoscaler.autoscaling/podinfo": "created"
143+ "service/frontend": "created",
144+ "deployment.apps/frontend": "created",
145+ "horizontalpodautoscaler.autoscaling/frontend": "created",
146+ "service/backend": "created",
147+ "deployment.apps/backend": "created",
148+ "horizontalpodautoscaler.autoscaling/backend": "created"
151149 }
152150}
153151` ` `
154152
155153You can trigger a kustomize build and apply any time with :
156154
157155` ` ` bash
158- kubectl annotate --overwrite kustomization/podinfo-dev kustomize.fluxcd.io/syncAt="$(date +%s)"
156+ kubectl -n kustomize-system annotate --overwrite kustomization/podinfo-dev \
157+ kustomize.fluxcd.io/syncAt="$(date +%s)"
159158` ` `
160159
161160When the source controller pulls a new Git revision, the kustomize controller will detect that the
@@ -175,8 +174,8 @@ status:
175174
176175` ` ` json
177176{
178- "kustomization": "default /podinfo-dev",
179- "error": "Error from server (NotFound): error when creating \" podinfo-dev.yaml\" : namespaces \" dev\" not found\n "
177+ "kustomization": "kustomize-system /podinfo-dev",
178+ "error": "Error from server (NotFound): error when creating podinfo-dev.yaml: namespaces dev not found"
180179}
181180` ` `
182181
@@ -196,7 +195,7 @@ metadata:
196195 namespace: kustomize-system
197196spec:
198197 interval: 10m
199- path: "./profiles/default /"
198+ path: "./istio/system /"
200199 sourceRef:
201200 kind: GitRepository
202201 name: istio
@@ -234,9 +233,9 @@ metadata:
234233 namespace: kustomize-system
235234spec:
236235 interval: 5m
237- url: https://github.com/stefanprodan/podinfo-deploy
236+ url: https://github.com/stefanprodan/podinfo
238237 ref:
239- semver: ">=0.0.1-rc.1 <1 .0.0"
238+ semver: ">=3.2.3 <4 .0.0"
240239` ` `
241240
242241With `ref.semver` we configure source controller to pull the Git tags and create an artifact from the most recent tag
@@ -252,14 +251,14 @@ metadata:
252251 namespace: kustomize-system
253252spec:
254253 interval: 10m
255- path: "./overlays/production/"
254+ path: "./deploy/ overlays/production/"
256255 sourceRef:
257256 kind: GitRepository
258257 name: podinfo-releases
259258` ` `
260259
261- Based on the above definition, the kustomize controller will build and apply a kustomization that matches the semver range
262- set in the Git repository manifest .
260+ Based on the above definition, the kustomize controller will apply the kustomization that matches the semver range
261+ set in the Git repository.
263262
264263# ## Configure alerting
265264
0 commit comments