mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-23 22:46:53 +00:00
[Backport release-1.1] Fix: change raw extension to pointer (#2469)
* Fix: change raw extension to pointer (cherry picked from commit113f785c97) * Test: fix ut (cherry picked from commit7b9dac98c2) Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
This commit is contained in:
co-authored by
FogDong
parent
bdfd8e1f8d
commit
141c6bb2ef
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package common
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
@@ -374,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
|
||||
@@ -384,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"`
|
||||
@@ -457,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
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ package common
|
||||
import (
|
||||
crossplane_runtime "github.com/oam-dev/terraform-controller/api/types/crossplane-runtime"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
@@ -93,7 +94,11 @@ func (in *AppStatus) DeepCopy() *AppStatus {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationComponent) DeepCopyInto(out *ApplicationComponent) {
|
||||
*out = *in
|
||||
in.Properties.DeepCopyInto(&out.Properties)
|
||||
if in.Properties != nil {
|
||||
in, out := &in.Properties, &out.Properties
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.DependsOn != nil {
|
||||
in, out := &in.DependsOn, &out.DependsOn
|
||||
*out = make([]string, len(*in))
|
||||
@@ -164,7 +169,11 @@ func (in *ApplicationComponentStatus) DeepCopy() *ApplicationComponentStatus {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationTrait) DeepCopyInto(out *ApplicationTrait) {
|
||||
*out = *in
|
||||
in.Properties.DeepCopyInto(&out.Properties)
|
||||
if in.Properties != nil {
|
||||
in, out := &in.Properties, &out.Properties
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationTrait.
|
||||
@@ -404,6 +413,26 @@ func (in *RawComponent) DeepCopy() *RawComponent {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RawExtensionPointer) DeepCopyInto(out *RawExtensionPointer) {
|
||||
*out = *in
|
||||
if in.RawExtension != nil {
|
||||
in, out := &in.RawExtension, &out.RawExtension
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RawExtensionPointer.
|
||||
func (in *RawExtensionPointer) DeepCopy() *RawExtensionPointer {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RawExtensionPointer)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Revision) DeepCopyInto(out *Revision) {
|
||||
*out = *in
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -44,7 +44,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 +58,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 +104,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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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"`
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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: []
|
||||
@@ -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: []
|
||||
@@ -708,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
|
||||
|
||||
@@ -103,7 +103,7 @@ var _ = Describe("Test Helm schematic appfile", func() {
|
||||
},
|
||||
},
|
||||
Helm: &common.Helm{
|
||||
Release: util.Object2RawExtension(map[string]interface{}{
|
||||
Release: *util.Object2RawExtension(map[string]interface{}{
|
||||
"chart": map[string]interface{}{
|
||||
"spec": map[string]interface{}{
|
||||
"chart": "podinfo",
|
||||
@@ -111,7 +111,7 @@ var _ = Describe("Test Helm schematic appfile", func() {
|
||||
},
|
||||
},
|
||||
}),
|
||||
Repository: util.Object2RawExtension(map[string]interface{}{
|
||||
Repository: *util.Object2RawExtension(map[string]interface{}{
|
||||
"url": "http://oam.dev/catalog/",
|
||||
}),
|
||||
},
|
||||
@@ -1061,7 +1061,7 @@ func TestGenerateTerraformConfigurationWorkload(t *testing.T) {
|
||||
Spec: configSpec,
|
||||
}
|
||||
rawConf := util.Object2RawExtension(tfConfiguration)
|
||||
wantWL, _ := util.RawExtension2Unstructured(&rawConf)
|
||||
wantWL, _ := util.RawExtension2Unstructured(rawConf)
|
||||
|
||||
if diff := cmp.Diff(wantWL, got); diff != "" {
|
||||
t.Errorf("\n%s\ngenerateTerraformConfigurationWorkload(...): -want, +got:\n%s\n", tcName, diff)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -260,12 +260,12 @@ func PatchComponent(baseComponent *common.ApplicationComponent, patchComponent *
|
||||
}
|
||||
|
||||
// PatchProperties merge patch parameter for dst parameter
|
||||
func PatchProperties(dst runtime.RawExtension, patch runtime.RawExtension) (map[string]interface{}, error) {
|
||||
patchParameter, err := util.RawExtension2Map(&patch)
|
||||
func PatchProperties(dst *runtime.RawExtension, patch *runtime.RawExtension) (map[string]interface{}, error) {
|
||||
patchParameter, err := util.RawExtension2Map(patch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
baseParameter, err := util.RawExtension2Map(&dst)
|
||||
baseParameter, err := util.RawExtension2Map(dst)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ func (o *OCMEngine) schedule(ctx context.Context, apps []*EnvBindApp) ([]v1alpha
|
||||
manifest := app.assembledManifests[component.Name]
|
||||
for j := range manifest {
|
||||
workloads = append(workloads, ocmworkv1.Manifest{
|
||||
RawExtension: util.Object2RawExtension(manifest[j]),
|
||||
RawExtension: *util.Object2RawExtension(manifest[j]),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.SetName("envbinding-select-cluster-by-name")
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Envs[0].Placement.ClusterSelector.Name = spokeClusterName
|
||||
envBinding.Spec.OutputResourcesTo = &v1alpha1.ConfigMapReference{
|
||||
@@ -229,7 +229,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.SetName("envbinding-select-cluster-by-label")
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Envs[0].Placement.ClusterSelector.Labels = map[string]string{
|
||||
"purpose": "test",
|
||||
@@ -277,7 +277,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.SetName("envbinding-with-two-env-config")
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Envs[0].Placement.ClusterSelector.Name = spokeClusterName
|
||||
|
||||
@@ -361,7 +361,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.SetName("envbinding-with-app-has-helm")
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
|
||||
envBinding.Spec.Envs = []v1alpha1.EnvConfig{{
|
||||
@@ -416,7 +416,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.SetName("envbinding-apply-resources-with-ocm")
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Envs[0].Placement.ClusterSelector.Name = spokeClusterName
|
||||
envBinding.Spec.Engine = v1alpha1.OCMEngine
|
||||
@@ -458,7 +458,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.SetName("envbinding-apply-resources")
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Engine = v1alpha1.SingleClusterEngine
|
||||
|
||||
@@ -494,7 +494,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.SetName("envbinding-store2configmap")
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Engine = v1alpha1.SingleClusterEngine
|
||||
envBinding.Spec.OutputResourcesTo = &v1alpha1.ConfigMapReference{
|
||||
@@ -538,7 +538,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.SetName("envbinding-specify-ns")
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Engine = v1alpha1.SingleClusterEngine
|
||||
envBinding.Spec.Envs[0].Placement = v1alpha1.EnvPlacement{
|
||||
@@ -579,7 +579,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.SetName("envbinding-select-ns-label")
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Engine = v1alpha1.SingleClusterEngine
|
||||
envBinding.Spec.Envs[0].Placement = v1alpha1.EnvPlacement{
|
||||
@@ -624,7 +624,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetName("test-envbinding-gc-single-cluster")
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Engine = v1alpha1.SingleClusterEngine
|
||||
envBinding.Spec.Envs[0].Placement = v1alpha1.EnvPlacement{
|
||||
@@ -742,7 +742,7 @@ var _ = Describe("EnvBinding Normal tests", func() {
|
||||
envBinding.SetName("test-envbinding-gc-multi-cluster")
|
||||
envBinding.SetNamespace(namespace)
|
||||
envBinding.Spec.AppTemplate = v1alpha1.AppTemplate{
|
||||
RawExtension: util.Object2RawExtension(appTemplate),
|
||||
RawExtension: *util.Object2RawExtension(appTemplate),
|
||||
}
|
||||
envBinding.Spec.Envs[0].Placement.ClusterSelector.Name = spokeClusterName
|
||||
|
||||
@@ -1007,7 +1007,7 @@ var podInfo = &v1beta1.ComponentDefinition{
|
||||
},
|
||||
Schematic: &commontype.Schematic{
|
||||
HELM: &commontype.Helm{
|
||||
Release: util.Object2RawExtension(map[string]interface{}{
|
||||
Release: *util.Object2RawExtension(map[string]interface{}{
|
||||
"chart": map[string]interface{}{
|
||||
"spec": map[string]interface{}{
|
||||
"chart": "podinfo",
|
||||
@@ -1015,7 +1015,7 @@ var podInfo = &v1beta1.ComponentDefinition{
|
||||
},
|
||||
},
|
||||
}),
|
||||
Repository: util.Object2RawExtension(map[string]interface{}{
|
||||
Repository: *util.Object2RawExtension(map[string]interface{}{
|
||||
"url": "http://oam.dev/catalog/",
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -73,7 +73,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","config":"myconfig"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","config":"myconfig"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -91,7 +91,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -103,7 +103,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
|
||||
appFailRender := appwithNoTrait.DeepCopy()
|
||||
appFailRender.SetName("app-fail-to-render")
|
||||
appFailRender.Spec.Components[0].Properties = runtime.RawExtension{
|
||||
appFailRender.Spec.Components[0].Properties = &runtime.RawExtension{
|
||||
Raw: []byte(`{"cmd1":["sleep","1000"],"image1":"busybox"}`),
|
||||
}
|
||||
|
||||
@@ -120,11 +120,11 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb",
|
||||
Type: "worker-import",
|
||||
Properties: runtime.RawExtension{Raw: []byte("{\"cmd\":[\"sleep\",\"1000\"],\"image\":\"busybox\"}")},
|
||||
Properties: &runtime.RawExtension{Raw: []byte("{\"cmd\":[\"sleep\",\"1000\"],\"image\":\"busybox\"}")},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "ingress-import",
|
||||
Properties: runtime.RawExtension{Raw: []byte("{\"http\":{\"/\":80},\"domain\":\"abc.com\"}")},
|
||||
Properties: &runtime.RawExtension{Raw: []byte("{\"http\":{\"/\":80},\"domain\":\"abc.com\"}")},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -176,7 +176,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
appWithTrait.Spec.Components[0].Traits = []common.ApplicationTrait{
|
||||
{
|
||||
Type: "scaler",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"replicas":2}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"replicas":2}`)},
|
||||
},
|
||||
}
|
||||
appWithTrait.Spec.Components[0].Name = "myweb3"
|
||||
@@ -220,7 +220,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
appWithTwoComp.Spec.Components = append(appWithTwoComp.Spec.Components, common.ApplicationComponent{
|
||||
Name: "myweb6",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox2","config":"myconfig"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox2","config":"myconfig"}`)},
|
||||
Scopes: map[string]string{"healthscopes.core.oam.dev": "app-with-two-comp-default-health"},
|
||||
})
|
||||
|
||||
@@ -457,7 +457,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
appWithComposedWorkload.Spec.Components[0].Traits = []common.ApplicationTrait{
|
||||
{
|
||||
Type: "scaler",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"replicas":2}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"replicas":2}`)},
|
||||
},
|
||||
}
|
||||
appWithComposedWorkload.Spec.Components[0].Name = compName
|
||||
@@ -702,13 +702,13 @@ var _ = Describe("Test Application Controller", func() {
|
||||
curApp.Spec.Components[0] = common.ApplicationComponent{
|
||||
Name: "myweb5",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox3"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox3"}`)},
|
||||
Scopes: map[string]string{"healthscopes.core.oam.dev": "app-with-two-comp-default-health"},
|
||||
}
|
||||
curApp.Spec.Components[1] = common.ApplicationComponent{
|
||||
Name: "myweb7",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Scopes: map[string]string{"healthscopes.core.oam.dev": "app-with-two-comp-default-health"},
|
||||
}
|
||||
Expect(k8sClient.Update(ctx, curApp)).Should(BeNil())
|
||||
@@ -1029,9 +1029,9 @@ var _ = Describe("Test Application Controller", func() {
|
||||
app := appWithTraitHealthStatus.DeepCopy()
|
||||
app.Spec.Components[0].Name = compName
|
||||
app.Spec.Components[0].Type = "nworker"
|
||||
app.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox3","lives":"3","enemies":"alien"}`)}
|
||||
app.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox3","lives":"3","enemies":"alien"}`)}
|
||||
app.Spec.Components[0].Traits[0].Type = "ingress"
|
||||
app.Spec.Components[0].Traits[0].Properties = runtime.RawExtension{Raw: []byte(`{"domain":"example.com","http":{"/":80}}`)}
|
||||
app.Spec.Components[0].Traits[0].Properties = &runtime.RawExtension{Raw: []byte(`{"domain":"example.com","http":{"/":80}}`)}
|
||||
|
||||
expDeployment.Name = app.Name
|
||||
expDeployment.Namespace = ns.Name
|
||||
@@ -1167,7 +1167,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
appRefertoWd.Spec.Components[0] = common.ApplicationComponent{
|
||||
Name: "mytask",
|
||||
Type: "task",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"image":"busybox", "cmd":["sleep","1000"]}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image":"busybox", "cmd":["sleep","1000"]}`)},
|
||||
}
|
||||
ns := &corev1.Namespace{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@@ -1217,7 +1217,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
appMix.Spec.Components[1] = common.ApplicationComponent{
|
||||
Name: "mytask",
|
||||
Type: "task",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"image":"busybox", "cmd":["sleep","1000"]}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image":"busybox", "cmd":["sleep","1000"]}`)},
|
||||
}
|
||||
ns := &corev1.Namespace{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@@ -1438,11 +1438,10 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "rollout",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{}`)},
|
||||
Type: "rollout",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1463,7 +1462,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: "myweb1", Namespace: ns.Name}, deploy)).Should(util.NotFoundMatcher{})
|
||||
|
||||
By("update component targetComponentRev will change")
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","2000"],"image":"nginx"}`)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","2000"],"image":"nginx"}`)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnce(reconciler, reconcile.Request{NamespacedName: appKey})
|
||||
checkApp = &v1beta1.Application{}
|
||||
@@ -1478,7 +1477,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
|
||||
By("check update rollout trait won't generate new appRevision")
|
||||
appRevName := checkApp.Status.LatestRevision.Name
|
||||
checkApp.Spec.Components[0].Traits[0].Properties.Raw = []byte(`{"targetRevision":"myweb1-v3"}`)
|
||||
checkApp.Spec.Components[0].Traits[0].Properties = &runtime.RawExtension{Raw: []byte(`{"targetRevision":"myweb1-v3"}`)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnce(reconciler, reconcile.Request{NamespacedName: appKey})
|
||||
checkApp = &v1beta1.Application{}
|
||||
@@ -1518,11 +1517,10 @@ var _ = Describe("Test Application Controller", func() {
|
||||
Name: "myweb1",
|
||||
Type: "worker",
|
||||
ExternalRevision: externalRevision,
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "rollout",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{}`)},
|
||||
Type: "rollout",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1570,7 +1568,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker-revision",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1619,7 +1617,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
Name: "myweb1",
|
||||
Type: "worker-revision",
|
||||
ExternalRevision: externalRevision,
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1676,11 +1674,10 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "rollout",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{}`)},
|
||||
Type: "rollout",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1690,7 +1687,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "apply",
|
||||
Type: "apply-component",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"component" : "myweb1"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"component" : "myweb1"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1742,7 +1739,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep"],"image":"busybox"}`)},
|
||||
Inputs: common.StepInputs{
|
||||
{
|
||||
From: "message",
|
||||
@@ -1761,7 +1758,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Outputs: common.StepOutputs{
|
||||
{Name: "message", ValueFrom: "output.status.conditions[0].message+\",\"+outputs.gameconfig.data.lives"},
|
||||
{Name: "sleepTime", ValueFrom: "\"100\""},
|
||||
@@ -1842,13 +1839,13 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
DependsOn: []string{"myweb2"},
|
||||
},
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1917,7 +1914,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
DependsOn: []string{"myweb2"},
|
||||
Inputs: common.StepInputs{
|
||||
{
|
||||
@@ -1933,7 +1930,7 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Outputs: common.StepOutputs{
|
||||
{Name: "message", ValueFrom: "output.status.conditions[0].message+\",\"+outputs.gameconfig.data.lives"},
|
||||
},
|
||||
@@ -2016,12 +2013,12 @@ var _ = Describe("Test Application Controller", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
},
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -107,7 +107,7 @@ var _ = Describe("Test application controller finalizer logic", func() {
|
||||
updateApp.Spec.Components[0].Traits = []common.ApplicationTrait{
|
||||
{
|
||||
Type: "cross-scaler",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
},
|
||||
}
|
||||
Expect(k8sClient.Update(ctx, updateApp)).Should(BeNil())
|
||||
@@ -236,7 +236,7 @@ var _ = Describe("Test application controller finalizer logic", func() {
|
||||
app.Spec.Components[0].Traits = []common.ApplicationTrait{
|
||||
{
|
||||
Type: "cross-scaler",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
},
|
||||
}
|
||||
Expect(k8sClient.Create(ctx, app)).Should(BeNil())
|
||||
@@ -284,7 +284,7 @@ func getApp(appName, namespace, comptype string) *v1beta1.Application {
|
||||
{
|
||||
Name: "comp1",
|
||||
Type: comptype,
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -113,7 +113,7 @@ var _ = Describe("Test Application apply", func() {
|
||||
Components: []common.ApplicationComponent{{
|
||||
Type: "test-worker",
|
||||
Name: "test-app",
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte(`{"image": "oamdev/testapp:v1", "cmd": ["node", "server.js"]}`),
|
||||
},
|
||||
}},
|
||||
|
||||
@@ -92,7 +92,7 @@ func convertStepProperties(step *v1beta1.WorkflowStep, app *v1beta1.Application)
|
||||
o := struct {
|
||||
Component string `json:"component"`
|
||||
}{}
|
||||
js, err := step.Properties.MarshalJSON()
|
||||
js, err := common.RawExtensionPointer{RawExtension: step.Properties}.MarshalJSON()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ var _ = Describe("Test Application workflow generator", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Inputs: common.StepInputs{
|
||||
{
|
||||
From: "message",
|
||||
@@ -96,7 +96,7 @@ var _ = Describe("Test Application workflow generator", func() {
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Outputs: common.StepOutputs{
|
||||
{
|
||||
Name: "message",
|
||||
@@ -145,12 +145,12 @@ var _ = Describe("Test Application workflow generator", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -633,7 +633,7 @@ func (h *AppHandler) createControllerRevision(ctx context.Context, cm *types.Com
|
||||
},
|
||||
},
|
||||
Revision: int64(revision),
|
||||
Data: util.Object2RawExtension(comp),
|
||||
Data: *util.Object2RawExtension(comp),
|
||||
}
|
||||
return h.r.Create(ctx, cr)
|
||||
}
|
||||
@@ -651,15 +651,15 @@ func componentManifest2Component(cm *types.ComponentManifest) (*v1alpha2.Compone
|
||||
wl = cm.StandardWorkload.DeepCopy()
|
||||
util.RemoveLabels(wl, []string{oam.LabelAppRevision})
|
||||
}
|
||||
component.Spec.Workload = util.Object2RawExtension(wl)
|
||||
component.Spec.Workload = *util.Object2RawExtension(wl)
|
||||
if len(cm.PackagedWorkloadResources) > 0 {
|
||||
helm := &common.Helm{}
|
||||
for _, helmResource := range cm.PackagedWorkloadResources {
|
||||
if helmResource.GetKind() == helmapi.HelmReleaseGVK.Kind {
|
||||
helm.Release = util.Object2RawExtension(helmResource)
|
||||
helm.Release = *util.Object2RawExtension(helmResource)
|
||||
}
|
||||
if helmResource.GetKind() == helmapi.HelmRepositoryGVK.Kind {
|
||||
helm.Repository = util.Object2RawExtension(helmResource)
|
||||
helm.Repository = *util.Object2RawExtension(helmResource)
|
||||
}
|
||||
}
|
||||
component.Spec.Helm = helm
|
||||
|
||||
@@ -79,7 +79,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
for i := 0; i < appRevisionLimit+1; i++ {
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, ctrl.Request{NamespacedName: appKey})
|
||||
}
|
||||
@@ -104,7 +104,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("create new appRevision will remove appRevison1")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 6)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err := reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -131,7 +131,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("update app again will gc appRevision2")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property = fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 7)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err = reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -164,7 +164,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
for i := 0; i < appRevisionLimit+1; i++ {
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, ctrl.Request{NamespacedName: appKey})
|
||||
}
|
||||
@@ -189,7 +189,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("create new appRevision will remove revision v1")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 6)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err := reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -216,7 +216,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("update app again will gc revision v2")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property = fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 7)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err = reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -242,7 +242,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("update app with comp as latest revision will not gc revision v3")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property = fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 6)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err = reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -273,7 +273,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
for i := 0; i < appRevisionLimit+1; i++ {
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, ctrl.Request{NamespacedName: appKey})
|
||||
}
|
||||
@@ -298,7 +298,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("create new appRevision will remove revision v1")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 6)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err := reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -325,7 +325,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("update app again will gc revision v2")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property = fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 7)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err = reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -351,7 +351,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("update app with comp as latest revision will not gc revision v3")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property = fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 6)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err = reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -382,7 +382,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
for i := 0; i < appRevisionLimit+1; i++ {
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, ctrl.Request{NamespacedName: appKey})
|
||||
}
|
||||
@@ -407,7 +407,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("create new appRevision will remove appRevison1")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 6)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err := reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -437,7 +437,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("update app again will gc appRevision2")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property = fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 7)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err = reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -475,7 +475,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
for i := 0; i < appRevisionLimit+1; i++ {
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, ctrl.Request{NamespacedName: appKey})
|
||||
}
|
||||
@@ -500,7 +500,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("create new appRevision will remove appRevison1")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 6)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err := reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -530,7 +530,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("update app again will gc appRevision2")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property = fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 7)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err = reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -568,7 +568,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
for i := 0; i < appRevisionLimit+1; i++ {
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, ctrl.Request{NamespacedName: appKey})
|
||||
}
|
||||
@@ -593,7 +593,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
By("create new appRevision will remove appRevison1")
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 6)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err := reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
@@ -644,7 +644,7 @@ var _ = Describe("Test application controller clean up ", func() {
|
||||
for i := 7; i < 9; i++ {
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property = fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
_, err = reconciler.Reconcile(context.TODO(), ctrl.Request{NamespacedName: appKey})
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
@@ -118,13 +118,13 @@ var _ = Describe("test generate revision ", func() {
|
||||
Type: cd.Name,
|
||||
Name: "express-server",
|
||||
Scopes: map[string]string{"healthscopes.core.oam.dev": "myapp-default-health"},
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte(`{"image": "oamdev/testapp:v1", "cmd": ["node", "server.js"]}`),
|
||||
},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: td.Name,
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte(`{"replicas": 5}`),
|
||||
},
|
||||
},
|
||||
@@ -232,7 +232,7 @@ var _ = Describe("test generate revision ", func() {
|
||||
It("Test appliction contain a SkipAppRevision tait will have same hash", func() {
|
||||
rolloutTrait := common.ApplicationTrait{
|
||||
Type: "rollout",
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte(`{"targetRevision":"myrev-v1"}`),
|
||||
},
|
||||
}
|
||||
@@ -336,7 +336,7 @@ var _ = Describe("test generate revision ", func() {
|
||||
Expect(err).Should(BeNil())
|
||||
expectWorkload = comps[0].StandardWorkload.DeepCopy()
|
||||
util.RemoveLabels(expectWorkload, []string{oam.LabelAppRevision, oam.LabelAppRevisionHash, oam.LabelAppComponentRevision})
|
||||
Expect(cmp.Diff(gotComp.Spec.Workload, util.Object2RawExtension(expectWorkload))).Should(BeEmpty())
|
||||
Expect(cmp.Diff(gotComp.Spec.Workload, *util.Object2RawExtension(expectWorkload))).Should(BeEmpty())
|
||||
|
||||
By("Verify component revision is not changed")
|
||||
expectCompRevName = "express-server-v1"
|
||||
@@ -348,7 +348,7 @@ var _ = Describe("test generate revision ", func() {
|
||||
By("Change the application and apply again")
|
||||
// bump the image tag
|
||||
app.ResourceVersion = curApp.ResourceVersion
|
||||
app.Spec.Components[0].Properties = runtime.RawExtension{
|
||||
app.Spec.Components[0].Properties = &runtime.RawExtension{
|
||||
Raw: []byte(`{"image": "oamdev/testapp:v2", "cmd": ["node", "server.js"]}`),
|
||||
}
|
||||
// persist the app
|
||||
@@ -400,12 +400,12 @@ var _ = Describe("test generate revision ", func() {
|
||||
Expect(err).Should(BeNil())
|
||||
expectWorkload = comps[0].StandardWorkload.DeepCopy()
|
||||
util.RemoveLabels(expectWorkload, []string{oam.LabelAppRevision, oam.LabelAppRevisionHash, oam.LabelAppComponentRevision})
|
||||
Expect(cmp.Diff(gotComp.Spec.Workload, util.Object2RawExtension(expectWorkload))).Should(BeEmpty())
|
||||
Expect(cmp.Diff(gotComp.Spec.Workload, *util.Object2RawExtension(expectWorkload))).Should(BeEmpty())
|
||||
|
||||
By("Change the application same as v1 and apply again")
|
||||
// bump the image tag
|
||||
app.ResourceVersion = curApp.ResourceVersion
|
||||
app.Spec.Components[0].Properties = runtime.RawExtension{
|
||||
app.Spec.Components[0].Properties = &runtime.RawExtension{
|
||||
Raw: []byte(`{"image": "oamdev/testapp:v1", "cmd": ["node", "server.js"]}`),
|
||||
}
|
||||
// persist the app
|
||||
@@ -465,7 +465,7 @@ var _ = Describe("test generate revision ", func() {
|
||||
expectWorkload = comps[0].StandardWorkload.DeepCopy()
|
||||
util.RemoveLabels(expectWorkload, []string{oam.LabelAppRevision, oam.LabelAppRevisionHash, oam.LabelAppComponentRevision})
|
||||
expectWorkload.SetAnnotations(map[string]string{"testKey1": "true"})
|
||||
Expect(cmp.Diff(gotComp.Spec.Workload, util.Object2RawExtension(expectWorkload))).Should(BeEmpty())
|
||||
Expect(cmp.Diff(gotComp.Spec.Workload, *util.Object2RawExtension(expectWorkload))).Should(BeEmpty())
|
||||
})
|
||||
|
||||
It("Test App with rollout template", func() {
|
||||
@@ -546,7 +546,7 @@ var _ = Describe("test generate revision ", func() {
|
||||
// bump the image tag
|
||||
app.SetAnnotations(map[string]string{oam.AnnotationAppRollout: strconv.FormatBool(true)})
|
||||
app.ResourceVersion = curApp.ResourceVersion
|
||||
app.Spec.Components[0].Properties = runtime.RawExtension{
|
||||
app.Spec.Components[0].Properties = &runtime.RawExtension{
|
||||
Raw: []byte(`{"image": "oamdev/testapp:v2", "cmd": ["node", "server.js"]}`),
|
||||
}
|
||||
// persist the app
|
||||
|
||||
@@ -55,13 +55,13 @@ var _ = Describe("Test Workflow", func() {
|
||||
Components: []common.ApplicationComponent{{
|
||||
Name: "test-component",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
}},
|
||||
Workflow: &oamcore.Workflow{
|
||||
Steps: []oamcore.WorkflowStep{{
|
||||
Name: "test-wf1",
|
||||
Type: "foowf",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"namespace":"test-ns"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"namespace":"test-ns"}`)},
|
||||
}},
|
||||
},
|
||||
},
|
||||
@@ -71,7 +71,7 @@ var _ = Describe("Test Workflow", func() {
|
||||
appWithWorkflowAndPolicy.Spec.Policies = []oamcore.AppPolicy{{
|
||||
Name: "test-policy",
|
||||
Type: "foopolicy",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"key":"test"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"key":"test"}`)},
|
||||
}}
|
||||
|
||||
appWithPolicy := &oamcore.Application{
|
||||
@@ -83,12 +83,12 @@ var _ = Describe("Test Workflow", func() {
|
||||
Components: []common.ApplicationComponent{{
|
||||
Name: "test-component",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
}},
|
||||
Policies: []oamcore.AppPolicy{{
|
||||
Name: "test-policy",
|
||||
Type: "foopolicy",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"key":"test"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"key":"test"}`)},
|
||||
}},
|
||||
},
|
||||
}
|
||||
@@ -160,7 +160,7 @@ var _ = Describe("Test Workflow", func() {
|
||||
appWithPolicyAndWorkflow.Spec.Policies = []oamcore.AppPolicy{{
|
||||
Name: "test-foo-policy",
|
||||
Type: "foopolicy",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"key":"test"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"key":"test"}`)},
|
||||
}}
|
||||
|
||||
Expect(k8sClient.Create(ctx, appWithPolicyAndWorkflow)).Should(BeNil())
|
||||
@@ -237,7 +237,7 @@ var _ = Describe("Test Workflow", func() {
|
||||
suspendApp.Spec.Workflow.Steps = []oamcore.WorkflowStep{{
|
||||
Name: "suspend",
|
||||
Type: "suspend",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{}`)},
|
||||
}}
|
||||
Expect(k8sClient.Create(ctx, suspendApp)).Should(BeNil())
|
||||
|
||||
@@ -284,12 +284,12 @@ var _ = Describe("Test Workflow", func() {
|
||||
{
|
||||
Name: "suspend",
|
||||
Type: "suspend",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{}`)},
|
||||
},
|
||||
{
|
||||
Name: "suspend-1",
|
||||
Type: "suspend",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{}`)},
|
||||
}}
|
||||
Expect(k8sClient.Create(ctx, suspendApp)).Should(BeNil())
|
||||
|
||||
@@ -352,7 +352,7 @@ var _ = Describe("Test Workflow", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Inputs: common.StepInputs{
|
||||
{
|
||||
From: "message",
|
||||
@@ -367,7 +367,7 @@ var _ = Describe("Test Workflow", func() {
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Outputs: common.StepOutputs{
|
||||
{Name: "message", ValueFrom: "output.status.conditions[0].message+\",\"+outputs.gameconfig.data.lives"},
|
||||
},
|
||||
@@ -377,11 +377,11 @@ var _ = Describe("Test Workflow", func() {
|
||||
Steps: []oamcore.WorkflowStep{{
|
||||
Name: "test-web2",
|
||||
Type: "apply-component",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"component":"myweb2"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb2"}`)},
|
||||
}, {
|
||||
Name: "test-web1",
|
||||
Type: "apply-component",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"component":"myweb1"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb1"}`)},
|
||||
}},
|
||||
},
|
||||
},
|
||||
@@ -461,24 +461,24 @@ var _ = Describe("Test Workflow", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
DependsOn: []string{"myweb2"},
|
||||
},
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
},
|
||||
},
|
||||
Workflow: &oamcore.Workflow{
|
||||
Steps: []oamcore.WorkflowStep{{
|
||||
Name: "test-web2",
|
||||
Type: "apply-component",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"component":"myweb2"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb2"}`)},
|
||||
}, {
|
||||
Name: "test-web1",
|
||||
Type: "apply-component",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"component":"myweb1"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb1"}`)},
|
||||
}},
|
||||
},
|
||||
},
|
||||
@@ -549,7 +549,7 @@ var _ = Describe("Test Workflow", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
DependsOn: []string{"myweb2"},
|
||||
Inputs: common.StepInputs{
|
||||
{
|
||||
@@ -565,7 +565,7 @@ var _ = Describe("Test Workflow", func() {
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "worker-with-health",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox","lives": "i am lives","enemies": "empty"}`)},
|
||||
Outputs: common.StepOutputs{
|
||||
{Name: "message", ValueFrom: "output.status.conditions[0].message+\",\"+outputs.gameconfig.data.lives"},
|
||||
},
|
||||
@@ -575,11 +575,11 @@ var _ = Describe("Test Workflow", func() {
|
||||
Steps: []oamcore.WorkflowStep{{
|
||||
Name: "test-web2",
|
||||
Type: "apply-component",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"component":"myweb2"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb2"}`)},
|
||||
}, {
|
||||
Name: "test-web1",
|
||||
Type: "apply-component",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"component":"myweb1"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb1"}`)},
|
||||
}},
|
||||
},
|
||||
},
|
||||
@@ -649,12 +649,12 @@ var _ = Describe("Test Workflow", func() {
|
||||
{
|
||||
Name: "myweb1",
|
||||
Type: "webserver",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image":"busybox"}`)},
|
||||
},
|
||||
{
|
||||
Name: "myweb2",
|
||||
Type: "webserver",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -666,19 +666,19 @@ var _ = Describe("Test Workflow", func() {
|
||||
updateApp := &oamcore.Application{}
|
||||
Expect(k8sClient.Get(ctx, appKey, updateApp)).Should(BeNil())
|
||||
Expect(updateApp.Status.Phase).Should(BeEquivalentTo(common.ApplicationRunning))
|
||||
updateApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(`{}`)}
|
||||
updateApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(`{}`)}
|
||||
updateApp.Spec.Workflow = &oamcore.Workflow{
|
||||
Steps: []oamcore.WorkflowStep{{
|
||||
Name: "test-web2",
|
||||
Type: "apply-component",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"component":"myweb2"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb2"}`)},
|
||||
Outputs: common.StepOutputs{
|
||||
{Name: "image", ValueFrom: "output.spec.template.spec.containers[0].image"},
|
||||
},
|
||||
}, {
|
||||
Name: "test-web1",
|
||||
Type: "apply-component",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"component":"myweb1"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"component":"myweb1"}`)},
|
||||
Inputs: common.StepInputs{
|
||||
{
|
||||
From: "image",
|
||||
|
||||
+2
-2
@@ -328,7 +328,7 @@ spec:
|
||||
cd.Spec.Workload.Definition = common.WorkloadGVK{APIVersion: "apps/v1", Kind: "Deployment"}
|
||||
cd.Spec.Schematic = &common.Schematic{
|
||||
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",
|
||||
@@ -336,7 +336,7 @@ spec:
|
||||
},
|
||||
},
|
||||
}),
|
||||
Repository: util.Object2RawExtension(map[string]interface{}{
|
||||
Repository: *util.Object2RawExtension(map[string]interface{}{
|
||||
"url": "http://oam.dev/catalog/",
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -727,9 +727,9 @@ func Object2Map(obj interface{}) (map[string]interface{}, error) {
|
||||
}
|
||||
|
||||
// Object2RawExtension converts an object to a rawExtension
|
||||
func Object2RawExtension(obj interface{}) runtime.RawExtension {
|
||||
func Object2RawExtension(obj interface{}) *runtime.RawExtension {
|
||||
bts := MustJSONMarshal(obj)
|
||||
return runtime.RawExtension{
|
||||
return &runtime.RawExtension{
|
||||
Raw: bts,
|
||||
}
|
||||
}
|
||||
@@ -774,7 +774,7 @@ func GenTraitName(componentName string, ct *v1alpha2.ComponentTrait, traitType s
|
||||
// compatibility
|
||||
func GenTraitNameCompatible(componentName string, trait *unstructured.Unstructured, traitType string) string {
|
||||
ct := &v1alpha2.ComponentTrait{
|
||||
Trait: Object2RawExtension(trait),
|
||||
Trait: *Object2RawExtension(trait),
|
||||
}
|
||||
return GenTraitName(componentName, ct, traitType)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -59,7 +59,7 @@ func getEnvNamespace(application *v1beta1.Application) string {
|
||||
namespace := DefaultEnvNamespace
|
||||
for _, comp := range application.Spec.Components {
|
||||
if comp.Type == RawType {
|
||||
obj, err := util.RawExtension2Unstructured(&comp.Properties)
|
||||
obj, err := util.RawExtension2Unstructured(comp.Properties)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -55,23 +55,24 @@ func Input(ctx wfContext.Context, paramValue *value.Value, step v1beta1.Workflow
|
||||
// Output get data from task value.
|
||||
func Output(ctx wfContext.Context, taskValue *value.Value, step v1beta1.WorkflowStep, phase common.WorkflowStepPhase) error {
|
||||
if phase == common.WorkflowStepPhaseSucceeded {
|
||||
ready, err := value.NewValue(`true`, nil, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o := struct {
|
||||
Name string `json:"name"`
|
||||
}{}
|
||||
js, err := step.Properties.MarshalJSON()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := json.Unmarshal(js, &o); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.SetVar(ready, ReadyComponent, o.Name); err != nil {
|
||||
return err
|
||||
if step.Properties != nil {
|
||||
o := struct {
|
||||
Name string `json:"name"`
|
||||
}{}
|
||||
js, err := common.RawExtensionPointer{RawExtension: step.Properties}.MarshalJSON()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := json.Unmarshal(js, &o); err != nil {
|
||||
return err
|
||||
}
|
||||
ready, err := value.NewValue(`true`, nil, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ctx.SetVar(ready, ReadyComponent, o.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
for _, output := range step.Outputs {
|
||||
|
||||
@@ -71,7 +71,7 @@ output: score: 99
|
||||
`, nil, "")
|
||||
r.NoError(err)
|
||||
err = Output(wfCtx, taskValue, v1beta1.WorkflowStep{
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte("{\"name\":\"mystep\"}"),
|
||||
},
|
||||
Outputs: common.StepOutputs{{
|
||||
|
||||
@@ -89,7 +89,7 @@ func TestLoadComponent(t *testing.T) {
|
||||
{
|
||||
Name: "c1",
|
||||
Type: "web",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"image": "busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image": "busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -122,8 +122,8 @@ func (t *TaskLoader) makeTaskGenerator(templ string) (wfTypes.TaskGenerator, err
|
||||
|
||||
params := map[string]interface{}{}
|
||||
|
||||
if len(wfStep.Properties.Raw) > 0 {
|
||||
bt, err := wfStep.Properties.MarshalJSON()
|
||||
if wfStep.Properties != nil && len(wfStep.Properties.Raw) > 0 {
|
||||
bt, err := common.RawExtensionPointer{RawExtension: wfStep.Properties}.MarshalJSON()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ close({
|
||||
{
|
||||
Name: "input-err",
|
||||
Type: "ok",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`
|
||||
{"score": {"y": 101}}
|
||||
`)},
|
||||
Inputs: common.StepInputs{{
|
||||
|
||||
@@ -37,7 +37,7 @@ var _ = It("Test ApplyTerraform", func() {
|
||||
Spec: v1beta1.ApplicationSpec{Components: []commontype.ApplicationComponent{{
|
||||
Name: "test-terraform-svc",
|
||||
Type: "aliyun-oss",
|
||||
Properties: runtime.RawExtension{Raw: []byte("{\"bucket\": \"oam-website\"}")},
|
||||
Properties: &runtime.RawExtension{Raw: []byte("{\"bucket\": \"oam-website\"}")},
|
||||
},
|
||||
}},
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func TestBuildOAMApplication2(t *testing.T) {
|
||||
{
|
||||
Name: "webapp",
|
||||
Type: "containerWorkload",
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte("{\"image\":\"busybox\"}"),
|
||||
},
|
||||
Scopes: map[string]string{"healthscopes.core.oam.dev": "test-default-health"},
|
||||
@@ -111,14 +111,14 @@ func TestBuildOAMApplication2(t *testing.T) {
|
||||
{
|
||||
Name: "webapp",
|
||||
Type: "containerWorkload",
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte("{\"image\":\"busybox\"}"),
|
||||
},
|
||||
Scopes: map[string]string{"healthscopes.core.oam.dev": "test-default-health"},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "scaler",
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte("{\"replicas\":10}"),
|
||||
},
|
||||
},
|
||||
@@ -261,12 +261,12 @@ outputs: ingress: {
|
||||
Type: "webservice",
|
||||
Name: "express-server",
|
||||
Scopes: map[string]string{"healthscopes.core.oam.dev": "myapp-default-health"},
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte(`{"image": "oamdev/testapp:v1", "cmd": ["node", "server.js"]}`),
|
||||
},
|
||||
Traits: []common.ApplicationTrait{{
|
||||
Type: "route",
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte(`{"domain": "example.com", "http":{"/": 8080}}`),
|
||||
},
|
||||
},
|
||||
@@ -278,7 +278,7 @@ outputs: ingress: {
|
||||
ac2.Spec.Components = append(ac2.Spec.Components, common.ApplicationComponent{
|
||||
Name: "mongodb",
|
||||
Type: "backend",
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte(`{"image":"bitnami/mongodb:3.6.20","cmd": ["mongodb"]}`),
|
||||
},
|
||||
Traits: []common.ApplicationTrait{},
|
||||
@@ -395,17 +395,17 @@ outputs: ingress: {
|
||||
assert.Equal(t, comp.Name, c.want.app.Spec.Components[idx].Name)
|
||||
assert.Equal(t, comp.Scopes, c.want.app.Spec.Components[idx].Scopes)
|
||||
|
||||
got, err := util.RawExtension2Map(&comp.Properties)
|
||||
got, err := util.RawExtension2Map(comp.Properties)
|
||||
assert.NoError(t, err)
|
||||
exp, err := util.RawExtension2Map(&c.want.app.Spec.Components[idx].Properties)
|
||||
exp, err := util.RawExtension2Map(c.want.app.Spec.Components[idx].Properties)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, exp, got)
|
||||
for tidx, tr := range comp.Traits {
|
||||
assert.Equal(t, tr.Type, c.want.app.Spec.Components[idx].Traits[tidx].Type)
|
||||
|
||||
got, err := util.RawExtension2Map(&tr.Properties)
|
||||
got, err := util.RawExtension2Map(tr.Properties)
|
||||
assert.NoError(t, err)
|
||||
exp, err := util.RawExtension2Map(&c.want.app.Spec.Components[idx].Traits[tidx].Properties)
|
||||
exp, err := util.RawExtension2Map(c.want.app.Spec.Components[idx].Traits[tidx].Properties)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, exp, got)
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ func (s Service) RenderServiceToApplicationComponent(tm template.Manager, servic
|
||||
if err := pts.UnmarshalJSON(jt); err != nil {
|
||||
return comp, err
|
||||
}
|
||||
trait.Properties = *pts
|
||||
trait.Properties = pts
|
||||
traits = append(traits, trait)
|
||||
continue
|
||||
}
|
||||
@@ -106,7 +106,7 @@ func (s Service) RenderServiceToApplicationComponent(tm template.Manager, servic
|
||||
if err := settings.UnmarshalJSON(pt); err != nil {
|
||||
return comp, err
|
||||
}
|
||||
comp.Properties = *settings
|
||||
comp.Properties = settings
|
||||
|
||||
if len(traits) > 0 {
|
||||
comp.Traits = traits
|
||||
|
||||
@@ -108,7 +108,9 @@ func GetApplicationSettings(app *v1beta1.Application, componentName string) (str
|
||||
for _, comp := range app.Spec.Components {
|
||||
if comp.Name == componentName {
|
||||
data := map[string]interface{}{}
|
||||
_ = json.Unmarshal(comp.Properties.Raw, &data)
|
||||
if comp.Properties != nil {
|
||||
_ = json.Unmarshal(comp.Properties.Raw, &data)
|
||||
}
|
||||
return comp.Type, data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,10 +72,14 @@ func SetTrait(app *v1beta1.Application, componentName, traitType string, traitDa
|
||||
continue
|
||||
}
|
||||
added = true
|
||||
app.Spec.Components[idx].Traits[j].Properties.Raw = data
|
||||
if app.Spec.Components[idx].Traits[j].Properties == nil && data != nil {
|
||||
app.Spec.Components[idx].Traits[j].Properties = &runtime.RawExtension{Raw: data}
|
||||
} else {
|
||||
app.Spec.Components[idx].Traits[j].Properties.Raw = data
|
||||
}
|
||||
}
|
||||
if !added {
|
||||
app.Spec.Components[idx].Traits = append(app.Spec.Components[idx].Traits, common.ApplicationTrait{Type: traitType, Properties: runtime.RawExtension{Raw: data}})
|
||||
app.Spec.Components[idx].Traits = append(app.Spec.Components[idx].Traits, common.ApplicationTrait{Type: traitType, Properties: &runtime.RawExtension{Raw: data}})
|
||||
}
|
||||
}
|
||||
if !foundComp {
|
||||
|
||||
@@ -193,7 +193,7 @@ func loopCheckStatus(ctx context.Context, c client.Client, ioStreams cmdutil.IOS
|
||||
var message string
|
||||
for _, v := range comp.Traits {
|
||||
if v.Type == tr.Type {
|
||||
traitData, _ := util.RawExtension2Map(&v.Properties)
|
||||
traitData, _ := util.RawExtension2Map(v.Properties)
|
||||
for k, v := range traitData {
|
||||
message += fmt.Sprintf("%v=%v\n\t\t", k, v)
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ var workflowSpec = v1beta1.ApplicationSpec{
|
||||
Components: []common.ApplicationComponent{{
|
||||
Name: "test-component",
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
}},
|
||||
Workflow: &v1beta1.Workflow{
|
||||
Steps: []v1beta1.WorkflowStep{{
|
||||
Name: "test-wf1",
|
||||
Type: "foowf",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"namespace":"default"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"namespace":"default"}`)},
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ var _ = Describe("rollout related e2e-test,Cloneset based app embed rollout test
|
||||
{
|
||||
Name: appName,
|
||||
Type: compType,
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte(initialProperty),
|
||||
},
|
||||
},
|
||||
@@ -496,7 +496,7 @@ var _ = Describe("rollout related e2e-test,Cloneset based app embed rollout test
|
||||
appName = "app-rollout-5"
|
||||
app := generateNewApp(appName, namespaceName, "clonesetservice", plan)
|
||||
ingressProperties := `{"domain":"test-1.example.com","http":{"/":8080}}`
|
||||
app.Spec.Components[0].Traits = []apicommon.ApplicationTrait{{Type: "ingress", Properties: runtime.RawExtension{Raw: []byte(ingressProperties)}}}
|
||||
app.Spec.Components[0].Traits = []apicommon.ApplicationTrait{{Type: "ingress", Properties: &runtime.RawExtension{Raw: []byte(ingressProperties)}}}
|
||||
Expect(k8sClient.Create(ctx, app)).Should(BeNil())
|
||||
verifyRolloutSucceeded(utils.ConstructRevisionName(appName, 1), "1")
|
||||
updateAppWithCpuAndPlan(app, "2", plan)
|
||||
@@ -530,7 +530,7 @@ var _ = Describe("rollout related e2e-test,Cloneset based app embed rollout test
|
||||
annotherComp := apicommon.ApplicationComponent{
|
||||
Name: "another-comp",
|
||||
Type: "clonesetservice",
|
||||
Properties: runtime.RawExtension{
|
||||
Properties: &runtime.RawExtension{
|
||||
Raw: []byte(initialProperty),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -99,10 +99,10 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"image": "nginx:latest"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image": "nginx:latest"}`)},
|
||||
Traits: []common.ApplicationTrait{{
|
||||
Type: "cluster-scope-trait",
|
||||
Properties: runtime.RawExtension{Raw: []byte("{}")},
|
||||
Properties: &runtime.RawExtension{Raw: []byte("{}")},
|
||||
}},
|
||||
},
|
||||
},
|
||||
@@ -177,15 +177,15 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"image": "nginx:latest"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image": "nginx:latest"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "cluster-scope-trait",
|
||||
Properties: runtime.RawExtension{Raw: []byte("{}")},
|
||||
Properties: &runtime.RawExtension{Raw: []byte("{}")},
|
||||
},
|
||||
{
|
||||
Type: "cross-scaler",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -217,7 +217,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"image": "nginx:latest"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"image": "nginx:latest"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
// remove the cluster-scoped trait and keep the
|
||||
// cross-namespaced trait.
|
||||
@@ -226,7 +226,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
// not cascading deletion
|
||||
{
|
||||
Type: "cross-scaler",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
}},
|
||||
},
|
||||
},
|
||||
@@ -274,7 +274,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "cross-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -379,7 +379,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "normal-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -426,7 +426,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
app.Spec.Components[0].Traits = []common.ApplicationTrait{
|
||||
{
|
||||
Type: "cross-scaler",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
},
|
||||
}
|
||||
return k8sClient.Update(ctx, app)
|
||||
@@ -495,11 +495,11 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "normal-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "cross-scaler",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"replicas": 1}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -607,12 +607,12 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: component1Name,
|
||||
Type: "normal-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
{
|
||||
Name: component2Name,
|
||||
Type: "cross-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -738,7 +738,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "cross-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -799,7 +799,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"nginx"}`)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"nginx"}`)}
|
||||
err = k8sClient.Update(ctx, checkApp)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -882,12 +882,12 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: component1Name,
|
||||
Type: "cross-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
{
|
||||
Name: component2Name,
|
||||
Type: "cross-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1036,11 +1036,11 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "cross-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Traits: []common.ApplicationTrait{
|
||||
{
|
||||
Type: "cross-scaler",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"replicas": 0}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"replicas": 0}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1194,7 +1194,7 @@ var _ = Describe("Test application cross namespace resource", func() {
|
||||
{
|
||||
Name: componentName,
|
||||
Type: "cross-worker",
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -93,7 +93,7 @@ var _ = Describe("Test application controller clean up appRevision", func() {
|
||||
checkApp = new(v1beta1.Application)
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
if err := k8sClient.Update(ctx, checkApp); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -133,7 +133,7 @@ var _ = Describe("Test application controller clean up appRevision", func() {
|
||||
return err
|
||||
}
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 5)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
return k8sClient.Update(ctx, checkApp)
|
||||
}, time.Second*10, time.Millisecond*500).Should(BeNil())
|
||||
|
||||
@@ -163,7 +163,7 @@ var _ = Describe("Test application controller clean up appRevision", func() {
|
||||
return err
|
||||
}
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, 6)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
if err := k8sClient.Update(ctx, checkApp); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -212,7 +212,7 @@ var _ = Describe("Test application controller clean up appRevision", func() {
|
||||
checkApp = new(v1beta1.Application)
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
property := fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
if err := k8sClient.Update(ctx, checkApp); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -243,7 +243,7 @@ var _ = Describe("Test application controller clean up appRevision", func() {
|
||||
if err := k8sClient.Get(ctx, appKey, checkApp); err != nil {
|
||||
return err
|
||||
}
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
return k8sClient.Update(ctx, checkApp)
|
||||
}, 15*time.Second, 500*time.Millisecond).Should(Succeed())
|
||||
deletedRevison := new(v1beta1.ApplicationRevision)
|
||||
@@ -272,7 +272,7 @@ var _ = Describe("Test application controller clean up appRevision", func() {
|
||||
if err := k8sClient.Get(ctx, appKey, checkApp); err != nil {
|
||||
return err
|
||||
}
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
return k8sClient.Update(ctx, checkApp)
|
||||
}, 15*time.Second, 500*time.Millisecond).Should(Succeed())
|
||||
Eventually(func() error {
|
||||
@@ -333,7 +333,7 @@ var _ = Describe("Test application controller clean up appRevision", func() {
|
||||
return err
|
||||
}
|
||||
property = fmt.Sprintf(`{"cmd":["sleep","1000"],"image":"busybox:%d"}`, i)
|
||||
checkApp.Spec.Components[0].Properties = runtime.RawExtension{Raw: []byte(property)}
|
||||
checkApp.Spec.Components[0].Properties = &runtime.RawExtension{Raw: []byte(property)}
|
||||
if err := k8sClient.Update(ctx, checkApp); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -438,7 +438,7 @@ func getApp(appName, namespace, comptype string) *v1beta1.Application {
|
||||
{
|
||||
Name: "comp1",
|
||||
Type: comptype,
|
||||
Properties: runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
Properties: &runtime.RawExtension{Raw: []byte(`{"cmd":["sleep","1000"],"image":"busybox"}`)},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -366,7 +366,7 @@ var _ = Describe("Test application of the specified definition version", func()
|
||||
}
|
||||
helmworkerV1.Spec.Schematic = &common.Schematic{
|
||||
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",
|
||||
@@ -374,7 +374,7 @@ var _ = Describe("Test application of the specified definition version", func()
|
||||
},
|
||||
},
|
||||
}),
|
||||
Repository: util.Object2RawExtension(map[string]interface{}{
|
||||
Repository: *util.Object2RawExtension(map[string]interface{}{
|
||||
"url": "https://stefanprodan.github.io/podinfo",
|
||||
}),
|
||||
},
|
||||
@@ -399,7 +399,7 @@ var _ = Describe("Test application of the specified definition version", func()
|
||||
helmworkerV2.Spec.Workload.Type = "deployments.apps"
|
||||
helmworkerV2.Spec.Schematic = &common.Schematic{
|
||||
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",
|
||||
@@ -407,7 +407,7 @@ var _ = Describe("Test application of the specified definition version", func()
|
||||
},
|
||||
},
|
||||
}),
|
||||
Repository: util.Object2RawExtension(map[string]interface{}{
|
||||
Repository: *util.Object2RawExtension(map[string]interface{}{
|
||||
"url": "https://stefanprodan.github.io/podinfo",
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -66,7 +66,7 @@ var _ = Describe("Test application containing helm module", func() {
|
||||
cd.Spec.Workload.Definition = common.WorkloadGVK{APIVersion: "apps/v1", Kind: "Deployment"}
|
||||
cd.Spec.Schematic = &common.Schematic{
|
||||
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",
|
||||
@@ -74,7 +74,7 @@ var _ = Describe("Test application containing helm module", func() {
|
||||
},
|
||||
},
|
||||
}),
|
||||
Repository: util.Object2RawExtension(map[string]interface{}{
|
||||
Repository: *util.Object2RawExtension(map[string]interface{}{
|
||||
"url": "http://oam.dev/catalog/",
|
||||
}),
|
||||
},
|
||||
@@ -266,7 +266,7 @@ var _ = Describe("Test application containing helm module", func() {
|
||||
workloaddef.Spec.Reference = common.DefinitionReference{Name: "deployments.apps", Version: "v1"}
|
||||
workloaddef.Spec.Schematic = &common.Schematic{
|
||||
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",
|
||||
@@ -274,7 +274,7 @@ var _ = Describe("Test application containing helm module", func() {
|
||||
},
|
||||
},
|
||||
}),
|
||||
Repository: util.Object2RawExtension(map[string]interface{}{
|
||||
Repository: *util.Object2RawExtension(map[string]interface{}{
|
||||
"url": "http://oam.dev/catalog/",
|
||||
}),
|
||||
},
|
||||
@@ -321,7 +321,7 @@ var _ = Describe("Test application containing helm module", func() {
|
||||
cd.SetNamespace(namespace)
|
||||
cd.Spec.Schematic = &common.Schematic{
|
||||
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",
|
||||
@@ -329,7 +329,7 @@ var _ = Describe("Test application containing helm module", func() {
|
||||
},
|
||||
},
|
||||
}),
|
||||
Repository: util.Object2RawExtension(map[string]interface{}{
|
||||
Repository: *util.Object2RawExtension(map[string]interface{}{
|
||||
"url": "http://oam.dev/catalog/",
|
||||
}),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user