Compare commits

...

38 Commits

Author SHA1 Message Date
github-actions[bot]
066c448c1a Fix: show reconcile error log (#2628)
(cherry picked from commit 77db060f8e)

Co-authored-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
2021-11-04 19:02:41 +08:00
github-actions[bot]
8de80ebdb2 [Backport release-1.1] Fix: add owner reference in workflow context cm (#2621)
* Fix: add owner reference in workflow context cm

(cherry picked from commit f5d5fe4463)

* fix ci

(cherry picked from commit b4debba07b)

* delete useless test case

(cherry picked from commit 6fffd6c3d9)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-11-04 14:20:24 +08:00
github-actions[bot]
855cbfe3ec [Backport release-1.1] Feat: store workflow step def properties in cm (#2614)
* Fix: fix notification def

(cherry picked from commit f35a213048)

* Feat: store workflow step def properties in cm

(cherry picked from commit 7f3902536c)

* fix ci

(cherry picked from commit a252749f77)

* fix data race

(cherry picked from commit 0b55ce8386)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-11-03 19:10:18 +08:00
github-actions[bot]
162534b611 Fix: change Initializer to Application for addon Observability (#2617)
In this doc, updated the Observability implementation from initializer
to Application. I also store definitions as it's not well stored in
vela-templates/addons/observability

(cherry picked from commit 52e17dc466)

Co-authored-by: zzxwill <zzxwill@gmail.com>
2021-11-03 17:33:44 +08:00
github-actions[bot]
6bd5d8e6e2 Fix: abnormal aux name (#2613)
(cherry picked from commit 7b2503e85b)

Co-authored-by: Jian.Li <lj176172@alibaba-inc.com>
2021-11-03 15:27:37 +08:00
github-actions[bot]
22079aacd3 allow import package in custom status cue template (#2610)
(cherry picked from commit aa80658be8)

Co-authored-by: chwetion <chwetion@foxmail.com>
2021-11-03 12:22:41 +08:00
github-actions[bot]
b2329d548d [Backport release-1.1] Feat: vela logs support multicluster (#2603)
* Feat: add basic multiple cluster logs

(cherry picked from commit ed232ce4d8)

* fix context

(cherry picked from commit 27cdad1e4b)

* Fix select style

(cherry picked from commit 11ea2693a7)

* Fix select style

(cherry picked from commit 070dcf4e09)

* remove useless env

(cherry picked from commit dec63906ce)

* fix naming

(cherry picked from commit 395a655341)

Co-authored-by: qiaozp <chivalry.pp@gmail.com>
2021-11-02 15:51:58 +08:00
github-actions[bot]
9152c15a88 [Backport release-1.1] Fix(cli): client-side throttling in vela CLI (#2586)
* fix cli throttling

(cherry picked from commit ef7c640430)

* fix import

(cherry picked from commit 93a4b8fd0e)

* set to a lower value

(cherry picked from commit e14623c9ca)

Co-authored-by: qiaozp <chivalry.pp@gmail.com>
2021-10-29 15:08:30 +08:00
wyike
73b3d3106b Feat(rollout): fill rolloutBatches if empty when scale up/down (#2569) (#2582)
* Feat: fill rolloutBatches if empty

* Fix: fix unit-test

* Test: add more test

Fix: lint

Fix: fix lint
2021-10-29 15:07:45 +08:00
wyike
237c71d94e Backport 2527 to release 1.1 (#2555)
* Fix: resolve confict

* Fix: cherry pick 2472  to  1.1
2021-10-28 20:49:27 +08:00
github-actions[bot]
2200d199f3 fix incorrect addon status (#2579)
(cherry picked from commit 8b13335133)

Co-authored-by: qiaozp <chivalry.pp@gmail.com>
2021-10-28 20:43:35 +08:00
Zheng Xi Zhou
d083039a32 Fix: backport all Terraform related features to release-1.1 (#2553)
Copy all Terraform related code to release-1.1 to fix probelms and support
features.

Fix #2547
2021-10-28 11:37:41 +08:00
Tianxin Dong
5e6be649c1 [Backport release-1.1] Feat: Commit step-generate data without success (#2565)
* Feat: commit without success

* Feat: add test case

Co-authored-by: Jian.Li <lj176172@alibaba-inc.com>
2021-10-28 10:48:39 +08:00
github-actions[bot]
706a65beae [Backport release-1.1] Feat: add nocalhost dev config trait definition (#2564)
* Feat: add nocalhost dev config trait definition

(cherry picked from commit 965869b43b)

* Feat: add nocalhost dev config trait example

add nocalhost dev config trait example in `docs/examples/nocalhost`

Signed-off-by: yuyicai <yuyicai@hotmail.com>
(cherry picked from commit 70114877ce)

Co-authored-by: yuyicai <yuyicai@hotmail.com>
2021-10-27 16:03:39 +08:00
Jian.Li
d21a337dd7 Backport 2522 to release 1.1 (#2529)
* Feat: not apply if render hash not change

* Fix: generateRenderHash panic
2021-10-27 11:56:11 +08:00
github-actions[bot]
b53f4f4fdd Feat: add cluster in read or apply object (#2560)
(cherry picked from commit 5dbd8c8765)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-27 10:08:29 +08:00
github-actions[bot]
24970cd990 Fix: CVE-2021-42836 (#2552)
CVE-2021-42836
GJSON before 1.9.3 allows a ReDoS (regular expression denial of service) attack.

(cherry picked from commit 25e4b682a8)

Co-authored-by: zzxwill <zzxwill@gmail.com>
2021-10-26 12:03:59 +08:00
github-actions[bot]
844f479f54 Feat: add helm type component definition custom status (#2525)
(cherry picked from commit d8c33db293)

Co-authored-by: qiaozp <chivalry.pp@gmail.com>
2021-10-19 19:03:16 +08:00
github-actions[bot]
91d336b469 Fix(cli): use flag instead of env in workflow cli (#2524)
(cherry picked from commit 3a7dea1cbe)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-19 17:54:09 +08:00
Zheng Xi Zhou
516156f32f Fix: aws/azure Terraform provider are broken (#2517)
Removed built-in aws/azure Terraform providers, and fix azure
mariadb definition issue.

Fix #2475
2021-10-19 12:57:36 +08:00
github-actions[bot]
eb5808e4ea Feat: support secret in webhook notification (#2516)
(cherry picked from commit 62bd87f13f)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-19 10:46:39 +08:00
github-actions[bot]
66f794e9fd Feat: add imagePullPolicy/imagePullSecret to task def (#2506)
(cherry picked from commit ba5f562b2a)

Co-authored-by: qiaozp <chivalry.pp@gmail.com>
2021-10-18 11:14:38 +08:00
github-actions[bot]
90f46c57e8 Feat: upgrade the image of kube-webhook-certgen (#2500)
(cherry picked from commit e1e004d596)

Co-authored-by: yangsoon <yangsoonlx@gmail.com>
2021-10-15 17:40:02 +08:00
github-actions[bot]
95496e55c0 [Backport release-1.1] Feat: add export config and secret def (#2498)
* Feat: add export config and secret def

(cherry picked from commit ed1f7c787d)

* Fix: change the def name and optimize the example

(cherry picked from commit 2d626c872a)

* Fix: fix the name in def

(cherry picked from commit 1e92d64767)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-15 15:40:51 +08:00
github-actions[bot]
3009d02fcd [Backport release-1.1] Fix: add libgit2 support for gitops (#2490)
* Fix: add libgit2 support for gitops

(cherry picked from commit 31102a2e65)

* Fix: resolve rebase

(cherry picked from commit 3137e15b3f)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-14 20:57:44 +08:00
qiaozp
df8b60d521 Feat: add read object step def (#2482) (#2487)
(cherry picked from commit 32364aa9e4)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>

Refactor: addon migrate to application (#2444)

* Refactor: addon migrate to application

* Refactor: change test for addon

* Fix: golint

* Fix: add annotation const

* Refactor: make CLI compatible

* Fix: go-lint

(cherry picked from commit 8c4af1d69c)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-10-14 20:55:27 +08:00
github-actions[bot]
6c6e834155 Fix(application): nil pointer for component properties (#2483)
(cherry picked from commit 92b92e683c)

Co-authored-by: kinsolee <lijingzhao@forchange.tech>
2021-10-14 20:11:38 +08:00
github-actions[bot]
cc3d2e28c0 Feat: add read object step def (#2482)
(cherry picked from commit 32364aa9e4)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-14 18:25:53 +08:00
github-actions[bot]
f95ff4f06e [Backport release-1.1] Fix: make nginx class to be default value and allow pvc trait to attach more than once (#2471)
* Fix: make nginx class to be default value

(cherry picked from commit 9c41df7b0f)

* Fix: allow pvc trait to attach more than once

(cherry picked from commit 33cf15e439)

Co-authored-by: 天元 <jianbo.sjb@alibaba-inc.com>
2021-10-13 17:21:43 +08:00
github-actions[bot]
e30876e4d2 Fix: compatibility bug (#2470)
make reivwable

(cherry picked from commit df5a802bd4)

Co-authored-by: wangyike <wangyike_wyk@163.com>
2021-10-13 16:59:30 +08:00
github-actions[bot]
141c6bb2ef [Backport release-1.1] Fix: change raw extension to pointer (#2469)
* Fix: change raw extension to pointer

(cherry picked from commit 113f785c97)

* Test: fix ut

(cherry picked from commit 7b9dac98c2)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-13 16:58:20 +08:00
github-actions[bot]
bdfd8e1f8d Fix: wrong log print format (#2453)
(cherry picked from commit 16ecbb8b91)

Co-authored-by: Xiaoxi He <xxhe@alauda.io>
2021-10-12 19:27:53 +08:00
github-actions[bot]
cfbaf38715 [Backport release-1.1] Fix: Closure Bug In newValue (#2452)
* Fix: new value bug

(cherry picked from commit dc184327a0)

* Fix: strategyUnify Bug

(cherry picked from commit 1b2c049ea8)

* Fix: e2e error

(cherry picked from commit f9bfbc0d53)

Co-authored-by: Jian.Li <lj176172@alibaba-inc.com>
2021-10-12 19:10:39 +08:00
github-actions[bot]
d3006f2d9e [Backport release-1.1] Fix: fix unhandled err (#2450)
* Fix: fix unhandled err

refer to https://lift.sonatype.com/result/bhamail/kubevela/01FFT7CSVNCPF6808ZM856V3HN?tab=results

(cherry picked from commit d0ced6cfc9)

* Test: fix panic err

(cherry picked from commit e5e5f9ac42)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-12 14:36:52 +08:00
github-actions[bot]
8f7aa9b746 Fix: update ingress class (#2447)
(cherry picked from commit 77e1b8296c)

Co-authored-by: Yin Da <yd219913@alibaba-inc.com>
2021-10-11 20:50:00 +08:00
github-actions[bot]
8431cdb10d [Backport release-1.1] Fix: add Chart icon and url (#2446)
* Fix: add Chart icon and url

Added an icon and url for KubeVela chart

(cherry picked from commit 4dcca2a47f)

* Fix: remove local logo file and use a web image

(cherry picked from commit a86bdb9639)

Co-authored-by: zzxwill <zzxwill@gmail.com>
2021-10-11 20:46:44 +08:00
wyike
66013a9607 Fix: confilict (#2443)
Fix: nil pointer panic
2021-10-11 17:56:18 +08:00
github-actions[bot]
1d133df1dd [Backport release-1.1] Feat: add support for envbinding with namespace selector (#2440)
* Feat: add support for envbinding with namespace selector

(cherry picked from commit 409fe1bf38)

* Fix: service account kubeconfig e2e-test

(cherry picked from commit db7539641c)

* Docs: add comments to explain functions

(cherry picked from commit c9bf6b8914)

* Docs: add envbinding example

(cherry picked from commit 0011c4563f)

Co-authored-by: Yin Da <yd219913@alibaba-inc.com>
2021-10-11 15:36:20 +08:00
248 changed files with 19848 additions and 17969 deletions

View File

@@ -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
View File

@@ -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

View File

@@ -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

View File

@@ -17,6 +17,8 @@ limitations under the License.
package common
import (
"encoding/json"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
@@ -112,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"`
}
@@ -374,7 +379,7 @@ type AppRolloutStatus struct {
type ApplicationTrait struct {
Type string `json:"type"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
Properties *runtime.RawExtension `json:"properties,omitempty"`
}
// ApplicationComponent describe the component of application
@@ -384,7 +389,7 @@ type ApplicationComponent struct {
// ExternalRevision specified the component revisionName
ExternalRevision string `json:"externalRevision,omitempty"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
Properties *runtime.RawExtension `json:"properties,omitempty"`
DependsOn []string `json:"dependsOn,omitempty"`
Inputs StepInputs `json:"inputs,omitempty"`
@@ -457,3 +462,29 @@ type ClusterObjectReference struct {
Creator ResourceCreatorRole `json:"creator,omitempty"`
corev1.ObjectReference `json:",inline"`
}
// RawExtensionPointer is the pointer of raw extension
type RawExtensionPointer struct {
RawExtension *runtime.RawExtension
}
// MarshalJSON may get called on pointers or values, so implement MarshalJSON on value.
// http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go
func (re RawExtensionPointer) MarshalJSON() ([]byte, error) {
if re.RawExtension == nil {
return nil, nil
}
if re.RawExtension.Raw == nil {
// TODO: this is to support legacy behavior of JSONPrinter and YAMLPrinter, which
// expect to call json.Marshal on arbitrary versioned objects (even those not in
// the scheme). pkg/kubectl/resource#AsVersionedObjects and its interaction with
// kubectl get on objects not in the scheme needs to be updated to ensure that the
// objects that are not part of the scheme are correctly put into the right form.
if re.RawExtension.Object != nil {
return json.Marshal(re.RawExtension.Object)
}
return []byte("null"), nil
}
// TODO: Check whether ContentType is actually JSON before returning it.
return re.RawExtension.Raw, nil
}

View File

@@ -23,6 +23,7 @@ package common
import (
crossplane_runtime "github.com/oam-dev/terraform-controller/api/types/crossplane-runtime"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@@ -93,7 +94,11 @@ func (in *AppStatus) DeepCopy() *AppStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ApplicationComponent) DeepCopyInto(out *ApplicationComponent) {
*out = *in
in.Properties.DeepCopyInto(&out.Properties)
if in.Properties != nil {
in, out := &in.Properties, &out.Properties
*out = new(runtime.RawExtension)
(*in).DeepCopyInto(*out)
}
if in.DependsOn != nil {
in, out := &in.DependsOn, &out.DependsOn
*out = make([]string, len(*in))
@@ -164,7 +169,11 @@ func (in *ApplicationComponentStatus) DeepCopy() *ApplicationComponentStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ApplicationTrait) DeepCopyInto(out *ApplicationTrait) {
*out = *in
in.Properties.DeepCopyInto(&out.Properties)
if in.Properties != nil {
in, out := &in.Properties, &out.Properties
*out = new(runtime.RawExtension)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationTrait.
@@ -404,6 +413,26 @@ func (in *RawComponent) DeepCopy() *RawComponent {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RawExtensionPointer) DeepCopyInto(out *RawExtensionPointer) {
*out = *in
if in.RawExtension != nil {
in, out := &in.RawExtension, &out.RawExtension
*out = new(runtime.RawExtension)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RawExtensionPointer.
func (in *RawExtensionPointer) DeepCopy() *RawExtensionPointer {
if in == nil {
return nil
}
out := new(RawExtensionPointer)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Revision) DeepCopyInto(out *Revision) {
*out = *in

View File

@@ -1,116 +0,0 @@
/*
Copyright 2021. The KubeVela Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
)
// WorkflowStepPhase describes the phase of a workflow step.
type WorkflowStepPhase string
const (
// WorkflowStepPhaseSucceeded will make the controller run the next step.
WorkflowStepPhaseSucceeded WorkflowStepPhase = "succeeded"
// WorkflowStepPhaseFailed will make the controller stop the workflow and report error in `message`.
WorkflowStepPhaseFailed WorkflowStepPhase = "failed"
// WorkflowStepPhaseTerminated will make the controller terminate the workflow.
WorkflowStepPhaseTerminated WorkflowStepPhase = "terminated"
// WorkflowStepPhaseSuspending will make the controller suspend the workflow.
WorkflowStepPhaseSuspending WorkflowStepPhase = "suspending"
// WorkflowStepPhaseRunning will make the controller continue the workflow.
WorkflowStepPhaseRunning WorkflowStepPhase = "running"
)
// WorkflowStep defines how to execute a workflow step.
type WorkflowStep struct {
// Name is the unique name of the workflow step.
Name string `json:"name"`
Type string `json:"type"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
Inputs common.StepInputs `json:"inputs,omitempty"`
Outputs common.StepOutputs `json:"outputs,omitempty"`
}
// A WorkflowSpec defines the desired state of a Workflow.
type WorkflowSpec struct {
Steps []WorkflowStep `json:"steps,omitempty"`
}
// A WorkflowStatus is the status of Workflow
type WorkflowStatus struct {
// ConditionedStatus reflects the observed status of a resource
condition.ConditionedStatus `json:",inline"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
StepIndex int `json:"stepIndex,omitempty"`
Suspend bool `json:"suspend"`
Terminated bool `json:"terminated"`
ContextBackend *corev1.ObjectReference `json:"contextBackend"`
Steps []WorkflowStepStatus `json:"steps,omitempty"`
}
// WorkflowStepStatus record the status of a workflow step
type WorkflowStepStatus struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Phase WorkflowStepPhase `json:"phase,omitempty"`
// A human readable message indicating details about why the workflowStep is in this state.
Message string `json:"message,omitempty"`
// A brief CamelCase message indicating details about why the workflowStep is in this state.
Reason string `json:"reason,omitempty"`
ResourceRef corev1.ObjectReference `json:"resourceRef,omitempty"`
}
// Workflow is the Schema for the Workflow API
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=workflow
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
type Workflow struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec WorkflowSpec `json:"spec,omitempty"`
Status WorkflowStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// WorkflowList contains a list of Workflow.
type WorkflowList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Workflow `json:"items"`
}
// SetConditions set condition for Workflow
func (w *Workflow) SetConditions(c ...condition.Condition) {
w.Status.SetConditions(c...)
}
// GetCondition gets condition from Workflow
func (w *Workflow) GetCondition(conditionType condition.ConditionType) condition.Condition {
return w.Status.GetCondition(conditionType)
}

View File

@@ -296,152 +296,3 @@ func (in *NamespaceSelector) DeepCopy() *NamespaceSelector {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Workflow) DeepCopyInto(out *Workflow) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workflow.
func (in *Workflow) DeepCopy() *Workflow {
if in == nil {
return nil
}
out := new(Workflow)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Workflow) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowList) DeepCopyInto(out *WorkflowList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Workflow, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowList.
func (in *WorkflowList) DeepCopy() *WorkflowList {
if in == nil {
return nil
}
out := new(WorkflowList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *WorkflowList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowSpec) DeepCopyInto(out *WorkflowSpec) {
*out = *in
if in.Steps != nil {
in, out := &in.Steps, &out.Steps
*out = make([]WorkflowStep, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowSpec.
func (in *WorkflowSpec) DeepCopy() *WorkflowSpec {
if in == nil {
return nil
}
out := new(WorkflowSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStatus) DeepCopyInto(out *WorkflowStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
if in.ContextBackend != nil {
in, out := &in.ContextBackend, &out.ContextBackend
*out = new(v1.ObjectReference)
**out = **in
}
if in.Steps != nil {
in, out := &in.Steps, &out.Steps
*out = make([]WorkflowStepStatus, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStatus.
func (in *WorkflowStatus) DeepCopy() *WorkflowStatus {
if in == nil {
return nil
}
out := new(WorkflowStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStep) DeepCopyInto(out *WorkflowStep) {
*out = *in
in.Properties.DeepCopyInto(&out.Properties)
if in.Inputs != nil {
in, out := &in.Inputs, &out.Inputs
*out = make(common.StepInputs, len(*in))
copy(*out, *in)
}
if in.Outputs != nil {
in, out := &in.Outputs, &out.Outputs
*out = make(common.StepOutputs, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStep.
func (in *WorkflowStep) DeepCopy() *WorkflowStep {
if in == nil {
return nil
}
out := new(WorkflowStep)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStepStatus) DeepCopyInto(out *WorkflowStepStatus) {
*out = *in
out.ResourceRef = in.ResourceRef
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepStatus.
func (in *WorkflowStepStatus) DeepCopy() *WorkflowStepStatus {
if in == nil {
return nil
}
out := new(WorkflowStepStatus)
in.DeepCopyInto(out)
return out
}

View File

@@ -54,7 +54,7 @@ type AppStatus struct {
type ApplicationTrait struct {
Name string `json:"name"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
Properties *runtime.RawExtension `json:"properties,omitempty"`
}
// ApplicationComponent describe the component of application

View File

@@ -20,6 +20,7 @@ import (
"fmt"
"reflect"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/conversion"
@@ -44,7 +45,7 @@ func ApplicationV1alpha2ToV1beta1(v1a2 *Application, v1b1 *v1beta1.Application)
for j, trait := range comp.Traits {
traits[j] = common.ApplicationTrait{
Type: trait.Name,
Properties: *trait.Properties.DeepCopy(),
Properties: trait.Properties.DeepCopy(),
}
}
@@ -58,7 +59,7 @@ func ApplicationV1alpha2ToV1beta1(v1a2 *Application, v1b1 *v1beta1.Application)
v1b1.Spec.Components = append(v1b1.Spec.Components, common.ApplicationComponent{
Name: comp.Name,
Type: comp.WorkloadType,
Properties: *comp.Settings.DeepCopy(),
Properties: comp.Settings.DeepCopy(),
Traits: traits,
Scopes: scopes,
})
@@ -104,7 +105,7 @@ func (app *Application) ConvertFrom(src conversion.Hub) error {
for j, trait := range comp.Traits {
traits[j] = ApplicationTrait{
Name: trait.Type,
Properties: *trait.Properties.DeepCopy(),
Properties: trait.Properties.DeepCopy(),
}
}
@@ -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,
})

View File

@@ -600,7 +600,11 @@ func (in *ApplicationSpec) DeepCopy() *ApplicationSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ApplicationTrait) DeepCopyInto(out *ApplicationTrait) {
*out = *in
in.Properties.DeepCopyInto(&out.Properties)
if in.Properties != nil {
in, out := &in.Properties, &out.Properties
*out = new(runtime.RawExtension)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationTrait.

View File

@@ -44,7 +44,7 @@ type AppPolicy struct {
Type string `json:"type"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
Properties *runtime.RawExtension `json:"properties,omitempty"`
}
// WorkflowStep defines how to execute a workflow step.
@@ -55,7 +55,7 @@ type WorkflowStep struct {
Type string `json:"type"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
Properties *runtime.RawExtension `json:"properties,omitempty"`
DependsOn []string `json:"dependsOn,omitempty"`

View File

@@ -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"`

View File

@@ -141,7 +141,11 @@ func (in *AppDeploymentStatus) DeepCopy() *AppDeploymentStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AppPolicy) DeepCopyInto(out *AppPolicy) {
*out = *in
in.Properties.DeepCopyInto(&out.Properties)
if in.Properties != nil {
in, out := &in.Properties, &out.Properties
*out = new(runtime.RawExtension)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppPolicy.
@@ -1450,7 +1454,11 @@ func (in *Workflow) DeepCopy() *Workflow {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStep) DeepCopyInto(out *WorkflowStep) {
*out = *in
in.Properties.DeepCopyInto(&out.Properties)
if in.Properties != nil {
in, out := &in.Properties, &out.Properties
*out = new(runtime.RawExtension)
(*in).DeepCopyInto(*out)
}
if in.DependsOn != nil {
in, out := &in.DependsOn, &out.DependsOn
*out = make([]string, len(*in))

View File

@@ -85,4 +85,5 @@ var DefaultFilterAnnots = []string{
oam.AnnotationInplaceUpgrade,
oam.AnnotationFilterLabelKeys,
oam.AnnotationFilterAnnotationKeys,
oam.AnnotationLastAppliedConfiguration,
}

View File

@@ -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

View File

@@ -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

View File

@@ -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: []

View File

@@ -19,3 +19,6 @@ version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.1.0
home: https://kubevela.io
icon: https://kubevela.io/img/logo.jpg

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -1,352 +0,0 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.2
name: workflows.core.oam.dev
spec:
group: core.oam.dev
names:
categories:
- oam
kind: Workflow
listKind: WorkflowList
plural: workflows
shortNames:
- workflow
singular: workflow
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .status.phase
name: PHASE
type: string
- jsonPath: .metadata.creationTimestamp
name: AGE
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Workflow is the Schema for the Workflow API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: A WorkflowSpec defines the desired state of a Workflow.
properties:
steps:
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
inputs:
description: StepInputs defines variable input of WorkflowStep
items:
properties:
from:
type: string
parameterKey:
type: string
required:
- from
- parameterKey
type: object
type: array
name:
description: Name is the unique name of the workflow step.
type: string
outputs:
description: StepOutputs defines output variable of WorkflowStep
items:
properties:
name:
type: string
valueFrom:
type: string
required:
- name
- valueFrom
type: object
type: array
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
type:
type: string
required:
- name
- type
type: object
type: array
type: object
status:
description: A WorkflowStatus is the status of Workflow
properties:
conditions:
description: Conditions of the resource.
items:
description: A Condition that may apply to a resource.
properties:
lastTransitionTime:
description: LastTransitionTime is the last time this condition
transitioned from one status to another.
format: date-time
type: string
message:
description: A Message containing details about this condition's
last transition from one status to another, if any.
type: string
reason:
description: A Reason for this condition's last transition from
one status to another.
type: string
status:
description: Status of this condition; is it currently True,
False, or Unknown?
type: string
type:
description: Type of this condition. At most one of each condition
type may apply to a resource at any point in time.
type: string
required:
- lastTransitionTime
- reason
- status
- type
type: object
type: array
contextBackend:
description: 'ObjectReference contains enough information to let you
inspect or modify the referred object. --- New uses of this type
are discouraged because of difficulty describing its usage when
embedded in APIs. 1. Ignored fields. It includes many fields which
are not generally honored. For instance, ResourceVersion and FieldPath
are both very rarely valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual usage. In most
embedded usages, there are particular restrictions like, "must
refer only to types A and B" or "UID not honored" or "name must
be restricted". Those cannot be well described when embedded. 3.
Inconsistent validation. Because the usages are different, the
validation rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a URL. This
can produce ambiguity during interpretation and require a REST
mapping. In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in many
locations, updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used type
that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
observedGeneration:
format: int64
type: integer
stepIndex:
type: integer
steps:
items:
description: WorkflowStepStatus record the status of a workflow
step
properties:
message:
description: A human readable message indicating details about
why the workflowStep is in this state.
type: string
name:
type: string
phase:
description: WorkflowStepPhase describes the phase of a workflow
step.
type: string
reason:
description: A brief CamelCase message indicating details about
why the workflowStep is in this state.
type: string
resourceRef:
description: 'ObjectReference contains enough information to
let you inspect or modify the referred object. --- New uses
of this type are discouraged because of difficulty describing
its usage when embedded in APIs. 1. Ignored fields. It includes
many fields which are not generally honored. For instance,
ResourceVersion and FieldPath are both very rarely valid in
actual usage. 2. Invalid usage help. It is impossible to
add specific help for individual usage. In most embedded
usages, there are particular restrictions like, "must
refer only to types A and B" or "UID not honored" or "name
must be restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and the
version of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they do not
control. Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead
of an entire object, this string should contain a valid
JSON/Go field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container
within a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that
triggered the event) or if no container name is specified
"spec.containers[2]" (container with index 2 in this pod).
This syntax is chosen only to have some well-defined way
of referencing a part of an object. TODO: this design
is not final and this field is subject to change in the
future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
type:
type: string
type: object
type: array
suspend:
type: boolean
terminated:
type: boolean
required:
- contextBackend
- suspend
- terminated
type: object
type: object
served: true
storage: true
subresources:
status: {}
- name: v1beta1
schema:
openAPIV3Schema:
description: Workflow defines workflow steps and other attributes
properties:
steps:
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
dependsOn:
items:
type: string
type: array
inputs:
description: StepInputs defines variable input of WorkflowStep
items:
properties:
from:
type: string
parameterKey:
type: string
required:
- from
- parameterKey
type: object
type: array
name:
description: Name is the unique name of the workflow step.
type: string
outputs:
description: StepOutputs defines output variable of WorkflowStep
items:
properties:
name:
type: string
valueFrom:
type: string
required:
- name
- valueFrom
type: object
type: array
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
type:
type: string
required:
- name
- type
type: object
type: array
type: object
served: true
storage: false
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -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:

View File

@@ -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

View File

@@ -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:

View File

@@ -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:

View File

@@ -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:

View File

@@ -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}}

View File

@@ -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}}

View File

@@ -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}}

View File

@@ -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

View File

@@ -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:

View File

@@ -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:

View File

@@ -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}}

View File

@@ -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:

View File

@@ -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:

View File

@@ -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: {}

View File

@@ -17,7 +17,7 @@ spec:
// +patchKey=name
containers: [{
name: context.name
// +patchKey=name
// +patchStrategy=retainKeys
env: [
for k, v in parameter.env {
name: k

View File

@@ -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: {}
}

View File

@@ -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: {}
}

View File

@@ -30,7 +30,10 @@ spec:
outputs: ingress: {
apiVersion: "networking.k8s.io/v1"
kind: "Ingress"
metadata: name: context.name
metadata: {
name: context.name
annotations: "kubernetes.io/ingress.class": parameter.class
}
spec: rules: [{
host: parameter.domain
http: paths: [
@@ -51,6 +54,9 @@ spec:
// +usage=Specify the mapping relationship between the http path and the workload port
http: [string]: int
// +usage=Specify the class of ingress to use
class: *"nginx" | string
}
status:
customStatus: |-

View 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
}
}
}

View File

@@ -50,7 +50,7 @@ spec:
},
]
}
outputs: pvc: {
outputs: "\(parameter.claimName)": {
apiVersion: "v1"
kind: "PersistentVolumeClaim"
metadata: name: parameter.claimName

View 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
}

View File

@@ -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

View File

@@ -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

View File

@@ -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
}
}
}
}

View File

@@ -73,7 +73,7 @@ admissionWebhooks:
enabled: true
image:
repository: oamdev/kube-webhook-certgen
tag: v2.2
tag: v2.3
pullPolicy: IfNotPresent
affinity: {}
tolerations: []

View File

@@ -19,3 +19,6 @@ version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.1.0
home: https://kubevela.io
icon: https://kubevela.io/img/logo.jpg

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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: {}

View File

@@ -17,7 +17,7 @@ spec:
// +patchKey=name
containers: [{
name: context.name
// +patchKey=name
// +patchStrategy=retainKeys
env: [
for k, v in parameter.env {
name: k

View File

@@ -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: {}
}

View File

@@ -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: {}
}

View File

@@ -30,7 +30,10 @@ spec:
outputs: ingress: {
apiVersion: "networking.k8s.io/v1"
kind: "Ingress"
metadata: name: context.name
metadata: {
name: context.name
annotations: "kubernetes.io/ingress.class": parameter.class
}
spec: rules: [{
host: parameter.domain
http: paths: [
@@ -51,6 +54,9 @@ spec:
// +usage=Specify the mapping relationship between the http path and the workload port
http: [string]: int
// +usage=Specify the class of ingress to use
class: *"nginx" | string
}
status:
customStatus: |-

View 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
}
}
}

View File

@@ -50,7 +50,7 @@ spec:
},
]
}
outputs: pvc: {
outputs: "\(parameter.claimName)": {
apiVersion: "v1"
kind: "PersistentVolumeClaim"
metadata: name: parameter.claimName

View 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
}

View File

@@ -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

View File

@@ -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

View File

@@ -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
}
}
}
}

View File

@@ -69,7 +69,7 @@ admissionWebhooks:
enabled: true
image:
repository: oamdev/kube-webhook-certgen
tag: v2.2
tag: v2.3
pullPolicy: IfNotPresent
affinity: {}
tolerations: []

View File

@@ -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,
@@ -326,8 +327,11 @@ func waitWebhookSecretVolume(certDir string, timeout, interval time.Duration) er
if err != nil {
return false
}
// nolint
defer f.Close()
defer func() {
if err := f.Close(); err != nil {
klog.Error(err, "Failed to close file")
}
}()
// check if dir is empty
if _, err := f.Readdir(1); errors.Is(err, io.EOF) {
return false

View File

@@ -0,0 +1,54 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: mysql-pvc
spec:
components:
- name: mysql
type: webservice
properties:
env:
- name: MYSQL_ROOT_PASSWORD
value: root
image: mysql:5.7
port: 3306
cpu: 1000m
memory: 500M
traits:
- type: ingress
properties:
http:
/: 13666
domain: com.zdww1
- type: scaler
properties:
replicas: 1
- type: cpuscaler
properties:
cpuUtil: 70
min: 1
max: 3
- type: pvc
properties:
claimName: aaa
accessModes:
- ReadWriteOnce
storageClassName: nfs-dynamic-sc
resources:
requests:
storage: 1Gi
volumesToMount:
- mountPath: /aaa
name: aaa
- type: pvc
properties:
claimName: bbb
accessModes:
- ReadWriteOnce
storageClassName: nfs-dynamic-sc
resources:
requests:
storage: 1Gi
volumesToMount:
- mountPath: /bbb
name: bbb

View File

@@ -0,0 +1,78 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: example-app
namespace: default
spec:
components:
- name: hello-world-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
traits:
- type: scaler
properties:
replicas: 1
- name: data-worker
type: worker
properties:
image: busybox
cmd:
- sleep
- '1000000'
policies:
- name: example-multi-env-policy
type: env-binding
properties:
envs:
- name: test
placement: # selecting the namespace (in local cluster) to deploy to
namespaceSelector:
name: test
selector:
components:
- data-worker
- name: staging
placement: # selecting the cluster to deploy to
clusterSelector:
name: cluster-worker
- name: prod
placement: # selecting both namespace and cluster to deploy to
clusterSelector:
name: cluster-worker
namespaceSelector:
name: prod
patch: # overlay patch on above components
components:
- name: hello-world-server
type: webservice
traits:
- type: scaler
properties:
replicas: 3
workflow:
steps:
# deploy to test env
- name: deploy-test
type: deploy2env
properties:
policy: example-multi-env-policy
env: test
# deploy to staging env
- name: deploy-staging
type: deploy2env
properties:
policy: example-multi-env-policy
env: staging
# deploy to prod env
- name: deploy-prod
type: deploy2env
properties:
policy: example-multi-env-policy
env: prod

View 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

View 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

View File

@@ -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

View File

@@ -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:

View 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

View 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

View 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

View File

@@ -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
`

View File

@@ -100,8 +100,14 @@ func InteractiveExec(cli string, consoleFn func(*expect.Console)) (string, error
command.Stdin = console.Tty()
session, err := gexec.Start(command, console.Tty(), console.Tty())
if err != nil {
return string(output), err
}
s := session.Wait(300 * time.Second)
console.Tty().Close()
err = console.Tty().Close()
if err != nil {
return string(output), err
}
<-doneC
if err != nil {
return string(output), err

4
go.mod
View File

@@ -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
View File

@@ -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=

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -1,352 +0,0 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.2
name: workflows.core.oam.dev
spec:
group: core.oam.dev
names:
categories:
- oam
kind: Workflow
listKind: WorkflowList
plural: workflows
shortNames:
- workflow
singular: workflow
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .status.phase
name: PHASE
type: string
- jsonPath: .metadata.creationTimestamp
name: AGE
type: date
name: v1alpha1
schema:
openAPIV3Schema:
description: Workflow is the Schema for the Workflow API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: A WorkflowSpec defines the desired state of a Workflow.
properties:
steps:
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
inputs:
description: StepInputs defines variable input of WorkflowStep
items:
properties:
from:
type: string
parameterKey:
type: string
required:
- from
- parameterKey
type: object
type: array
name:
description: Name is the unique name of the workflow step.
type: string
outputs:
description: StepOutputs defines output variable of WorkflowStep
items:
properties:
name:
type: string
valueFrom:
type: string
required:
- name
- valueFrom
type: object
type: array
properties:
type: object
type:
type: string
required:
- name
- type
type: object
type: array
type: object
status:
description: A WorkflowStatus is the status of Workflow
properties:
conditions:
description: Conditions of the resource.
items:
description: A Condition that may apply to a resource.
properties:
lastTransitionTime:
description: LastTransitionTime is the last time this condition
transitioned from one status to another.
format: date-time
type: string
message:
description: A Message containing details about this condition's
last transition from one status to another, if any.
type: string
reason:
description: A Reason for this condition's last transition from
one status to another.
type: string
status:
description: Status of this condition; is it currently True,
False, or Unknown?
type: string
type:
description: Type of this condition. At most one of each condition
type may apply to a resource at any point in time.
type: string
required:
- lastTransitionTime
- reason
- status
- type
type: object
type: array
contextBackend:
description: 'ObjectReference contains enough information to let you
inspect or modify the referred object. --- New uses of this type
are discouraged because of difficulty describing its usage when
embedded in APIs. 1. Ignored fields. It includes many fields which
are not generally honored. For instance, ResourceVersion and FieldPath
are both very rarely valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual usage. In most
embedded usages, there are particular restrictions like, "must
refer only to types A and B" or "UID not honored" or "name must
be restricted". Those cannot be well described when embedded. 3.
Inconsistent validation. Because the usages are different, the
validation rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a URL. This
can produce ambiguity during interpretation and require a REST
mapping. In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in many
locations, updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used type
that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
observedGeneration:
format: int64
type: integer
stepIndex:
type: integer
steps:
items:
description: WorkflowStepStatus record the status of a workflow
step
properties:
message:
description: A human readable message indicating details about
why the workflowStep is in this state.
type: string
name:
type: string
phase:
description: WorkflowStepPhase describes the phase of a workflow
step.
type: string
reason:
description: A brief CamelCase message indicating details about
why the workflowStep is in this state.
type: string
resourceRef:
description: 'ObjectReference contains enough information to
let you inspect or modify the referred object. --- New uses
of this type are discouraged because of difficulty describing
its usage when embedded in APIs. 1. Ignored fields. It includes
many fields which are not generally honored. For instance,
ResourceVersion and FieldPath are both very rarely valid in
actual usage. 2. Invalid usage help. It is impossible to
add specific help for individual usage. In most embedded
usages, there are particular restrictions like, "must
refer only to types A and B" or "UID not honored" or "name
must be restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and the
version of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they do not
control. Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead
of an entire object, this string should contain a valid
JSON/Go field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container
within a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that
triggered the event) or if no container name is specified
"spec.containers[2]" (container with index 2 in this pod).
This syntax is chosen only to have some well-defined way
of referencing a part of an object. TODO: this design
is not final and this field is subject to change in the
future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
type:
type: string
type: object
type: array
suspend:
type: boolean
terminated:
type: boolean
required:
- contextBackend
- suspend
- terminated
type: object
type: object
served: true
storage: true
subresources:
status: {}
- name: v1beta1
schema:
openAPIV3Schema:
description: Workflow defines workflow steps and other attributes
properties:
steps:
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
dependsOn:
items:
type: string
type: array
inputs:
description: StepInputs defines variable input of WorkflowStep
items:
properties:
from:
type: string
parameterKey:
type: string
required:
- from
- parameterKey
type: object
type: array
name:
description: Name is the unique name of the workflow step.
type: string
outputs:
description: StepOutputs defines output variable of WorkflowStep
items:
properties:
name:
type: string
valueFrom:
type: string
required:
- name
- valueFrom
type: object
type: array
properties:
type: object
type:
type: string
required:
- name
- type
type: object
type: array
type: object
served: true
storage: false
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -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:

View File

@@ -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

View File

@@ -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 {
@@ -708,7 +709,7 @@ func generateTerraformConfigurationWorkload(wl *Workload, ns string) (*unstructu
}
configuration.Spec.Variable = &runtime.RawExtension{Raw: data}
raw := util.Object2RawExtension(&configuration)
return util.RawExtension2Unstructured(&raw)
return util.RawExtension2Unstructured(raw)
}
// a helper map whose key is parameter name

View File

@@ -103,7 +103,7 @@ var _ = Describe("Test Helm schematic appfile", func() {
},
},
Helm: &common.Helm{
Release: util.Object2RawExtension(map[string]interface{}{
Release: *util.Object2RawExtension(map[string]interface{}{
"chart": map[string]interface{}{
"spec": map[string]interface{}{
"chart": "podinfo",
@@ -111,7 +111,7 @@ var _ = Describe("Test Helm schematic appfile", func() {
},
},
}),
Repository: util.Object2RawExtension(map[string]interface{}{
Repository: *util.Object2RawExtension(map[string]interface{}{
"url": "http://oam.dev/catalog/",
}),
},
@@ -1061,7 +1061,7 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) {
Spec: configSpec,
}
rawConf := util.Object2RawExtension(tfConfiguration)
wantWL, _ := util.RawExtension2Unstructured(&rawConf)
wantWL, _ := util.RawExtension2Unstructured(rawConf)
if diff := cmp.Diff(wantWL, got); diff != "" {
t.Errorf("\n%s\ngenerateTerraformConfigurationWorkload(...): -want, +got:\n%s\n", tcName, diff)

View File

@@ -251,7 +251,7 @@ func (p *Parser) parsePoliciesFromRevision(policies []v1beta1.AppPolicy, appRev
return ws, nil
}
func (p *Parser) makeWorkload(ctx context.Context, name, typ string, capType types.CapType, props runtime.RawExtension) (*Workload, error) {
func (p *Parser) makeWorkload(ctx context.Context, name, typ string, capType types.CapType, props *runtime.RawExtension) (*Workload, error) {
templ, err := p.tmplLoader.LoadTemplate(ctx, p.dm, p.client, typ, capType)
if err != nil {
return nil, errors.WithMessagef(err, "fetch component/policy type of %s", name)
@@ -259,7 +259,7 @@ func (p *Parser) makeWorkload(ctx context.Context, name, typ string, capType typ
return p.convertTemplate2Workload(name, typ, props, templ)
}
func (p *Parser) makeWorkloadFromRevision(name, typ string, capType types.CapType, props runtime.RawExtension, appRev *v1beta1.ApplicationRevision) (*Workload, error) {
func (p *Parser) makeWorkloadFromRevision(name, typ string, capType types.CapType, props *runtime.RawExtension, appRev *v1beta1.ApplicationRevision) (*Workload, error) {
templ, err := LoadTemplateFromRevision(typ, capType, appRev, p.dm)
if err != nil {
return nil, errors.WithMessagef(err, "fetch component/policy type of %s from revision", name)
@@ -268,8 +268,8 @@ func (p *Parser) makeWorkloadFromRevision(name, typ string, capType types.CapTyp
return p.convertTemplate2Workload(name, typ, props, templ)
}
func (p *Parser) convertTemplate2Workload(name, typ string, props runtime.RawExtension, templ *Template) (*Workload, error) {
settings, err := util.RawExtension2Map(&props)
func (p *Parser) convertTemplate2Workload(name, typ string, props *runtime.RawExtension, templ *Template) (*Workload, error) {
settings, err := util.RawExtension2Map(props)
if err != nil {
return nil, errors.WithMessagef(err, "fail to parse settings for %s", name)
}
@@ -299,7 +299,7 @@ func (p *Parser) parseWorkload(ctx context.Context, comp common.ApplicationCompo
workload.ExternalRevision = comp.ExternalRevision
for _, traitValue := range comp.Traits {
properties, err := util.RawExtension2Map(&traitValue.Properties)
properties, err := util.RawExtension2Map(traitValue.Properties)
if err != nil {
return nil, errors.Errorf("fail to parse properties of %s for %s", traitValue.Type, comp.Name)
}
@@ -335,7 +335,7 @@ func (p *Parser) ParseWorkloadFromRevision(comp common.ApplicationComponent, app
workload.ExternalRevision = comp.ExternalRevision
for _, traitValue := range comp.Traits {
properties, err := util.RawExtension2Map(&traitValue.Properties)
properties, err := util.RawExtension2Map(traitValue.Properties)
if err != nil {
return nil, errors.Errorf("fail to parse properties of %s for %s", traitValue.Type, comp.Name)
}

Some files were not shown because too many files have changed in this diff Show More