Skip to content

Commit 210c273

Browse files
author
卢永杰
committed
[Addon]: add fluxcd kustomize healthcheck
1 parent e011c70 commit 210c273

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

addons/fluxcd/definitions/kustomize.cue

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
11
kustomize: {
2-
attributes: workload: type: "autodetects.core.oam.dev"
2+
attributes:{
3+
workload: type: "autodetects.core.oam.dev"
4+
status: {
5+
healthPolicy: #"""
6+
isHealth: len(context.output.status.conditions) != 0 && context.output.status.conditions[0]["reason"]=="ReconciliationSucceeded" && context.output.status.conditions[0]["type"]=="Ready" && context.output.status.conditions[0]["status"] == "True"
7+
"""#
8+
customStatus: #"""
9+
repoMessage: *"" | string
10+
kustMessage: *"Wating repository ready" | string
11+
if context.outputs.repo == _|_ {
12+
repoMessage: "Use existed repository"
13+
}
14+
if context.outputs.repo != _|_ && context.outputs.repo.status == _|_ {
15+
repoMessage: "Fetching repository"
16+
}
17+
if context.outputs.repo != _|_ && context.outputs.repo.status != _|_ && context.outputs.repo.status.conditions != _|_ {
18+
repoStatus: context.outputs.repo.status
19+
if len(repoStatus.conditions) != 0 && repoStatus.conditions[0]["reason"] != "Succeeded" {
20+
lastMessage: repoStatus.conditions[0].message
21+
if len(repoStatus.conditions)>1{
22+
repoMessage : repoStatus.conditions[1].message + ", " + lastMessage
23+
}
24+
}
25+
if len(repoStatus.conditions) != 0 && repoStatus.conditions[0]["reason"] == "Succeeded" {
26+
repoMessage: repoStatus.conditions[0].message
27+
}
28+
}
29+
if context.output.status == _|_ {
30+
kustMessage: "Creating git repo"
31+
}
32+
if context.output.status != _|_ {
33+
kustStatus: context.output.status
34+
if kustStatus.conditions != _|_ {
35+
if len(kustStatus.conditions) > 0 {
36+
if kustStatus.conditions[0]["type"] != _|_ && kustStatus.conditions[0]["message"] != _|_ {
37+
if kustStatus.conditions[0]["reason"] == "ReconciliationSucceeded"{
38+
kustMessage: "Create kustomize successfully"
39+
}
40+
if kustStatus.conditions[0]["message"] != "ReconciliationSucceeded" {
41+
kustBasicMessage: "Delivery git kustomize in progress, message: " + kustStatus.conditions[0]["message"]
42+
if len(kustStatus.conditions) == 1 {
43+
kustMessage: kustBasicMessage
44+
}
45+
if len(kustStatus.conditions) > 1 {
46+
if kustStatus.conditions[1]["message"] != _|_ {
47+
kustMessage: kustBasicMessage + ", " + kustStatus.conditions[1]["message"]
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}
54+
}
55+
message: repoMessage + ", " + kustMessage
56+
"""#
57+
}
58+
}
359
description: "kustomize can fetching, building, updating and applying Kustomize manifests from Git repo or Bucket or OCI repo."
460
type: "component"
561
annotations: {

addons/fluxcd/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: fluxcd
2-
version: 2.3.4
2+
version: 2.3.5
33
description: Extended workload to do continuous and progressive delivery
44
icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/flux/horizontal/color/flux-horizontal-color.png
55
url: https://fluxcd.io

0 commit comments

Comments
 (0)