mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 20:46:37 +00:00
* Feat: add the feature that views in addon are applied independently.(#3905) separate the deployment of views in addon and deploy them separately instead of nested in application. see the issue for details Refs #3905 Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: add test case of readViewFile. Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: add the apply method of yaml view. Signed-off-by: HanMengnan <1448189829@qq.com> * Fix: add addon suit-test case Signed-off-by: HanMengnan <1448189829@qq.com>
76 lines
1.6 KiB
CUE
76 lines
1.6 KiB
CUE
import (
|
|
"vela/ql"
|
|
)
|
|
|
|
parameter: {
|
|
name: string
|
|
namespace: string
|
|
cluster: *"" | string
|
|
}
|
|
pod: ql.#Read & {
|
|
value: {
|
|
apiVersion: "v1"
|
|
kind: "Pod"
|
|
metadata: {
|
|
name: parameter.name
|
|
namespace: parameter.namespace
|
|
}
|
|
}
|
|
cluster: parameter.cluster
|
|
}
|
|
eventList: ql.#SearchEvents & {
|
|
value: {
|
|
apiVersion: "v1"
|
|
kind: "Pod"
|
|
metadata: pod.value.metadata
|
|
}
|
|
cluster: parameter.cluster
|
|
}
|
|
podMetrics: ql.#Read & {
|
|
cluster: parameter.cluster
|
|
value: {
|
|
apiVersion: "metrics.k8s.io/v1beta1"
|
|
kind: "PodMetrics"
|
|
metadata: {
|
|
name: parameter.name
|
|
namespace: parameter.namespace
|
|
}
|
|
}
|
|
}
|
|
status: {
|
|
if pod.err == _|_ {
|
|
containers: [ for container in pod.value.spec.containers {
|
|
name: container.name
|
|
image: container.image
|
|
resources: {
|
|
if container.resources.limits != _|_ {
|
|
limits: container.resources.limits
|
|
}
|
|
if container.resources.requests != _|_ {
|
|
requests: container.resources.requests
|
|
}
|
|
if podMetrics.err == _|_ {
|
|
usage: {for containerUsage in podMetrics.value.containers {
|
|
if containerUsage.name == container.name {
|
|
cpu: containerUsage.usage.cpu
|
|
memory: containerUsage.usage.memory
|
|
}
|
|
}}
|
|
}
|
|
}
|
|
if pod.value.status.containerStatuses != _|_ {
|
|
status: {for containerStatus in pod.value.status.containerStatuses if containerStatus.name == container.name {
|
|
state: containerStatus.state
|
|
restartCount: containerStatus.restartCount
|
|
}}
|
|
}
|
|
}]
|
|
if eventList.err == _|_ {
|
|
events: eventList.list
|
|
}
|
|
}
|
|
if pod.err != _|_ {
|
|
error: pod.err
|
|
}
|
|
}
|