Skip to content

Commit

Permalink
[Addon]: add fluxcd kustomize healthcheck ,customStatus.
Browse files Browse the repository at this point in the history
and flow details.

[Addon]: add fluxcd kustomize healthcheck ,customStatus.
Kustomize flow details.

[Addon]: add fluxcd kustomize healthcheck
  • Loading branch information
卢永杰 committed Apr 28, 2023
1 parent e011c70 commit 6002528
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
58 changes: 57 additions & 1 deletion addons/fluxcd/definitions/kustomize.cue
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
kustomize: {
attributes: workload: type: "autodetects.core.oam.dev"
attributes:{
workload: type: "autodetects.core.oam.dev"
status: {
healthPolicy: #"""
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"
"""#
customStatus: #"""
repoMessage: *"" | string
kustMessage: *"Wating repository ready" | string
if context.outputs.repo == _|_ {
repoMessage: "Use existed repository"
}
if context.outputs.repo != _|_ && context.outputs.repo.status == _|_ {
repoMessage: "Fetching repository"
}
if context.outputs.repo != _|_ && context.outputs.repo.status != _|_ && context.outputs.repo.status.conditions != _|_ {
repoStatus: context.outputs.repo.status
if len(repoStatus.conditions) != 0 && repoStatus.conditions[0]["reason"] != "Succeeded" {
lastMessage: repoStatus.conditions[0].message
if len(repoStatus.conditions)>1{
repoMessage : repoStatus.conditions[1].message + ", " + lastMessage
}
}
if len(repoStatus.conditions) != 0 && repoStatus.conditions[0]["reason"] == "Succeeded" {
repoMessage: repoStatus.conditions[0].message
}
}
if context.output.status == _|_ {
kustMessage: "Creating git repo"
}
if context.output.status != _|_ {
kustStatus: context.output.status
if kustStatus.conditions != _|_ {
if len(kustStatus.conditions) > 0 {
if kustStatus.conditions[0]["type"] != _|_ && kustStatus.conditions[0]["reason"] != _|_ {
if kustStatus.conditions[0]["reason"] != "ReconciliationSucceeded" {
kustBasicMessage: "Delivery git kustomize in progress, message: " + kustStatus.conditions[0]["message"]
if len(kustStatus.conditions) == 1 {
kustMessage: kustBasicMessage
}
if len(kustStatus.conditions) > 1 {
if kustStatus.conditions[1]["message"] != _|_ {
kustMessage: kustBasicMessage + ", " + kustStatus.conditions[1]["message"]
}
}
}
if kustStatus.conditions[0]["reason"] == "ReconciliationSucceeded"{
kustMessage: "Create kustomize successfully"
}
}
}
}
}
message: repoMessage + ", " + kustMessage
"""#
}
}
description: "kustomize can fetching, building, updating and applying Kustomize manifests from Git repo or Bucket or OCI repo."
type: "component"
annotations: {
Expand Down
2 changes: 1 addition & 1 deletion addons/fluxcd/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: fluxcd
version: 2.3.4
version: 2.3.5
description: Extended workload to do continuous and progressive delivery
icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/flux/horizontal/color/flux-horizontal-color.png
url: https://fluxcd.io
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: demo-kust-fluxcd-new
namespace: default
spec:
components:
- name: demo-kust-fluxcd-new
properties:
force: false
path: ./exmaple
prune: true
pullInterval: 5m
repoType: git
secretRef: test
suspend: false
targetNamespace: default
url: https://nobody/kubevela/demo.git
type: kustomize

0 comments on commit 6002528

Please sign in to comment.