api: add policy and workflow

This commit is contained in:
Hongchao Deng
2021-05-09 18:29:36 -04:00
parent a11ae2f95d
commit ef021c5d2d
12 changed files with 1185 additions and 0 deletions

View File

@@ -50,10 +50,41 @@ type ApplicationComponent struct {
Scopes map[string]string `json:"scopes,omitempty"`
}
// AppPolicy defines a global policy for all components in the app.
type AppPolicy struct {
Type string `json:"type"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
}
// WorkflowStep defines how to execute a workflow step.
type WorkflowStep struct {
Type string `json:"type"`
// The stage is the running stage this workflow runs.
// It could be `pre-render` or `post-render` (default).
Stage string `json:"stage,omitempty"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
}
// ApplicationSpec is the spec of Application
type ApplicationSpec struct {
Components []ApplicationComponent `json:"components"`
// Policies defines the global policies for all components in the app, e.g. security, metrics, gitops,
// multi-cluster placement rules, etc.
// Policies are applied after components are rendered and before workflow steps are executed.
Policies []AppPolicy `json:"policies,omitempty"`
// Workflow defines how to customize the control logic.
// If workflow is specified, Vela won't apply any resource, but provide rendered output in AppRevision.
// Workflow steps are executed in array order, and each step:
// - will have a context in annotation.
// - should mark "finish" phase in status.conditions.
Workflow []WorkflowStep `json:"workflow,omitempty"`
// TODO(wonderflow): we should have application level scopes supported here
// RolloutPlan is the details on how to rollout the resources

View File

@@ -0,0 +1,60 @@
/*
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 v1beta1
import (
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
)
// PolicyDefinitionSpec defines the desired state of PolicyDefinition
type PolicyDefinitionSpec struct {
// Schematic defines the data format and template of the encapsulation of the policy definition
// +optional
Schematic *common.Schematic `json:"schematic,omitempty"`
}
// PolicyDefinitionStatus is the status of PolicyDefinition
type PolicyDefinitionStatus struct {
// ConditionedStatus reflects the observed status of a resource
runtimev1alpha1.ConditionedStatus `json:",inline"`
}
// +kubebuilder:object:root=true
// PolicyDefinition is the Schema for the policydefinitions API
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=policy
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
type PolicyDefinition struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PolicyDefinitionSpec `json:"spec,omitempty"`
Status PolicyDefinitionStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// PolicyDefinitionList contains a list of PolicyDefinition
type PolicyDefinitionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PolicyDefinition `json:"items"`
}

View File

@@ -0,0 +1,60 @@
/*
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 v1beta1
import (
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
)
// WorkflowStepDefinitionSpec defines the desired state of WorkflowStepDefinition
type WorkflowStepDefinitionSpec struct {
// Schematic defines the data format and template of the encapsulation of the workflow step definition
// +optional
Schematic *common.Schematic `json:"schematic,omitempty"`
}
// WorkflowStepDefinitionStatus is the status of WorkflowStepDefinition
type WorkflowStepDefinitionStatus struct {
// ConditionedStatus reflects the observed status of a resource
runtimev1alpha1.ConditionedStatus `json:",inline"`
}
// +kubebuilder:object:root=true
// WorkflowStepDefinition is the Schema for the workflowstepdefinitions API
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=workflowstep
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
type WorkflowStepDefinition struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec WorkflowStepDefinitionSpec `json:"spec,omitempty"`
Status WorkflowStepDefinitionStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// WorkflowStepDefinitionList contains a list of WorkflowStepDefinition
type WorkflowStepDefinitionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []WorkflowStepDefinition `json:"items"`
}

View File

@@ -135,6 +135,22 @@ func (in *AppDeploymentStatus) DeepCopy() *AppDeploymentStatus {
return out
}
// 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)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppPolicy.
func (in *AppPolicy) DeepCopy() *AppPolicy {
if in == nil {
return nil
}
out := new(AppPolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AppRevision) DeepCopyInto(out *AppRevision) {
*out = *in
@@ -446,6 +462,20 @@ func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Policies != nil {
in, out := &in.Policies, &out.Policies
*out = make([]AppPolicy, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Workflow != nil {
in, out := &in.Workflow, &out.Workflow
*out = make([]WorkflowStep, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.RolloutPlan != nil {
in, out := &in.RolloutPlan, &out.RolloutPlan
*out = new(v1alpha1.RolloutPlan)
@@ -921,6 +951,101 @@ func (in *PlacementStatus) DeepCopy() *PlacementStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicyDefinition) DeepCopyInto(out *PolicyDefinition) {
*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 PolicyDefinition.
func (in *PolicyDefinition) DeepCopy() *PolicyDefinition {
if in == nil {
return nil
}
out := new(PolicyDefinition)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PolicyDefinition) 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 *PolicyDefinitionList) DeepCopyInto(out *PolicyDefinitionList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]PolicyDefinition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyDefinitionList.
func (in *PolicyDefinitionList) DeepCopy() *PolicyDefinitionList {
if in == nil {
return nil
}
out := new(PolicyDefinitionList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PolicyDefinitionList) 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 *PolicyDefinitionSpec) DeepCopyInto(out *PolicyDefinitionSpec) {
*out = *in
if in.Schematic != nil {
in, out := &in.Schematic, &out.Schematic
*out = new(common.Schematic)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyDefinitionSpec.
func (in *PolicyDefinitionSpec) DeepCopy() *PolicyDefinitionSpec {
if in == nil {
return nil
}
out := new(PolicyDefinitionSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicyDefinitionStatus) DeepCopyInto(out *PolicyDefinitionStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyDefinitionStatus.
func (in *PolicyDefinitionStatus) DeepCopy() *PolicyDefinitionStatus {
if in == nil {
return nil
}
out := new(PolicyDefinitionStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceTracker) DeepCopyInto(out *ResourceTracker) {
*out = *in
@@ -1276,6 +1401,117 @@ func (in *WeightedTarget) DeepCopy() *WeightedTarget {
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)
}
// 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 *WorkflowStepDefinition) DeepCopyInto(out *WorkflowStepDefinition) {
*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 WorkflowStepDefinition.
func (in *WorkflowStepDefinition) DeepCopy() *WorkflowStepDefinition {
if in == nil {
return nil
}
out := new(WorkflowStepDefinition)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *WorkflowStepDefinition) 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 *WorkflowStepDefinitionList) DeepCopyInto(out *WorkflowStepDefinitionList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]WorkflowStepDefinition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepDefinitionList.
func (in *WorkflowStepDefinitionList) DeepCopy() *WorkflowStepDefinitionList {
if in == nil {
return nil
}
out := new(WorkflowStepDefinitionList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *WorkflowStepDefinitionList) 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 *WorkflowStepDefinitionSpec) DeepCopyInto(out *WorkflowStepDefinitionSpec) {
*out = *in
if in.Schematic != nil {
in, out := &in.Schematic, &out.Schematic
*out = new(common.Schematic)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepDefinitionSpec.
func (in *WorkflowStepDefinitionSpec) DeepCopy() *WorkflowStepDefinitionSpec {
if in == nil {
return nil
}
out := new(WorkflowStepDefinitionSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStepDefinitionStatus) DeepCopyInto(out *WorkflowStepDefinitionStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepDefinitionStatus.
func (in *WorkflowStepDefinitionStatus) DeepCopy() *WorkflowStepDefinitionStatus {
if in == nil {
return nil
}
out := new(WorkflowStepDefinitionStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkloadDefinition) DeepCopyInto(out *WorkloadDefinition) {
*out = *in

View File

@@ -1294,6 +1294,20 @@ spec:
- type
type: object
type: array
policies:
description: Policies defines the global policies for all components in the app, e.g. security, metrics, gitops, multi-cluster placement rules, etc. Policies are applied after components are rendered and before workflow steps are executed.
items:
description: AppPolicy defines a global policy for all components in the app.
properties:
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
type:
type: string
required:
- type
type: object
type: array
rolloutPlan:
description: RolloutPlan is the details on how to rollout the resources The controller simply replace the old resources with the new one if there is no rollout plan involved
properties:
@@ -1512,6 +1526,23 @@ spec:
format: int32
type: integer
type: object
workflow:
description: 'Workflow defines how to customize the control logic. If workflow is specified, Vela won''t apply any resource, but provide rendered output in AppRevision. Workflow steps are executed in array order, and each step: - will have a context in annotation. - should mark "finish" phase in status.conditions.'
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
stage:
description: The stage is the running stage this workflow runs. It could be `pre-render` or `post-render` (default).
type: string
type:
type: string
required:
- type
type: object
type: array
required:
- components
type: object

View File

@@ -631,6 +631,20 @@ spec:
- type
type: object
type: array
policies:
description: Policies defines the global policies for all components in the app, e.g. security, metrics, gitops, multi-cluster placement rules, etc. Policies are applied after components are rendered and before workflow steps are executed.
items:
description: AppPolicy defines a global policy for all components in the app.
properties:
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
type:
type: string
required:
- type
type: object
type: array
rolloutPlan:
description: RolloutPlan is the details on how to rollout the resources The controller simply replace the old resources with the new one if there is no rollout plan involved
properties:
@@ -849,6 +863,23 @@ spec:
format: int32
type: integer
type: object
workflow:
description: 'Workflow defines how to customize the control logic. If workflow is specified, Vela won''t apply any resource, but provide rendered output in AppRevision. Workflow steps are executed in array order, and each step: - will have a context in annotation. - should mark "finish" phase in status.conditions.'
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
stage:
description: The stage is the running stage this workflow runs. It could be `pre-render` or `post-render` (default).
type: string
type:
type: string
required:
- type
type: object
type: array
required:
- components
type: object

View File

@@ -0,0 +1,168 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
name: policydefinitions.core.oam.dev
spec:
group: core.oam.dev
names:
categories:
- oam
kind: PolicyDefinition
listKind: PolicyDefinitionList
plural: policydefinitions
shortNames:
- policy
singular: policydefinition
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: PolicyDefinition is the Schema for the policydefinitions 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: PolicyDefinitionSpec defines the desired state of PolicyDefinition
properties:
schematic:
description: Schematic defines the data format and template of the encapsulation of the policy definition
properties:
cue:
description: CUE defines the encapsulation in CUE format
properties:
template:
description: Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field. Template is a required field if CUE is defined in Capability Definition.
type: string
required:
- template
type: object
helm:
description: A Helm represents resources used by a Helm module
properties:
release:
description: Release records a Helm release used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
repository:
description: HelmRelease records a Helm repository used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- release
- repository
type: object
kube:
description: Kube defines the encapsulation in raw Kubernetes resource format
properties:
parameters:
description: Parameters defines configurable parameters
items:
description: A KubeParameter defines a configurable parameter of a component.
properties:
description:
description: Description of this parameter.
type: string
fieldPaths:
description: "FieldPaths specifies an array of fields within this workload that will be overwritten by the value of this parameter. \tAll fields must be of the same type. Fields are specified as JSON field paths without a leading dot, for example 'spec.replicas'."
items:
type: string
type: array
name:
description: Name of this parameter
type: string
required:
default: false
description: Required specifies whether or not a value for this parameter must be supplied when authoring an Application.
type: boolean
type:
description: 'ValueType indicates the type of the parameter value, and only supports basic data types: string, number, boolean.'
enum:
- string
- number
- boolean
type: string
required:
- fieldPaths
- name
- type
type: object
type: array
template:
description: Template defines the raw Kubernetes resource
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- template
type: object
terraform:
description: Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
properties:
configuration:
description: Configuration is Terraform Configuration
type: string
type:
default: hcl
description: Type specifies which Terraform configuration it is, HCL or JSON syntax
enum:
- hcl
- json
type: string
required:
- configuration
type: object
type: object
type: object
status:
description: PolicyDefinitionStatus is the status of PolicyDefinition
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
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -0,0 +1,168 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
name: workflowstepdefinitions.core.oam.dev
spec:
group: core.oam.dev
names:
categories:
- oam
kind: WorkflowStepDefinition
listKind: WorkflowStepDefinitionList
plural: workflowstepdefinitions
shortNames:
- workflowstep
singular: workflowstepdefinition
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: WorkflowStepDefinition is the Schema for the workflowstepdefinitions 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: WorkflowStepDefinitionSpec defines the desired state of WorkflowStepDefinition
properties:
schematic:
description: Schematic defines the data format and template of the encapsulation of the workflow step definition
properties:
cue:
description: CUE defines the encapsulation in CUE format
properties:
template:
description: Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field. Template is a required field if CUE is defined in Capability Definition.
type: string
required:
- template
type: object
helm:
description: A Helm represents resources used by a Helm module
properties:
release:
description: Release records a Helm release used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
repository:
description: HelmRelease records a Helm repository used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- release
- repository
type: object
kube:
description: Kube defines the encapsulation in raw Kubernetes resource format
properties:
parameters:
description: Parameters defines configurable parameters
items:
description: A KubeParameter defines a configurable parameter of a component.
properties:
description:
description: Description of this parameter.
type: string
fieldPaths:
description: "FieldPaths specifies an array of fields within this workload that will be overwritten by the value of this parameter. \tAll fields must be of the same type. Fields are specified as JSON field paths without a leading dot, for example 'spec.replicas'."
items:
type: string
type: array
name:
description: Name of this parameter
type: string
required:
default: false
description: Required specifies whether or not a value for this parameter must be supplied when authoring an Application.
type: boolean
type:
description: 'ValueType indicates the type of the parameter value, and only supports basic data types: string, number, boolean.'
enum:
- string
- number
- boolean
type: string
required:
- fieldPaths
- name
- type
type: object
type: array
template:
description: Template defines the raw Kubernetes resource
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- template
type: object
terraform:
description: Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
properties:
configuration:
description: Configuration is Terraform Configuration
type: string
type:
default: hcl
description: Type specifies which Terraform configuration it is, HCL or JSON syntax
enum:
- hcl
- json
type: string
required:
- configuration
type: object
type: object
type: object
status:
description: WorkflowStepDefinitionStatus is the status of WorkflowStepDefinition
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
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -1291,6 +1291,20 @@ spec:
- type
type: object
type: array
policies:
description: Policies defines the global policies for all components in the app, e.g. security, metrics, gitops, multi-cluster placement rules, etc. Policies are applied after components are rendered and before workflow steps are executed.
items:
description: AppPolicy defines a global policy for all components in the app.
properties:
properties:
type: object
type:
type: string
required:
- type
type: object
type: array
rolloutPlan:
description: RolloutPlan is the details on how to rollout the resources The controller simply replace the old resources with the new one if there is no rollout plan involved
properties:
@@ -1509,6 +1523,23 @@ spec:
format: int32
type: integer
type: object
workflow:
description: 'Workflow defines how to customize the control logic. If workflow is specified, Vela won''t apply any resource, but provide rendered output in AppRevision. Workflow steps are executed in array order, and each step: - will have a context in annotation. - should mark "finish" phase in status.conditions.'
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
properties:
type: object
stage:
description: The stage is the running stage this workflow runs. It could be `pre-render` or `post-render` (default).
type: string
type:
type: string
required:
- type
type: object
type: array
required:
- components
type: object

View File

@@ -602,6 +602,20 @@ spec:
- type
type: object
type: array
policies:
description: Policies defines the global policies for all components in the app, e.g. security, metrics, gitops, multi-cluster placement rules, etc. Policies are applied after components are rendered and before workflow steps are executed.
items:
description: AppPolicy defines a global policy for all components in the app.
properties:
properties:
type: object
type:
type: string
required:
- type
type: object
type: array
rolloutPlan:
description: RolloutPlan is the details on how to rollout the resources The controller simply replace the old resources with the new one if there is no rollout plan involved
properties:
@@ -820,6 +834,23 @@ spec:
format: int32
type: integer
type: object
workflow:
description: 'Workflow defines how to customize the control logic. If workflow is specified, Vela won''t apply any resource, but provide rendered output in AppRevision. Workflow steps are executed in array order, and each step: - will have a context in annotation. - should mark "finish" phase in status.conditions.'
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
properties:
type: object
stage:
description: The stage is the running stage this workflow runs. It could be `pre-render` or `post-render` (default).
type: string
type:
type: string
required:
- type
type: object
type: array
required:
- components
type: object

View File

@@ -0,0 +1,169 @@
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
name: policydefinitions.core.oam.dev
spec:
group: core.oam.dev
names:
categories:
- oam
kind: PolicyDefinition
listKind: PolicyDefinitionList
plural: policydefinitions
shortNames:
- policy
singular: policydefinition
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: PolicyDefinition is the Schema for the policydefinitions 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: PolicyDefinitionSpec defines the desired state of PolicyDefinition
properties:
schematic:
description: Schematic defines the data format and template of the encapsulation of the policy definition
properties:
cue:
description: CUE defines the encapsulation in CUE format
properties:
template:
description: Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field. Template is a required field if CUE is defined in Capability Definition.
type: string
required:
- template
type: object
helm:
description: A Helm represents resources used by a Helm module
properties:
release:
description: Release records a Helm release used by a Helm module workload.
type: object
repository:
description: HelmRelease records a Helm repository used by a Helm module workload.
type: object
required:
- release
- repository
type: object
kube:
description: Kube defines the encapsulation in raw Kubernetes resource format
properties:
parameters:
description: Parameters defines configurable parameters
items:
description: A KubeParameter defines a configurable parameter of a component.
properties:
description:
description: Description of this parameter.
type: string
fieldPaths:
description: "FieldPaths specifies an array of fields within this workload that will be overwritten by the value of this parameter. \tAll fields must be of the same type. Fields are specified as JSON field paths without a leading dot, for example 'spec.replicas'."
items:
type: string
type: array
name:
description: Name of this parameter
type: string
required:
description: Required specifies whether or not a value for this parameter must be supplied when authoring an Application.
type: boolean
type:
description: 'ValueType indicates the type of the parameter value, and only supports basic data types: string, number, boolean.'
enum:
- string
- number
- boolean
type: string
required:
- fieldPaths
- name
- type
type: object
type: array
template:
description: Template defines the raw Kubernetes resource
type: object
required:
- template
type: object
terraform:
description: Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
properties:
configuration:
description: Configuration is Terraform Configuration
type: string
type:
default: hcl
description: Type specifies which Terraform configuration it is, HCL or JSON syntax
enum:
- hcl
- json
type: string
required:
- configuration
type: object
type: object
type: object
status:
description: PolicyDefinitionStatus is the status of PolicyDefinition
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
type: object
type: object
version: v1beta1
versions:
- name: v1beta1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -0,0 +1,169 @@
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
name: workflowstepdefinitions.core.oam.dev
spec:
group: core.oam.dev
names:
categories:
- oam
kind: WorkflowStepDefinition
listKind: WorkflowStepDefinitionList
plural: workflowstepdefinitions
shortNames:
- workflowstep
singular: workflowstepdefinition
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: WorkflowStepDefinition is the Schema for the workflowstepdefinitions 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: WorkflowStepDefinitionSpec defines the desired state of WorkflowStepDefinition
properties:
schematic:
description: Schematic defines the data format and template of the encapsulation of the workflow step definition
properties:
cue:
description: CUE defines the encapsulation in CUE format
properties:
template:
description: Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field. Template is a required field if CUE is defined in Capability Definition.
type: string
required:
- template
type: object
helm:
description: A Helm represents resources used by a Helm module
properties:
release:
description: Release records a Helm release used by a Helm module workload.
type: object
repository:
description: HelmRelease records a Helm repository used by a Helm module workload.
type: object
required:
- release
- repository
type: object
kube:
description: Kube defines the encapsulation in raw Kubernetes resource format
properties:
parameters:
description: Parameters defines configurable parameters
items:
description: A KubeParameter defines a configurable parameter of a component.
properties:
description:
description: Description of this parameter.
type: string
fieldPaths:
description: "FieldPaths specifies an array of fields within this workload that will be overwritten by the value of this parameter. \tAll fields must be of the same type. Fields are specified as JSON field paths without a leading dot, for example 'spec.replicas'."
items:
type: string
type: array
name:
description: Name of this parameter
type: string
required:
description: Required specifies whether or not a value for this parameter must be supplied when authoring an Application.
type: boolean
type:
description: 'ValueType indicates the type of the parameter value, and only supports basic data types: string, number, boolean.'
enum:
- string
- number
- boolean
type: string
required:
- fieldPaths
- name
- type
type: object
type: array
template:
description: Template defines the raw Kubernetes resource
type: object
required:
- template
type: object
terraform:
description: Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
properties:
configuration:
description: Configuration is Terraform Configuration
type: string
type:
default: hcl
description: Type specifies which Terraform configuration it is, HCL or JSON syntax
enum:
- hcl
- json
type: string
required:
- configuration
type: object
type: object
type: object
status:
description: WorkflowStepDefinitionStatus is the status of WorkflowStepDefinition
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
type: object
type: object
version: v1beta1
versions:
- name: v1beta1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []