Add example for `.spec.wait` usage

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan 2021-10-07 11:37:39 +03:00
parent efd1cb4b9a
commit dba56a569e
No known key found for this signature in database
GPG Key ID: 3299AEB0E4085BAF
3 changed files with 25 additions and 11 deletions

View File

@ -17,8 +17,8 @@ limitations under the License.
package v1beta2
const (
// HealthyCondition is the condition type used
// to record the last health assessment result.
// HealthyCondition represents the last recorded
// health assessment result.
HealthyCondition string = "Healthy"
// PruneFailedReason represents the fact that the
@ -26,18 +26,14 @@ const (
PruneFailedReason string = "PruneFailed"
// ArtifactFailedReason represents the fact that the
// artifact download of the kustomization failed.
// source artifact download failed.
ArtifactFailedReason string = "ArtifactFailed"
// BuildFailedReason represents the fact that the
// kustomize build of the Kustomization failed.
// kustomize build failed.
BuildFailedReason string = "BuildFailed"
// HealthCheckFailedReason represents the fact that
// one of the health checks of the Kustomization failed.
// one of the health checks failed.
HealthCheckFailedReason string = "HealthCheckFailed"
// ValidationFailedReason represents the fact that the
// validation of the Kustomization manifests has failed.
ValidationFailedReason string = "ValidationFailed"
)

View File

@ -172,7 +172,7 @@ data:
events := getEvents(resultK.GetName(), map[string]string{"kustomize.toolkit.fluxcd.io/revision": revision})
g.Expect(len(events) > 0).To(BeTrue())
g.Expect(events[len(events)-1].Type).To(BeIdenticalTo("Warning"))
g.Expect(events[len(events)-1].Message).To(ContainSubstring("NotFound"))
g.Expect(events[len(events)-1].Message).To(ContainSubstring("context deadline"))
})
t.Run("recovers and reports healthy status", func(t *testing.T) {

View File

@ -361,7 +361,25 @@ A Kustomization can contain a series of health checks used to determine the
[rollout status](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#deployment-status)
of the deployed workloads and the ready status of custom resources.
To enabled health checking for all the reconciled resources, set `spec.wait` to `true`.
To enabled health checking for all the reconciled resources,
set `spec.wait` and `spec.timeout`:
```yaml
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: backend
namespace: default
spec:
interval: 5m
path: "./deploy"
sourceRef:
kind: GitRepository
name: webapp
wait: true
timeout: 2m
```
If you wish to select only certain resources, list them under `spec.healthChecks`.
Note that when `spec.wait` is enabled, the `spec.healthChecks` field is ignored.