Compare commits

...

30 Commits

Author SHA1 Message Date
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
github-actions[bot]
c66f5f103f Fix: fix depends on app built-in step (#2435)
(cherry picked from commit b126cf1a34)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-09 18:52:57 +08:00
github-actions[bot]
e6779f6906 [Backport release-1.1] Fix: fix apiserver 1.1.3 not available bug (#2431)
* Fix: fix apiserver 1.1.3 not available bug

(cherry picked from commit a0b0c032d4)

* Feat: change apiserver image repository

(cherry picked from commit d417e9014a)

* Fix(helm chart): fix startup args for apiserver

(cherry picked from commit fa759459af)

Co-authored-by: barnettZQG <yiyun.pro>
2021-10-09 16:52:05 +08:00
github-actions[bot]
a48b74d4be Feat: add secure tls for cluster-gateway (#2428)
(cherry picked from commit cf4d508189)

Co-authored-by: Yin Da <yd219913@alibaba-inc.com>
2021-10-09 15:24:41 +08:00
github-actions[bot]
2da80af3c4 [Backport release-1.1] Feat: add apply raw built in workflow steps (#2424)
* Feat: add apply raw built in workflow steps

(cherry picked from commit be68f388a2)

* Feat: add apply raw example

(cherry picked from commit 8243b6d916)

* Fix: change the name to apply object

(cherry picked from commit b996a04862)

* Fix: example server name

(cherry picked from commit 2341bf0f5a)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2021-10-09 12:21:28 +08:00
github-actions[bot]
7bf5e17262 Chore(deps): bump github.com/containerd/containerd from 1.4.8 to 1.4.11 (#2422)
(cherry picked from commit 8450b4153e)

Co-authored-by: 天元 <jianbo.sjb@alibaba-inc.com>
2021-10-09 11:12:08 +08:00
Zheng Xi Zhou
53a6d54b73 Fix: support terraform/provider-azure addon (#2402) (#2418)
Also added some componentdefinitions for Azure cloud resource
2021-10-08 19:14:59 +08:00
github-actions[bot]
bcd072507b [Backport release-1.1] Feat: multicluster support ServiceAccountToken (#2415)
* Feat: support serviceaccount in multicluster

(cherry picked from commit 6168af830e)

* Fix: add compatibility & support sa

(cherry picked from commit 0193d74dfa)

* Fix: add multicluster sa test

(cherry picked from commit d445d29649)

* Fix: add test for upgrade func

(cherry picked from commit f4ba55b540)

* Style: format

(cherry picked from commit 0a8645c30c)

Co-authored-by: Yin Da <yd219913@alibaba-inc.com>
2021-10-08 15:55:12 +08:00
qiaozp
ae075e6cb6 Refactor(cli): Refactor vela env, deprecate vela config (#2037) (#2413)
* Refactor(cli): cut env to namespace, use application to save

Signed-off-by: qiaozp <chivalry.pp@gmail.com>

* Fix: test

* Fix: typo

(cherry picked from commit a574fc0fbf)
2021-10-08 14:44:30 +08:00
Somefive
b2127ee4fa Feat: use #ApplyComponent for EnvBinding (#2382) (#2414)
* Feat: use #ApplyComponent in EnvBinding

* Fix: application test compRev control by resourcetracker

* Fix: add more detail in error info
2021-10-08 14:43:44 +08:00
242 changed files with 19802 additions and 19124 deletions

View File

@@ -17,9 +17,13 @@ limitations under the License.
package common
import (
"encoding/json"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
types "github.com/oam-dev/terraform-controller/api/types/crossplane-runtime"
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
@@ -109,6 +113,9 @@ type Terraform struct {
// +kubebuilder:default:=hcl
// +kubebuilder:validation:Enum:=hcl;json;remote
Type string `json:"type,omitempty"`
// ProviderReference specifies the reference to Provider
ProviderReference *types.Reference `json:"providerRef,omitempty"`
}
// A WorkloadTypeDescriptor refer to a Workload Type
@@ -369,7 +376,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
@@ -379,7 +386,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"`
@@ -452,3 +459,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

@@ -21,7 +21,9 @@ limitations under the License.
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.
@@ -92,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))
@@ -163,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.
@@ -403,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
@@ -439,7 +469,7 @@ func (in *Schematic) DeepCopyInto(out *Schematic) {
if in.Terraform != nil {
in, out := &in.Terraform, &out.Terraform
*out = new(Terraform)
**out = **in
(*in).DeepCopyInto(*out)
}
}
@@ -529,6 +559,11 @@ func (in *SubStepsStatus) DeepCopy() *SubStepsStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Terraform) DeepCopyInto(out *Terraform) {
*out = *in
if in.ProviderReference != nil {
in, out := &in.ProviderReference, &out.ProviderReference
*out = new(crossplane_runtime.Reference)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Terraform.

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

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

@@ -47,12 +47,13 @@ const (
StatusStaging = "Staging"
)
// EnvMeta stores the info for app environment
// Config contains key/value pairs
type Config map[string]string
// EnvMeta stores the namespace for app environment
type EnvMeta struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Email string `json:"email,omitempty"`
Domain string `json:"domain,omitempty"`
Current string `json:"current,omitempty"`
}
@@ -84,4 +85,5 @@ var DefaultFilterAnnots = []string{
oam.AnnotationInplaceUpgrade,
oam.AnnotationFilterLabelKeys,
oam.AnnotationFilterAnnotationKeys,
oam.AnnotationLastAppliedConfiguration,
}

View File

@@ -188,6 +188,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -454,6 +468,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -193,6 +193,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -440,6 +454,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

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,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -1621,6 +1635,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -1908,6 +1936,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -3318,6 +3360,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -3600,6 +3656,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -3971,6 +4041,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -4221,6 +4305,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -4487,6 +4585,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -179,6 +179,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -449,6 +463,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -222,6 +222,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -492,6 +506,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -755,6 +783,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -999,6 +1041,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -151,6 +151,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -188,6 +188,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -454,6 +468,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

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,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -193,6 +193,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -440,6 +454,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

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,8 +1,8 @@
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
@@ -10,50 +10,46 @@ data:
name: terraform-provider-alibaba
namespace: default
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-provider-secret
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 Azure
addons.oam.dev/name: terraform/provider-azure
name: terraform-provider-azure
namespace: default
spec:
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
source: Secret
provider: azure
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 Azure
addons.oam.dev/name: terraform/provider-azure
labels:
addons.oam.dev/type: terraform-provider-azure
name: terraform-provider-azure
namespace: {{.Values.systemDefinitionNamespace}}

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,366 +10,485 @@ 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
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.1.19
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: |
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 = 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

@@ -32,12 +32,28 @@ spec:
- "--secure-port={{ .Values.multicluster.clusterGateway.port }}"
- "--secret-namespace={{ .Release.Namespace }}"
- "--feature-gates=APIPriorityAndFairness=false"
{{ if .Values.multicluster.clusterGateway.secureTLS.enabled }}
- "--cert-dir={{ .Values.multicluster.clusterGateway.secureTLS.certPath }}"
{{ end }}
image: {{ .Values.multicluster.clusterGateway.image.repository }}:{{ .Values.multicluster.clusterGateway.image.tag }}
imagePullPolicy: {{ .Values.multicluster.clusterGateway.image.pullPolicy }}
resources:
{{- toYaml .Values.multicluster.clusterGateway.resources | nindent 12 }}
ports:
- containerPort: {{ .Values.multicluster.clusterGateway.port }}
{{ if .Values.multicluster.clusterGateway.secureTLS.enabled }}
volumeMounts:
- mountPath: {{ .Values.multicluster.clusterGateway.secureTLS.certPath }}
name: tls-cert-vol
readOnly: true
{{- end }}
{{ if .Values.multicluster.clusterGateway.secureTLS.enabled }}
volumes:
- name: tls-cert-vol
secret:
defaultMode: 420
secretName: {{ template "kubevela.fullname" . }}-cluster-gateway-tls
{{ end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
@@ -84,5 +100,92 @@ spec:
namespace: {{ .Release.Namespace }}
port: {{ .Values.multicluster.clusterGateway.port }}
versionPriority: 10
insecureSkipTLSVerify: true
insecureSkipTLSVerify: {{ not .Values.multicluster.clusterGateway.secureTLS.enabled }}
{{ if .Values.multicluster.clusterGateway.secureTLS.enabled }}
caBundle: Cg==
{{ end }}
{{ end }}
---
{{ if and .Values.multicluster.enabled .Values.multicluster.clusterGateway.secureTLS.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-create
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
labels:
app: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-create
{{- include "kubevela.labels" . | nindent 4 }}
spec:
{{- if .Capabilities.APIVersions.Has "batch/v1alpha1" }}
# Alpha feature since k8s 1.12
ttlSecondsAfterFinished: 0
{{- end }}
template:
metadata:
name: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-create
labels:
app: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-create
{{- include "kubevela.labels" . | nindent 8 }}
spec:
containers:
- name: create
image: {{ .Values.admissionWebhooks.patch.image.repository }}:{{ .Values.admissionWebhooks.patch.image.tag }}
imagePullPolicy: {{ .Values.admissionWebhooks.patch.image.pullPolicy }}
args:
- create
- --host={{ .Release.Name }}-cluster-gateway-service,{{ .Release.Name }}-cluster-gateway-service.{{ .Release.Namespace }}.svc
- --namespace={{ .Release.Namespace }}
- --secret-name={{ template "kubevela.fullname" . }}-cluster-gateway-tls
- --key-name=apiserver.key
- --cert-name=apiserver.crt
restartPolicy: OnFailure
serviceAccountName: {{ template "kubevela.fullname" . }}-admission
securityContext:
runAsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
{{ end }}
---
{{ if and .Values.multicluster.enabled .Values.multicluster.clusterGateway.secureTLS.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-patch
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
labels:
app: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-patch
{{- include "kubevela.labels" . | nindent 4 }}
spec:
{{- if .Capabilities.APIVersions.Has "batch/v1alpha1" }}
# Alpha feature since k8s 1.12
ttlSecondsAfterFinished: 0
{{- end }}
template:
metadata:
name: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-patch
labels:
app: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-patch
{{- include "kubevela.labels" . | nindent 8 }}
spec:
containers:
- name: patch
image: {{ .Values.multicluster.clusterGateway.image.repository }}:{{ .Values.multicluster.clusterGateway.image.tag }}
imagePullPolicy: {{ .Values.multicluster.clusterGateway.image.pullPolicy }}
command:
- /patch
args:
- --secret-namespace={{ .Release.Namespace }}
- --secret-name={{ template "kubevela.fullname" . }}-cluster-gateway-tls
restartPolicy: OnFailure
serviceAccountName: {{ include "kubevela.serviceAccountName" . }}
securityContext:
runAsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
{{ end }}

View File

@@ -0,0 +1,22 @@
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
# Definition source cue file: vela-templates/definitions/internal/apply-object.cue
apiVersion: core.oam.dev/v1beta1
kind: WorkflowStepDefinition
metadata:
annotations:
definition.oam.dev/description: Apply raw kubernetes objects for your workflow steps
name: apply-object
namespace: {{.Values.systemDefinitionNamespace}}
spec:
schematic:
cue:
template: |
import (
"vela/op"
)
apply: op.#Apply & {
value: parameter
}
parameter: {}

View File

@@ -27,7 +27,7 @@ spec:
}
}
load: op.#Steps & {
if dependsOn.err != _|_ {
if dependsOn.err != _|_ && dependsOn.value == _|_ {
configMap: op.#Read & {
value: {
apiVersion: "v1"
@@ -43,18 +43,16 @@ spec:
yaml.Unmarshal(configMap.value.data[parameter.name])
}
}
}
if dependsOn.err == _|_ {
apply: op.#Apply & {
value: {
dependsOn.value
}
wait: op.#ConditionalWait & {
continue: load.apply.value.status.status == "running"
}
}
if dependsOn.value != _|_ {
wait: op.#ConditionalWait & {
continue: dependsOn.value.status.status == "running"
}
}
}
phase: load.apply.value.status.status
wait: op.#ConditionalWait & {
continue: phase == "running"
}
parameter: {
// +usage=Specify the name of the dependent Application

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

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

View File

@@ -0,0 +1,58 @@
# 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
}
}
}
}
}
if parameter.apiVersion != _|_ || parameter.kind != _|_ {
op.#Read & {
value: {
apiVersion: parameter.apiVersion
kind: parameter.kind
metadata: {
name: parameter.name
if parameter.namespace != _|_ {
namespace: parameter.namespace
}
}
}
}
}
}
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
}

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]
@@ -121,19 +134,61 @@ spec:
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

@@ -29,9 +29,9 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
args:
- "apiserver"
- "--bind-addr=0.0.0.0:{{ .Values.apiServer.port }}"
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ quote .Values.image.pullPolicy }}
- "--port={{ .Values.apiServer.port }}"
image: {{ .Values.apiserverImage.repository }}:{{ .Values.apiserverImage.tag }}
imagePullPolicy: {{ quote .Values.apiserverImage.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
ports:

View File

@@ -11,6 +11,10 @@ image:
repository: oamdev/vela-core
tag: latest
pullPolicy: Always
apiserverImage:
repository: oamdev/vela-apiserver
tag: v1.1.2
pullPolicy: Always
imagePullSecrets: []
nameOverride: ""
@@ -69,7 +73,7 @@ admissionWebhooks:
enabled: true
image:
repository: oamdev/kube-webhook-certgen
tag: v2.2
tag: v2.3
pullPolicy: IfNotPresent
affinity: {}
tolerations: []
@@ -118,9 +122,12 @@ multicluster:
port: 9443
image:
repository: oamdev/cluster-gateway
tag: v1.1.1
tag: v1.1.3
pullPolicy: Always
resources:
limits:
cpu: 100m
memory: 200Mi
memory: 200Mi
secureTLS:
enabled: true
certPath: /etc/k8s-cluster-gateway-certs

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,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -1621,6 +1635,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -1908,6 +1936,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -3318,6 +3360,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -3600,6 +3656,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -3971,6 +4041,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -4221,6 +4305,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -4487,6 +4585,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -222,6 +222,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -492,6 +506,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -755,6 +783,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -999,6 +1041,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -151,6 +151,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -188,6 +188,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -454,6 +468,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -148,6 +148,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -193,6 +193,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -440,6 +454,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -32,12 +32,28 @@ spec:
- "--secure-port={{ .Values.multicluster.clusterGateway.port }}"
- "--secret-namespace={{ .Release.Namespace }}"
- "--feature-gates=APIPriorityAndFairness=false"
{{ if .Values.multicluster.clusterGateway.secureTLS.enabled }}
- "--cert-dir={{ .Values.multicluster.clusterGateway.secureTLS.certPath }}"
{{ end }}
image: {{ .Values.multicluster.clusterGateway.image.repository }}:{{ .Values.multicluster.clusterGateway.image.tag }}
imagePullPolicy: {{ .Values.multicluster.clusterGateway.image.pullPolicy }}
resources:
{{- toYaml .Values.multicluster.clusterGateway.resources | nindent 12 }}
ports:
- containerPort: {{ .Values.multicluster.clusterGateway.port }}
{{ if .Values.multicluster.clusterGateway.secureTLS.enabled }}
volumeMounts:
- mountPath: {{ .Values.multicluster.clusterGateway.secureTLS.certPath }}
name: tls-cert-vol
readOnly: true
{{- end }}
{{ if .Values.multicluster.clusterGateway.secureTLS.enabled }}
volumes:
- name: tls-cert-vol
secret:
defaultMode: 420
secretName: {{ template "kubevela.fullname" . }}-cluster-gateway-tls
{{ end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
@@ -50,9 +66,9 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{ end }}
{{ end }}
---
{{ if .Values.multicluster.enabled }}
{{ if .Values.multicluster.enabled }}
apiVersion: v1
kind: Service
metadata:
@@ -65,9 +81,9 @@ spec:
- protocol: TCP
port: {{ .Values.multicluster.clusterGateway.port }}
targetPort: {{ .Values.multicluster.clusterGateway.port }}
{{ end }}
{{ end }}
---
{{ if .Values.multicluster.enabled }}
{{ if .Values.multicluster.enabled }}
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
@@ -84,5 +100,92 @@ spec:
namespace: {{ .Release.Namespace }}
port: {{ .Values.multicluster.clusterGateway.port }}
versionPriority: 10
insecureSkipTLSVerify: true
{{ end }}
insecureSkipTLSVerify: {{ not .Values.multicluster.clusterGateway.secureTLS.enabled }}
{{ if .Values.multicluster.clusterGateway.secureTLS.enabled }}
caBundle: Cg==
{{ end }}
{{ end }}
---
{{ if and .Values.multicluster.enabled .Values.multicluster.clusterGateway.secureTLS.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-create
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
labels:
app: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-create
{{- include "kubevela.labels" . | nindent 4 }}
spec:
{{- if .Capabilities.APIVersions.Has "batch/v1alpha1" }}
# Alpha feature since k8s 1.12
ttlSecondsAfterFinished: 0
{{- end }}
template:
metadata:
name: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-create
labels:
app: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-create
{{- include "kubevela.labels" . | nindent 8 }}
spec:
containers:
- name: create
image: {{ .Values.admissionWebhooks.patch.image.repository }}:{{ .Values.admissionWebhooks.patch.image.tag }}
imagePullPolicy: {{ .Values.admissionWebhooks.patch.image.pullPolicy }}
args:
- create
- --host={{ .Release.Name }}-cluster-gateway-service,{{ .Release.Name }}-cluster-gateway-service.{{ .Release.Namespace }}.svc
- --namespace={{ .Release.Namespace }}
- --secret-name={{ template "kubevela.fullname" . }}-cluster-gateway-tls
- --key-name=apiserver.key
- --cert-name=apiserver.crt
restartPolicy: OnFailure
serviceAccountName: {{ template "kubevela.fullname" . }}-admission
securityContext:
runAsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
{{ end }}
---
{{ if and .Values.multicluster.enabled .Values.multicluster.clusterGateway.secureTLS.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-patch
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
labels:
app: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-patch
{{- include "kubevela.labels" . | nindent 4 }}
spec:
{{- if .Capabilities.APIVersions.Has "batch/v1alpha1" }}
# Alpha feature since k8s 1.12
ttlSecondsAfterFinished: 0
{{- end }}
template:
metadata:
name: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-patch
labels:
app: {{ template "kubevela.fullname" . }}-cluster-gateway-tls-secret-patch
{{- include "kubevela.labels" . | nindent 8 }}
spec:
containers:
- name: patch
image: {{ .Values.multicluster.clusterGateway.image.repository }}:{{ .Values.multicluster.clusterGateway.image.tag }}
imagePullPolicy: {{ .Values.multicluster.clusterGateway.image.pullPolicy }}
command:
- /patch
args:
- --secret-namespace={{ .Release.Namespace }}
- --secret-name={{ template "kubevela.fullname" . }}-cluster-gateway-tls
restartPolicy: OnFailure
serviceAccountName: {{ include "kubevela.serviceAccountName" . }}
securityContext:
runAsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
{{ end }}

View File

@@ -0,0 +1,22 @@
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
# Definition source cue file: vela-templates/definitions/internal/apply-object.cue
apiVersion: core.oam.dev/v1beta1
kind: WorkflowStepDefinition
metadata:
annotations:
definition.oam.dev/description: Apply raw kubernetes objects for your workflow steps
name: apply-object
namespace: {{.Values.systemDefinitionNamespace}}
spec:
schematic:
cue:
template: |
import (
"vela/op"
)
apply: op.#Apply & {
value: parameter
}
parameter: {}

View File

@@ -27,7 +27,7 @@ spec:
}
}
load: op.#Steps & {
if dependsOn.err != _|_ {
if dependsOn.err != _|_ && dependsOn.value == _|_ {
configMap: op.#Read & {
value: {
apiVersion: "v1"
@@ -43,18 +43,16 @@ spec:
yaml.Unmarshal(configMap.value.data[parameter.name])
}
}
}
if dependsOn.err == _|_ {
apply: op.#Apply & {
value: {
dependsOn.value
}
wait: op.#ConditionalWait & {
continue: load.apply.value.status.status == "running"
}
}
if dependsOn.value != _|_ {
wait: op.#ConditionalWait & {
continue: dependsOn.value.status.status == "running"
}
}
}
phase: load.apply.value.status.status
wait: op.#ConditionalWait & {
continue: phase == "running"
}
parameter: {
// +usage=Specify the name of the dependent Application

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

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

View File

@@ -0,0 +1,58 @@
# 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
}
}
}
}
}
if parameter.apiVersion != _|_ || parameter.kind != _|_ {
op.#Read & {
value: {
apiVersion: parameter.apiVersion
kind: parameter.kind
metadata: {
name: parameter.name
if parameter.namespace != _|_ {
namespace: parameter.namespace
}
}
}
}
}
}
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
}

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]
@@ -121,19 +134,61 @@ spec:
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: []
@@ -117,9 +117,12 @@ multicluster:
port: 9443
image:
repository: oamdev/cluster-gateway
tag: v1.1.1
tag: v1.1.3
pullPolicy: Always
resources:
limits:
cpu: 100m
memory: 200Mi
memory: 200Mi
secureTLS:
enabled: true
certPath: /etc/k8s-cluster-gateway-certs

View File

@@ -30,6 +30,7 @@ import (
"strings"
"time"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -206,7 +207,7 @@ func main() {
LeaseDuration: &leaseDuration,
RenewDeadline: &renewDeadline,
RetryPeriod: &retryPeriod,
ClientDisableCacheFor: []client.Object{&v1beta1.ResourceTracker{}},
ClientDisableCacheFor: []client.Object{&v1beta1.ResourceTracker{}, &appsv1.ControllerRevision{}},
})
if err != nil {
klog.ErrorS(err, "Unable to create a controller manager")
@@ -325,8 +326,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,39 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: server-with-pvc
namespace: default
spec:
components:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
port: 8000
volumes:
- name: "my-pvc"
type: "pvc"
mountPath: "/test"
claimName: "myclaim"
workflow:
steps:
- 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
- name: apply-server
type: apply-component
properties:
component: express-server

View File

@@ -1,56 +0,0 @@
apiVersion: core.oam.dev/v1beta1
kind: WorkflowStepDefinition
metadata:
name: apply-component
spec:
schematic:
cue:
template: |
import ("vela/op")
parameter: {
component: string
prefixIP?: string
}
load: op.#Load
// apply workload to kubernetes cluster
apply: op.#ApplyComponent & {
value: load.value[parameter.component]
}
// wait until workload.status equal "Running"
wait: op.#ConditionalWait & {
continue: apply.output.status.phase =="Running"
}
// export podIP
myIP: apply.output.status.podIP
---
apiVersion: core.oam.dev/v1beta1
kind: WorkflowStepDefinition
metadata:
name: apply-remaining
spec:
schematic:
cue:
template: |
import ("vela/op")
parameter: {
exceptions?: [componentName=string]: {
// skipApplyWorkload indicates whether to skip apply the workload resource
skipApplyWorkload: *true | bool
// skipAllTraits indicates to skip apply all resources of the traits.
// If this is true, skipApplyTraits will be ignored
skipAllTraits: *true| bool
// skipApplyTraits specifies the names of the traits to skip apply
skipApplyTraits: [...string]
}
}
apply: op.#ApplyRemaining & {
parameter
}

View File

@@ -0,0 +1,26 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: kruise
namespace: vela-system
spec:
components:
- name: kruise
type: helm
properties:
branch: master
chart: ./charts/kruise/v0.9.0
version: "*"
repoType: git
url: https://github.com/openkruise/kruise
workflow:
steps:
- name: check-flux
type: depends-on-app
properties:
name: fluxcd
namespace: vela-system
- name: apply-kruise
type: apply-component
properties:
component: kruise

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

@@ -111,7 +111,7 @@ var ApplicationExecContext = func(context string, appName string) bool {
var ApplicationPortForwardContext = func(context string, appName string) bool {
return ginkgo.Context(context, func() {
ginkgo.It("should get output of portward successfully", func() {
ginkgo.It("should get output of port-forward successfully", func() {
cli := fmt.Sprintf("vela port-forward %s 80:80 ", appName)
output, err := e2e.ExecAndTerminate(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
@@ -128,14 +128,6 @@ var ApplicationInitIntercativeCliContext = func(context string, appName string,
data := []struct {
q, a string
}{
{
q: "What is the domain of your application service (optional): ",
a: "testdomain",
},
{
q: "What is your email (optional, used to generate certification): ",
a: "test@mail",
},
{
q: "What would you like to name your application (required): ",
a: appName,

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

View File

@@ -33,7 +33,7 @@ var (
cli := fmt.Sprintf("vela env init %s", envName)
output, err := Exec(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
expectedOutput := fmt.Sprintf("environment %s created,", envName)
expectedOutput := fmt.Sprintf("environment %s created", envName)
gomega.Expect(output).To(gomega.ContainSubstring(expectedOutput))
})
})
@@ -45,7 +45,7 @@ var (
cli := fmt.Sprintf("vela env init %s --namespace %s", envName, namespace)
output, err := Exec(cli)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
expectedOutput := fmt.Sprintf("environment %s created,", envName)
expectedOutput := fmt.Sprintf("environment %s created", envName)
gomega.Expect(output).To(gomega.ContainSubstring(expectedOutput))
})
})

2
e2e/env/env_test.go vendored
View File

@@ -32,7 +32,7 @@ var _ = ginkgo.Describe("Env", func() {
e2e.EnvInitContext("env init", envName)
e2e.EnvInitContext("env init another one", envName2)
e2e.EnvShowContext("env show", envName)
e2e.EnvSetContext("env sw", envName)
e2e.EnvSetContext("env set", envName)
ginkgo.Context("env list", func() {
ginkgo.It("should list all envs", func() {

6
go.mod
View File

@@ -10,7 +10,7 @@ require (
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869
github.com/briandowns/spinner v1.11.1
github.com/containerd/containerd v1.4.8
github.com/containerd/containerd v1.4.11
github.com/coreos/prometheus-operator v0.41.1
github.com/crossplane/crossplane-runtime v0.14.1-0.20210722005935-0b469fcc77cd
github.com/davecgh/go-spew v1.1.1
@@ -32,9 +32,9 @@ require (
github.com/imdario/mergo v0.3.12
github.com/kyokomi/emoji v2.2.4+incompatible
github.com/mitchellh/hashstructure/v2 v2.0.1
github.com/oam-dev/cluster-gateway v0.0.0-20210907072424-2f8720b116f8
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.0
github.com/oam-dev/terraform-controller v0.2.4
github.com/olekukonko/tablewriter v0.0.5
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.16.0

17
go.sum
View File

@@ -307,8 +307,8 @@ github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on
github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ=
github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
github.com/containerd/containerd v1.4.4/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
github.com/containerd/containerd v1.4.8 h1:H0wkS4AbVKTg9vyvBdCBrxoax8AMObKbNz9Fl2N0i4Y=
github.com/containerd/containerd v1.4.8/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
github.com/containerd/containerd v1.4.11 h1:QCGOUN+i70jEEL/A6JVIbhy4f4fanzAzSR4kNG7SlcE=
github.com/containerd/containerd v1.4.11/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7 h1:6ejg6Lkk8dskcM7wQ28gONkukbQkM4qpj4RnYbpFzrI=
github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y=
@@ -580,7 +580,6 @@ github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh
github.com/go-openapi/swag v0.19.6/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
github.com/go-openapi/swag v0.19.11/go.mod h1:Uc0gKkdR+ojzsEpjh39QChyu92vPgIr72POcgHMAgSY=
github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng=
github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-openapi/validate v0.17.2/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4=
@@ -1201,14 +1200,14 @@ github.com/nishanths/predeclared v0.2.1/go.mod h1:HvkGJcA3naj4lOwnFXFDkFxVtSqQMB
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/oam-dev/cluster-gateway v0.0.0-20210907072424-2f8720b116f8 h1:aTfUhMr6DC+jTiBvCzv+fcgqBvIoGLvrnmXjIUgib7I=
github.com/oam-dev/cluster-gateway v0.0.0-20210907072424-2f8720b116f8/go.mod h1:ZB7/tubU3MtdQ9bzQjksjO8UK+9e0Wrw3HAqKdY/lZY=
github.com/oam-dev/cluster-gateway v1.1.2 h1:sxC8Uyx/d3Yu8nIFSz31i+4JKhJfDAS9XVIPEWa1y+Q=
github.com/oam-dev/cluster-gateway v1.1.2/go.mod h1:EjPUZwTYBe+gFtPV/yGohLE19fDr3CUg4tfSRY72fkM=
github.com/oam-dev/stern v1.13.0-alpha h1:EVjM8Qvh6LssB6t4RZrjf9DtCq1cz+/cy6OF7fpy9wk=
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.0 h1:GBQ+CvXtY9bcRkwGaPYHbYFkbVWzDExc05hz0NL0rqs=
github.com/oam-dev/terraform-controller v0.2.0/go.mod h1:wd4rnqnJzz274Sg1/qoeIhBx1rvTZ/ECzXoMff0ucR0=
github.com/oam-dev/terraform-controller v0.2.4 h1:yGgIzm2EWNghuRutnChrRfhMjdlU/jE/cLfBizCgE24=
github.com/oam-dev/terraform-controller v0.2.4/go.mod h1:wd4rnqnJzz274Sg1/qoeIhBx1rvTZ/ECzXoMff0ucR0=
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=
@@ -2523,8 +2522,8 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyz
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.19/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22 h1:fmRfl9WJ4ApJn7LxNuED4m0t18qivVQOxP6aAYG9J6c=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
sigs.k8s.io/apiserver-runtime v1.0.3-0.20210906132642-810075b08b5f h1:RM+QxWPIZi3mo3i4fiUSvyFELyKr7jjMSJ5EEmt+i6M=
sigs.k8s.io/apiserver-runtime v1.0.3-0.20210906132642-810075b08b5f/go.mod h1:ynhMgoDTl6cihO5OpeV95iG+3bzKfHwWQU2VSbmoNmk=
sigs.k8s.io/apiserver-runtime v1.0.3-0.20210913073608-0663f60bfee2 h1:c6RYHA1wUg9IEsfjnxg0WsPwvDC2Qw2eryXKXgSEF1c=
sigs.k8s.io/apiserver-runtime v1.0.3-0.20210913073608-0663f60bfee2/go.mod h1:gvPfh5FX3Wi3kIRpkh7qvY0i/DQl3SDpRtvqMGZE3Vo=
sigs.k8s.io/controller-runtime v0.6.0/go.mod h1:CpYf5pdNY/B352A1TFLAS2JVSlnGQ5O2cftPHndTroo=
sigs.k8s.io/controller-runtime v0.6.2/go.mod h1:vhcq/rlnENJ09SIRp3EveTaZ0yqH526hjf9iJdbUJ/E=
sigs.k8s.io/controller-runtime v0.9.2/go.mod h1:TxzMCHyEUpaeuOiZx/bIdc2T81vfs/aKdvJt9wuu0zk=

View File

@@ -1232,6 +1232,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -1621,6 +1635,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -1908,6 +1936,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -3318,6 +3360,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -3600,6 +3656,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -3971,6 +4041,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -4221,6 +4305,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -4487,6 +4585,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -179,6 +179,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -449,6 +463,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -222,6 +222,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -492,6 +506,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -755,6 +783,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -999,6 +1041,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference
to Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -151,6 +151,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -188,6 +188,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -454,6 +468,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

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,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -193,6 +193,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration
@@ -440,6 +454,20 @@ spec:
configuration:
description: Configuration is Terraform Configuration
type: string
providerRef:
description: ProviderReference specifies the reference to
Provider
properties:
name:
description: Name of the referenced object.
type: string
namespace:
default: default
description: Namespace of the secret.
type: string
required:
- name
type: object
type:
default: hcl
description: Type specifies which Terraform configuration

View File

@@ -649,7 +649,7 @@ func generateComponentFromKubeModule(wl *Workload, appName, revision, ns string)
}
func generateTerraformConfigurationWorkload(wl *Workload, ns string) (*unstructured.Unstructured, error) {
if wl.FullTemplate.Terraform.Configuration == "" {
if wl.FullTemplate == nil || wl.FullTemplate.Terraform == nil || wl.FullTemplate.Terraform.Configuration == "" {
return nil, errors.New(errTerraformConfigurationIsNotSet)
}
params, err := json.Marshal(wl.Params)
@@ -671,6 +671,10 @@ func generateTerraformConfigurationWorkload(wl *Workload, ns string) (*unstructu
configuration.Spec.Remote = wl.FullTemplate.Terraform.Configuration
}
if wl.FullTemplate.Terraform.ProviderReference != nil {
configuration.Spec.ProviderReference = wl.FullTemplate.Terraform.ProviderReference
}
// 1. parse writeConnectionSecretToRef
if err := json.Unmarshal(params, &configuration.Spec); err != nil {
return nil, errors.Wrap(err, errFailToConvertTerraformComponentProperties)
@@ -704,7 +708,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/",
}),
},
@@ -909,6 +909,7 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) {
hcl string
remote string
params map[string]interface{}
providerRef *terraformtypes.Reference
}
type want struct {
@@ -967,7 +968,18 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) {
params: badParam,
hcl: "abc",
},
want: want{err: errors.Wrap(badParamMarshalError, errFailToConvertTerraformComponentProperties)}},
want: want{err: errors.Wrap(badParamMarshalError, errFailToConvertTerraformComponentProperties)},
},
"terraform workload has a provider reference": {
args: args{
params: badParam,
hcl: "abc",
providerRef: &terraformtypes.Reference{Name: "azure", Namespace: "default"},
},
want: want{err: errors.Wrap(badParamMarshalError, errFailToConvertTerraformComponentProperties)},
},
}
for tcName, tc := range testcases {
@@ -1027,6 +1039,9 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) {
WriteConnectionSecretToReference: tc.args.writeConnectionSecretToRef,
}
}
if tc.args.providerRef != nil {
template.Terraform.ProviderReference = tc.args.providerRef
}
wl := &Workload{
FullTemplate: template,
@@ -1046,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

@@ -1,96 +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 config
import (
"context"
"strings"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)
const (
// Splitter is a splitter for configmap name generation
Splitter = "-"
// TypeConfigMap defines the type of Configmap
TypeConfigMap = "configmap"
)
// ToConfigMap will get the data of the store and upload to configmap.
// Serverside Application controller can only use the config in appfile context by configmap.
func ToConfigMap(s Store, name, envName string, configData map[string]string) (*v1.ConfigMap, error) {
namespace, err := s.Namespace(envName)
if err != nil {
return nil, err
}
var cm = v1.ConfigMap{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1",
Kind: "ConfigMap",
},
}
cm.SetName(name)
cm.SetNamespace(namespace)
cm.Data = configData
return &cm, nil
}
// GenConfigMapName is a fixed way to name the configmap name for appfile config
func GenConfigMapName(appName, serviceName, configName string) string {
return strings.Join([]string{"kubevela", appName, serviceName, configName}, Splitter)
}
var _ Store = &Configmap{}
// Configmap is the configmap implementation of config store
type Configmap struct {
Client client.Client
}
// GetConfigData will get config data from configmap
func (f *Configmap) GetConfigData(name, envName string) ([]map[string]string, error) {
namespace, err := f.Namespace(envName)
if err != nil {
return nil, err
}
var cm v1.ConfigMap
err = f.Client.Get(context.Background(), client.ObjectKey{Name: name, Namespace: namespace}, &cm)
if err != nil {
return nil, err
}
var data []map[string]string
for k, v := range cm.Data {
data = append(data, EncodeConfigFormat(k, v))
}
return data, nil
}
// Namespace returns the namespace of the config store from env
func (f *Configmap) Namespace(envName string) (string, error) {
// TODO(wonderflow): now we regard env as namespace, it should be fixed when env is store serverside as configmap
return envName, nil
}
// Type returns the type of the config store
func (Configmap) Type() string {
return TypeConfigMap
}

View File

@@ -1,65 +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 config
import (
"bufio"
"bytes"
"github.com/oam-dev/kubevela/pkg/utils/config"
env2 "github.com/oam-dev/kubevela/pkg/utils/env"
)
// TypeLocal defines the local config store type
const TypeLocal = "local"
// Local is the local implementation of config store
type Local struct{}
var _ Store = &Local{}
// GetConfigData will return config data from local
func (l *Local) GetConfigData(configName, envName string) ([]map[string]string, error) {
cfgData, err := config.ReadConfig(envName, configName)
if err != nil {
return nil, err
}
scanner := bufio.NewScanner(bytes.NewReader(cfgData))
var data []map[string]string
for scanner.Scan() {
k, v, err := config.ReadConfigLine(scanner.Text())
if err != nil {
return nil, err
}
data = append(data, EncodeConfigFormat(k, v))
}
return data, nil
}
// Namespace return namespace from env
func (l *Local) Namespace(envName string) (string, error) {
env, err := env2.GetEnvByName(envName)
if err != nil {
return "", err
}
return env.Namespace, nil
}
// Type returns the type of this config store implementation
func (l *Local) Type() string {
return TypeLocal
}

View File

@@ -1,76 +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 config
import "errors"
// Store will get config data
type Store interface {
GetConfigData(configName, envName string) ([]map[string]string, error)
Type() string
Namespace(envName string) (string, error)
}
// TypeFake is a fake type
const TypeFake = "fake"
var _ Store = &Fake{}
// Fake is a fake implementation of config store, help for test
type Fake struct {
Data []map[string]string
}
// GetConfigData get data
func (f *Fake) GetConfigData(_ string, _ string) ([]map[string]string, error) {
return f.Data, nil
}
// Type return the type
func (Fake) Type() string {
return TypeFake
}
// Namespace return the Namespace
func (Fake) Namespace(_ string) (string, error) {
return "", nil
}
// EncodeConfigFormat will encode key-value to config{name: key, value: value} format
func EncodeConfigFormat(key, value string) map[string]string {
return map[string]string{
"name": key,
"value": value,
}
}
// DecodeConfigFormat will decode config{name: key, value: value} format to key-value mode.
func DecodeConfigFormat(data []map[string]string) (map[string]string, error) {
var res = make(map[string]string)
for _, d := range data {
key, ok := d["name"]
if !ok {
return nil, errors.New("invalid data format, no 'name' found")
}
value, ok := d["value"]
if !ok {
return nil, errors.New("invalid data format, no 'value' found")
}
res[key] = value
}
return res, nil
}

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

View File

@@ -23,6 +23,7 @@ import (
"os"
"path/filepath"
"k8s.io/klog/v2"
"sigs.k8s.io/kind/pkg/cluster"
"sigs.k8s.io/kind/pkg/cluster/nodes"
"sigs.k8s.io/kind/pkg/cluster/nodeutils"
@@ -137,7 +138,11 @@ func loadImage(imageTarName string, node nodes.Node) error {
if err != nil {
return errors.Wrap(err, "failed to open image")
}
defer f.Close()
defer func() {
if err := f.Close(); err != nil {
klog.Error(err, "Failed to close file")
}
}()
return nodeutils.LoadImageArchive(node, f)
}

View File

@@ -30,6 +30,7 @@ import (
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
"github.com/oam-dev/kubevela/pkg/controller/utils"
"github.com/oam-dev/kubevela/pkg/oam"
)
@@ -84,7 +85,14 @@ func (c *CloneSetRolloutController) VerifySpec(ctx context.Context) (bool, error
}
// make sure that the updateRevision is different from what we have already done
targetHash := c.cloneSet.Status.UpdateRevision
targetHash, verifyErr := utils.ComputeSpecHash(c.cloneSet.Spec)
if verifyErr != nil {
// do not fail the rollout because we can't compute the hash value for some reason
c.rolloutStatus.RolloutRetry(verifyErr.Error())
// nolint:nilerr
return false, nil
}
if targetHash == c.rolloutStatus.LastAppliedPodTemplateIdentifier {
return false, fmt.Errorf("there is no difference between the source and target, hash = %s", targetHash)
}

View File

@@ -137,14 +137,14 @@ var _ = Describe("cloneset controller", func() {
Expect(consistent).Should(BeFalse())
})
It("there is no difference between the source and target", func() {
It("verify rollout spec hash", func() {
By("Create a CloneSet")
cloneSet.Spec.UpdateStrategy.Paused = true
Expect(k8sClient.Create(ctx, &cloneSet)).Should(Succeed())
By("Verify should fail because the cloneset hash is not computed without kruise controller")
consistent, err := c.VerifySpec(ctx)
Expect(err).Should(Equal(fmt.Errorf("there is no difference between the source and target, hash = ")))
Expect(consistent).Should(BeFalse())
Expect(err).Should(BeNil())
Expect(consistent).Should(BeTrue())
})
It("the cloneset is in the middle of updating", func() {

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