mirror of
https://github.com/kubevela/kubevela.git
synced 2026-03-01 17:20:45 +00:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
066c448c1a | ||
|
|
8de80ebdb2 | ||
|
|
855cbfe3ec | ||
|
|
162534b611 | ||
|
|
6bd5d8e6e2 | ||
|
|
22079aacd3 | ||
|
|
b2329d548d | ||
|
|
9152c15a88 | ||
|
|
73b3d3106b | ||
|
|
237c71d94e | ||
|
|
2200d199f3 | ||
|
|
d083039a32 | ||
|
|
5e6be649c1 | ||
|
|
706a65beae | ||
|
|
d21a337dd7 | ||
|
|
b53f4f4fdd | ||
|
|
24970cd990 | ||
|
|
844f479f54 | ||
|
|
91d336b469 | ||
|
|
516156f32f | ||
|
|
eb5808e4ea | ||
|
|
66f794e9fd | ||
|
|
90f46c57e8 | ||
|
|
95496e55c0 | ||
|
|
3009d02fcd | ||
|
|
df8b60d521 | ||
|
|
6c6e834155 | ||
|
|
cc3d2e28c0 |
6
.github/workflows/e2e-multicluster-test.yml
vendored
6
.github/workflows/e2e-multicluster-test.yml
vendored
@@ -76,10 +76,16 @@ jobs:
|
||||
- name: Load Image to kind cluster (Hub)
|
||||
run: make kind-load
|
||||
|
||||
- name: Load Image to kind cluster (Worker)
|
||||
run: |
|
||||
make kind-load-runtime-cluster
|
||||
|
||||
- name: Cleanup for e2e tests
|
||||
run: |
|
||||
make e2e-cleanup
|
||||
make e2e-setup-core
|
||||
make
|
||||
make setup-runtime-e2e-cluster
|
||||
|
||||
- name: Run e2e multicluster tests
|
||||
run: make e2e-multicluster-test
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -45,4 +45,7 @@ charts/vela-core/crds/_.yaml
|
||||
.vela/
|
||||
|
||||
# check docs
|
||||
git-page/
|
||||
git-page/
|
||||
|
||||
# e2e rollout runtime image build
|
||||
runtime/rollout/e2e/tmp
|
||||
12
Makefile
12
Makefile
@@ -39,6 +39,9 @@ endif
|
||||
VELA_CORE_IMAGE ?= vela-core:latest
|
||||
VELA_CORE_TEST_IMAGE ?= vela-core-test:$(GIT_COMMIT)
|
||||
VELA_RUNTIME_ROLLOUT_IMAGE ?= vela-runtime-rollout:latest
|
||||
VELA_RUNTIME_ROLLOUT_TEST_IMAGE ?= vela-runtime-rollout-test:$(GIT_COMMIT)
|
||||
RUNTIME_CLUSTER_CONFIG ?= /tmp/worker.kubeconfig
|
||||
RUNTIME_CLUSTER_NAME ?= worker
|
||||
|
||||
all: build
|
||||
|
||||
@@ -143,6 +146,9 @@ e2e-setup-core:
|
||||
helm upgrade --install --create-namespace --namespace vela-system --set image.pullPolicy=IfNotPresent --set image.repository=vela-core-test --set applicationRevisionLimit=5 --set dependCheckWait=10s --set image.tag=$(GIT_COMMIT) --set multicluster.enabled=true --wait kubevela ./charts/vela-core
|
||||
kubectl wait --for=condition=Available deployment/kubevela-vela-core -n vela-system --timeout=180s
|
||||
|
||||
setup-runtime-e2e-cluster:
|
||||
helm upgrade --install --create-namespace --namespace vela-system --kubeconfig=$(RUNTIME_CLUSTER_CONFIG) --set image.pullPolicy=IfNotPresent --set image.repository=vela-runtime-rollout-test --set image.tag=$(GIT_COMMIT) --wait vela-rollout ./runtime/rollout/charts
|
||||
|
||||
e2e-setup:
|
||||
helm install kruise https://github.com/openkruise/kruise/releases/download/v0.9.0/kruise-chart.tgz --set featureGates="PreDownloadImageForInPlaceUpdate=true"
|
||||
sh ./hack/e2e/modify_charts.sh
|
||||
@@ -209,6 +215,12 @@ kind-load:
|
||||
docker build -t $(VELA_CORE_TEST_IMAGE) -f Dockerfile.e2e .
|
||||
kind load docker-image $(VELA_CORE_TEST_IMAGE) || { echo >&2 "kind not installed or error loading image: $(VELA_CORE_TEST_IMAGE)"; exit 1; }
|
||||
|
||||
kind-load-runtime-cluster:
|
||||
/bin/sh hack/e2e/build_runtime_rollout.sh
|
||||
docker build -t $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) -f runtime/rollout/e2e/Dockerfile.e2e runtime/rollout/e2e/
|
||||
rm -rf runtime/rollout/e2e/tmp
|
||||
kind load docker-image $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) --name=$(RUNTIME_CLUSTER_NAME) || { echo >&2 "kind not installed or error loading image: $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)"; exit 1; }
|
||||
|
||||
# Run tests
|
||||
core-test: fmt vet manifests
|
||||
go test ./pkg/... -coverprofile cover.out
|
||||
|
||||
@@ -114,6 +114,9 @@ type Terraform struct {
|
||||
// +kubebuilder:validation:Enum:=hcl;json;remote
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Path is the sub-directory of remote git repository. It's valid when remote is set
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// ProviderReference specifies the reference to Provider
|
||||
ProviderReference *types.Reference `json:"providerRef,omitempty"`
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/conversion"
|
||||
|
||||
@@ -115,10 +116,17 @@ func (app *Application) ConvertFrom(src conversion.Hub) error {
|
||||
}
|
||||
// convert component
|
||||
// `.properties` -> `.settings`
|
||||
|
||||
var compProperties runtime.RawExtension
|
||||
|
||||
if comp.Properties != nil {
|
||||
compProperties = *comp.Properties.DeepCopy()
|
||||
}
|
||||
|
||||
app.Spec.Components = append(app.Spec.Components, ApplicationComponent{
|
||||
Name: comp.Name,
|
||||
WorkloadType: comp.Type,
|
||||
Settings: *comp.Properties.DeepCopy(),
|
||||
Settings: compProperties,
|
||||
Traits: traits,
|
||||
Scopes: scopes,
|
||||
})
|
||||
|
||||
@@ -38,7 +38,8 @@ type WorkflowStepDefinitionSpec struct {
|
||||
type WorkflowStepDefinitionStatus struct {
|
||||
// ConditionedStatus reflects the observed status of a resource
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
|
||||
// ConfigMapRef refer to a ConfigMap which contains OpenAPI V3 JSON schema of Component parameters.
|
||||
ConfigMapRef string `json:"configMapRef,omitempty"`
|
||||
// LatestRevision of the component definition
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
|
||||
@@ -85,4 +85,5 @@ var DefaultFilterAnnots = []string{
|
||||
oam.AnnotationInplaceUpgrade,
|
||||
oam.AnnotationFilterLabelKeys,
|
||||
oam.AnnotationFilterAnnotationKeys,
|
||||
oam.AnnotationLastAppliedConfiguration,
|
||||
}
|
||||
|
||||
@@ -188,6 +188,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -468,6 +472,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -193,6 +193,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -454,6 +458,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -68,8 +68,8 @@ admissionWebhooks:
|
||||
patch:
|
||||
enabled: true
|
||||
image:
|
||||
repository: wonderflow/kube-webhook-certgen
|
||||
tag: v2.1
|
||||
repository: oamdev/kube-webhook-certgen
|
||||
tag: v2.3
|
||||
pullPolicy: IfNotPresent
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
|
||||
@@ -1232,6 +1232,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1635,6 +1639,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1936,6 +1944,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3360,6 +3372,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3656,6 +3672,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4041,6 +4061,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4305,6 +4329,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4371,6 +4399,10 @@ spec:
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
configMapRef:
|
||||
description: ConfigMapRef refer to a ConfigMap which contains
|
||||
OpenAPI V3 JSON schema of Component parameters.
|
||||
type: string
|
||||
latestRevision:
|
||||
description: LatestRevision of the component definition
|
||||
properties:
|
||||
@@ -4585,6 +4617,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
|
||||
@@ -179,6 +179,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -463,6 +467,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -222,6 +222,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -506,6 +510,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -783,6 +791,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1041,6 +1053,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1107,6 +1123,10 @@ spec:
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
configMapRef:
|
||||
description: ConfigMapRef refer to a ConfigMap which contains
|
||||
OpenAPI V3 JSON schema of Component parameters.
|
||||
type: string
|
||||
latestRevision:
|
||||
description: LatestRevision of the component definition
|
||||
properties:
|
||||
|
||||
@@ -151,6 +151,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -188,6 +188,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -468,6 +472,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -148,6 +148,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -212,6 +216,10 @@ spec:
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
configMapRef:
|
||||
description: ConfigMapRef refer to a ConfigMap which contains OpenAPI
|
||||
V3 JSON schema of Component parameters.
|
||||
type: string
|
||||
latestRevision:
|
||||
description: LatestRevision of the component definition
|
||||
properties:
|
||||
|
||||
@@ -193,6 +193,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -454,6 +458,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: istio Controller is a Kubernetes Controller for manage
|
||||
@@ -10,246 +10,248 @@ data:
|
||||
name: istio
|
||||
namespace: istio-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: istio
|
||||
properties:
|
||||
chart: istio
|
||||
repoType: helm
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 1.11.1
|
||||
type: helm
|
||||
- name: canary-rollout
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
name: canary-rollout
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |-
|
||||
import ("vela/op")
|
||||
components:
|
||||
- name: ns-istio-system
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: istio-system
|
||||
type: raw
|
||||
- name: istio
|
||||
properties:
|
||||
chart: istio
|
||||
repoType: helm
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 1.11.1
|
||||
type: helm
|
||||
- name: canary-rollout
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
name: canary-rollout
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |-
|
||||
import ("vela/op")
|
||||
|
||||
parameter: {
|
||||
batchPartition: int
|
||||
traffic: weightedTargets: [...{
|
||||
revision: string
|
||||
weight: int
|
||||
parameter: {
|
||||
batchPartition: int
|
||||
traffic: weightedTargets: [...{
|
||||
revision: string
|
||||
weight: int
|
||||
}]
|
||||
}
|
||||
|
||||
comps__: op.#Load
|
||||
compNames__: [ for name, c in comps__.value {name}]
|
||||
comp__: compNames__[0]
|
||||
|
||||
apply: op.#ApplyComponent & {
|
||||
value: comps__.value[comp__]
|
||||
patch: {
|
||||
traits: "rollout": {
|
||||
spec: rolloutPlan: batchPartition: parameter.batchPartition
|
||||
}
|
||||
|
||||
traits: "virtualService": {
|
||||
spec:
|
||||
// +patchStrategy=retainKeys
|
||||
http: [
|
||||
{
|
||||
route: [
|
||||
for i, t in parameter.traffic.weightedTargets {
|
||||
destination: {
|
||||
host: comp__
|
||||
subset: t.revision
|
||||
}
|
||||
weight: t.weight
|
||||
}]
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
traits: "destinationRule": {
|
||||
// +patchStrategy=retainKeys
|
||||
spec: {
|
||||
host: comp__
|
||||
subsets: [
|
||||
for i, t in parameter.traffic.weightedTargets {
|
||||
name: t.revision
|
||||
labels: {"app.oam.dev/revision": t.revision}
|
||||
},
|
||||
]}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyRemaining: op.#ApplyRemaining & {
|
||||
exceptions: [comp__]
|
||||
}
|
||||
type: raw
|
||||
- name: istio-gateway
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: use istio to manage in-cluster traffic
|
||||
name: istio-gateway
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: "\noutputs: gateway: {\n apiVersion: \"networking.istio.io/v1alpha3\"\n
|
||||
\ kind: \"Gateway\"\n metadata: {\n name: context.name\n
|
||||
\ namespace: context.namespace\n }\n spec: {\n selector:
|
||||
{\n istio: parameter.gateway\n }\n servers: [{\n hosts:
|
||||
parameter.hosts\n port: {\n name: \"http\"\n number:
|
||||
80\n protocol: \"HTTP\"\n }\n }]\n }\n}\n\noutputs:
|
||||
virtualService: {\n apiVersion: \"networking.istio.io/v1alpha3\"\n
|
||||
\ kind: \"VirtualService\"\n metadata: {\n name: context.name\n
|
||||
\ namespace: context.namespace\n }\n spec: {\n gateways:
|
||||
[context.name]\n hosts: parameter.hosts\n http:[{\n match:
|
||||
[ for i, u in parameter.match { uri: u} ]\n route: [{destination:
|
||||
{\n host: context.name\n port: number: parameter.port\n
|
||||
\ }}]\n }]\n }\n}\n\nparameter: {\n hosts: [string]\n
|
||||
\ gateway: *\"ingressgateway\"|string\n match: [...#uri]\n port:
|
||||
int\n}\n\n#uri: {\n exact?: string\n prefix?: string\n} \n"
|
||||
type: raw
|
||||
- name: canary-rollback
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
name: canary-rollback
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |-
|
||||
import ("vela/op")
|
||||
|
||||
parameter: {...}
|
||||
|
||||
comps: op.#Load
|
||||
compNames: [ for name, c in comps.value {name}]
|
||||
firstcomp: compNames[0]
|
||||
|
||||
rolloutObj: op.#Read & {
|
||||
value: {
|
||||
apiVersion: "standard.oam.dev/v1alpha1"
|
||||
kind: "Rollout"
|
||||
metadata: {
|
||||
name: firstcomp
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_sourceRevision: rolloutObj.value.status.LastSourceRevision
|
||||
|
||||
apply: op.#ApplyComponent & {
|
||||
value: comps.value[firstcomp]
|
||||
patch: {
|
||||
traits: "rollout": {
|
||||
spec: {
|
||||
targetRevisionName: _sourceRevision
|
||||
}
|
||||
}
|
||||
|
||||
traits: "virtualService": {
|
||||
spec:
|
||||
// +patchStrategy=retainKeys
|
||||
http: [
|
||||
{
|
||||
route: [{
|
||||
destination: {
|
||||
host: firstcomp
|
||||
subset: _sourceRevision
|
||||
}
|
||||
weight: 100
|
||||
}]
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
comps__: op.#Load
|
||||
compNames__: [ for name, c in comps__.value {name}]
|
||||
comp__: compNames__[0]
|
||||
|
||||
apply: op.#ApplyComponent & {
|
||||
value: comps__.value[comp__]
|
||||
patch: {
|
||||
traits: "rollout": {
|
||||
spec: rolloutPlan: batchPartition: parameter.batchPartition
|
||||
}
|
||||
|
||||
traits: "virtualService": {
|
||||
spec:
|
||||
// +patchStrategy=retainKeys
|
||||
http: [
|
||||
{
|
||||
route: [
|
||||
for i, t in parameter.traffic.weightedTargets {
|
||||
destination: {
|
||||
host: comp__
|
||||
subset: t.revision
|
||||
}
|
||||
weight: t.weight
|
||||
}]
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
traits: "destinationRule": {
|
||||
// +patchStrategy=retainKeys
|
||||
spec: {
|
||||
host: comp__
|
||||
subsets: [
|
||||
for i, t in parameter.traffic.weightedTargets {
|
||||
name: t.revision
|
||||
labels: {"app.oam.dev/revision": t.revision}
|
||||
},
|
||||
]}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyRemaining: op.#ApplyRemaining & {
|
||||
exceptions: [comp__]
|
||||
}
|
||||
type: raw
|
||||
- name: istio-gateway
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: use istio to manage in-cluster traffic
|
||||
name: istio-gateway
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: "\noutputs: gateway: {\n apiVersion: \"networking.istio.io/v1alpha3\"\n
|
||||
\ kind: \"Gateway\"\n metadata: {\n name: context.name\n
|
||||
\ namespace: context.namespace\n }\n spec: {\n selector:
|
||||
{\n istio: parameter.gateway\n }\n servers: [{\n
|
||||
\ hosts: parameter.hosts\n port: {\n name:
|
||||
\"http\"\n number: 80\n protocol: \"HTTP\"\n
|
||||
\ }\n }]\n }\n}\n\noutputs: virtualService: {\n apiVersion:
|
||||
\"networking.istio.io/v1alpha3\"\n kind: \"VirtualService\"\n
|
||||
\ metadata: {\n name: context.name\n namespace:
|
||||
context.namespace\n }\n spec: {\n gateways: [context.name]\n
|
||||
\ hosts: parameter.hosts\n http:[{\n match: [ for
|
||||
i, u in parameter.match { uri: u} ]\n route: [{destination:
|
||||
{\n host: context.name\n port: number: parameter.port\n
|
||||
\ }}]\n }]\n }\n}\n\nparameter: {\n hosts: [string]\n
|
||||
\ gateway: *\"ingressgateway\"|string\n match: [...#uri]\n
|
||||
\ port: int\n}\n\n#uri: {\n exact?: string\n prefix?: string\n}
|
||||
\n"
|
||||
type: raw
|
||||
- name: canary-rollback
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
name: canary-rollback
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |-
|
||||
import ("vela/op")
|
||||
|
||||
parameter: {...}
|
||||
|
||||
comps: op.#Load
|
||||
compNames: [ for name, c in comps.value {name}]
|
||||
firstcomp: compNames[0]
|
||||
|
||||
rolloutObj: op.#Read & {
|
||||
value: {
|
||||
apiVersion: "standard.oam.dev/v1alpha1"
|
||||
kind: "Rollout"
|
||||
metadata: {
|
||||
name: firstcomp
|
||||
namespace: context.namespace
|
||||
}
|
||||
traits: "destinationRule": {
|
||||
// +patchStrategy=retainKeys
|
||||
spec: {
|
||||
host: firstcomp
|
||||
subsets: [
|
||||
{
|
||||
name: _sourceRevision
|
||||
labels: {"app.oam.dev/revision": _sourceRevision}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_sourceRevision: rolloutObj.value.status.LastSourceRevision
|
||||
|
||||
apply: op.#ApplyComponent & {
|
||||
value: comps.value[firstcomp]
|
||||
patch: {
|
||||
traits: "rollout": {
|
||||
spec: {
|
||||
targetRevisionName: _sourceRevision
|
||||
}
|
||||
}
|
||||
|
||||
traits: "virtualService": {
|
||||
spec:
|
||||
// +patchStrategy=retainKeys
|
||||
http: [
|
||||
{
|
||||
route: [{
|
||||
destination: {
|
||||
host: firstcomp
|
||||
subset: _sourceRevision
|
||||
}
|
||||
weight: 100
|
||||
}]
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
traits: "destinationRule": {
|
||||
// +patchStrategy=retainKeys
|
||||
spec: {
|
||||
host: firstcomp
|
||||
subsets: [
|
||||
{
|
||||
name: _sourceRevision
|
||||
labels: {"app.oam.dev/revision": _sourceRevision}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyRemaining: op.#ApplyRemaining & {
|
||||
exceptions: [firstcomp]
|
||||
}
|
||||
type: raw
|
||||
- name: canary-traffic
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: use istio to manage traffic
|
||||
name: canary-traffic
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: "outputs: service: {\n\t\tapiVersion: \"v1\"\n\t\tkind:
|
||||
\ \"Service\"\n\t\tmetadata: name: context.name\n\t\tspec:
|
||||
{\n\t\t\tselector: \"app.oam.dev/component\": context.name\n\t\t\tports:
|
||||
[\n\t\t\t\tfor p in parameter.port {\n\t\t\t\t\tport: p\n\t\t\t\t\ttargetPort:
|
||||
p\n\t\t\t\t},\n\t\t\t]\n\t\t\ttype: \"ClusterIP\"\n\t\t}\n}\n\noutputs:
|
||||
virtualService: {\n apiVersion: \"networking.istio.io/v1alpha3\"\n
|
||||
\ kind: \"VirtualService\"\n metadata: {\n name: context.name\n
|
||||
\ namespace: context.namespace\n }\n spec: {\n hosts:
|
||||
[context.name]\n http: [{route: [\n {destination: {\n
|
||||
\ host: context.name\n port: {number: parameter.port[0]}\n
|
||||
\ }}]}]\n }\n}\n\noutputs: destinationRule: {\n apiVersion:
|
||||
\"networking.istio.io/v1alpha3\"\n kind: \"DestinationRule\"\n
|
||||
\ metadata: {\n name: context.name\n namespace:
|
||||
context.namespace\n }\n spec: {\n host: context.name\n
|
||||
\ subsets: [{\n name: context.revision\n labels:
|
||||
{\"app.oam.dev/revision\": context.revision}\n }]\n }\n}\n\nparameter:
|
||||
{\n port: [int]\n} \n"
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
dependsOn:
|
||||
- ref:
|
||||
applyRemaining: op.#ApplyRemaining & {
|
||||
exceptions: [firstcomp]
|
||||
}
|
||||
type: raw
|
||||
- name: canary-traffic
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
- ref:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: ns-istio-system
|
||||
namespace: vela-system
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: use istio to manage traffic
|
||||
name: canary-traffic
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: "outputs: service: {\n\t\tapiVersion: \"v1\"\n\t\tkind: \"Service\"\n\t\tmetadata:
|
||||
name: context.name\n\t\tspec: {\n\t\t\tselector: \"app.oam.dev/component\":
|
||||
context.name\n\t\t\tports: [\n\t\t\t\tfor p in parameter.port {\n\t\t\t\t\tport:
|
||||
\ p\n\t\t\t\t\ttargetPort: p\n\t\t\t\t},\n\t\t\t]\n\t\t\ttype:
|
||||
\"ClusterIP\"\n\t\t}\n}\n\noutputs: virtualService: {\n apiVersion:
|
||||
\"networking.istio.io/v1alpha3\"\n kind: \"VirtualService\"\n metadata:
|
||||
{\n name: context.name\n namespace: context.namespace\n
|
||||
\ }\n spec: {\n hosts: [context.name]\n http: [{route:
|
||||
[\n {destination: {\n host: context.name\n port:
|
||||
{number: parameter.port[0]}\n }}]}]\n }\n}\n\noutputs: destinationRule:
|
||||
{\n apiVersion: \"networking.istio.io/v1alpha3\"\n kind:
|
||||
\"DestinationRule\"\n metadata: {\n name: context.name\n
|
||||
\ namespace: context.namespace\n }\n spec: {\n
|
||||
\ host: context.name\n subsets: [{\n name:
|
||||
context.revision\n labels: {\"app.oam.dev/revision\": context.revision}\n
|
||||
\ }]\n }\n}\n\nparameter: {\n port: [int]\n} \n"
|
||||
type: raw
|
||||
workflow:
|
||||
steps:
|
||||
- name: checking-depends-on
|
||||
properties:
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
type: depends-on-app
|
||||
- name: apply-ns
|
||||
properties:
|
||||
component: ns-istio-system
|
||||
type: apply-component
|
||||
- name: apply-resources
|
||||
type: apply-remaining
|
||||
status:
|
||||
observedGeneration: 0
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
@@ -1,39 +1,38 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: KEDA is a Kubernetes-based Event Driven Autoscaler.
|
||||
name: keda
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: keda
|
||||
properties:
|
||||
chart: keda
|
||||
repoType: helm
|
||||
url: https://kedacore.github.io/charts
|
||||
type: helm
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
dependsOn:
|
||||
- ref:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
components:
|
||||
- name: keda
|
||||
properties:
|
||||
chart: keda
|
||||
repoType: helm
|
||||
url: https://kedacore.github.io/charts
|
||||
type: helm
|
||||
workflow:
|
||||
steps:
|
||||
- name: checking-depends-on
|
||||
properties:
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
type: depends-on-app
|
||||
- name: apply-resources
|
||||
type: apply-application
|
||||
status:
|
||||
observedGeneration: 0
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Kruise is a Kubernetes extended suite for application
|
||||
@@ -10,182 +10,173 @@ data:
|
||||
name: kruise
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: kruise
|
||||
properties:
|
||||
chart: ./charts/kruise/v0.9.0
|
||||
git:
|
||||
branch: master
|
||||
repoType: git
|
||||
url: https://github.com/openkruise/kruise
|
||||
values:
|
||||
featureGates: PreDownloadImageForInPlaceUpdate=true
|
||||
type: helm
|
||||
- name: cloneset
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Describes long-running, scalable, containerized
|
||||
services that have a stable network endpoint to receive external network
|
||||
traffic from customers. If workload type is skipped for any service
|
||||
defined in Appfile, it will be defaulted to `webservice` type.
|
||||
name: cloneset
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "output: {\n\tapiVersion: \"apps.kruise.io/v1alpha1\"\n\tkind:
|
||||
\ \"CloneSet\"\n\tmetadata: labels: {\n\t\t\"app.oam.dev/component\":
|
||||
context.name\n\t}\n\tspec: {\n\t\tselector: matchLabels: {\n\t\t\t\"app.oam.dev/component\":
|
||||
context.name\n\t\t}\n\n\t\ttemplate: {\n\t\t\tmetadata: labels:
|
||||
{\n\t\t\t\t\"app.oam.dev/component\": context.name\n\t\t\t}\n\n\t\t\tspec:
|
||||
{\n\t\t\t\tcontainers: [{\n\t\t\t\t\tname: context.name\n\t\t\t\t\timage:
|
||||
parameter.image\n\n\t\t\t\t\tif parameter.cmd != _|_ {\n\t\t\t\t\t\tcommand:
|
||||
parameter.cmd\n\t\t\t\t\t}\n\t\t\t\t\tif parameter.args != _|_ {\n\t\t\t\t\t\targs:
|
||||
parameter.args\n\t\t\t\t\t}\n\t\t\t\t\tif parameter.env != _|_ {\n\t\t\t\t\t\tenv:
|
||||
parameter.env\n\t\t\t\t\t}\n\n\t\t\t\t\tif context.config != _|_
|
||||
{\n\t\t\t\t\t\tenv: context.config\n\t\t\t\t\t}\n\n\t\t\t\t\tif
|
||||
parameter[\"imagePullPolicy\"] != _|_ {\n\t\t\t\t\t\timagePullPolicy:
|
||||
parameter.imagePullPolicy\n\t\t\t\t\t}\n\n\t\t\t\t\tports: [{\n\t\t\t\t\t\tcontainerPort:
|
||||
parameter.port\n\t\t\t\t\t}]\n\n\t\t\t\t\tif parameter[\"cpu\"]
|
||||
!= _|_ {\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\tlimits: cpu: parameter.cpu\n\t\t\t\t\t\t\trequests:
|
||||
cpu: parameter.cpu\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif parameter[\"memory\"]
|
||||
!= _|_ {\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\tlimits: memory:
|
||||
\ parameter.memory\n\t\t\t\t\t\t\trequests: memory: parameter.memory\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif
|
||||
parameter[\"livenessProbe\"] != _|_ {\n\t\t\t\t\t\tlivenessProbe:
|
||||
parameter.livenessProbe\n\t\t\t\t\t}\n\n\t\t\t\t\tif parameter[\"readinessProbe\"]
|
||||
!= _|_ {\n\t\t\t\t\t\treadinessProbe: parameter.readinessProbe\n\t\t\t\t\t}\n\n\t\t\t\t\tlifecycle:
|
||||
{\n\t\t\t\t\t\tif parameter.postStart != _|_ {\n\t\t\t\t\t\t\tpostStart:
|
||||
exec: command: parameter.postStart\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif
|
||||
parameter.preStop != _|_ {\n\t\t\t\t\t\t\tpreStop: exec: command:
|
||||
parameter.preStop\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}]\n\t\t\t\tif
|
||||
parameter.hostAliases != _|_ {\n\t\t\t\t\thostAliases: parameter.hostAliases\n\t\t\t\t}\n\t\t\t\tif
|
||||
parameter[\"imagePullSecrets\"] != _|_ {\n\t\t\t\t\timagePullSecrets:
|
||||
[ for v in parameter.imagePullSecrets {name: v}]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif
|
||||
parameter.updateStrategyType != _|_ {\n\t\t\tupdateStrategy: {\n\t\t\t\ttype:
|
||||
parameter.updateStrategyType\n\t\t\t}\n\t\t}\n\t}\n}\nparameter:
|
||||
{\n\t// +usage=Which image would you like to use for your service\n\t//
|
||||
+short=i\n\timage: string\n\n\t// +usage=Specify image pull policy
|
||||
for your service\n\timagePullPolicy?: string\n\n\t// +usage=Specify
|
||||
image pull secrets for your service\n\timagePullSecrets?: [...string]\n\n\t//
|
||||
+usage=Number of CPU units for the service, like `0.5` (0.5 CPU
|
||||
core), `1` (1 CPU core)\n\tcpu?: string\n\n\t// +usage=Specify the
|
||||
amount of memory to limit\n\tmemory?: *\"2048Mi\" | =~\"^([1-9][0-9]{0,63})(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)$\"\n\n\t//
|
||||
+usage=Commands to run in the container\n\tcmd?: [...string]\n\n\t//
|
||||
+usage=Arguments to the command.\n\targs?: [...string]\n\n\t// +usage=postStart
|
||||
commands will be called immediately after a container is created.\n\tpostStart?:
|
||||
[...string]\n\n\t// +usage=PreStop is called immediately before
|
||||
a container is terminated due to an API request or management event
|
||||
such as liveness/startup probe failure, preemption, resource contention,
|
||||
etc. The handler is not called if the container crashes or exits.
|
||||
The reason for termination is passed to the handler. The Pod's termination
|
||||
grace period countdown begins before the PreStop hooked is executed.
|
||||
Regardless of the outcome of the handler, the container will eventually
|
||||
terminate within the Pod's termination grace period. Other management
|
||||
of the container blocks until the hook completes or until the termination
|
||||
grace period is reached. More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks\n\tpreStop?:
|
||||
[...string]\n\n\t// +usage=Which port do you want customer traffic
|
||||
sent to\n\t// +short=p\n\tport: *80 | int\n\n\t// +usage=Define
|
||||
arguments by using environment variables\n\tenv?: [...#ENV]\n\n\t//
|
||||
+usage=Cloneset updateStrategy, candidates are `ReCreate`/`InPlaceIfPossible`/`InPlaceOnly`\n\tupdateStrategyType?:
|
||||
string\n\n\t// +usage=HostAliases is a list of hosts and IPs that
|
||||
will be write into the pod's hosts file\n\thostAliases?: [...{\n\t\thostnames:
|
||||
[...string]\n\t\tip: string\n\t}]\n\n\t// +usage=Instructions for
|
||||
assessing whether the container is alive.\n\tlivenessProbe?: #HealthProbe\n\n\t//
|
||||
+usage=Instructions for assessing whether the container is in a
|
||||
suitable state to serve traffic.\n\treadinessProbe?: #HealthProbe\n}\n\n#ENV:
|
||||
{\n\t// +usage=Environment variable name\n\tname: string\n\t// +usage=The
|
||||
value of the environment variable\n\tvalue?: string\n\t// +usage=Specifies
|
||||
a source the value of this var should come from\n\tvalueFrom?: {\n\t\t//
|
||||
+usage=Selects a key of a secret in the pod's namespace\n\t\tsecretKeyRef:
|
||||
{\n\t\t\t// +usage=The name of the secret in the pod's namespace
|
||||
to select from\n\t\t\tname: string\n\t\t\t// +usage=The key of the
|
||||
secret to select from. Must be a valid secret key\n\t\t\tkey: string\n\t\t}\n\t}\n}\n\n#HealthProbe:
|
||||
{\n\n\t// +usage=Instructions for assessing container health by
|
||||
executing a command. Either this attribute or the httpGet attribute
|
||||
or the tcpSocket attribute MUST be specified. This attribute is
|
||||
mutually exclusive with both the httpGet attribute and the tcpSocket
|
||||
attribute.\n\texec?: {\n\t\t// +usage=A command to be executed inside
|
||||
the container to assess its health. Each space delimited token of
|
||||
the command is a separate array element. Commands exiting 0 are
|
||||
considered to be successful probes, whilst all other exit codes
|
||||
are considered failures.\n\t\tcommand: [...string]\n\t}\n\n\t//
|
||||
+usage=Instructions for assessing container health by executing
|
||||
an HTTP GET request. Either this attribute or the exec attribute
|
||||
or the tcpSocket attribute MUST be specified. This attribute is
|
||||
mutually exclusive with both the exec attribute and the tcpSocket
|
||||
attribute.\n\thttpGet?: {\n\t\t// +usage=The endpoint, relative
|
||||
to the port, to which the HTTP GET request should be directed.\n\t\tpath:
|
||||
string\n\t\t// +usage=The TCP socket within the container to which
|
||||
the HTTP GET request should be directed.\n\t\tport: int\n\t\thttpHeaders?:
|
||||
[...{\n\t\t\tname: string\n\t\t\tvalue: string\n\t\t}]\n\t}\n\n\t//
|
||||
+usage=Instructions for assessing container health by probing a
|
||||
TCP socket. Either this attribute or the exec attribute or the httpGet
|
||||
attribute MUST be specified. This attribute is mutually exclusive
|
||||
with both the exec attribute and the httpGet attribute.\n\ttcpSocket?:
|
||||
{\n\t\t// +usage=The TCP socket within the container that should
|
||||
be probed to assess container health.\n\t\tport: int\n\t}\n\n\t//
|
||||
+usage=Number of seconds after the container is started before the
|
||||
first probe is initiated.\n\tinitialDelaySeconds: *0 | int\n\n\t//
|
||||
+usage=How often, in seconds, to execute the probe.\n\tperiodSeconds:
|
||||
*10 | int\n\n\t// +usage=Number of seconds after which the probe
|
||||
times out.\n\ttimeoutSeconds: *1 | int\n\n\t// +usage=Minimum consecutive
|
||||
successes for the probe to be considered successful after having
|
||||
failed.\n\tsuccessThreshold: *1 | int\n\n\t// +usage=Number of consecutive
|
||||
failures required to determine the container is not alive (liveness
|
||||
probe) or not ready (readiness probe).\n\tfailureThreshold: *3 |
|
||||
int\n} \n"
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: CloneSet
|
||||
type: raw
|
||||
- name: predownloadimage
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
name: predownloadimage
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "import (\"vela/op\")\nparameter: {\n image: string\n parallel:
|
||||
int\n kvs: [string]: string\n type: *\"Always\" | string\n activeDeadlineSeconds:
|
||||
*1200 | int\n ttlSecondsAfterFinished: *300 | int\n backoffLimit?:
|
||||
int\n timeoutSeconds?: int\n arr: [...string]\n}\n\npullImageJob:
|
||||
op.#Apply & {\n value:{\n apiVersion: \"apps.kruise.io/v1alpha1\"\n
|
||||
\ kind: \"ImagePullJob\"\n metadata: {\n name: \"pull-image-job\"\n
|
||||
\ }\n spec: {\n image: parameter.image\n parallelism:
|
||||
parameter.parallel\n selector: matchLabels: parameter.kvs\n
|
||||
\ completionPolicy: {\n type: parameter.type\n activeDeadlineSeconds:
|
||||
parameter.activeDeadlineSeconds\n ttlSecondsAfterFinished:
|
||||
parameter.ttlSecondsAfterFinished\n }\n pullPolicy: {\n
|
||||
\ if parameter.backoffLimit != _|_ {\n backoffLimit:
|
||||
parameter.backoffLimit\n }\n if parameter.timeoutSeconds
|
||||
!= _|_ {\n timeoutSeconds: parameter.timeoutSeconds\n }\n
|
||||
\ }\n pullSecrets: parameter.arr\n } \n }
|
||||
\ \n} \n"
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
dependsOn:
|
||||
- ref:
|
||||
components:
|
||||
- name: kruise
|
||||
properties:
|
||||
chart: ./charts/kruise/v0.9.0
|
||||
git:
|
||||
branch: master
|
||||
repoType: git
|
||||
url: https://github.com/openkruise/kruise
|
||||
values:
|
||||
featureGates: PreDownloadImageForInPlaceUpdate=true
|
||||
type: helm
|
||||
- name: cloneset
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Describes long-running, scalable, containerized
|
||||
services that have a stable network endpoint to receive external network
|
||||
traffic from customers. If workload type is skipped for any service defined
|
||||
in Appfile, it will be defaulted to `webservice` type.
|
||||
name: cloneset
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "output: {\n\tapiVersion: \"apps.kruise.io/v1alpha1\"\n\tkind:
|
||||
\ \"CloneSet\"\n\tmetadata: labels: {\n\t\t\"app.oam.dev/component\":
|
||||
context.name\n\t}\n\tspec: {\n\t\tselector: matchLabels: {\n\t\t\t\"app.oam.dev/component\":
|
||||
context.name\n\t\t}\n\n\t\ttemplate: {\n\t\t\tmetadata: labels: {\n\t\t\t\t\"app.oam.dev/component\":
|
||||
context.name\n\t\t\t}\n\n\t\t\tspec: {\n\t\t\t\tcontainers: [{\n\t\t\t\t\tname:
|
||||
\ context.name\n\t\t\t\t\timage: parameter.image\n\n\t\t\t\t\tif parameter.cmd
|
||||
!= _|_ {\n\t\t\t\t\t\tcommand: parameter.cmd\n\t\t\t\t\t}\n\t\t\t\t\tif
|
||||
parameter.args != _|_ {\n\t\t\t\t\t\targs: parameter.args\n\t\t\t\t\t}\n\t\t\t\t\tif
|
||||
parameter.env != _|_ {\n\t\t\t\t\t\tenv: parameter.env\n\t\t\t\t\t}\n\n\t\t\t\t\tif
|
||||
context.config != _|_ {\n\t\t\t\t\t\tenv: context.config\n\t\t\t\t\t}\n\n\t\t\t\t\tif
|
||||
parameter[\"imagePullPolicy\"] != _|_ {\n\t\t\t\t\t\timagePullPolicy:
|
||||
parameter.imagePullPolicy\n\t\t\t\t\t}\n\n\t\t\t\t\tports: [{\n\t\t\t\t\t\tcontainerPort:
|
||||
parameter.port\n\t\t\t\t\t}]\n\n\t\t\t\t\tif parameter[\"cpu\"] != _|_
|
||||
{\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\tlimits: cpu: parameter.cpu\n\t\t\t\t\t\t\trequests:
|
||||
cpu: parameter.cpu\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif parameter[\"memory\"]
|
||||
!= _|_ {\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\tlimits: memory: parameter.memory\n\t\t\t\t\t\t\trequests:
|
||||
memory: parameter.memory\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif
|
||||
parameter[\"livenessProbe\"] != _|_ {\n\t\t\t\t\t\tlivenessProbe: parameter.livenessProbe\n\t\t\t\t\t}\n\n\t\t\t\t\tif
|
||||
parameter[\"readinessProbe\"] != _|_ {\n\t\t\t\t\t\treadinessProbe:
|
||||
parameter.readinessProbe\n\t\t\t\t\t}\n\n\t\t\t\t\tlifecycle: {\n\t\t\t\t\t\tif
|
||||
parameter.postStart != _|_ {\n\t\t\t\t\t\t\tpostStart: exec: command:
|
||||
parameter.postStart\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif parameter.preStop
|
||||
!= _|_ {\n\t\t\t\t\t\t\tpreStop: exec: command: parameter.preStop\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}]\n\t\t\t\tif
|
||||
parameter.hostAliases != _|_ {\n\t\t\t\t\thostAliases: parameter.hostAliases\n\t\t\t\t}\n\t\t\t\tif
|
||||
parameter[\"imagePullSecrets\"] != _|_ {\n\t\t\t\t\timagePullSecrets:
|
||||
[ for v in parameter.imagePullSecrets {name: v}]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif
|
||||
parameter.updateStrategyType != _|_ {\n\t\t\tupdateStrategy: {\n\t\t\t\ttype:
|
||||
parameter.updateStrategyType\n\t\t\t}\n\t\t}\n\t}\n}\nparameter: {\n\t//
|
||||
+usage=Which image would you like to use for your service\n\t// +short=i\n\timage:
|
||||
string\n\n\t// +usage=Specify image pull policy for your service\n\timagePullPolicy?:
|
||||
string\n\n\t// +usage=Specify image pull secrets for your service\n\timagePullSecrets?:
|
||||
[...string]\n\n\t// +usage=Number of CPU units for the service, like
|
||||
`0.5` (0.5 CPU core), `1` (1 CPU core)\n\tcpu?: string\n\n\t// +usage=Specify
|
||||
the amount of memory to limit\n\tmemory?: *\"2048Mi\" | =~\"^([1-9][0-9]{0,63})(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)$\"\n\n\t//
|
||||
+usage=Commands to run in the container\n\tcmd?: [...string]\n\n\t//
|
||||
+usage=Arguments to the command.\n\targs?: [...string]\n\n\t// +usage=postStart
|
||||
commands will be called immediately after a container is created.\n\tpostStart?:
|
||||
[...string]\n\n\t// +usage=PreStop is called immediately before a container
|
||||
is terminated due to an API request or management event such as liveness/startup
|
||||
probe failure, preemption, resource contention, etc. The handler is
|
||||
not called if the container crashes or exits. The reason for termination
|
||||
is passed to the handler. The Pod's termination grace period countdown
|
||||
begins before the PreStop hooked is executed. Regardless of the outcome
|
||||
of the handler, the container will eventually terminate within the Pod's
|
||||
termination grace period. Other management of the container blocks until
|
||||
the hook completes or until the termination grace period is reached.
|
||||
More info: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks\n\tpreStop?:
|
||||
[...string]\n\n\t// +usage=Which port do you want customer traffic sent
|
||||
to\n\t// +short=p\n\tport: *80 | int\n\n\t// +usage=Define arguments
|
||||
by using environment variables\n\tenv?: [...#ENV]\n\n\t// +usage=Cloneset
|
||||
updateStrategy, candidates are `ReCreate`/`InPlaceIfPossible`/`InPlaceOnly`\n\tupdateStrategyType?:
|
||||
string\n\n\t// +usage=HostAliases is a list of hosts and IPs that will
|
||||
be write into the pod's hosts file\n\thostAliases?: [...{\n\t\thostnames:
|
||||
[...string]\n\t\tip: string\n\t}]\n\n\t// +usage=Instructions for assessing
|
||||
whether the container is alive.\n\tlivenessProbe?: #HealthProbe\n\n\t//
|
||||
+usage=Instructions for assessing whether the container is in a suitable
|
||||
state to serve traffic.\n\treadinessProbe?: #HealthProbe\n}\n\n#ENV:
|
||||
{\n\t// +usage=Environment variable name\n\tname: string\n\t// +usage=The
|
||||
value of the environment variable\n\tvalue?: string\n\t// +usage=Specifies
|
||||
a source the value of this var should come from\n\tvalueFrom?: {\n\t\t//
|
||||
+usage=Selects a key of a secret in the pod's namespace\n\t\tsecretKeyRef:
|
||||
{\n\t\t\t// +usage=The name of the secret in the pod's namespace to
|
||||
select from\n\t\t\tname: string\n\t\t\t// +usage=The key of the secret
|
||||
to select from. Must be a valid secret key\n\t\t\tkey: string\n\t\t}\n\t}\n}\n\n#HealthProbe:
|
||||
{\n\n\t// +usage=Instructions for assessing container health by executing
|
||||
a command. Either this attribute or the httpGet attribute or the tcpSocket
|
||||
attribute MUST be specified. This attribute is mutually exclusive with
|
||||
both the httpGet attribute and the tcpSocket attribute.\n\texec?: {\n\t\t//
|
||||
+usage=A command to be executed inside the container to assess its health.
|
||||
Each space delimited token of the command is a separate array element.
|
||||
Commands exiting 0 are considered to be successful probes, whilst all
|
||||
other exit codes are considered failures.\n\t\tcommand: [...string]\n\t}\n\n\t//
|
||||
+usage=Instructions for assessing container health by executing an HTTP
|
||||
GET request. Either this attribute or the exec attribute or the tcpSocket
|
||||
attribute MUST be specified. This attribute is mutually exclusive with
|
||||
both the exec attribute and the tcpSocket attribute.\n\thttpGet?: {\n\t\t//
|
||||
+usage=The endpoint, relative to the port, to which the HTTP GET request
|
||||
should be directed.\n\t\tpath: string\n\t\t// +usage=The TCP socket
|
||||
within the container to which the HTTP GET request should be directed.\n\t\tport:
|
||||
int\n\t\thttpHeaders?: [...{\n\t\t\tname: string\n\t\t\tvalue: string\n\t\t}]\n\t}\n\n\t//
|
||||
+usage=Instructions for assessing container health by probing a TCP
|
||||
socket. Either this attribute or the exec attribute or the httpGet attribute
|
||||
MUST be specified. This attribute is mutually exclusive with both the
|
||||
exec attribute and the httpGet attribute.\n\ttcpSocket?: {\n\t\t// +usage=The
|
||||
TCP socket within the container that should be probed to assess container
|
||||
health.\n\t\tport: int\n\t}\n\n\t// +usage=Number of seconds after the
|
||||
container is started before the first probe is initiated.\n\tinitialDelaySeconds:
|
||||
*0 | int\n\n\t// +usage=How often, in seconds, to execute the probe.\n\tperiodSeconds:
|
||||
*10 | int\n\n\t// +usage=Number of seconds after which the probe times
|
||||
out.\n\ttimeoutSeconds: *1 | int\n\n\t// +usage=Minimum consecutive
|
||||
successes for the probe to be considered successful after having failed.\n\tsuccessThreshold:
|
||||
*1 | int\n\n\t// +usage=Number of consecutive failures required to determine
|
||||
the container is not alive (liveness probe) or not ready (readiness
|
||||
probe).\n\tfailureThreshold: *3 | int\n} \n"
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: CloneSet
|
||||
type: raw
|
||||
- name: predownloadimage
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
name: predownloadimage
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "import (\"vela/op\")\nparameter: {\n image: string\n parallel:
|
||||
int\n kvs: [string]: string\n type: *\"Always\" | string\n activeDeadlineSeconds:
|
||||
*1200 | int\n ttlSecondsAfterFinished: *300 | int\n backoffLimit?:
|
||||
int\n timeoutSeconds?: int\n arr: [...string]\n}\n\npullImageJob:
|
||||
op.#Apply & {\n value:{\n apiVersion: \"apps.kruise.io/v1alpha1\"\n
|
||||
\ kind: \"ImagePullJob\"\n metadata: {\n name: \"pull-image-job\"\n
|
||||
\ }\n spec: {\n image: parameter.image\n parallelism:
|
||||
parameter.parallel\n selector: matchLabels: parameter.kvs\n completionPolicy:
|
||||
{\n type: parameter.type\n activeDeadlineSeconds: parameter.activeDeadlineSeconds\n
|
||||
\ ttlSecondsAfterFinished: parameter.ttlSecondsAfterFinished\n
|
||||
\ }\n pullPolicy: {\n if parameter.backoffLimit != _|_
|
||||
{\n backoffLimit: parameter.backoffLimit\n }\n if
|
||||
parameter.timeoutSeconds != _|_ {\n timeoutSeconds: parameter.timeoutSeconds\n
|
||||
\ }\n }\n pullSecrets: parameter.arr\n } \n
|
||||
\ } \n} \n"
|
||||
type: raw
|
||||
workflow:
|
||||
steps:
|
||||
- name: checking-depends-on
|
||||
properties:
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
type: depends-on-app
|
||||
- name: apply-resources
|
||||
type: apply-application
|
||||
status:
|
||||
observedGeneration: 0
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Create namespace for flux-system
|
||||
name: ns-flux-system
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: flux-system
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: flux-system
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
status:
|
||||
observedGeneration: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Create namespace for flux-system
|
||||
addons.oam.dev/name: ns-flux-system
|
||||
labels:
|
||||
addons.oam.dev/type: ns-flux-system
|
||||
name: ns-flux-system
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
@@ -1,40 +0,0 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Create namespace for istio-system
|
||||
name: ns-istio-system
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: istio-system
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: istio-system
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
status:
|
||||
observedGeneration: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Create namespace for istio-system
|
||||
addons.oam.dev/name: ns-istio-system
|
||||
labels:
|
||||
addons.oam.dev/type: ns-istio-system
|
||||
name: ns-istio-system
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
@@ -1,128 +0,0 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Preparations that observability need
|
||||
name: observability-asset
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: observability
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: observability
|
||||
type: raw
|
||||
- name: import-grafana-dashboard
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Import dashboards to Grafana
|
||||
name: import-grafana-dashboard
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "outputs: registerdatasource: {\n\tapiVersion: \"grafana.extension.oam.dev/v1alpha1\"\n\tkind:
|
||||
\ \"ImportDashboard\"\n\tspec: {\n\t\tgrafana: {\n\t\t\tservice:
|
||||
\ parameter.grafanaServiceName\n\t\t\tnamespace:
|
||||
\ parameter.grafanaServiceNamespace\n\t\t\tcredentialSecret:
|
||||
\ parameter.credentialSecret\n\t\t\tcredentialSecretNamespace:
|
||||
parameter.credentialSecretNamespace\n\t\t}\n\t\turls: parameter.urls\n\t}\n}\nparameter:
|
||||
{\n\tgrafanaServiceName: string\n\tgrafanaServiceNamespace:
|
||||
\ *\"default\" | string\n\tcredentialSecret: string\n\tcredentialSecretNamespace:
|
||||
*\"default\" | string\n\turls: [...string]\n} \n"
|
||||
type: raw
|
||||
- name: pure-ingress
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Enable public web traffic for the component
|
||||
without creating a Service.
|
||||
name: pure-ingress
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "\noutputs: ingress: {\n\tapiVersion: \"networking.k8s.io/v1beta1\"\n\tkind:
|
||||
\ \"Ingress\"\n\tmetadata:\n\t\tname: context.name\n\tspec:
|
||||
{\n\t\trules: [{\n\t\t\thost: parameter.domain\n\t\t\thttp: {\n\t\t\t\tpaths:
|
||||
[\n\t\t\t\t\tfor k, v in parameter.http {\n\t\t\t\t\t\tpath: k\n\t\t\t\t\t\tbackend:
|
||||
{\n\t\t\t\t\t\t\tserviceName: context.name\n\t\t\t\t\t\t\tservicePort:
|
||||
v\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t}\n\t\t}]\n\t}\n}\n\nparameter:
|
||||
{\n\t// +usage=Specify the domain you want to expose\n\tdomain:
|
||||
string\n\n\t// +usage=Specify the mapping relationship between the
|
||||
http path and the workload port\n\thttp: [string]: int\n}\n"
|
||||
status:
|
||||
customStatus: |-
|
||||
let igs = context.outputs.ingress.status.loadBalancer.ingress
|
||||
if igs == _|_ {
|
||||
message: "No loadBalancer found, visiting by using 'vela port-forward " + context.appName + " --route'\n"
|
||||
}
|
||||
if len(igs) > 0 {
|
||||
if igs[0].ip != _|_ {
|
||||
message: "Visiting URL: " + context.outputs.ingress.spec.rules[0].host + ", IP: " + igs[0].ip
|
||||
}
|
||||
if igs[0].ip == _|_ {
|
||||
message: "Visiting URL: " + context.outputs.ingress.spec.rules[0].host
|
||||
}
|
||||
}
|
||||
healthPolicy: |
|
||||
isHealth: len(context.outputs.ingress.status.loadBalancer.ingress) > 0
|
||||
type: raw
|
||||
- name: register-grafana-datasource
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Add a datasource to Grafana
|
||||
name: register-grafana-datasource
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "outputs: registerdatasource: {\n\tapiVersion: \"grafana.extension.oam.dev/v1alpha1\"\n\tkind:
|
||||
\ \"DatasourceRegistration\"\n\tspec: {\n\t\tgrafana: {\n\t\t\tservice:
|
||||
\ parameter.grafanaServiceName\n\t\t\tnamespace:
|
||||
\ parameter.grafanaServiceNamespace\n\t\t\tcredentialSecret:
|
||||
\ parameter.credentialSecret\n\t\t\tcredentialSecretNamespace:
|
||||
parameter.credentialSecretNamespace\n\t\t}\n\t\tdatasource: {\n\t\t\tname:
|
||||
\ parameter.name\n\t\t\ttype: parameter.type\n\t\t\taccess:
|
||||
\ parameter.access\n\t\t\tservice: parameter.service\n\t\t\tnamespace:
|
||||
parameter.namespace\n\t\t}\n\t}\n}\n\nparameter: {\n\tgrafanaServiceName:
|
||||
\ string\n\tgrafanaServiceNamespace: *\"default\" | string\n\tcredentialSecret:
|
||||
\ string\n\tcredentialSecretNamespace: string\n\tname: string\n\ttype:
|
||||
\ string\n\taccess: *\"proxy\"
|
||||
| string\n\tservice: string\n\tnamespace: *\"default\"
|
||||
| string\n}\n"
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
status:
|
||||
observedGeneration: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Preparations that observability need
|
||||
addons.oam.dev/name: observability-asset
|
||||
labels:
|
||||
addons.oam.dev/type: observability-asset
|
||||
name: observability-asset
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
@@ -1,141 +1,243 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: An out of the box solution for KubeVela observability
|
||||
name: observability
|
||||
namespace: observability
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: grafana-registration
|
||||
properties:
|
||||
chart: ./chart
|
||||
git:
|
||||
branch: master
|
||||
repoType: git
|
||||
targetNamespace: observability
|
||||
url: https://github.com/oam-dev/grafana-registration
|
||||
values:
|
||||
replicaCount: 1
|
||||
type: helm
|
||||
- name: grafana
|
||||
properties:
|
||||
chart: grafana
|
||||
releaseName: grafana
|
||||
repoType: helm
|
||||
targetNamespace: observability
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 6.14.1
|
||||
traits:
|
||||
- properties:
|
||||
domain: '[[ index .Args "grafana-domain" ]]'
|
||||
http:
|
||||
/: 80
|
||||
type: pure-ingress
|
||||
- properties:
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
urls:
|
||||
- https://charts.kubevela.net/addons/dashboards/kubevela_core_logging.json
|
||||
- https://charts.kubevela.net/addons/dashboards/kubevela_core_monitoring.json
|
||||
- https://charts.kubevela.net/addons/dashboards/kubevela_application_logging.json
|
||||
- https://charts.kubevela.net/addons/dashboards/flux2/cluster.json
|
||||
type: import-grafana-dashboard
|
||||
type: helm
|
||||
- name: loki
|
||||
properties:
|
||||
chart: loki-stack
|
||||
releaseName: loki
|
||||
repoType: helm
|
||||
targetNamespace: observability
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 2.4.1
|
||||
traits:
|
||||
- properties:
|
||||
access: proxy
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
name: loki
|
||||
namespace: observability
|
||||
service: loki
|
||||
type: loki
|
||||
type: register-grafana-datasource
|
||||
type: helm
|
||||
- name: prometheus-server
|
||||
properties:
|
||||
chart: prometheus
|
||||
releaseName: prometheus
|
||||
repoType: helm
|
||||
targetNamespace: observability
|
||||
url: https://charts.kubevela.net/addons
|
||||
values:
|
||||
alertmanager:
|
||||
persistentVolume:
|
||||
enabled: '[[ index .Args "alertmanager-pvc-enabled" | default "true"
|
||||
]]'
|
||||
size: '[[ index .Args "alertmanager-pvc-size" | default "20Gi" ]]'
|
||||
storageClass: '[[ index .Args "alertmanager-pvc-class" ]]'
|
||||
server:
|
||||
persistentVolume:
|
||||
enabled: '[[ index .Args "server-pvc-enabled" | default "true" ]]'
|
||||
size: '[[ index .Args "server-pvc-size" | default "20Gi" ]]'
|
||||
storageClass: '[[ index .Args "server-pvc-class" ]]'
|
||||
version: 14.4.1
|
||||
traits:
|
||||
- properties:
|
||||
access: proxy
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
name: prometheus
|
||||
namespace: observability
|
||||
service: prometheus-server
|
||||
type: prometheus
|
||||
type: register-grafana-datasource
|
||||
type: helm
|
||||
- name: kube-state-metrics
|
||||
properties:
|
||||
chart: kube-state-metrics
|
||||
repoType: helm
|
||||
targetNamespace: observability
|
||||
url: https://charts.kubevela.net/addons
|
||||
values:
|
||||
image:
|
||||
repository: oamdev/kube-state-metrics
|
||||
tag: v2.1.0
|
||||
version: 3.4.1
|
||||
type: helm
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
dependsOn:
|
||||
- ref:
|
||||
components:
|
||||
- name: ns-observability
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: observability
|
||||
type: raw
|
||||
- name: import-grafana-dashboard-traitdef
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
- ref:
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Import dashboards to Grafana
|
||||
name: import-grafana-dashboard
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "outputs: registerdatasource: {\n\tapiVersion: \"grafana.extension.oam.dev/v1alpha1\"\n\tkind:
|
||||
\ \"ImportDashboard\"\n\tspec: {\n\t\tgrafana: {\n\t\t\tservice:
|
||||
\ parameter.grafanaServiceName\n\t\t\tnamespace: parameter.grafanaServiceNamespace\n\t\t\tcredentialSecret:
|
||||
\ parameter.credentialSecret\n\t\t\tcredentialSecretNamespace:
|
||||
parameter.credentialSecretNamespace\n\t\t}\n\t\turls: parameter.urls\n\t}\n}\nparameter:
|
||||
{\n\tgrafanaServiceName: string\n\tgrafanaServiceNamespace: *\"default\"
|
||||
| string\n\tcredentialSecret: string\n\tcredentialSecretNamespace:
|
||||
*\"default\" | string\n\turls: [...string]\n}\n"
|
||||
type: raw
|
||||
- name: pure-ingress-traitdef
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: observability-asset
|
||||
namespace: vela-system
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Enable public web traffic for the component
|
||||
without creating a Service.
|
||||
name: pure-ingress
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "\noutputs: ingress: {\n\tapiVersion: \"networking.k8s.io/v1beta1\"\n\tkind:
|
||||
\ \"Ingress\"\n\tmetadata:\n\t\tname: context.name\n\tspec: {\n\t\trules:
|
||||
[{\n\t\t\thost: parameter.domain\n\t\t\thttp: {\n\t\t\t\tpaths: [\n\t\t\t\t\tfor
|
||||
k, v in parameter.http {\n\t\t\t\t\t\tpath: k\n\t\t\t\t\t\tbackend:
|
||||
{\n\t\t\t\t\t\t\tserviceName: context.name\n\t\t\t\t\t\t\tservicePort:
|
||||
v\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t}\n\t\t}]\n\t}\n}\n\nparameter:
|
||||
{\n\t// +usage=Specify the domain you want to expose\n\tdomain: string\n\n\t//
|
||||
+usage=Specify the mapping relationship between the http path and the
|
||||
workload port\n\thttp: [string]: int\n}\n"
|
||||
status:
|
||||
customStatus: |-
|
||||
let igs = context.outputs.ingress.status.loadBalancer.ingress
|
||||
if igs == _|_ {
|
||||
message: "No loadBalancer found, visiting by using 'vela port-forward " + context.appName + " --route'\n"
|
||||
}
|
||||
if len(igs) > 0 {
|
||||
if igs[0].ip != _|_ {
|
||||
message: "Visiting URL: " + context.outputs.ingress.spec.rules[0].host + ", IP: " + igs[0].ip
|
||||
}
|
||||
if igs[0].ip == _|_ {
|
||||
message: "Visiting URL: " + context.outputs.ingress.spec.rules[0].host
|
||||
}
|
||||
}
|
||||
healthPolicy: |
|
||||
isHealth: len(context.outputs.ingress.status.loadBalancer.ingress) > 0
|
||||
type: raw
|
||||
- name: register-grafana-datasource-traitdef
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Add a datasource to Grafana
|
||||
name: register-grafana-datasource
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: "outputs: registerdatasource: {\n\tapiVersion: \"grafana.extension.oam.dev/v1alpha1\"\n\tkind:
|
||||
\ \"DatasourceRegistration\"\n\tspec: {\n\t\tgrafana: {\n\t\t\tservice:
|
||||
\ parameter.grafanaServiceName\n\t\t\tnamespace: parameter.grafanaServiceNamespace\n\t\t\tcredentialSecret:
|
||||
\ parameter.credentialSecret\n\t\t\tcredentialSecretNamespace:
|
||||
parameter.credentialSecretNamespace\n\t\t}\n\t\tdatasource: {\n\t\t\tname:
|
||||
\ parameter.name\n\t\t\ttype: parameter.type\n\t\t\taccess:
|
||||
\ parameter.access\n\t\t\tservice: parameter.service\n\t\t\tnamespace:
|
||||
parameter.namespace\n\t\t}\n\t}\n}\n\nparameter: {\n\tgrafanaServiceName:
|
||||
\ string\n\tgrafanaServiceNamespace: *\"default\" | string\n\tcredentialSecret:
|
||||
\ string\n\tcredentialSecretNamespace: string\n\tname: string\n\ttype:
|
||||
\ string\n\taccess: *\"proxy\"
|
||||
| string\n\tservice: string\n\tnamespace: *\"default\"
|
||||
| string\n}\n"
|
||||
type: raw
|
||||
- name: grafana-registration
|
||||
properties:
|
||||
chart: ./chart
|
||||
git:
|
||||
branch: master
|
||||
repoType: git
|
||||
targetNamespace: observability
|
||||
url: https://github.com/oam-dev/grafana-registration
|
||||
values:
|
||||
replicaCount: 1
|
||||
type: helm
|
||||
- name: grafana
|
||||
properties:
|
||||
chart: grafana
|
||||
releaseName: grafana
|
||||
repoType: helm
|
||||
targetNamespace: observability
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 6.14.1
|
||||
traits:
|
||||
- properties:
|
||||
domain: '[[ index .Args "grafana-domain" ]]'
|
||||
http:
|
||||
/: 80
|
||||
type: pure-ingress
|
||||
- properties:
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
urls:
|
||||
- https://charts.kubevela.net/addons/dashboards/kubevela_core_logging.json
|
||||
- https://charts.kubevela.net/addons/dashboards/kubevela_core_monitoring.json
|
||||
- https://charts.kubevela.net/addons/dashboards/kubevela_application_logging.json
|
||||
- https://charts.kubevela.net/addons/dashboards/flux2/cluster.json
|
||||
type: import-grafana-dashboard
|
||||
type: helm
|
||||
- name: loki
|
||||
properties:
|
||||
chart: loki-stack
|
||||
releaseName: loki
|
||||
repoType: helm
|
||||
targetNamespace: observability
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 2.4.1
|
||||
traits:
|
||||
- properties:
|
||||
access: proxy
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
name: loki
|
||||
namespace: observability
|
||||
service: loki
|
||||
type: loki
|
||||
type: register-grafana-datasource
|
||||
type: helm
|
||||
- name: prometheus-server
|
||||
properties:
|
||||
chart: prometheus
|
||||
releaseName: prometheus
|
||||
repoType: helm
|
||||
targetNamespace: observability
|
||||
url: https://charts.kubevela.net/addons
|
||||
values:
|
||||
alertmanager:
|
||||
persistentVolume:
|
||||
enabled: '[[ index .Args "alertmanager-pvc-enabled" | default "true" ]]'
|
||||
size: '[[ index .Args "alertmanager-pvc-size" | default "20Gi" ]]'
|
||||
storageClass: '[[ index .Args "alertmanager-pvc-class" ]]'
|
||||
server:
|
||||
persistentVolume:
|
||||
enabled: '[[ index .Args "server-pvc-enabled" | default "true" ]]'
|
||||
size: '[[ index .Args "server-pvc-size" | default "20Gi" ]]'
|
||||
storageClass: '[[ index .Args "server-pvc-class" ]]'
|
||||
version: 14.4.1
|
||||
traits:
|
||||
- properties:
|
||||
access: proxy
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
name: prometheus
|
||||
namespace: observability
|
||||
service: prometheus-server
|
||||
type: prometheus
|
||||
type: register-grafana-datasource
|
||||
type: helm
|
||||
- name: kube-state-metrics
|
||||
properties:
|
||||
chart: kube-state-metrics
|
||||
repoType: helm
|
||||
targetNamespace: observability
|
||||
url: https://charts.kubevela.net/addons
|
||||
values:
|
||||
image:
|
||||
repository: oamdev/kube-state-metrics
|
||||
tag: v2.1.0
|
||||
version: 3.4.1
|
||||
type: helm
|
||||
workflow:
|
||||
steps:
|
||||
- name: checking-depends-on
|
||||
properties:
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
type: depends-on-app
|
||||
- name: apply-ns
|
||||
properties:
|
||||
component: ns-observability
|
||||
type: apply-component
|
||||
- name: apply-trait-1
|
||||
properties:
|
||||
component: import-grafana-dashboard-traitdef
|
||||
type: apply-component
|
||||
- name: apply-trait-2
|
||||
properties:
|
||||
component: pure-ingress-traitdef
|
||||
type: apply-component
|
||||
- name: apply-trait-3
|
||||
properties:
|
||||
component: register-grafana-datasource-traitdef
|
||||
type: apply-component
|
||||
- name: apply-resources
|
||||
type: apply-remaining
|
||||
status:
|
||||
observedGeneration: 0
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Prometheus is an open-source systems monitoring and
|
||||
@@ -10,31 +10,30 @@ data:
|
||||
name: prometheus
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: prometheus
|
||||
properties:
|
||||
chart: premetheus
|
||||
repoType: helm
|
||||
url: https://prometheus-community.github.io/helm-charts
|
||||
type: helm
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
dependsOn:
|
||||
- ref:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
components:
|
||||
- name: prometheus
|
||||
properties:
|
||||
chart: premetheus
|
||||
repoType: helm
|
||||
url: https://prometheus-community.github.io/helm-charts
|
||||
type: helm
|
||||
workflow:
|
||||
steps:
|
||||
- name: checking-depends-on
|
||||
properties:
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
type: depends-on-app
|
||||
- name: apply-resources
|
||||
type: apply-application
|
||||
status:
|
||||
observedGeneration: 0
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
@@ -1,59 +1,55 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Kubernetes Terraform Controller for Alibaba Cloud
|
||||
addons.oam.dev/name: terraform/provider-alibaba
|
||||
name: terraform-provider-alibaba
|
||||
namespace: default
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: alibaba-account-creds
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
components:
|
||||
- name: alibaba-account-creds
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: alibaba-account-creds
|
||||
namespace: vela-system
|
||||
stringData:
|
||||
credentials: |
|
||||
accessKeyID: [[ index .Args "ALICLOUD_ACCESS_KEY" ]]
|
||||
accessKeySecret: [[ index .Args "ALICLOUD_SECRET_KEY" ]]
|
||||
securityToken: [[ index .Args "ALICLOUD_SECURITY_TOKEN" ]]
|
||||
type: Opaque
|
||||
type: raw
|
||||
- name: default
|
||||
properties:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: default
|
||||
namespace: default
|
||||
spec:
|
||||
credentials:
|
||||
secretRef:
|
||||
key: credentials
|
||||
name: alibaba-account-creds
|
||||
namespace: vela-system
|
||||
stringData:
|
||||
credentials: |
|
||||
accessKeyID: [[ index .Args "ALICLOUD_ACCESS_KEY" ]]
|
||||
accessKeySecret: [[ index .Args "ALICLOUD_SECRET_KEY" ]]
|
||||
securityToken: [[ index .Args "ALICLOUD_SECURITY_TOKEN" ]]
|
||||
type: Opaque
|
||||
type: raw
|
||||
- name: default
|
||||
properties:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: default
|
||||
namespace: default
|
||||
spec:
|
||||
credentials:
|
||||
secretRef:
|
||||
key: credentials
|
||||
name: alibaba-account-creds
|
||||
namespace: vela-system
|
||||
source: Secret
|
||||
provider: alibaba
|
||||
region: '[[ index .Args "ALICLOUD_REGION" ]]'
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
source: Secret
|
||||
provider: alibaba
|
||||
region: '[[ index .Args "ALICLOUD_REGION" ]]'
|
||||
type: raw
|
||||
status:
|
||||
observedGeneration: 0
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Kubernetes Terraform Controller for AWS
|
||||
addons.oam.dev/name: terraform/provider-aws
|
||||
name: terraform-provider-aws
|
||||
namespace: vela-system
|
||||
spec:
|
||||
components:
|
||||
- name: aws-account-creds
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: aws-account-creds
|
||||
namespace: vela-system
|
||||
stringData:
|
||||
credentials: |
|
||||
awsAccessKeyID: [[ index .Args "AWS_ACCESS_KEY_ID" ]]
|
||||
awsSecretAccessKey: [[ index .Args "AWS_SECRET_ACCESS_KEY" ]]
|
||||
awsSessionToken: [[ index .Args "AWS_SESSION_TOKEN" ]]
|
||||
type: Opaque
|
||||
type: raw
|
||||
- name: aws
|
||||
properties:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: aws
|
||||
namespace: default
|
||||
spec:
|
||||
credentials:
|
||||
secretRef:
|
||||
key: credentials
|
||||
name: aws-account-creds
|
||||
namespace: vela-system
|
||||
source: Secret
|
||||
provider: aws
|
||||
region: '[[ index .Args "AWS_DEFAULT_REGION" ]]'
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Kubernetes Terraform Controller for AWS
|
||||
addons.oam.dev/name: terraform/provider-aws
|
||||
labels:
|
||||
addons.oam.dev/type: terraform-provider-aws
|
||||
name: terraform-provider-aws
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
@@ -1,59 +1,55 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Kubernetes Terraform Controller for Azure
|
||||
addons.oam.dev/name: terraform/provider-azure
|
||||
name: terraform-provider-azure
|
||||
namespace: default
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: azure-account-creds
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
components:
|
||||
- name: azure-account-creds
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: azure-account-creds
|
||||
namespace: vela-system
|
||||
stringData:
|
||||
credentials: |
|
||||
armClientID: [[ index .Args "ARM_CLIENT_ID" ]]
|
||||
armClientSecret: [[ index .Args "ARM_CLIENT_SECRET" ]]
|
||||
armSubscriptionID: [[ index .Args "ARM_SUBSCRIPTION_ID" ]]
|
||||
armTenantID: [[ index .Args "ARM_TENANT_ID" ]]
|
||||
type: Opaque
|
||||
type: raw
|
||||
- name: azure
|
||||
properties:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: azure
|
||||
namespace: default
|
||||
spec:
|
||||
credentials:
|
||||
secretRef:
|
||||
key: credentials
|
||||
name: azure-account-creds
|
||||
namespace: vela-system
|
||||
stringData:
|
||||
credentials: |
|
||||
armClientID: [[ index .Args "ARM_CLIENT_ID" ]]
|
||||
armClientSecret: [[ index .Args "ARM_CLIENT_SECRET" ]]
|
||||
armSubscriptionID: [[ index .Args "ARM_SUBSCRIPTION_ID" ]]
|
||||
armTenantID: [[ index .Args "ARM_TENANT_ID" ]]
|
||||
type: Opaque
|
||||
type: raw
|
||||
- name: azure
|
||||
properties:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: azure
|
||||
namespace: default
|
||||
spec:
|
||||
credentials:
|
||||
secretRef:
|
||||
key: credentials
|
||||
name: azure-account-creds
|
||||
namespace: vela-system
|
||||
source: Secret
|
||||
provider: azure
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
source: Secret
|
||||
provider: azure
|
||||
type: raw
|
||||
status:
|
||||
observedGeneration: 0
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Terraform Controller is a Kubernetes Controller for
|
||||
@@ -10,443 +10,346 @@ data:
|
||||
name: terraform
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: terraform-controller
|
||||
properties:
|
||||
chart: terraform-controller
|
||||
repoType: helm
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 0.1.19
|
||||
type: helm
|
||||
- name: terraform-system
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: terraform-system
|
||||
type: raw
|
||||
- name: alibaba-ack
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba
|
||||
Cloud ACK cluster
|
||||
labels:
|
||||
type: terraform
|
||||
name: alibaba-ack
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
module "kubernetes" {
|
||||
source = "github.com/zzxwill/terraform-alicloud-kubernetes"
|
||||
new_nat_gateway = true
|
||||
vpc_name = var.vpc_name
|
||||
vpc_cidr = var.vpc_cidr
|
||||
vswitch_name_prefix = var.vswitch_name_prefix
|
||||
vswitch_cidrs = var.vswitch_cidrs
|
||||
master_instance_types = var.master_instance_types
|
||||
worker_instance_types = var.worker_instance_types
|
||||
k8s_pod_cidr = var.k8s_pod_cidr
|
||||
k8s_service_cidr = var.k8s_service_cidr
|
||||
k8s_worker_number = var.k8s_worker_number
|
||||
cpu_core_count = var.cpu_core_count
|
||||
memory_size = var.memory_size
|
||||
zone_id = var.zone_id
|
||||
k8s_version = var.k8s_version
|
||||
k8s_name_prefix = var.k8s_name_prefix
|
||||
}
|
||||
######################
|
||||
# Instance types variables
|
||||
######################
|
||||
variable "cpu_core_count" {
|
||||
description = "CPU core count is used to fetch instance types."
|
||||
type = number
|
||||
default = 4
|
||||
}
|
||||
variable "memory_size" {
|
||||
description = "Memory size used to fetch instance types."
|
||||
type = number
|
||||
default = 8
|
||||
}
|
||||
######################
|
||||
# VPC variables
|
||||
######################
|
||||
variable "vpc_name" {
|
||||
description = "The vpc name used to create a new vpc when 'vpc_id' is not specified. Default to variable `example_name`"
|
||||
type = string
|
||||
default = "tf-k8s-vpc"
|
||||
}
|
||||
variable "vpc_cidr" {
|
||||
description = "The cidr block used to launch a new vpc when 'vpc_id' is not specified."
|
||||
type = string
|
||||
default = "10.0.0.0/8"
|
||||
}
|
||||
######################
|
||||
# VSwitch variables
|
||||
######################
|
||||
variable "vswitch_name_prefix" {
|
||||
type = string
|
||||
description = "The vswitch name prefix used to create several new vswitches. Default to variable 'example_name'."
|
||||
default = "tf-k8s-vsw"
|
||||
}
|
||||
variable "number_format" {
|
||||
description = "The number format used to output."
|
||||
type = string
|
||||
default = "%02d"
|
||||
}
|
||||
variable "vswitch_ids" {
|
||||
description = "List of existing vswitch id."
|
||||
type = list
|
||||
default = []
|
||||
}
|
||||
variable "vswitch_cidrs" {
|
||||
description = "List of cidr blocks used to create several new vswitches when 'vswitch_ids' is not specified."
|
||||
type = list
|
||||
default = [
|
||||
"10.1.0.0/16",
|
||||
"10.2.0.0/16",
|
||||
"10.3.0.0/16"]
|
||||
}
|
||||
variable "k8s_name_prefix" {
|
||||
description = "The name prefix used to create several kubernetes clusters. Default to variable `example_name`"
|
||||
type = string
|
||||
default = "poc"
|
||||
}
|
||||
variable "new_nat_gateway" {
|
||||
type = bool
|
||||
description = "Whether to create a new nat gateway. In this template, a new nat gateway will create a nat gateway, eip and server snat entries."
|
||||
default = true
|
||||
}
|
||||
variable "master_instance_types" {
|
||||
description = "The ecs instance types used to launch master nodes."
|
||||
type = list
|
||||
default = [
|
||||
# hongkong
|
||||
"ecs.sn1ne.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6.xlarge",
|
||||
# hongkong
|
||||
"ecs.c4.xlarge",
|
||||
# hongkong
|
||||
"ecs.c5.xlarge",
|
||||
"ecs.n4.xlarge",
|
||||
# "ecs.n1.large",
|
||||
# "ecs.sn1.large",
|
||||
# "ecs.s6-c1m2.xlarge",
|
||||
# "ecs.c6e.xlarge"
|
||||
]
|
||||
}
|
||||
variable "worker_instance_types" {
|
||||
description = "The ecs instance types used to launch worker nodes."
|
||||
type = list
|
||||
default = [
|
||||
# hongkong
|
||||
"ecs.sn1ne.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6.xlarge",
|
||||
# hongkong
|
||||
"ecs.c4.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6e.xlarge",
|
||||
"ecs.n4.xlarge",
|
||||
// "ecs.n1.large",
|
||||
// "ecs.sn1.large",
|
||||
// "ecs.s6-c1m2.xlarge"
|
||||
]
|
||||
}
|
||||
variable "node_cidr_mask" {
|
||||
type = number
|
||||
description = "The node cidr block to specific how many pods can run on single node. Valid values: [24-28]."
|
||||
default = 24
|
||||
}
|
||||
variable "enable_ssh" {
|
||||
description = "Enable login to the node through SSH."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
variable "install_cloud_monitor" {
|
||||
description = "Install cloud monitor agent on ECS."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
variable "cpu_policy" {
|
||||
type = string
|
||||
description = "kubelet cpu policy. Valid values: 'none','static'. Default to 'none'."
|
||||
default = "none"
|
||||
}
|
||||
variable "proxy_mode" {
|
||||
description = "Proxy mode is option of kube-proxy. Valid values: 'ipvs','iptables'. Default to 'iptables'."
|
||||
type = string
|
||||
default = "iptables"
|
||||
}
|
||||
variable "password" {
|
||||
description = "The password of ECS instance."
|
||||
type = string
|
||||
default = "Just4Test"
|
||||
}
|
||||
variable "k8s_worker_number" {
|
||||
description = "The number of worker nodes in kubernetes cluster."
|
||||
type = number
|
||||
default = 2
|
||||
}
|
||||
# k8s_pod_cidr is only for flannel network
|
||||
variable "k8s_pod_cidr" {
|
||||
description = "The kubernetes pod cidr block. It cannot be equals to vpc's or vswitch's and cannot be in them."
|
||||
type = string
|
||||
default = "172.20.0.0/16"
|
||||
}
|
||||
variable "k8s_service_cidr" {
|
||||
description = "The kubernetes service cidr block. It cannot be equals to vpc's or vswitch's or pod's and cannot be in them."
|
||||
type = string
|
||||
default = "192.168.0.0/16"
|
||||
}
|
||||
variable "k8s_version" {
|
||||
description = "The version of the kubernetes version. Valid values: '1.16.6-aliyun.1','1.14.8-aliyun.1'. Default to '1.16.6-aliyun.1'."
|
||||
type = string
|
||||
default = "1.20.4-aliyun.1"
|
||||
}
|
||||
variable "zone_id" {
|
||||
description = "Availability Zone ID"
|
||||
type = string
|
||||
default = "cn-hongkong-b"
|
||||
# "cn-beijing-a"
|
||||
}
|
||||
output "name" {
|
||||
value = module.kubernetes.name
|
||||
}
|
||||
output "kubeconfig" {
|
||||
value = module.kubernetes.kubeconfig
|
||||
}
|
||||
output "cluster_ca_cert" {
|
||||
value = module.kubernetes.cluster_ca_cert
|
||||
}
|
||||
output "client_cert" {
|
||||
value = module.kubernetes.client_cert
|
||||
}
|
||||
output "client_key" {
|
||||
value = module.kubernetes.client_key
|
||||
}
|
||||
output "api_server_internet" {
|
||||
value = module.kubernetes.api_server_internet
|
||||
}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: alibaba-eip
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba
|
||||
Cloud Elastic IP
|
||||
labels:
|
||||
type: terraform
|
||||
name: alibaba-eip
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: https://github.com/oam-dev/terraform-alibaba-eip.git
|
||||
type: remote
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: alibaba-oss
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba
|
||||
Cloud OSS object
|
||||
labels:
|
||||
type: terraform
|
||||
name: alibaba-oss
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: "resource \"alicloud_oss_bucket\" \"bucket-acl\" {\n
|
||||
\ bucket = var.bucket\n acl = var.acl\n}\noutput \"BUCKET_NAME\"
|
||||
{\n value = \"${alicloud_oss_bucket.bucket-acl.bucket}.${alicloud_oss_bucket.bucket-acl.extranet_endpoint}\"\n}\nvariable
|
||||
\"bucket\" {\n description = \"OSS bucket name\"\n default = \"vela-website\"\n
|
||||
\ type = string\n}\nvariable \"acl\" {\n description = \"OSS bucket
|
||||
ACL, supported 'private', 'public-read', 'public-read-write'\"\n
|
||||
\ default = \"private\"\n type = string\n} \n"
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: alibaba-rds
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba
|
||||
Cloud RDS object
|
||||
labels:
|
||||
type: terraform
|
||||
name: alibaba-rds
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
module "rds" {
|
||||
source = "terraform-alicloud-modules/rds/alicloud"
|
||||
engine = "MySQL"
|
||||
engine_version = "8.0"
|
||||
instance_type = "rds.mysql.c1.large"
|
||||
instance_storage = "20"
|
||||
instance_name = var.instance_name
|
||||
account_name = var.account_name
|
||||
password = var.password
|
||||
}
|
||||
|
||||
output "DB_NAME" {
|
||||
value = module.rds.this_db_instance_name
|
||||
}
|
||||
output "DB_USER" {
|
||||
value = module.rds.this_db_database_account
|
||||
}
|
||||
output "DB_PORT" {
|
||||
value = module.rds.this_db_instance_port
|
||||
}
|
||||
output "DB_HOST" {
|
||||
value = module.rds.this_db_instance_connection_string
|
||||
}
|
||||
output "DB_PASSWORD" {
|
||||
value = var.password
|
||||
}
|
||||
|
||||
variable "instance_name" {
|
||||
description = "RDS instance name"
|
||||
type = string
|
||||
default = "poc"
|
||||
}
|
||||
|
||||
variable "account_name" {
|
||||
description = "RDS instance user account name"
|
||||
type = string
|
||||
default = "oam"
|
||||
}
|
||||
|
||||
variable "password" {
|
||||
description = "RDS instance account password"
|
||||
type = string
|
||||
default = "Xyfff83jfewGGfaked"
|
||||
}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: azure-database-mariadb
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Azure Database
|
||||
Mariadb
|
||||
provider: azure
|
||||
labels:
|
||||
type: terraform
|
||||
name: azure-database-mariadb
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
# Configure the Microsoft Azure Provider
|
||||
provider "azurerm" {
|
||||
features {}
|
||||
}
|
||||
|
||||
resource "azurerm_resource_group" "example" {
|
||||
name = "tfex-mariadb-database-RG"
|
||||
location = "West Europe"
|
||||
}
|
||||
|
||||
resource "azurerm_mariadb_server" "example" {
|
||||
name = "mariadb-svr-sample"
|
||||
location = azurerm_resource_group.example.location
|
||||
resource_group_name = azurerm_resource_group.example.name
|
||||
|
||||
sku_name = "B_Gen5_2"
|
||||
|
||||
storage_mb = 51200
|
||||
backup_retention_days = 7
|
||||
geo_redundant_backup_enabled = false
|
||||
|
||||
administrator_login = var.username
|
||||
administrator_login_password = var.password
|
||||
version = "10.2"
|
||||
ssl_enforcement_enabled = true
|
||||
}
|
||||
|
||||
resource "azurerm_mariadb_database" "example" {
|
||||
name = var.name
|
||||
resource_group_name = azurerm_resource_group.example.name
|
||||
server_name = azurerm_mariadb_server.example.name
|
||||
charset = "utf8"
|
||||
collation = "utf8_general_ci"
|
||||
}
|
||||
|
||||
variable "name" {
|
||||
default = "mariadb_database"
|
||||
type = string
|
||||
description = "Database instance name"
|
||||
}
|
||||
|
||||
variable "username" {
|
||||
default = "acctestun"
|
||||
type = string
|
||||
description = "Database instance username"
|
||||
}
|
||||
|
||||
variable "password" {
|
||||
default = "H@Sh1CoR3!faked"
|
||||
type = string
|
||||
description = "Database instance password"
|
||||
}
|
||||
providerRef:
|
||||
name: azure
|
||||
namespace: default
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
dependsOn:
|
||||
- ref:
|
||||
components:
|
||||
- name: ns-terraform-system
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: terraform-system
|
||||
type: raw
|
||||
- name: terraform-controller
|
||||
properties:
|
||||
chart: terraform-controller
|
||||
repoType: helm
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 0.2.6
|
||||
type: helm
|
||||
- name: alibaba-ack
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
|
||||
ACK cluster
|
||||
labels:
|
||||
type: terraform
|
||||
name: alibaba-ack
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: https://github.com/kubevela-contrib/terraform-modules.git
|
||||
path: alibaba/cs/dedicated-kubernetes
|
||||
type: remote
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: alibaba-eip
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
|
||||
Elastic IP
|
||||
labels:
|
||||
type: terraform
|
||||
name: alibaba-eip
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: https://github.com/oam-dev/terraform-alibaba-eip.git
|
||||
type: remote
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: alibaba-oss
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
|
||||
OSS object
|
||||
labels:
|
||||
type: terraform
|
||||
name: alibaba-oss
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: "resource \"alicloud_oss_bucket\" \"bucket-acl\" {\n bucket
|
||||
= var.bucket\n acl = var.acl\n}\noutput \"BUCKET_NAME\" {\n value
|
||||
= \"${alicloud_oss_bucket.bucket-acl.bucket}.${alicloud_oss_bucket.bucket-acl.extranet_endpoint}\"\n}\nvariable
|
||||
\"bucket\" {\n description = \"OSS bucket name\"\n default = \"vela-website\"\n
|
||||
\ type = string\n}\nvariable \"acl\" {\n description = \"OSS bucket
|
||||
ACL, supported 'private', 'public-read', 'public-read-write'\"\n default
|
||||
= \"private\"\n type = string\n} \n"
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: alibaba-rds
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
|
||||
RDS object
|
||||
labels:
|
||||
type: terraform
|
||||
name: alibaba-rds
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
module "rds" {
|
||||
source = "github.com/kubevela-contrib/terraform-alicloud-rds"
|
||||
engine = "MySQL"
|
||||
engine_version = "8.0"
|
||||
instance_type = "rds.mysql.c1.large"
|
||||
instance_storage = "20"
|
||||
instance_name = var.instance_name
|
||||
account_name = var.account_name
|
||||
password = var.password
|
||||
allocate_public_connection = var.allocate_public_connection
|
||||
security_ips = ["0.0.0.0/0",]
|
||||
}
|
||||
|
||||
output "DB_NAME" {
|
||||
value = module.rds.this_db_instance_name
|
||||
}
|
||||
output "DB_USER" {
|
||||
value = module.rds.this_db_database_account
|
||||
}
|
||||
output "DB_PORT" {
|
||||
value = module.rds.this_db_instance_port
|
||||
}
|
||||
output "DB_HOST" {
|
||||
value = module.rds.this_db_instance_connection_string
|
||||
}
|
||||
output "DB_PASSWORD" {
|
||||
value = var.password
|
||||
}
|
||||
output "DB_PUBLIC_HOST" {
|
||||
value = module.rds.db_public_connection_string
|
||||
}
|
||||
|
||||
variable "instance_name" {
|
||||
description = "RDS instance name"
|
||||
type = string
|
||||
default = "poc"
|
||||
}
|
||||
|
||||
variable "account_name" {
|
||||
description = "RDS instance user account name"
|
||||
type = string
|
||||
default = "oam"
|
||||
}
|
||||
|
||||
variable "password" {
|
||||
description = "RDS instance account password"
|
||||
type = string
|
||||
default = "Xyfff83jfewGGfaked"
|
||||
}
|
||||
|
||||
variable "allocate_public_connection" {
|
||||
description = "Whether to allocate public connection for a RDS instance."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: aws-s3
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for AWS S3
|
||||
labels:
|
||||
type: terraform
|
||||
name: aws-s3
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
resource "aws_s3_bucket" "bucket-acl" {
|
||||
bucket = var.bucket
|
||||
acl = var.acl
|
||||
}
|
||||
|
||||
output "BUCKET_NAME" {
|
||||
value = aws_s3_bucket.bucket-acl.bucket_domain_name
|
||||
}
|
||||
|
||||
variable "bucket" {
|
||||
description = "S3 bucket name"
|
||||
default = "vela-website"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "acl" {
|
||||
description = "S3 bucket ACL"
|
||||
default = "private"
|
||||
type = string
|
||||
}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: azure-database-mariadb
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for Azure Database
|
||||
Mariadb
|
||||
provider: azure
|
||||
labels:
|
||||
type: terraform
|
||||
name: azure-database-mariadb
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
# Configure the Microsoft Azure Provider
|
||||
provider "azurerm" {
|
||||
features {}
|
||||
}
|
||||
|
||||
resource "azurerm_resource_group" "example" {
|
||||
name = var.resource_group
|
||||
location = var.location
|
||||
}
|
||||
|
||||
resource "azurerm_mariadb_server" "example" {
|
||||
name = var.server_name
|
||||
location = var.location
|
||||
resource_group_name = azurerm_resource_group.example.name
|
||||
|
||||
sku_name = "B_Gen5_2"
|
||||
|
||||
storage_mb = 51200
|
||||
backup_retention_days = 7
|
||||
geo_redundant_backup_enabled = false
|
||||
|
||||
administrator_login = var.username
|
||||
administrator_login_password = var.password
|
||||
version = "10.2"
|
||||
ssl_enforcement_enabled = true
|
||||
}
|
||||
|
||||
resource "azurerm_mariadb_database" "example" {
|
||||
name = var.db_name
|
||||
resource_group_name = azurerm_resource_group.example.name
|
||||
server_name = azurerm_mariadb_server.example.name
|
||||
charset = "utf8"
|
||||
collation = "utf8_general_ci"
|
||||
}
|
||||
|
||||
variable "server_name" {
|
||||
type = string
|
||||
description = "mariadb server name"
|
||||
default = "mariadb-svr-sample"
|
||||
}
|
||||
|
||||
variable "db_name" {
|
||||
default = "backend"
|
||||
type = string
|
||||
description = "Database instance name"
|
||||
}
|
||||
|
||||
variable "username" {
|
||||
default = "acctestun"
|
||||
type = string
|
||||
description = "Database instance username"
|
||||
}
|
||||
|
||||
variable "password" {
|
||||
default = "H@Sh1CoR3!faked"
|
||||
type = string
|
||||
description = "Database instance password"
|
||||
}
|
||||
|
||||
variable "location" {
|
||||
description = "Azure location"
|
||||
type = string
|
||||
default = "West Europe"
|
||||
}
|
||||
|
||||
variable "resource_group" {
|
||||
description = "Resource group"
|
||||
type = string
|
||||
default = "kubevela-group"
|
||||
}
|
||||
|
||||
output "SERVER_NAME" {
|
||||
value = var.server_name
|
||||
}
|
||||
|
||||
output "DB_NAME" {
|
||||
value = var.db_name
|
||||
}
|
||||
output "DB_USER" {
|
||||
value = var.username
|
||||
}
|
||||
output "DB_PASSWORD" {
|
||||
sensitive = true
|
||||
value = var.password
|
||||
}
|
||||
output "DB_PORT" {
|
||||
value = "3306"
|
||||
}
|
||||
output "DB_HOST" {
|
||||
value = azurerm_mariadb_server.example.fqdn
|
||||
}
|
||||
providerRef:
|
||||
name: azure
|
||||
namespace: default
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
workflow:
|
||||
steps:
|
||||
- name: checking-depends-on
|
||||
properties:
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
type: depends-on-app
|
||||
- name: apply-ns
|
||||
properties:
|
||||
component: ns-terraform-system
|
||||
type: apply-component
|
||||
- name: apply-resources
|
||||
type: apply-remaining
|
||||
status:
|
||||
observedGeneration: 0
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
@@ -16,7 +16,13 @@ spec:
|
||||
)
|
||||
|
||||
apply: op.#Apply & {
|
||||
value: parameter
|
||||
value: parameter.value
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the value of the object
|
||||
value: {...}
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
parameter: {}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/export2config.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Export data to config map for your workflow steps
|
||||
name: export2config
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
)
|
||||
|
||||
apply: op.#Apply & {
|
||||
value: {
|
||||
apiVersion: "v1"
|
||||
kind: "ConfigMap"
|
||||
metadata: {
|
||||
name: parameter.configName
|
||||
if parameter.namespace != _|_ {
|
||||
namespace: parameter.namespace
|
||||
}
|
||||
if parameter.namespace == _|_ {
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
data: parameter.data
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the name of the config map
|
||||
configName: string
|
||||
// +usage=Specify the namespace of the config map
|
||||
namespace?: string
|
||||
// +usage=Specify the data of config map
|
||||
data: {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/export2secret.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Export data to secret for your workflow steps
|
||||
name: export2secret
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
)
|
||||
|
||||
apply: op.#Apply & {
|
||||
value: {
|
||||
apiVersion: "v1"
|
||||
kind: "Secret"
|
||||
if parameter.type != _|_ {
|
||||
type: parameter.type
|
||||
}
|
||||
metadata: {
|
||||
name: parameter.secretName
|
||||
if parameter.namespace != _|_ {
|
||||
namespace: parameter.namespace
|
||||
}
|
||||
if parameter.namespace == _|_ {
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
stringData: parameter.data
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the name of the secret
|
||||
secretName: string
|
||||
// +usage=Specify the namespace of the secret
|
||||
namespace?: string
|
||||
// +usage=Specify the type of the secret
|
||||
type?: string
|
||||
// +usage=Specify the data of secret
|
||||
data: {}
|
||||
}
|
||||
|
||||
113
charts/vela-core/templates/defwithtemplate/nocalhost.yaml
Normal file
113
charts/vela-core/templates/defwithtemplate/nocalhost.yaml
Normal file
@@ -0,0 +1,113 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/nocalhost.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: nocalhost develop configuration.
|
||||
name: nocalhost
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- '*'
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
patch: metadata: annotations: {
|
||||
"dev.nocalhost/application-name": context.appName
|
||||
"dev.nocalhost/application-namespace": context.namespace
|
||||
"dev.nocalhost": json.Marshal({
|
||||
containers: [
|
||||
{
|
||||
name: context.name
|
||||
dev: {
|
||||
if parameter.gitUrl != _|_ {
|
||||
gitUrl: parameter.gitUrl
|
||||
}
|
||||
image: parameter.image
|
||||
shell: parameter.shell
|
||||
workDir: parameter.workDir
|
||||
if parameter.storageClass != _|_ {
|
||||
storageClass: parameter.storageClass
|
||||
}
|
||||
resources: {
|
||||
limits: parameter.resources.limits
|
||||
requests: parameter.resources.requests
|
||||
}
|
||||
if parameter.persistentVolumeDirs != _|_ {
|
||||
persistentVolumeDirs: [
|
||||
for v in parameter.persistentVolumeDirs {
|
||||
path: v.path
|
||||
capacity: v.capacity
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.command != _|_ {
|
||||
command: parameter.command
|
||||
}
|
||||
if parameter.debug != _|_ {
|
||||
debug: parameter.debug
|
||||
}
|
||||
hotReload: parameter.hotReload
|
||||
if parameter.sync != _|_ {
|
||||
sync: parameter.sync
|
||||
}
|
||||
if parameter.env != _|_ {
|
||||
env: [
|
||||
for v in parameter.env {
|
||||
name: v.name
|
||||
value: v.value
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.portForward != _|_ {
|
||||
portForward: parameter.portForward
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
parameter: {
|
||||
gitUrl?: string
|
||||
image: string
|
||||
shell: *"bash" | string
|
||||
workDir: *"/home/nocalhost-dev" | string
|
||||
storageClass?: string
|
||||
command?: {
|
||||
run?: [...string]
|
||||
debug?: [...string]
|
||||
}
|
||||
debug?: remoteDebugPort?: int
|
||||
hotReload: *true | bool
|
||||
sync: {
|
||||
type: *"send" | string
|
||||
filePattern?: [...string]
|
||||
ignoreFilePattern?: [...string]
|
||||
}
|
||||
env?: [...{
|
||||
name: string
|
||||
value: string
|
||||
}]
|
||||
portForward?: [...string]
|
||||
persistentVolumeDirs?: [...{
|
||||
path: string
|
||||
capacity: string
|
||||
}]
|
||||
resources: {
|
||||
limits: {
|
||||
memory: *"2Gi" | string
|
||||
cpu: *"2" | string
|
||||
}
|
||||
requests: {
|
||||
memory: *"512Mi" | string
|
||||
cpu: *"0.5" | string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
62
charts/vela-core/templates/defwithtemplate/read-object.yaml
Normal file
62
charts/vela-core/templates/defwithtemplate/read-object.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/read-object.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Read objects for your workflow steps
|
||||
name: read-object
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
)
|
||||
|
||||
output: {
|
||||
if parameter.apiVersion == _|_ && parameter.kind == _|_ {
|
||||
op.#Read & {
|
||||
value: {
|
||||
apiVersion: "core.oam.dev/v1beta1"
|
||||
kind: "Application"
|
||||
metadata: {
|
||||
name: parameter.name
|
||||
if parameter.namespace != _|_ {
|
||||
namespace: parameter.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
if parameter.apiVersion != _|_ || parameter.kind != _|_ {
|
||||
op.#Read & {
|
||||
value: {
|
||||
apiVersion: parameter.apiVersion
|
||||
kind: parameter.kind
|
||||
metadata: {
|
||||
name: parameter.name
|
||||
if parameter.namespace != _|_ {
|
||||
namespace: parameter.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the apiVersion of the object, defaults to core.oam.dev/v1beta1
|
||||
apiVersion?: string
|
||||
// +usage=Specify the kind of the object, defaults to Application
|
||||
kind?: string
|
||||
// +usage=Specify the name of the object
|
||||
name: string
|
||||
// +usage=Specify the namespace of the object
|
||||
namespace?: string
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ spec:
|
||||
componentName: context.name
|
||||
rolloutPlan: {
|
||||
rolloutStrategy: "IncreaseFirst"
|
||||
rolloutBatches: parameter.rolloutBatches
|
||||
targetSize: parameter.targetSize
|
||||
if parameter.rolloutBatches != _|_ {
|
||||
rolloutBatches: parameter.rolloutBatches
|
||||
}
|
||||
targetSize: parameter.targetSize
|
||||
if parameter["batchPartition"] != _|_ {
|
||||
batchPartition: parameter.batchPartition
|
||||
}
|
||||
@@ -35,7 +37,7 @@ spec:
|
||||
parameter: {
|
||||
targetRevision: *context.revision | string
|
||||
targetSize: int
|
||||
rolloutBatches: [...rolloutBatch]
|
||||
rolloutBatches?: [...rolloutBatch]
|
||||
batchPartition?: int
|
||||
}
|
||||
rolloutBatch: replicas: int
|
||||
|
||||
@@ -23,6 +23,10 @@ spec:
|
||||
name: context.name
|
||||
image: parameter.image
|
||||
|
||||
if parameter["imagePullPolicy"] != _|_ {
|
||||
imagePullPolicy: parameter.imagePullPolicy
|
||||
}
|
||||
|
||||
if parameter["cmd"] != _|_ {
|
||||
command: parameter.cmd
|
||||
}
|
||||
@@ -85,6 +89,13 @@ spec:
|
||||
}}]
|
||||
}
|
||||
|
||||
if parameter["imagePullSecrets"] != _|_ {
|
||||
imagePullSecrets: [ for v in parameter.imagePullSecrets {
|
||||
name: v
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +108,12 @@ spec:
|
||||
// +short=i
|
||||
image: string
|
||||
|
||||
// +usage=Specify image pull policy for your service
|
||||
imagePullPolicy?: string
|
||||
|
||||
// +usage=Specify image pull secrets for your service
|
||||
imagePullSecrets?: [...string]
|
||||
|
||||
// +usage=Define the job restart policy, the value can only be Never or OnFailure. By default, it's Never.
|
||||
restart: *"Never" | string
|
||||
|
||||
|
||||
@@ -13,11 +13,18 @@ spec:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
"encoding/base64"
|
||||
)
|
||||
|
||||
parameter: {
|
||||
dingding?: {
|
||||
url: string
|
||||
url: {
|
||||
address?: string
|
||||
fromSecret?: {
|
||||
name: string
|
||||
key: string
|
||||
}
|
||||
}
|
||||
message: {
|
||||
text?: *null | {
|
||||
content: string
|
||||
@@ -62,7 +69,13 @@ spec:
|
||||
}
|
||||
|
||||
slack?: {
|
||||
url: string
|
||||
url: {
|
||||
address?: string
|
||||
fromSecret?: {
|
||||
name: string
|
||||
key: string
|
||||
}
|
||||
}
|
||||
message: {
|
||||
text: string
|
||||
blocks?: *null | [...block]
|
||||
@@ -84,17 +97,17 @@ spec:
|
||||
url?: string
|
||||
value?: string
|
||||
style?: string
|
||||
text?: text
|
||||
text?: textType
|
||||
confirm?: {
|
||||
title: text
|
||||
text: text
|
||||
confirm: text
|
||||
deny: text
|
||||
title: textType
|
||||
text: textType
|
||||
confirm: textType
|
||||
deny: textType
|
||||
style?: string
|
||||
}
|
||||
options?: [...option]
|
||||
initial_options?: [...option]
|
||||
placeholder?: text
|
||||
placeholder?: textType
|
||||
initial_date?: string
|
||||
image_url?: string
|
||||
alt_text?: string
|
||||
@@ -108,32 +121,74 @@ spec:
|
||||
initial_time?: string
|
||||
}]
|
||||
}
|
||||
text: {
|
||||
textType: {
|
||||
type: string
|
||||
text: string
|
||||
emoji?: bool
|
||||
verbatim?: bool
|
||||
}
|
||||
option: {
|
||||
text: text
|
||||
text: textType
|
||||
value: string
|
||||
description?: text
|
||||
description?: textType
|
||||
url?: string
|
||||
}
|
||||
// send webhook notification
|
||||
ding: {
|
||||
ding: op.#Steps & {
|
||||
if parameter.dingding != _|_ {
|
||||
op.#DingTalk & {
|
||||
message: parameter.dingding.message
|
||||
dingUrl: parameter.dingding.url
|
||||
if parameter.dingding.url.address != _|_ {
|
||||
ding1: op.#DingTalk & {
|
||||
message: parameter.dingding.message
|
||||
dingUrl: parameter.dingding.url.address
|
||||
}
|
||||
}
|
||||
if parameter.dingding.url.fromSecret != _|_ && parameter.dingding.url.address == _|_ {
|
||||
read: op.#Read & {
|
||||
value: {
|
||||
apiVersion: "v1"
|
||||
kind: "Secret"
|
||||
metadata: {
|
||||
name: parameter.dingding.url.fromSecret.name
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decoded: base64.Decode(null, read.value.data[parameter.dingding.url.fromSecret.key])
|
||||
stringValue: op.#ConvertString & {bt: decoded}
|
||||
ding2: op.#DingTalk & {
|
||||
message: parameter.dingding.message
|
||||
dingUrl: stringValue.str
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
slack: {
|
||||
slack: op.#Steps & {
|
||||
if parameter.slack != _|_ {
|
||||
op.#Slack & {
|
||||
message: parameter.slack.message
|
||||
slackUrl: parameter.slack.url
|
||||
if parameter.slack.url.address != _|_ {
|
||||
slack1: op.#Slack & {
|
||||
message: parameter.slack.message
|
||||
slackUrl: parameter.slack.url.address
|
||||
}
|
||||
}
|
||||
if parameter.slack.url.fromSecret != _|_ && parameter.slack.url.address == _|_ {
|
||||
read: op.#Read & {
|
||||
value: {
|
||||
kind: "Secret"
|
||||
apiVersion: "v1"
|
||||
metadata: {
|
||||
name: parameter.slack.url.fromSecret.name
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decoded: base64.Decode(null, read.value.data[parameter.slack.url.fromSecret.key])
|
||||
stringValue: op.#ConvertString & {bt: decoded}
|
||||
slack2: op.#Slack & {
|
||||
message: parameter.slack.message
|
||||
slackUrl: stringValue.str
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ admissionWebhooks:
|
||||
enabled: true
|
||||
image:
|
||||
repository: oamdev/kube-webhook-certgen
|
||||
tag: v2.2
|
||||
tag: v2.3
|
||||
pullPolicy: IfNotPresent
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
|
||||
@@ -1232,6 +1232,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1635,6 +1639,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1936,6 +1944,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3360,6 +3372,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3656,6 +3672,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4041,6 +4061,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4305,6 +4329,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4371,6 +4399,10 @@ spec:
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
configMapRef:
|
||||
description: ConfigMapRef refer to a ConfigMap which contains
|
||||
OpenAPI V3 JSON schema of Component parameters.
|
||||
type: string
|
||||
latestRevision:
|
||||
description: LatestRevision of the component definition
|
||||
properties:
|
||||
@@ -4585,6 +4617,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
|
||||
@@ -222,6 +222,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -506,6 +510,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -783,6 +791,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1041,6 +1053,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1107,6 +1123,10 @@ spec:
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
configMapRef:
|
||||
description: ConfigMapRef refer to a ConfigMap which contains
|
||||
OpenAPI V3 JSON schema of Component parameters.
|
||||
type: string
|
||||
latestRevision:
|
||||
description: LatestRevision of the component definition
|
||||
properties:
|
||||
|
||||
@@ -151,6 +151,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -188,6 +188,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -468,6 +472,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -148,6 +148,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -212,6 +216,10 @@ spec:
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
configMapRef:
|
||||
description: ConfigMapRef refer to a ConfigMap which contains OpenAPI
|
||||
V3 JSON schema of Component parameters.
|
||||
type: string
|
||||
latestRevision:
|
||||
description: LatestRevision of the component definition
|
||||
properties:
|
||||
|
||||
@@ -193,6 +193,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -454,6 +458,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -16,7 +16,13 @@ spec:
|
||||
)
|
||||
|
||||
apply: op.#Apply & {
|
||||
value: parameter
|
||||
value: parameter.value
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the value of the object
|
||||
value: {...}
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
parameter: {}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/export2config.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Export data to config map for your workflow steps
|
||||
name: export2config
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
)
|
||||
|
||||
apply: op.#Apply & {
|
||||
value: {
|
||||
apiVersion: "v1"
|
||||
kind: "ConfigMap"
|
||||
metadata: {
|
||||
name: parameter.configName
|
||||
if parameter.namespace != _|_ {
|
||||
namespace: parameter.namespace
|
||||
}
|
||||
if parameter.namespace == _|_ {
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
data: parameter.data
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the name of the config map
|
||||
configName: string
|
||||
// +usage=Specify the namespace of the config map
|
||||
namespace?: string
|
||||
// +usage=Specify the data of config map
|
||||
data: {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/export2secret.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Export data to secret for your workflow steps
|
||||
name: export2secret
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
)
|
||||
|
||||
apply: op.#Apply & {
|
||||
value: {
|
||||
apiVersion: "v1"
|
||||
kind: "Secret"
|
||||
if parameter.type != _|_ {
|
||||
type: parameter.type
|
||||
}
|
||||
metadata: {
|
||||
name: parameter.secretName
|
||||
if parameter.namespace != _|_ {
|
||||
namespace: parameter.namespace
|
||||
}
|
||||
if parameter.namespace == _|_ {
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
stringData: parameter.data
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the name of the secret
|
||||
secretName: string
|
||||
// +usage=Specify the namespace of the secret
|
||||
namespace?: string
|
||||
// +usage=Specify the type of the secret
|
||||
type?: string
|
||||
// +usage=Specify the data of secret
|
||||
data: {}
|
||||
}
|
||||
|
||||
113
charts/vela-minimal/templates/defwithtemplate/nocalhost.yaml
Normal file
113
charts/vela-minimal/templates/defwithtemplate/nocalhost.yaml
Normal file
@@ -0,0 +1,113 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/nocalhost.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: nocalhost develop configuration.
|
||||
name: nocalhost
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- '*'
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
patch: metadata: annotations: {
|
||||
"dev.nocalhost/application-name": context.appName
|
||||
"dev.nocalhost/application-namespace": context.namespace
|
||||
"dev.nocalhost": json.Marshal({
|
||||
containers: [
|
||||
{
|
||||
name: context.name
|
||||
dev: {
|
||||
if parameter.gitUrl != _|_ {
|
||||
gitUrl: parameter.gitUrl
|
||||
}
|
||||
image: parameter.image
|
||||
shell: parameter.shell
|
||||
workDir: parameter.workDir
|
||||
if parameter.storageClass != _|_ {
|
||||
storageClass: parameter.storageClass
|
||||
}
|
||||
resources: {
|
||||
limits: parameter.resources.limits
|
||||
requests: parameter.resources.requests
|
||||
}
|
||||
if parameter.persistentVolumeDirs != _|_ {
|
||||
persistentVolumeDirs: [
|
||||
for v in parameter.persistentVolumeDirs {
|
||||
path: v.path
|
||||
capacity: v.capacity
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.command != _|_ {
|
||||
command: parameter.command
|
||||
}
|
||||
if parameter.debug != _|_ {
|
||||
debug: parameter.debug
|
||||
}
|
||||
hotReload: parameter.hotReload
|
||||
if parameter.sync != _|_ {
|
||||
sync: parameter.sync
|
||||
}
|
||||
if parameter.env != _|_ {
|
||||
env: [
|
||||
for v in parameter.env {
|
||||
name: v.name
|
||||
value: v.value
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.portForward != _|_ {
|
||||
portForward: parameter.portForward
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
parameter: {
|
||||
gitUrl?: string
|
||||
image: string
|
||||
shell: *"bash" | string
|
||||
workDir: *"/home/nocalhost-dev" | string
|
||||
storageClass?: string
|
||||
command?: {
|
||||
run?: [...string]
|
||||
debug?: [...string]
|
||||
}
|
||||
debug?: remoteDebugPort?: int
|
||||
hotReload: *true | bool
|
||||
sync: {
|
||||
type: *"send" | string
|
||||
filePattern?: [...string]
|
||||
ignoreFilePattern?: [...string]
|
||||
}
|
||||
env?: [...{
|
||||
name: string
|
||||
value: string
|
||||
}]
|
||||
portForward?: [...string]
|
||||
persistentVolumeDirs?: [...{
|
||||
path: string
|
||||
capacity: string
|
||||
}]
|
||||
resources: {
|
||||
limits: {
|
||||
memory: *"2Gi" | string
|
||||
cpu: *"2" | string
|
||||
}
|
||||
requests: {
|
||||
memory: *"512Mi" | string
|
||||
cpu: *"0.5" | string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/read-object.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Read objects for your workflow steps
|
||||
name: read-object
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
)
|
||||
|
||||
output: {
|
||||
if parameter.apiVersion == _|_ && parameter.kind == _|_ {
|
||||
op.#Read & {
|
||||
value: {
|
||||
apiVersion: "core.oam.dev/v1beta1"
|
||||
kind: "Application"
|
||||
metadata: {
|
||||
name: parameter.name
|
||||
if parameter.namespace != _|_ {
|
||||
namespace: parameter.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
if parameter.apiVersion != _|_ || parameter.kind != _|_ {
|
||||
op.#Read & {
|
||||
value: {
|
||||
apiVersion: parameter.apiVersion
|
||||
kind: parameter.kind
|
||||
metadata: {
|
||||
name: parameter.name
|
||||
if parameter.namespace != _|_ {
|
||||
namespace: parameter.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the apiVersion of the object, defaults to core.oam.dev/v1beta1
|
||||
apiVersion?: string
|
||||
// +usage=Specify the kind of the object, defaults to Application
|
||||
kind?: string
|
||||
// +usage=Specify the name of the object
|
||||
name: string
|
||||
// +usage=Specify the namespace of the object
|
||||
namespace?: string
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ spec:
|
||||
componentName: context.name
|
||||
rolloutPlan: {
|
||||
rolloutStrategy: "IncreaseFirst"
|
||||
rolloutBatches: parameter.rolloutBatches
|
||||
targetSize: parameter.targetSize
|
||||
if parameter.rolloutBatches != _|_ {
|
||||
rolloutBatches: parameter.rolloutBatches
|
||||
}
|
||||
targetSize: parameter.targetSize
|
||||
if parameter["batchPartition"] != _|_ {
|
||||
batchPartition: parameter.batchPartition
|
||||
}
|
||||
@@ -35,7 +37,7 @@ spec:
|
||||
parameter: {
|
||||
targetRevision: *context.revision | string
|
||||
targetSize: int
|
||||
rolloutBatches: [...rolloutBatch]
|
||||
rolloutBatches?: [...rolloutBatch]
|
||||
batchPartition?: int
|
||||
}
|
||||
rolloutBatch: replicas: int
|
||||
|
||||
@@ -23,6 +23,10 @@ spec:
|
||||
name: context.name
|
||||
image: parameter.image
|
||||
|
||||
if parameter["imagePullPolicy"] != _|_ {
|
||||
imagePullPolicy: parameter.imagePullPolicy
|
||||
}
|
||||
|
||||
if parameter["cmd"] != _|_ {
|
||||
command: parameter.cmd
|
||||
}
|
||||
@@ -85,6 +89,13 @@ spec:
|
||||
}}]
|
||||
}
|
||||
|
||||
if parameter["imagePullSecrets"] != _|_ {
|
||||
imagePullSecrets: [ for v in parameter.imagePullSecrets {
|
||||
name: v
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +108,12 @@ spec:
|
||||
// +short=i
|
||||
image: string
|
||||
|
||||
// +usage=Specify image pull policy for your service
|
||||
imagePullPolicy?: string
|
||||
|
||||
// +usage=Specify image pull secrets for your service
|
||||
imagePullSecrets?: [...string]
|
||||
|
||||
// +usage=Define the job restart policy, the value can only be Never or OnFailure. By default, it's Never.
|
||||
restart: *"Never" | string
|
||||
|
||||
|
||||
@@ -13,11 +13,18 @@ spec:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
"encoding/base64"
|
||||
)
|
||||
|
||||
parameter: {
|
||||
dingding?: {
|
||||
url: string
|
||||
url: {
|
||||
address?: string
|
||||
fromSecret?: {
|
||||
name: string
|
||||
key: string
|
||||
}
|
||||
}
|
||||
message: {
|
||||
text?: *null | {
|
||||
content: string
|
||||
@@ -62,7 +69,13 @@ spec:
|
||||
}
|
||||
|
||||
slack?: {
|
||||
url: string
|
||||
url: {
|
||||
address?: string
|
||||
fromSecret?: {
|
||||
name: string
|
||||
key: string
|
||||
}
|
||||
}
|
||||
message: {
|
||||
text: string
|
||||
blocks?: *null | [...block]
|
||||
@@ -84,17 +97,17 @@ spec:
|
||||
url?: string
|
||||
value?: string
|
||||
style?: string
|
||||
text?: text
|
||||
text?: textType
|
||||
confirm?: {
|
||||
title: text
|
||||
text: text
|
||||
confirm: text
|
||||
deny: text
|
||||
title: textType
|
||||
text: textType
|
||||
confirm: textType
|
||||
deny: textType
|
||||
style?: string
|
||||
}
|
||||
options?: [...option]
|
||||
initial_options?: [...option]
|
||||
placeholder?: text
|
||||
placeholder?: textType
|
||||
initial_date?: string
|
||||
image_url?: string
|
||||
alt_text?: string
|
||||
@@ -108,32 +121,74 @@ spec:
|
||||
initial_time?: string
|
||||
}]
|
||||
}
|
||||
text: {
|
||||
textType: {
|
||||
type: string
|
||||
text: string
|
||||
emoji?: bool
|
||||
verbatim?: bool
|
||||
}
|
||||
option: {
|
||||
text: text
|
||||
text: textType
|
||||
value: string
|
||||
description?: text
|
||||
description?: textType
|
||||
url?: string
|
||||
}
|
||||
// send webhook notification
|
||||
ding: {
|
||||
ding: op.#Steps & {
|
||||
if parameter.dingding != _|_ {
|
||||
op.#DingTalk & {
|
||||
message: parameter.dingding.message
|
||||
dingUrl: parameter.dingding.url
|
||||
if parameter.dingding.url.address != _|_ {
|
||||
ding1: op.#DingTalk & {
|
||||
message: parameter.dingding.message
|
||||
dingUrl: parameter.dingding.url.address
|
||||
}
|
||||
}
|
||||
if parameter.dingding.url.fromSecret != _|_ && parameter.dingding.url.address == _|_ {
|
||||
read: op.#Read & {
|
||||
value: {
|
||||
apiVersion: "v1"
|
||||
kind: "Secret"
|
||||
metadata: {
|
||||
name: parameter.dingding.url.fromSecret.name
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decoded: base64.Decode(null, read.value.data[parameter.dingding.url.fromSecret.key])
|
||||
stringValue: op.#ConvertString & {bt: decoded}
|
||||
ding2: op.#DingTalk & {
|
||||
message: parameter.dingding.message
|
||||
dingUrl: stringValue.str
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
slack: {
|
||||
slack: op.#Steps & {
|
||||
if parameter.slack != _|_ {
|
||||
op.#Slack & {
|
||||
message: parameter.slack.message
|
||||
slackUrl: parameter.slack.url
|
||||
if parameter.slack.url.address != _|_ {
|
||||
slack1: op.#Slack & {
|
||||
message: parameter.slack.message
|
||||
slackUrl: parameter.slack.url.address
|
||||
}
|
||||
}
|
||||
if parameter.slack.url.fromSecret != _|_ && parameter.slack.url.address == _|_ {
|
||||
read: op.#Read & {
|
||||
value: {
|
||||
kind: "Secret"
|
||||
apiVersion: "v1"
|
||||
metadata: {
|
||||
name: parameter.slack.url.fromSecret.name
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decoded: base64.Decode(null, read.value.data[parameter.slack.url.fromSecret.key])
|
||||
stringValue: op.#ConvertString & {bt: decoded}
|
||||
slack2: op.#Slack & {
|
||||
message: parameter.slack.message
|
||||
slackUrl: stringValue.str
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ admissionWebhooks:
|
||||
enabled: true
|
||||
image:
|
||||
repository: oamdev/kube-webhook-certgen
|
||||
tag: v2.2
|
||||
tag: v2.3
|
||||
pullPolicy: IfNotPresent
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
|
||||
@@ -32,6 +32,7 @@ import (
|
||||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/klog/v2/klogr"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/healthz"
|
||||
@@ -192,7 +193,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
ctrl.SetLogger(klogr.New())
|
||||
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
|
||||
Scheme: scheme,
|
||||
MetricsBindAddress: metricsAddr,
|
||||
|
||||
157
docs/examples/nocalhost/nocalhost.yaml
Normal file
157
docs/examples/nocalhost/nocalhost.yaml
Normal file
@@ -0,0 +1,157 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: bookinfo
|
||||
spec:
|
||||
components:
|
||||
- name: productpage
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/productpage:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-productpage.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/python:3.7.7-slim-productpage-with-pydevd
|
||||
shell: "bash"
|
||||
workDir: "/opt/work"
|
||||
resources:
|
||||
limits:
|
||||
memory: 1Gi
|
||||
cpu: "1"
|
||||
requests:
|
||||
memory: 512Mi
|
||||
cpu: "0.5"
|
||||
debug:
|
||||
remoteDebugPort: 9009
|
||||
hotReload: true
|
||||
sync:
|
||||
type: send
|
||||
filePattern:
|
||||
- ./
|
||||
ignoreFilePattern:
|
||||
- .git
|
||||
- .idea
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
env:
|
||||
- name: "foo"
|
||||
value: "bar"
|
||||
portForward:
|
||||
- 39080:9080
|
||||
|
||||
- name: authors
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/authors:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-authors.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/golang:latest
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
debug:
|
||||
remoteDebugPort: 9009
|
||||
|
||||
- name: details
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/details:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-details.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/ruby:2.7.1-slim
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
sync:
|
||||
filePattern:
|
||||
- ./
|
||||
ignoreFilePattern:
|
||||
- .git
|
||||
- .idea
|
||||
|
||||
- name: ratings
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/ratings:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-ratings.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/node:12.18.1-slim
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
|
||||
- name: reviews
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/reviews:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-reviews.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/java:latest
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
debug:
|
||||
remoteDebugPort: 5005
|
||||
sync:
|
||||
filePattern:
|
||||
- ./
|
||||
ignoreFilePattern:
|
||||
- .git
|
||||
- .idea
|
||||
- .gradle
|
||||
- build
|
||||
130
docs/examples/obervability/application-observability.yaml
Normal file
130
docs/examples/obervability/application-observability.yaml
Normal file
@@ -0,0 +1,130 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: observability
|
||||
spec: { }
|
||||
|
||||
---
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: "An out of the box solution for KubeVela observability"
|
||||
name: grafana
|
||||
namespace: observability
|
||||
spec:
|
||||
components:
|
||||
# install grafana datasource registration chart
|
||||
- name: grafana-registration-release
|
||||
type: helm
|
||||
properties:
|
||||
repoType: git
|
||||
url: https://github.com/oam-dev/grafana-registration
|
||||
git:
|
||||
branch: master
|
||||
chart: ./chart
|
||||
targetNamespace: observability
|
||||
values:
|
||||
replicaCount: 1
|
||||
|
||||
# install Grafana
|
||||
- name: grafana
|
||||
properties:
|
||||
chart: grafana
|
||||
version: 6.14.1
|
||||
repoType: helm
|
||||
# original url: https://grafana.github.io/helm-charts
|
||||
url: https://charts.kubevela.net/addons
|
||||
targetNamespace: observability
|
||||
releaseName: grafana
|
||||
type: helm
|
||||
traits:
|
||||
- type: pure-ingress
|
||||
properties:
|
||||
domain: grafana.c58136db32cbc44cca364bf1cf7f90519.cn-hongkong.alicontainer.com
|
||||
http:
|
||||
"/": 80
|
||||
- type: import-grafana-dashboard
|
||||
properties:
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
urls:
|
||||
- "https://charts.kubevela.net/addons/dashboards/kubevela_core_logging.json"
|
||||
- "https://charts.kubevela.net/addons/dashboards/kubevela_core_monitoring.json"
|
||||
- "https://charts.kubevela.net/addons/dashboards/flux2/cluster.json"
|
||||
- "https://charts.kubevela.net/addons/dashboards/kubevela_application_logging.json"
|
||||
|
||||
# install loki
|
||||
- name: loki
|
||||
type: helm
|
||||
properties:
|
||||
chart: loki-stack
|
||||
version: 2.4.1
|
||||
repoType: helm
|
||||
# original url: https://grafana.github.io/helm-charts
|
||||
url: https://charts.kubevela.net/addons
|
||||
targetNamespace: observability
|
||||
releaseName: loki
|
||||
traits:
|
||||
- type: register-grafana-datasource # register loki datasource to Grafana
|
||||
properties:
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
name: loki
|
||||
service: loki
|
||||
namespace: observability
|
||||
type: loki
|
||||
access: proxy
|
||||
|
||||
# install Prometheus
|
||||
- name: prometheus-server
|
||||
type: helm
|
||||
properties:
|
||||
chart: prometheus
|
||||
version: 14.4.1
|
||||
repoType: helm
|
||||
# original url: https://prometheus-community.github.io/helm-charts
|
||||
url: https://charts.kubevela.net/addons
|
||||
targetNamespace: observability
|
||||
releaseName: prometheus
|
||||
values:
|
||||
alertmanager:
|
||||
persistentVolume:
|
||||
storageClass: "alicloud-disk-available"
|
||||
size: "20Gi"
|
||||
server:
|
||||
persistentVolume:
|
||||
storageClass: "alicloud-disk-available"
|
||||
size: "20Gi"
|
||||
|
||||
traits:
|
||||
- type: register-grafana-datasource # register Prometheus datasource to Grafana
|
||||
properties:
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
name: prometheus
|
||||
service: prometheus-server
|
||||
namespace: observability
|
||||
type: prometheus
|
||||
access: proxy
|
||||
|
||||
# install kube-state-metrics
|
||||
- name: kube-state-metrics
|
||||
type: helm
|
||||
properties:
|
||||
chart: kube-state-metrics
|
||||
version: 3.4.1
|
||||
repoType: helm
|
||||
# original url: https://prometheus-community.github.io/helm-charts
|
||||
url: https://charts.kubevela.net/addons
|
||||
targetNamespace: observability
|
||||
values:
|
||||
image:
|
||||
repository: oamdev/kube-state-metrics
|
||||
tag: v2.1.0
|
||||
@@ -1,159 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: observability
|
||||
spec: { }
|
||||
|
||||
---
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
metadata:
|
||||
name: grafana
|
||||
namespace: observability
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
# install grafana datasource registration chart
|
||||
- name: grafana-registration-release
|
||||
properties:
|
||||
apiVersion: helm.toolkit.fluxcd.io/v2beta1
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: grafana-registration-release
|
||||
namespace: observability
|
||||
spec:
|
||||
chart:
|
||||
spec:
|
||||
chart: ./chart
|
||||
interval: 1m
|
||||
sourceRef:
|
||||
kind: GitRepository
|
||||
name: grafana-registration-repo
|
||||
namespace: observability
|
||||
interval: 5m
|
||||
values:
|
||||
replicaCount: 1
|
||||
type: raw
|
||||
- name: grafana-registration-repo
|
||||
properties:
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta1
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
name: grafana-registration-repo
|
||||
namespace: observability
|
||||
spec:
|
||||
interval: 5m
|
||||
ref:
|
||||
branch: master
|
||||
url: https://github.com/oam-dev/grafana-registration
|
||||
type: raw
|
||||
|
||||
# install Grafana
|
||||
- name: grafana
|
||||
properties:
|
||||
chart: grafana
|
||||
version: 6.14.1
|
||||
repoType: helm
|
||||
# original url: https://grafana.github.io/helm-charts
|
||||
url: https://charts.kubevela.net/addons
|
||||
targetNamespace: observability
|
||||
releaseName: grafana
|
||||
type: helm
|
||||
traits:
|
||||
- type: pure-ingress
|
||||
properties:
|
||||
domain: grafana.cf7223b8abedc4691b7eccfe3c675850a.cn-hongkong.alicontainer.com
|
||||
http:
|
||||
"/": 80
|
||||
- type: import-grafana-dashboard
|
||||
properties:
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
urls:
|
||||
- "https://charts.kubevela.net/addons/dashboards/kubevela_core_logging.json"
|
||||
- "https://charts.kubevela.net/addons/dashboards/kubevela_core_monitoring.json"
|
||||
- "https://charts.kubevela.net/addons/dashboards/flux2/cluster.json"
|
||||
- "https://charts.kubevela.net/addons/dashboards/kubevela_application_logging.json"
|
||||
|
||||
# install loki
|
||||
- name: loki
|
||||
type: helm
|
||||
properties:
|
||||
chart: loki-stack
|
||||
version: 2.4.1
|
||||
repoType: helm
|
||||
# original url: https://grafana.github.io/helm-charts
|
||||
url: https://charts.kubevela.net/addons
|
||||
targetNamespace: observability
|
||||
releaseName: loki
|
||||
traits:
|
||||
- type: register-grafana-datasource # register loki datasource to Grafana
|
||||
properties:
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
name: loki
|
||||
service: loki
|
||||
namespace: observability
|
||||
type: loki
|
||||
access: proxy
|
||||
|
||||
# install Prometheus
|
||||
- name: prometheus-server
|
||||
type: helm
|
||||
properties:
|
||||
chart: prometheus
|
||||
version: 14.4.1
|
||||
repoType: helm
|
||||
# original url: https://prometheus-community.github.io/helm-charts
|
||||
url: https://charts.kubevela.net/addons
|
||||
targetNamespace: observability
|
||||
releaseName: prometheus
|
||||
values:
|
||||
alertmanager:
|
||||
persistentVolume:
|
||||
storageClass: "alicloud-disk-available"
|
||||
size: "20Gi"
|
||||
server:
|
||||
persistentVolume:
|
||||
storageClass: "alicloud-disk-available"
|
||||
size: "20Gi"
|
||||
|
||||
traits:
|
||||
- type: register-grafana-datasource # register Prometheus datasource to Grafana
|
||||
properties:
|
||||
grafanaServiceName: grafana
|
||||
grafanaServiceNamespace: observability
|
||||
credentialSecret: grafana
|
||||
credentialSecretNamespace: observability
|
||||
name: prometheus
|
||||
service: prometheus-server
|
||||
namespace: observability
|
||||
type: prometheus
|
||||
access: proxy
|
||||
|
||||
# install kube-state-metrics
|
||||
- name: kube-state-metrics
|
||||
type: helm
|
||||
properties:
|
||||
chart: kube-state-metrics
|
||||
version: 3.4.1
|
||||
repoType: helm
|
||||
# original url: https://prometheus-community.github.io/helm-charts
|
||||
url: https://charts.kubevela.net/addons
|
||||
targetNamespace: observability
|
||||
values:
|
||||
image:
|
||||
repository: oamdev/kube-state-metrics
|
||||
tag: v2.1.0
|
||||
|
||||
dependsOn:
|
||||
- ref:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
@@ -21,18 +21,21 @@ spec:
|
||||
- name: apply-pvc
|
||||
type: apply-object
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: myclaim
|
||||
namespace: default
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 8Gi
|
||||
storageClassName: standard
|
||||
value:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: myclaim
|
||||
namespace: default
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 8Gi
|
||||
storageClassName: standard
|
||||
# for multi-cluster
|
||||
# cluster: my-cluster
|
||||
- name: apply-server
|
||||
type: apply-component
|
||||
properties:
|
||||
|
||||
28
docs/examples/workflow/export2config/app.yaml
Normal file
28
docs/examples/workflow/export2config/app.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: export-config
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
workflow:
|
||||
steps:
|
||||
- name: apply-server
|
||||
type: apply-component
|
||||
outputs:
|
||||
- name: status
|
||||
valueFrom: output.status.conditions[0].message
|
||||
properties:
|
||||
component: express-server
|
||||
- name: export-config
|
||||
type: export-config
|
||||
inputs:
|
||||
- from: status
|
||||
parameterKey: data.serverstatus
|
||||
properties:
|
||||
configName: my-configmap
|
||||
28
docs/examples/workflow/export2secret/app.yaml
Normal file
28
docs/examples/workflow/export2secret/app.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: export-secret
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
workflow:
|
||||
steps:
|
||||
- name: apply-server
|
||||
type: apply-component
|
||||
outputs:
|
||||
- name: status
|
||||
valueFrom: output.status.conditions[0].message
|
||||
properties:
|
||||
component: express-server
|
||||
- name: export-secret
|
||||
type: export-secret
|
||||
inputs:
|
||||
- from: status
|
||||
parameterKey: data.serverstatus
|
||||
properties:
|
||||
secretName: my-secret
|
||||
36
docs/examples/workflow/read-object/app.yaml
Normal file
36
docs/examples/workflow/read-object/app.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: read-object
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
workflow:
|
||||
steps:
|
||||
- name: read-object
|
||||
type: read-object
|
||||
outputs:
|
||||
- name: cpu
|
||||
valueFrom: output.value.data["cpu"]
|
||||
- name: memory
|
||||
valueFrom: output.value.data["memory"]
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: my-cm-name
|
||||
# for multi cluster
|
||||
# cluster: my-cluster
|
||||
- name: apply
|
||||
type: apply-component
|
||||
inputs:
|
||||
- from: cpu
|
||||
parameterKey: cpu
|
||||
- from: memory
|
||||
parameterKey: memory
|
||||
properties:
|
||||
component: express-server
|
||||
@@ -38,12 +38,12 @@ var _ = Describe("Addon Test", func() {
|
||||
k8sClient, err := args.GetClient()
|
||||
Expect(err).Should(BeNil())
|
||||
It("Apply test addon", func() {
|
||||
Expect(yaml.Unmarshal([]byte(test_addon), &cmSimpleAddon)).Should(BeNil())
|
||||
Expect(yaml.Unmarshal([]byte(testAddon), &cmSimpleAddon)).Should(BeNil())
|
||||
err = k8sClient.Create(context.Background(), &cmSimpleAddon)
|
||||
Expect(err).Should(SatisfyAny(BeNil(), &util.AlreadyExistMatcher{}))
|
||||
})
|
||||
It("Apply test input addon", func() {
|
||||
Expect(yaml.Unmarshal([]byte(test_input_addon), &cmInputAddon)).Should(BeNil())
|
||||
Expect(yaml.Unmarshal([]byte(testInputAddon), &cmInputAddon)).Should(BeNil())
|
||||
err = k8sClient.Create(context.Background(), &cmInputAddon)
|
||||
Expect(err).Should(SatisfyAny(BeNil(), &util.AlreadyExistMatcher{}))
|
||||
})
|
||||
@@ -100,7 +100,7 @@ var _ = Describe("Addon Test", func() {
|
||||
|
||||
})
|
||||
|
||||
var test_addon = `
|
||||
var testAddon = `
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
@@ -112,33 +112,46 @@ metadata:
|
||||
name: test-addon
|
||||
namespace: vela-system
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: This is a addon for e2e test
|
||||
name: test-addon
|
||||
namespace: test-addon-system
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: test-addon-pod
|
||||
type: raw
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: test-addon-pod
|
||||
namespace: test-addon-system
|
||||
spec:
|
||||
containers:
|
||||
- name: test-addon-pod-container
|
||||
image: nginx
|
||||
workflow:
|
||||
steps:
|
||||
- name: apply-ns
|
||||
type: apply-component
|
||||
properties:
|
||||
component: ns-test-addon-system
|
||||
- name: apply-resources
|
||||
type: apply-remaining
|
||||
components:
|
||||
- name: ns-test-addon-system
|
||||
type: raw
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: test-addon-system
|
||||
- name: test-addon-pod
|
||||
type: raw
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: test-addon-pod
|
||||
spec:
|
||||
namespace: test-addon-system
|
||||
containers:
|
||||
- name: test-addon-pod-container
|
||||
image: nginx
|
||||
`
|
||||
|
||||
var test_input_addon = `
|
||||
var testInputAddon = `
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
@@ -150,38 +163,20 @@ metadata:
|
||||
namespace: vela-system
|
||||
apiVersion: v1
|
||||
data:
|
||||
initializer: |
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: This is a test addon for test addon input
|
||||
name: test-input-addon
|
||||
namespace: vela-system
|
||||
spec:
|
||||
appTemplate:
|
||||
spec:
|
||||
components:
|
||||
- name: test-chart
|
||||
properties:
|
||||
chart: [[ index .Args "chart" ]]
|
||||
repoType: helm
|
||||
url: [[ index .Args "url" ]]
|
||||
type: helm
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
dependsOn:
|
||||
- ref:
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Initializer
|
||||
name: fluxcd
|
||||
namespace: vela-system
|
||||
status:
|
||||
observedGeneration: 0
|
||||
components:
|
||||
- name: test-chart
|
||||
properties:
|
||||
chart: [[ index .Args "chart" ]]
|
||||
repoType: helm
|
||||
url: [[ index .Args "url" ]]
|
||||
type: helm
|
||||
`
|
||||
|
||||
4
go.mod
4
go.mod
@@ -34,7 +34,7 @@ require (
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.1
|
||||
github.com/oam-dev/cluster-gateway v1.1.2
|
||||
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28
|
||||
github.com/oam-dev/terraform-controller v0.2.1
|
||||
github.com/oam-dev/terraform-controller v0.2.6
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/onsi/ginkgo v1.16.4
|
||||
github.com/onsi/gomega v1.16.0
|
||||
@@ -45,7 +45,7 @@ require (
|
||||
github.com/spf13/cobra v1.2.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/tidwall/gjson v1.6.8
|
||||
github.com/tidwall/gjson v1.9.3
|
||||
github.com/wercker/stern v0.0.0-20190705090245-4fa46dd6987f
|
||||
github.com/wonderflow/cert-manager-api v1.0.3
|
||||
go.mongodb.org/mongo-driver v1.5.1
|
||||
|
||||
16
go.sum
16
go.sum
@@ -1206,8 +1206,8 @@ github.com/oam-dev/stern v1.13.0-alpha h1:EVjM8Qvh6LssB6t4RZrjf9DtCq1cz+/cy6OF7f
|
||||
github.com/oam-dev/stern v1.13.0-alpha/go.mod h1:AOkvfFUv0Arz7GBi0jz7S0Jsu4K/kdvSjNsnRt1+BIg=
|
||||
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28 h1:tD8HiFKnt0jnwdTWjeqUnfnUYLD/+Nsmj8ZGIxqDWiU=
|
||||
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28/go.mod h1:Mu8i0/DdplvnjwRbAYPsc8+LRR27n/mp8VWdkN10GzE=
|
||||
github.com/oam-dev/terraform-controller v0.2.1 h1:gGXcUDBMWKfWet84STm99RX6gXo89pyTRsgQSLq2mog=
|
||||
github.com/oam-dev/terraform-controller v0.2.1/go.mod h1:5Vy6jLx9fjotEd6E005Ve1f0x3fEpVlG/DVjmqLjAq0=
|
||||
github.com/oam-dev/terraform-controller v0.2.6 h1:aoEj4sfxDMBdTkM5uKYmjVFOgjhYeYBm0xzdRb4+Xu0=
|
||||
github.com/oam-dev/terraform-controller v0.2.6/go.mod h1:xFSCd3Nwuh6P1HEpx5jDnLzN35T9hoH53zdojDYE6LI=
|
||||
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
|
||||
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
||||
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
|
||||
@@ -1511,13 +1511,13 @@ github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG
|
||||
github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM=
|
||||
github.com/tetafro/godot v1.4.7/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8=
|
||||
github.com/thanos-io/thanos v0.11.0/go.mod h1:N/Yes7J68KqvmY+xM6J5CJqEvWIvKSR5sqGtmuD6wDc=
|
||||
github.com/tidwall/gjson v1.6.8 h1:CTmXMClGYPAmln7652e69B7OLXfTi5ABcPPwjIWUv7w=
|
||||
github.com/tidwall/gjson v1.6.8/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
|
||||
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
|
||||
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/gjson v1.9.3 h1:hqzS9wAHMO+KVBBkLxYdkEeeFHuqr95GfClRLKlgK0E=
|
||||
github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
||||
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
|
||||
github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/tklauser/go-sysconf v0.3.4/go.mod h1:Cl2c8ZRWfHD5IrfHo9VN+FX9kCFjIOyVklgXycLB6ek=
|
||||
|
||||
12
hack/e2e/build_runtime_rollout.sh
Executable file
12
hack/e2e/build_runtime_rollout.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
TEMP_DIR="./runtime/rollout/e2e/tmp/"
|
||||
|
||||
mkdir -p $TEMP_DIR
|
||||
cp -r go.mod $TEMP_DIR
|
||||
cp -r go.sum $TEMP_DIR
|
||||
cp -r entrypoint.sh $TEMP_DIR
|
||||
cp -r runtime/rollout/cmd/main.go $TEMP_DIR
|
||||
cp -r ./apis $TEMP_DIR
|
||||
cp -r ./pkg $TEMP_DIR
|
||||
cp -r ./version $TEMP_DIR
|
||||
@@ -1232,6 +1232,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1635,6 +1639,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1936,6 +1944,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3360,6 +3372,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3656,6 +3672,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4041,6 +4061,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4305,6 +4329,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4371,6 +4399,10 @@ spec:
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
configMapRef:
|
||||
description: ConfigMapRef refer to a ConfigMap which contains
|
||||
OpenAPI V3 JSON schema of Component parameters.
|
||||
type: string
|
||||
latestRevision:
|
||||
description: LatestRevision of the component definition
|
||||
properties:
|
||||
@@ -4585,6 +4617,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
|
||||
@@ -179,6 +179,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -463,6 +467,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -222,6 +222,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -506,6 +510,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -783,6 +791,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1041,6 +1053,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1107,6 +1123,10 @@ spec:
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
configMapRef:
|
||||
description: ConfigMapRef refer to a ConfigMap which contains
|
||||
OpenAPI V3 JSON schema of Component parameters.
|
||||
type: string
|
||||
latestRevision:
|
||||
description: LatestRevision of the component definition
|
||||
properties:
|
||||
|
||||
@@ -151,6 +151,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -188,6 +188,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -468,6 +472,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -148,6 +148,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -212,6 +216,10 @@ spec:
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
configMapRef:
|
||||
description: ConfigMapRef refer to a ConfigMap which contains OpenAPI
|
||||
V3 JSON schema of Component parameters.
|
||||
type: string
|
||||
latestRevision:
|
||||
description: LatestRevision of the component definition
|
||||
properties:
|
||||
|
||||
@@ -193,6 +193,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -454,6 +458,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -669,6 +669,7 @@ func generateTerraformConfigurationWorkload(wl *Workload, ns string) (*unstructu
|
||||
configuration.Spec.JSON = wl.FullTemplate.Terraform.Configuration
|
||||
case "remote":
|
||||
configuration.Spec.Remote = wl.FullTemplate.Terraform.Configuration
|
||||
configuration.Spec.Path = wl.FullTemplate.Terraform.Path
|
||||
}
|
||||
|
||||
if wl.FullTemplate.Terraform.ProviderReference != nil {
|
||||
|
||||
@@ -43,6 +43,7 @@ import (
|
||||
common2 "github.com/oam-dev/kubevela/pkg/controller/common"
|
||||
core "github.com/oam-dev/kubevela/pkg/controller/core.oam.dev"
|
||||
"github.com/oam-dev/kubevela/pkg/controller/core.oam.dev/v1alpha1/envbinding"
|
||||
"github.com/oam-dev/kubevela/pkg/controller/core.oam.dev/v1alpha2/application/assemble"
|
||||
"github.com/oam-dev/kubevela/pkg/cue/packages"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/discoverymapper"
|
||||
@@ -223,7 +224,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
|
||||
return r.endWithNegativeCondition(ctx, app, condition.ErrorCondition("Render", err), common.ApplicationRendering)
|
||||
}
|
||||
|
||||
handler.handleCheckManageWorkloadTrait(handler.currentAppRev.Spec.TraitDefinitions, comps)
|
||||
assemble.HandleCheckManageWorkloadTrait(*handler.currentAppRev, comps)
|
||||
|
||||
if err := handler.HandleComponentsRevision(ctx, comps); err != nil {
|
||||
klog.ErrorS(err, "Failed to handle compoents revision", "application", klog.KObj(app))
|
||||
|
||||
@@ -26,8 +26,6 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam/testutil"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
@@ -40,6 +38,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/utils/pointer"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"sigs.k8s.io/yaml"
|
||||
@@ -52,6 +51,7 @@ import (
|
||||
velatypes "github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/controller/utils"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/testutil"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
common2 "github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
)
|
||||
@@ -2069,6 +2069,51 @@ var _ = Describe("Test Application Controller", func() {
|
||||
}))
|
||||
})
|
||||
|
||||
It("app record execution state with controllerRevision", func() {
|
||||
ns := &corev1.Namespace{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "vela-test-app-trace",
|
||||
},
|
||||
}
|
||||
|
||||
app := appwithNoTrait.DeepCopy()
|
||||
app.Name = "vela-test-app-trace"
|
||||
app.SetNamespace(ns.Name)
|
||||
Expect(k8sClient.Create(ctx, ns)).Should(BeNil())
|
||||
Expect(k8sClient.Create(ctx, app)).Should(BeNil())
|
||||
|
||||
appKey := client.ObjectKey{
|
||||
Name: app.Name,
|
||||
Namespace: app.Namespace,
|
||||
}
|
||||
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, reconcile.Request{NamespacedName: appKey})
|
||||
checkApp := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
Expect(checkApp.Status.Phase).Should(BeEquivalentTo(common.ApplicationRunning))
|
||||
web := &v1.Deployment{}
|
||||
Expect(k8sClient.Get(ctx, client.ObjectKey{
|
||||
Name: "myweb2",
|
||||
Namespace: app.Namespace,
|
||||
}, web)).Should(BeNil())
|
||||
web.Spec.Replicas = pointer.Int32(0)
|
||||
Expect(k8sClient.Update(ctx, web)).Should(BeNil())
|
||||
|
||||
checkApp.Status.Workflow = nil
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, reconcile.Request{NamespacedName: appKey})
|
||||
checkApp = &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
Expect(checkApp.Status.Phase).Should(BeEquivalentTo(common.ApplicationRunning))
|
||||
|
||||
checkWeb := &v1.Deployment{}
|
||||
Expect(k8sClient.Get(ctx, client.ObjectKey{
|
||||
Name: "myweb2",
|
||||
Namespace: app.Namespace,
|
||||
}, checkWeb)).Should(BeNil())
|
||||
Expect(*(checkWeb.Spec.Replicas)).Should(BeEquivalentTo(int32(0)))
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
const (
|
||||
|
||||
@@ -37,7 +37,6 @@ import (
|
||||
"github.com/oam-dev/kubevela/pkg/controller/core.oam.dev/v1alpha2/applicationrollout"
|
||||
"github.com/oam-dev/kubevela/pkg/controller/utils"
|
||||
"github.com/oam-dev/kubevela/pkg/cue/process"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
oamutil "github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
)
|
||||
|
||||
@@ -304,26 +303,6 @@ func (h *AppHandler) aggregateHealthStatus(appFile *appfile.Appfile) ([]common.A
|
||||
return appStatus, healthy, nil
|
||||
}
|
||||
|
||||
func (h *AppHandler) handleCheckManageWorkloadTrait(traitDefs map[string]v1beta1.TraitDefinition, comps []*types.ComponentManifest) {
|
||||
manageWorkloadTrait := map[string]bool{}
|
||||
for traitName, definition := range traitDefs {
|
||||
if definition.Spec.ManageWorkload {
|
||||
manageWorkloadTrait[traitName] = true
|
||||
}
|
||||
}
|
||||
if len(manageWorkloadTrait) == 0 {
|
||||
return
|
||||
}
|
||||
for _, comp := range comps {
|
||||
for _, trait := range comp.Traits {
|
||||
traitType := trait.GetLabels()[oam.TraitTypeLabel]
|
||||
if manageWorkloadTrait[traitType] {
|
||||
trait.SetLabels(oamutil.MergeMapOverrideWithDst(trait.GetLabels(), map[string]string{oam.LabelManageWorkloadTrait: "true"}))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func generateScopeReference(scopes []appfile.Scope) []corev1.ObjectReference {
|
||||
var references []corev1.ObjectReference
|
||||
for _, scope := range scopes {
|
||||
|
||||
@@ -30,7 +30,6 @@ import (
|
||||
. "github.com/onsi/gomega"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
@@ -41,7 +40,6 @@ import (
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
velatypes "github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/appfile"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
const workloadDefinition = `
|
||||
@@ -217,37 +215,3 @@ var _ = Describe("Test statusAggregate", func() {
|
||||
Expect(err).Should(BeNil())
|
||||
})
|
||||
})
|
||||
|
||||
var _ = Describe("Test handleCheckManageWorkloadTrait func", func() {
|
||||
It("Test every situation", func() {
|
||||
traitDefs := map[string]v1beta1.TraitDefinition{
|
||||
"rollout": v1beta1.TraitDefinition{
|
||||
Spec: v1beta1.TraitDefinitionSpec{
|
||||
ManageWorkload: true,
|
||||
},
|
||||
},
|
||||
"normal": v1beta1.TraitDefinition{
|
||||
Spec: v1beta1.TraitDefinitionSpec{},
|
||||
},
|
||||
}
|
||||
rolloutTrait := &unstructured.Unstructured{}
|
||||
rolloutTrait.SetLabels(map[string]string{oam.TraitTypeLabel: "rollout"})
|
||||
|
||||
normalTrait := &unstructured.Unstructured{}
|
||||
normalTrait.SetLabels(map[string]string{oam.TraitTypeLabel: "normal"})
|
||||
comps := []*velatypes.ComponentManifest{
|
||||
{
|
||||
Traits: []*unstructured.Unstructured{
|
||||
rolloutTrait,
|
||||
normalTrait,
|
||||
},
|
||||
},
|
||||
}
|
||||
h := AppHandler{}
|
||||
h.handleCheckManageWorkloadTrait(traitDefs, comps)
|
||||
Expect(len(rolloutTrait.GetLabels())).Should(BeEquivalentTo(2))
|
||||
Expect(rolloutTrait.GetLabels()[oam.LabelManageWorkloadTrait]).Should(BeEquivalentTo("true"))
|
||||
Expect(len(normalTrait.GetLabels())).Should(BeEquivalentTo(1))
|
||||
Expect(normalTrait.GetLabels()[oam.LabelManageWorkloadTrait]).Should(BeEquivalentTo(""))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -232,6 +232,9 @@ func PrepareBeforeApply(comp *types.ComponentManifest, appRev *v1beta1.Applicati
|
||||
}
|
||||
|
||||
assembledTraits := make([]*unstructured.Unstructured, len(comp.Traits))
|
||||
|
||||
HandleCheckManageWorkloadTrait(*appRev, []*types.ComponentManifest{comp})
|
||||
|
||||
for i, trait := range comp.Traits {
|
||||
setTraitLabels(trait, additionalLabel)
|
||||
assembledTraits[i] = trait
|
||||
@@ -329,3 +332,25 @@ func setTraitLabels(trait *unstructured.Unstructured, additionalLabels map[strin
|
||||
// add more trait-specific labels here
|
||||
util.AddLabels(trait, additionalLabels)
|
||||
}
|
||||
|
||||
// HandleCheckManageWorkloadTrait will checkout every trait whether a manage-workload trait, if yes set label and annotation in trait
|
||||
func HandleCheckManageWorkloadTrait(appRev v1beta1.ApplicationRevision, comps []*types.ComponentManifest) {
|
||||
traitDefs := appRev.Spec.TraitDefinitions
|
||||
manageWorkloadTrait := map[string]bool{}
|
||||
for traitName, definition := range traitDefs {
|
||||
if definition.Spec.ManageWorkload {
|
||||
manageWorkloadTrait[traitName] = true
|
||||
}
|
||||
}
|
||||
if len(manageWorkloadTrait) == 0 {
|
||||
return
|
||||
}
|
||||
for _, comp := range comps {
|
||||
for _, trait := range comp.Traits {
|
||||
traitType := trait.GetLabels()[oam.TraitTypeLabel]
|
||||
if manageWorkloadTrait[traitType] {
|
||||
trait.SetLabels(util.MergeMapOverrideWithDst(trait.GetLabels(), map[string]string{oam.LabelManageWorkloadTrait: "true"}))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
velatypes "github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
@@ -203,3 +204,49 @@ var _ = Describe("Test Assemble Options", func() {
|
||||
Expect(wl.GetName()).Should(Equal(workloadName))
|
||||
})
|
||||
})
|
||||
|
||||
var _ = Describe("Test handleCheckManageWorkloadTrait func", func() {
|
||||
It("Test every situation", func() {
|
||||
traitDefs := map[string]v1beta1.TraitDefinition{
|
||||
"rollout": v1beta1.TraitDefinition{
|
||||
Spec: v1beta1.TraitDefinitionSpec{
|
||||
ManageWorkload: true,
|
||||
},
|
||||
},
|
||||
"normal": v1beta1.TraitDefinition{
|
||||
Spec: v1beta1.TraitDefinitionSpec{},
|
||||
},
|
||||
}
|
||||
appRev := v1beta1.ApplicationRevision{
|
||||
Spec: v1beta1.ApplicationRevisionSpec{
|
||||
TraitDefinitions: traitDefs,
|
||||
},
|
||||
}
|
||||
rolloutTrait := &unstructured.Unstructured{}
|
||||
rolloutTrait.SetLabels(map[string]string{oam.TraitTypeLabel: "rollout"})
|
||||
|
||||
normalTrait := &unstructured.Unstructured{}
|
||||
normalTrait.SetLabels(map[string]string{oam.TraitTypeLabel: "normal"})
|
||||
|
||||
workload := unstructured.Unstructured{}
|
||||
workload.SetLabels(map[string]string{
|
||||
oam.WorkloadTypeLabel: "webservice",
|
||||
})
|
||||
|
||||
comps := []*velatypes.ComponentManifest{
|
||||
{
|
||||
Traits: []*unstructured.Unstructured{
|
||||
rolloutTrait,
|
||||
normalTrait,
|
||||
},
|
||||
StandardWorkload: &workload,
|
||||
},
|
||||
}
|
||||
|
||||
HandleCheckManageWorkloadTrait(appRev, comps)
|
||||
Expect(len(rolloutTrait.GetLabels())).Should(BeEquivalentTo(2))
|
||||
Expect(rolloutTrait.GetLabels()[oam.LabelManageWorkloadTrait]).Should(BeEquivalentTo("true"))
|
||||
Expect(len(normalTrait.GetLabels())).Should(BeEquivalentTo(1))
|
||||
Expect(normalTrait.GetLabels()[oam.LabelManageWorkloadTrait]).Should(BeEquivalentTo(""))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -241,7 +241,7 @@ func (a *AppManifestsDispatcher) applyAndRecordManifests(ctx context.Context, ma
|
||||
ctrlUIDs = append(ctrlUIDs, rt.UID)
|
||||
}
|
||||
|
||||
applyOpts := []apply.ApplyOption{apply.MustBeControllableByAny(ctrlUIDs)}
|
||||
applyOpts := []apply.ApplyOption{apply.MustBeControllableByAny(ctrlUIDs), apply.NotUpdateRenderHashEqual()}
|
||||
ownerRef := metav1.OwnerReference{
|
||||
APIVersion: v1beta1.SchemeGroupVersion.String(),
|
||||
Kind: reflect.TypeOf(v1beta1.ResourceTracker{}).Name(),
|
||||
|
||||
@@ -693,7 +693,7 @@ func (e *GenerationUnchanged) Error() string {
|
||||
// applyOnceOnly is an ApplyOption that controls the applying mechanism for workload and trait.
|
||||
// More detail refers to the ApplyOnceOnlyMode type annotation
|
||||
func applyOnceOnly(ac *v1alpha2.ApplicationConfiguration, mode core.ApplyOnceOnlyMode) apply.ApplyOption {
|
||||
return func(_ context.Context, existing, desired runtime.Object) error {
|
||||
return apply.MakeCustomApplyOption(func(existing, desired client.Object) error {
|
||||
if mode == core.ApplyOnceOnlyOff {
|
||||
return nil
|
||||
}
|
||||
@@ -791,5 +791,5 @@ func applyOnceOnly(ac *v1alpha2.ApplicationConfiguration, mode core.ApplyOnceOnl
|
||||
}
|
||||
// its spec is not changed, return an error to abort applying it
|
||||
return &GenerationUnchanged{}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -89,13 +89,10 @@ func HandleReplicas(ctx context.Context, rolloutComp string, c client.Client) as
|
||||
pv := fieldpath.Pave(u.UnstructuredContent())
|
||||
|
||||
// we hard code here, but we can easily support more types of workload by add more cases logic in switch
|
||||
var replicasFieldPath string
|
||||
switch u.GetKind() {
|
||||
case reflect.TypeOf(v1alpha1.CloneSet{}).Name(), reflect.TypeOf(appsv1.Deployment{}).Name(), reflect.TypeOf(appsv1.StatefulSet{}).Name():
|
||||
replicasFieldPath = "spec.replicas"
|
||||
default:
|
||||
replicasFieldPath, err := GetWorkloadReplicasPath(*u)
|
||||
if err != nil {
|
||||
klog.Errorf("rollout meet a workload we cannot support yet", "Kind", u.GetKind(), "name", u.GetName())
|
||||
return fmt.Errorf("rollout meet a workload we cannot support yet Kind %s name %s", u.GetKind(), u.GetName())
|
||||
return err
|
||||
}
|
||||
|
||||
workload := u.DeepCopy()
|
||||
@@ -127,6 +124,16 @@ func HandleReplicas(ctx context.Context, rolloutComp string, c client.Client) as
|
||||
})
|
||||
}
|
||||
|
||||
// GetWorkloadReplicasPath get replicas path of workload
|
||||
func GetWorkloadReplicasPath(u unstructured.Unstructured) (string, error) {
|
||||
switch u.GetKind() {
|
||||
case reflect.TypeOf(v1alpha1.CloneSet{}).Name(), reflect.TypeOf(appsv1.Deployment{}).Name(), reflect.TypeOf(appsv1.StatefulSet{}).Name():
|
||||
return "spec.replicas", nil
|
||||
default:
|
||||
return "", fmt.Errorf("rollout meet a workload we cannot support yet Kind %s name %s", u.GetKind(), u.GetName())
|
||||
}
|
||||
}
|
||||
|
||||
// appRollout should take over updating workload, so disable previous controller owner(resourceTracker)
|
||||
func disableControllerOwner(workload *unstructured.Unstructured) {
|
||||
if workload == nil {
|
||||
|
||||
@@ -20,12 +20,13 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
oamstandard "github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
|
||||
"gotest.tools/assert"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/utils/pointer"
|
||||
@@ -192,3 +193,37 @@ func TestHandleTerminated(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetWorkloadReplicasPath(t *testing.T) {
|
||||
deploy := appsv1.Deployment{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: "appsv1",
|
||||
Kind: "Deployment",
|
||||
},
|
||||
}
|
||||
u, err := util.Object2Unstructured(deploy)
|
||||
if err != nil {
|
||||
t.Errorf("deployment shounld't meet an error %w", err)
|
||||
}
|
||||
pathStr, err := GetWorkloadReplicasPath(*u)
|
||||
if err != nil {
|
||||
t.Errorf("deployment should handle deployment")
|
||||
}
|
||||
if pathStr != "spec.replicas" {
|
||||
t.Errorf("deployPath error got %s", pathStr)
|
||||
}
|
||||
ds := appsv1.DaemonSet{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: "appsv1",
|
||||
Kind: "DaemonSet",
|
||||
},
|
||||
}
|
||||
u, err = util.Object2Unstructured(ds)
|
||||
if err != nil {
|
||||
t.Errorf("ds shounld't meet an error %w", err)
|
||||
}
|
||||
_, err = GetWorkloadReplicasPath(*u)
|
||||
if err == nil {
|
||||
t.Errorf("daemonset shouldn't support")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
apps "k8s.io/api/apps/v1"
|
||||
core "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@@ -370,7 +371,7 @@ func getAppConfigNameFromLabel(o metav1.Object) string {
|
||||
func getVersioningPeerWorkloadRefs(ctx context.Context, c client.Reader, wlRef core.ObjectReference, ns string) ([]core.ObjectReference, error) {
|
||||
o := &unstructured.Unstructured{}
|
||||
o.SetGroupVersionKind(wlRef.GroupVersionKind())
|
||||
if err := c.Get(ctx, client.ObjectKey{Namespace: ns, Name: wlRef.Name}, o); err != nil {
|
||||
if err := c.Get(ctx, client.ObjectKey{Namespace: ns, Name: wlRef.Name}, o); err != nil && !apierrors.IsNotFound(err) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package healthscope
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -615,12 +616,34 @@ func (r *Reconciler) createWorkloadRefs(ctx context.Context, appRef v1alpha2.App
|
||||
}, o); err != nil {
|
||||
continue
|
||||
}
|
||||
if labels := o.GetLabels(); labels != nil && labels[oam.WorkloadTypeLabel] != "" {
|
||||
wlRefs = append(wlRefs, WorkloadReference{
|
||||
ObjectReference: rs.ObjectReference,
|
||||
clusterName: rs.Cluster,
|
||||
envName: decisionsMap[rs.Cluster],
|
||||
})
|
||||
|
||||
if labels := o.GetLabels(); labels != nil {
|
||||
if labels[oam.WorkloadTypeLabel] != "" {
|
||||
wlRefs = append(wlRefs, WorkloadReference{
|
||||
ObjectReference: rs.ObjectReference,
|
||||
clusterName: rs.Cluster,
|
||||
envName: decisionsMap[rs.Cluster],
|
||||
})
|
||||
} else if labels[oam.TraitTypeLabel] != "" && labels[oam.LabelManageWorkloadTrait] == "true" {
|
||||
// this means this trait is a manage-Workload trait, get workload GVK and name for trait's annotation
|
||||
objectRef := corev1.ObjectReference{}
|
||||
err := json.Unmarshal([]byte(o.GetAnnotations()[oam.AnnotationWorkloadGVK]), &objectRef)
|
||||
if err != nil {
|
||||
// don't break whole check process due to this error
|
||||
continue
|
||||
}
|
||||
if o.GetAnnotations() != nil && len(o.GetAnnotations()[oam.AnnotationWorkloadName]) != 0 {
|
||||
objectRef.Name = o.GetAnnotations()[oam.AnnotationWorkloadName]
|
||||
} else {
|
||||
// use component name as default
|
||||
objectRef.Name = labels[oam.LabelAppComponent]
|
||||
}
|
||||
wlRefs = append(wlRefs, WorkloadReference{
|
||||
ObjectReference: objectRef,
|
||||
clusterName: rs.Cluster,
|
||||
envName: decisionsMap[rs.Cluster],
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +122,28 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
|
||||
r.record.Event(&wfstepdefinition, event.Warning("failed to garbage collect DefinitionRevision of type WorkflowStepDefinition", err))
|
||||
}
|
||||
|
||||
def := utils.NewCapabilityStepDef(&wfstepdefinition)
|
||||
def.Name = req.NamespacedName.Name
|
||||
// Store the parameter of stepDefinition to configMap
|
||||
cmName, err := def.StoreOpenAPISchema(ctx, r.Client, r.pd, req.Namespace, req.Name, defRev.Name)
|
||||
if err != nil {
|
||||
klog.InfoS("Could not store capability in ConfigMap", "err", err)
|
||||
r.record.Event(&(wfstepdefinition), event.Warning("Could not store capability in ConfigMap", err))
|
||||
return ctrl.Result{}, util.PatchCondition(ctx, r, &wfstepdefinition,
|
||||
condition.ReconcileError(fmt.Errorf(util.ErrStoreCapabilityInConfigMap, wfstepdefinition.Name, err)))
|
||||
}
|
||||
|
||||
if wfstepdefinition.Status.ConfigMapRef != cmName {
|
||||
wfstepdefinition.Status.ConfigMapRef = cmName
|
||||
if err := r.UpdateStatus(ctx, &wfstepdefinition); err != nil {
|
||||
klog.ErrorS(err, "Could not update WorkflowStepDefinition Status", "workflowStepDefinition", klog.KRef(req.Namespace, req.Name))
|
||||
r.record.Event(&wfstepdefinition, event.Warning("Could not update WorkflowStepDefinition Status", err))
|
||||
return ctrl.Result{}, util.PatchCondition(ctx, r, &wfstepdefinition,
|
||||
condition.ReconcileError(fmt.Errorf(util.ErrUpdateWorkflowStepDefinition, wfstepdefinition.Name, err)))
|
||||
}
|
||||
klog.InfoS("Successfully updated the status.configMapRef of the WorkflowStepDefinition", "workflowStepDefinition",
|
||||
klog.KRef(req.Namespace, req.Name), "status.configMapRef", cmName)
|
||||
}
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
"k8s.io/utils/pointer"
|
||||
|
||||
"github.com/crossplane/crossplane-runtime/pkg/event"
|
||||
"github.com/crossplane/crossplane-runtime/pkg/fieldpath"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
@@ -240,6 +241,19 @@ func (h *handler) checkWorkloadNotExist(ctx context.Context) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func getWorkloadReplicasNum(u unstructured.Unstructured) (int32, error) {
|
||||
replicaPath, err := applicationrollout.GetWorkloadReplicasPath(u)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("get workload replicas path err %w", err)
|
||||
}
|
||||
wlpv := fieldpath.Pave(u.UnstructuredContent())
|
||||
replicas, err := wlpv.GetInteger(replicaPath)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("get workload replicas err %w", err)
|
||||
}
|
||||
return int32(replicas), nil
|
||||
}
|
||||
|
||||
// checkRollingTerminated check the rollout if have finished
|
||||
func checkRollingTerminated(rollout v1alpha1.Rollout) bool {
|
||||
// handle rollout completed
|
||||
|
||||
@@ -40,6 +40,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/utils/pointer"
|
||||
)
|
||||
|
||||
var _ = Describe("Test rollout related handler func", func() {
|
||||
@@ -513,6 +514,50 @@ var _ = Describe("Test rollout related handler func", func() {
|
||||
Expect(checkRt.Status.TrackedResources[0].Name).Should(BeEquivalentTo(u.GetName()))
|
||||
Expect(checkRt.Status.TrackedResources[0].UID).Should(BeEquivalentTo(u.GetUID()))
|
||||
})
|
||||
|
||||
It("TestGetWorkloadReplicasNum", func() {
|
||||
deployName := "test-workload-get"
|
||||
deploy := appsv1.Deployment{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "Deployment",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: namespace,
|
||||
Name: deployName,
|
||||
},
|
||||
Spec: appsv1.DeploymentSpec{
|
||||
Replicas: pointer.Int32Ptr(3),
|
||||
Selector: &metav1.LabelSelector{
|
||||
MatchLabels: map[string]string{
|
||||
"app": "test",
|
||||
},
|
||||
},
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"app": "test",
|
||||
},
|
||||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Name: "test-container",
|
||||
Image: "test-image",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Expect(k8sClient.Create(ctx, &deploy)).Should(BeNil())
|
||||
u := unstructured.Unstructured{}
|
||||
u.SetAPIVersion("apps/v1")
|
||||
u.SetKind("Deployment")
|
||||
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: deployName, Namespace: namespace}, &u)).Should(BeNil())
|
||||
rep, err := getWorkloadReplicasNum(u)
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(rep).Should(BeEquivalentTo(3))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ package rollout
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"math"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
@@ -34,6 +38,8 @@ import (
|
||||
common2 "github.com/oam-dev/kubevela/pkg/controller/common"
|
||||
rolloutplan "github.com/oam-dev/kubevela/pkg/controller/common/rollout"
|
||||
oamctrl "github.com/oam-dev/kubevela/pkg/controller/core.oam.dev"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
oamutil "github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/apply"
|
||||
)
|
||||
@@ -110,6 +116,33 @@ func (r *reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
if rollout.Status.RollingState == v1alpha1.LocatingTargetAppState {
|
||||
if rollout.GetAnnotations() == nil || rollout.GetAnnotations()[oam.AnnotationWorkloadName] != h.targetWorkload.GetName() {
|
||||
// this is a update operation, the target workload will change so modify annotation
|
||||
gvk := map[string]string{"apiVersion": h.targetWorkload.GetAPIVersion(), "kind": h.targetWorkload.GetKind()}
|
||||
gvkValue, _ := json.Marshal(gvk)
|
||||
rollout.SetAnnotations(oamutil.MergeMapOverrideWithDst(rollout.GetAnnotations(),
|
||||
map[string]string{oam.AnnotationWorkloadName: h.targetWorkload.GetName(), oam.AnnotationWorkloadGVK: string(gvkValue)}))
|
||||
klog.InfoS("rollout controller set targetWorkload ", h.targetWorkload.GetName(),
|
||||
"in annotation in rollout namespace: ", rollout.Namespace, " name", rollout.Name, "gvk", gvkValue)
|
||||
// exit current reconcile before create target workload, this reconcile don't update status just modify annotation
|
||||
// next round reconcile will create workload and pass `LocatingTargetAppState` phase
|
||||
return ctrl.Result{}, h.Update(ctx, rollout)
|
||||
}
|
||||
|
||||
// this is a scale operation, if user don't fill rolloutBatches, fill it with default value
|
||||
if len(h.sourceRevName) == 0 && len(rollout.Spec.RolloutPlan.RolloutBatches) == 0 {
|
||||
// logic reach here means cannot get an error, so ignore it
|
||||
replicas, _ := getWorkloadReplicasNum(*h.targetWorkload)
|
||||
rollout.Spec.RolloutPlan.RolloutBatches = []v1alpha1.RolloutBatch{{
|
||||
Replicas: intstr.FromInt(int(math.Abs(float64(*rollout.Spec.RolloutPlan.TargetSize - replicas))))},
|
||||
}
|
||||
klog.InfoS("rollout controller set default rollout batches ", h.rollout.GetName(),
|
||||
" namespace: ", rollout.Namespace, "targetSize", rollout.Spec.RolloutPlan.TargetSize)
|
||||
return ctrl.Result{}, h.Update(ctx, rollout)
|
||||
}
|
||||
}
|
||||
|
||||
switch rollout.Status.RollingState {
|
||||
case v1alpha1.RolloutDeletingState:
|
||||
removed, err := h.checkWorkloadNotExist(ctx)
|
||||
|
||||
@@ -351,6 +351,75 @@ func (def *CapabilityTraitDefinition) StoreOpenAPISchema(ctx context.Context, k8
|
||||
return cmName, nil
|
||||
}
|
||||
|
||||
// CapabilityStepDefinition is the Capability struct for WorkflowStepDefinition
|
||||
type CapabilityStepDefinition struct {
|
||||
Name string `json:"name"`
|
||||
StepDefinition v1beta1.WorkflowStepDefinition `json:"stepDefinition"`
|
||||
|
||||
CapabilityBaseDefinition
|
||||
}
|
||||
|
||||
// NewCapabilityStepDef will create a CapabilityStepDefinition
|
||||
func NewCapabilityStepDef(stepdefinition *v1beta1.WorkflowStepDefinition) CapabilityStepDefinition {
|
||||
var def CapabilityStepDefinition
|
||||
def.Name = stepdefinition.Name
|
||||
def.StepDefinition = *stepdefinition.DeepCopy()
|
||||
return def
|
||||
}
|
||||
|
||||
// GetOpenAPISchema gets OpenAPI v3 schema by StepDefinition name
|
||||
func (def *CapabilityStepDefinition) GetOpenAPISchema(pd *packages.PackageDiscover, name string) ([]byte, error) {
|
||||
capability, err := appfile.ConvertTemplateJSON2Object(name, nil, def.StepDefinition.Spec.Schematic)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to convert WorkflowStepDefinition to Capability Object")
|
||||
}
|
||||
return getOpenAPISchema(capability, pd)
|
||||
}
|
||||
|
||||
// StoreOpenAPISchema stores OpenAPI v3 schema from StepDefinition in ConfigMap
|
||||
func (def *CapabilityStepDefinition) StoreOpenAPISchema(ctx context.Context, k8sClient client.Client, pd *packages.PackageDiscover, namespace, name string, revName string) (string, error) {
|
||||
var jsonSchema []byte
|
||||
var err error
|
||||
|
||||
jsonSchema, err = def.GetOpenAPISchema(pd, name)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to generate OpenAPI v3 JSON schema for capability %s: %w", def.Name, err)
|
||||
}
|
||||
|
||||
stepDefinition := def.StepDefinition
|
||||
ownerReference := []metav1.OwnerReference{{
|
||||
APIVersion: stepDefinition.APIVersion,
|
||||
Kind: stepDefinition.Kind,
|
||||
Name: stepDefinition.Name,
|
||||
UID: stepDefinition.GetUID(),
|
||||
Controller: pointer.BoolPtr(true),
|
||||
BlockOwnerDeletion: pointer.BoolPtr(true),
|
||||
}}
|
||||
cmName, err := def.CreateOrUpdateConfigMap(ctx, k8sClient, namespace, stepDefinition.Name, jsonSchema, ownerReference)
|
||||
if err != nil {
|
||||
return cmName, err
|
||||
}
|
||||
|
||||
// Create a configmap to store parameter for each definitionRevision
|
||||
defRev := new(v1beta1.DefinitionRevision)
|
||||
if err = k8sClient.Get(ctx, client.ObjectKey{Namespace: namespace, Name: revName}, defRev); err != nil {
|
||||
return "", err
|
||||
}
|
||||
ownerReference = []metav1.OwnerReference{{
|
||||
APIVersion: defRev.APIVersion,
|
||||
Kind: defRev.Kind,
|
||||
Name: defRev.Name,
|
||||
UID: defRev.GetUID(),
|
||||
Controller: pointer.BoolPtr(true),
|
||||
BlockOwnerDeletion: pointer.BoolPtr(true),
|
||||
}}
|
||||
_, err = def.CreateOrUpdateConfigMap(ctx, k8sClient, namespace, revName, jsonSchema, ownerReference)
|
||||
if err != nil {
|
||||
return cmName, err
|
||||
}
|
||||
return cmName, nil
|
||||
}
|
||||
|
||||
// CapabilityBaseDefinition is the base struct for CapabilityWorkloadDefinition and CapabilityTraitDefinition
|
||||
type CapabilityBaseDefinition struct {
|
||||
}
|
||||
@@ -399,7 +468,7 @@ func (def *CapabilityBaseDefinition) CreateOrUpdateConfigMap(ctx context.Context
|
||||
return cmName, nil
|
||||
}
|
||||
|
||||
// getDefinition is the main function for GetDefinition API
|
||||
// getOpenAPISchema is the main function for GetDefinition API
|
||||
func getOpenAPISchema(capability types.Capability, pd *packages.PackageDiscover) ([]byte, error) {
|
||||
openAPISchema, err := generateOpenAPISchemaFromCapabilityParameter(capability, pd)
|
||||
if err != nil {
|
||||
|
||||
@@ -231,10 +231,11 @@ func (wd *workloadDef) Status(ctx process.Context, cli client.Client, ns string,
|
||||
if err != nil {
|
||||
return "", errors.WithMessage(err, "get template context")
|
||||
}
|
||||
return getStatusMessage(templateContext, customStatusTemplate, parameter)
|
||||
return getStatusMessage(wd.pd, templateContext, customStatusTemplate, parameter)
|
||||
}
|
||||
|
||||
func getStatusMessage(templateContext map[string]interface{}, customStatusTemplate string, parameter interface{}) (string, error) {
|
||||
func getStatusMessage(pd *packages.PackageDiscover, templateContext map[string]interface{}, customStatusTemplate string, parameter interface{}) (string, error) {
|
||||
bi := build.NewContext().NewInstance("", nil)
|
||||
var ctxBuff string
|
||||
var paramBuff = "parameter: {}\n"
|
||||
|
||||
@@ -251,10 +252,12 @@ func getStatusMessage(templateContext map[string]interface{}, customStatusTempla
|
||||
if string(bt) != "null" {
|
||||
paramBuff = "parameter: " + string(bt) + "\n"
|
||||
}
|
||||
var buff = ctxBuff + paramBuff + customStatusTemplate
|
||||
var buff = customStatusTemplate + "\n" + ctxBuff + paramBuff
|
||||
if err := bi.AddFile("-", buff); err != nil {
|
||||
return "", errors.WithMessagef(err, "invalid cue template of customStatus")
|
||||
}
|
||||
|
||||
var r cue.Runtime
|
||||
inst, err := r.Compile("-", buff)
|
||||
inst, err := pd.ImportPackagesAndBuildInstance(bi)
|
||||
if err != nil {
|
||||
return "", errors.WithMessage(err, "compile customStatus template")
|
||||
}
|
||||
@@ -426,7 +429,7 @@ func (td *traitDef) Status(ctx process.Context, cli client.Client, ns string, cu
|
||||
if err != nil {
|
||||
return "", errors.WithMessage(err, "get template context")
|
||||
}
|
||||
return getStatusMessage(templateContext, customStatusTemplate, parameter)
|
||||
return getStatusMessage(td.pd, templateContext, customStatusTemplate, parameter)
|
||||
}
|
||||
|
||||
// HealthCheck address health check for trait
|
||||
|
||||
@@ -1245,9 +1245,36 @@ if len(context.outputs.ingress.status.loadBalancer.ingress) == 0 {
|
||||
statusTemp: `message: parameter.configInfo.name + ".type: " + context.outputs["\(parameter.configInfo.name)"].spec.type`,
|
||||
expMessage: "test-name.type: NodePort",
|
||||
},
|
||||
"import package in template": {
|
||||
tpContext: map[string]interface{}{
|
||||
"outputs": map[string]interface{}{
|
||||
"service": map[string]interface{}{
|
||||
"spec": map[string]interface{}{
|
||||
"type": "NodePort",
|
||||
"clusterIP": "10.0.0.1",
|
||||
"ports": []interface{}{
|
||||
map[string]interface{}{
|
||||
"port": 80,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"ingress": map[string]interface{}{
|
||||
"rules": []interface{}{
|
||||
map[string]interface{}{
|
||||
"host": "example.com",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
statusTemp: `import "strconv"
|
||||
message: "ports: " + strconv.FormatInt(context.outputs.service.spec.ports[0].port,10)`,
|
||||
expMessage: "ports: 80",
|
||||
},
|
||||
}
|
||||
for message, ca := range cases {
|
||||
gotMessage, err := getStatusMessage(ca.tpContext, ca.statusTemp, ca.parameter)
|
||||
gotMessage, err := getStatusMessage(&packages.PackageDiscover{}, ca.tpContext, ca.statusTemp, ca.parameter)
|
||||
assert.NoError(t, err, message)
|
||||
assert.Equal(t, ca.expMessage, gotMessage, message)
|
||||
}
|
||||
|
||||
@@ -311,8 +311,11 @@ func openBaiscLit(root ast.Node) {
|
||||
field, ok := node.(*ast.Field)
|
||||
if ok {
|
||||
v := field.Value
|
||||
if lit, ok := v.(*ast.BasicLit); ok {
|
||||
switch lit := v.(type) {
|
||||
case *ast.BasicLit:
|
||||
field.Value = ast.NewBinExpr(token.OR, &ast.UnaryExpr{X: lit, Op: token.MUL}, ast.NewIdent("_"))
|
||||
case *ast.ListLit:
|
||||
field.Value = ast.NewBinExpr(token.OR, &ast.UnaryExpr{X: lit, Op: token.MUL}, ast.NewList(&ast.Ellipsis{}))
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -248,6 +248,7 @@ b: "foo"
|
||||
b1: string
|
||||
c: true
|
||||
c1: bool
|
||||
arr: [1,2]
|
||||
top: _
|
||||
bottom: _|_
|
||||
`)
|
||||
@@ -258,6 +259,7 @@ b: *"foo" | _
|
||||
b1: string
|
||||
c: *true | _
|
||||
c1: bool
|
||||
arr: *[1, 2] | [...]
|
||||
top: _
|
||||
bottom: _|_
|
||||
`)
|
||||
|
||||
@@ -35,6 +35,8 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/client-go/rest"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/stdlib"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -107,6 +109,9 @@ func (pd *PackageDiscover) ImportBuiltinPackagesFor(bi *build.Instance) {
|
||||
// ImportPackagesAndBuildInstance Combine import built-in packages and build cue template together to avoid data race
|
||||
func (pd *PackageDiscover) ImportPackagesAndBuildInstance(bi *build.Instance) (inst *cue.Instance, err error) {
|
||||
pd.ImportBuiltinPackagesFor(bi)
|
||||
if err := stdlib.AddImportsFor(bi, ""); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r cue.Runtime
|
||||
pd.mutex.Lock()
|
||||
defer pd.mutex.Unlock()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user