diff --git a/apis/core.oam.dev/v1alpha1/register.go b/apis/core.oam.dev/v1alpha1/register.go index ef4aeca19..3f8ff2188 100644 --- a/apis/core.oam.dev/v1alpha1/register.go +++ b/apis/core.oam.dev/v1alpha1/register.go @@ -18,6 +18,7 @@ package v1alpha1 import ( "k8s.io/apimachinery/pkg/runtime/schema" + k8sscheme "k8s.io/client-go/kubernetes/scheme" "sigs.k8s.io/controller-runtime/pkg/scheme" workflowv1alpha1 "github.com/kubevela/workflow/api/v1alpha1" @@ -57,4 +58,5 @@ var ( func init() { SchemeBuilder.Register(&Policy{}, &PolicyList{}) SchemeBuilder.Register(&workflowv1alpha1.Workflow{}, &workflowv1alpha1.WorkflowList{}) + _ = SchemeBuilder.AddToScheme(k8sscheme.Scheme) } diff --git a/apis/core.oam.dev/v1beta1/register.go b/apis/core.oam.dev/v1beta1/register.go index 91be6559c..158f4f50d 100644 --- a/apis/core.oam.dev/v1beta1/register.go +++ b/apis/core.oam.dev/v1beta1/register.go @@ -20,6 +20,7 @@ import ( "reflect" "k8s.io/apimachinery/pkg/runtime/schema" + k8sscheme "k8s.io/client-go/kubernetes/scheme" "sigs.k8s.io/controller-runtime/pkg/scheme" "github.com/oam-dev/kubevela/apis/core.oam.dev/common" @@ -133,6 +134,7 @@ func init() { SchemeBuilder.Register(&Application{}, &ApplicationList{}) SchemeBuilder.Register(&ApplicationRevision{}, &ApplicationRevisionList{}) SchemeBuilder.Register(&ResourceTracker{}, &ResourceTrackerList{}) + _ = SchemeBuilder.AddToScheme(k8sscheme.Scheme) } // Resource takes an unqualified resource and returns a Group qualified GroupResource diff --git a/cmd/core/app/hooks/pre_start_hook.go b/cmd/core/app/hooks/pre_start_hook.go new file mode 100644 index 000000000..c8686983c --- /dev/null +++ b/cmd/core/app/hooks/pre_start_hook.go @@ -0,0 +1,86 @@ +/* +Copyright 2022 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 hooks + +import ( + "context" + "fmt" + "time" + + "github.com/kubevela/pkg/util/compression" + "github.com/kubevela/pkg/util/singleton" + "k8s.io/apiserver/pkg/util/feature" + "k8s.io/klog/v2" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/oam-dev/kubevela/apis/core.oam.dev/common" + "github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1" + "github.com/oam-dev/kubevela/apis/types" + "github.com/oam-dev/kubevela/pkg/features" + "github.com/oam-dev/kubevela/pkg/oam" +) + +// PreStartHook hook that should be run before controller start working +type PreStartHook interface { + Run(ctx context.Context) error +} + +// SystemCRDValidationHook checks if the crd in the system are valid to run the current controller +type SystemCRDValidationHook struct { + client.Client +} + +// NewSystemCRDValidationHook . +func NewSystemCRDValidationHook() PreStartHook { + return &SystemCRDValidationHook{Client: singleton.KubeClient.Get()} +} + +// Run . +func (in *SystemCRDValidationHook) Run(ctx context.Context) error { + if feature.DefaultMutableFeatureGate.Enabled(features.ZstdApplicationRevision) || + feature.DefaultMutableFeatureGate.Enabled(features.GzipApplicationRevision) { + appRev := &v1beta1.ApplicationRevision{} + appRev.Name = fmt.Sprintf("core.pre-check.%d", time.Now().UnixNano()) + appRev.Namespace = types.DefaultKubeVelaNS + key := client.ObjectKeyFromObject(appRev) + appRev.SetLabels(map[string]string{oam.LabelPreCheck: types.VelaCoreName}) + appRev.Spec.Application.Name = appRev.Name + appRev.Spec.Application.Spec.Components = []common.ApplicationComponent{} + if feature.DefaultMutableFeatureGate.Enabled(features.ZstdApplicationRevision) { + appRev.Spec.Compression.SetType(compression.Zstd) + } else if feature.DefaultMutableFeatureGate.Enabled(features.GzipApplicationRevision) { + appRev.Spec.Compression.SetType(compression.Gzip) + } + if err := in.Client.Create(ctx, appRev); err != nil { + return err + } + defer func() { + if err := in.Client.DeleteAllOf(ctx, &v1beta1.ApplicationRevision{}, + client.InNamespace(types.DefaultKubeVelaNS), + client.MatchingLabels{oam.LabelPreCheck: types.VelaCoreName}); err != nil { + klog.Errorf("failed to recycle pre-check ApplicationRevision: %w", err) + } + }() + if err := in.Client.Get(ctx, key, appRev); err != nil { + return err + } + if appRev.Spec.Application.Name != appRev.Name { + return fmt.Errorf("the ApplicationRevision CRD is not updated. Compression cannot be used. Please upgrade your CRD to latest ones") + } + } + return nil +} diff --git a/cmd/core/app/hooks/pre_start_hook_test.go b/cmd/core/app/hooks/pre_start_hook_test.go new file mode 100644 index 000000000..34de1f8f9 --- /dev/null +++ b/cmd/core/app/hooks/pre_start_hook_test.go @@ -0,0 +1,52 @@ +/* +Copyright 2022 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 hooks_test + +import ( + "context" + "testing" + + "github.com/kubevela/pkg/util/k8s" + "github.com/kubevela/pkg/util/singleton" + "github.com/kubevela/pkg/util/test/bootstrap" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + utilfeature "k8s.io/apiserver/pkg/util/feature" + featuregatetesting "k8s.io/component-base/featuregate/testing" + + "github.com/oam-dev/kubevela/apis/types" + "github.com/oam-dev/kubevela/cmd/core/app/hooks" + "github.com/oam-dev/kubevela/pkg/features" +) + +var _ = bootstrap.InitKubeBuilderForTest(bootstrap.WithCRDPath("./testdata")) + +func TestPreStartHook(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Run pre-start hook test") +} + +var _ = Describe("Test pre-start hooks", func() { + It("Test SystemCRDValidationHook", func() { + defer featuregatetesting.SetFeatureGateDuringTest(&testing.T{}, utilfeature.DefaultFeatureGate, features.ZstdApplicationRevision, true)() + ctx := context.Background() + Expect(k8s.EnsureNamespace(ctx, singleton.KubeClient.Get(), types.DefaultKubeVelaNS)).Should(Succeed()) + err := hooks.NewSystemCRDValidationHook().Run(ctx) + Expect(err).ShouldNot(Succeed()) + Expect(err.Error()).Should(ContainSubstring("the ApplicationRevision CRD is not updated")) + }) +}) diff --git a/cmd/core/app/hooks/testdata/old_apprev_crd.yaml b/cmd/core/app/hooks/testdata/old_apprev_crd.yaml new file mode 100644 index 000000000..77c142568 --- /dev/null +++ b/cmd/core/app/hooks/testdata/old_apprev_crd.yaml @@ -0,0 +1,4927 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.6.2 + name: applicationrevisions.core.oam.dev +spec: + group: core.oam.dev + names: + categories: + - oam + kind: ApplicationRevision + listKind: ApplicationRevisionList + plural: applicationrevisions + shortNames: + - apprev + singular: applicationrevision + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1alpha2 + schema: + openAPIV3Schema: + description: ApplicationRevision is the Schema for the ApplicationRevision + 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: ApplicationRevisionSpec is the spec of ApplicationRevision + properties: + application: + description: Application records the snapshot of the created/modified + Application + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: ApplicationSpec is the spec of Application + properties: + components: + items: + description: ApplicationComponent describe the component + of application + properties: + name: + type: string + scopes: + additionalProperties: + type: string + description: scopes in ApplicationComponent defines + the component-level scopes the format is + pairs, the key represents type of `ScopeDefinition` + while the value represent the name of scope instance. + type: object + x-kubernetes-preserve-unknown-fields: true + settings: + type: object + x-kubernetes-preserve-unknown-fields: true + traits: + description: Traits define the trait of one component, + the type must be array to keep the order. + items: + description: ApplicationTrait defines the trait of + application + properties: + name: + type: string + properties: + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - name + type: object + type: array + type: + type: string + required: + - name + - type + type: object + type: array + rolloutPlan: + description: RolloutPlan is the details on how to rollout + the resources The controller simply replace the old resources + with the new one if there is no rollout plan involved + properties: + batchPartition: + description: All pods in the batches up to the batchPartition + (included) will have the target resource specification + while the rest still have the source resource This is + designed for the operators to manually rollout Default + is the the number of batches which will rollout all + the batches + format: int32 + type: integer + canaryMetric: + description: CanaryMetric provides a way for the rollout + process to automatically check certain metrics before + complete the process + items: + description: CanaryMetric holds the reference to metrics + used for canary analysis + properties: + interval: + description: Interval represents the windows size + type: string + metricsRange: + description: Range value accepted for this metric + properties: + max: + anyOf: + - type: integer + - type: string + description: Maximum value + x-kubernetes-int-or-string: true + min: + anyOf: + - type: integer + - type: string + description: Minimum value + x-kubernetes-int-or-string: true + type: object + name: + description: Name of the metric + type: string + templateRef: + description: TemplateRef references a metric template + object + 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 + required: + - name + type: object + type: array + numBatches: + description: The number of batches, default = 1 + format: int32 + type: integer + paused: + description: Paused the rollout, default is false + type: boolean + rolloutBatches: + description: The exact distribution among batches. its + size has to be exactly the same as the NumBatches (if + set) The total number cannot exceed the targetSize or + the size of the source resource We will IGNORE the last + batch's replica field if it's a percentage since round + errors can lead to inaccurate sum We highly recommend + to leave the last batch's replica field empty + items: + description: RolloutBatch is used to describe how the + each batch rollout should be + properties: + batchRolloutWebhooks: + description: RolloutWebhooks provides a way for + the batch rollout to interact with an external + process + items: + description: RolloutWebhook holds the reference + to external checks used for canary analysis + properties: + expectedStatus: + description: ExpectedStatus contains all the + expected http status code that we will accept + as success + items: + type: integer + type: array + metadata: + additionalProperties: + type: string + description: Metadata (key-value pairs) for + this webhook + type: object + method: + description: Method the HTTP call method, + default is POST + type: string + name: + description: Name of this webhook + type: string + type: + description: Type of this webhook + type: string + url: + description: URL address of this webhook + type: string + required: + - name + - type + - url + type: object + type: array + canaryMetric: + description: CanaryMetric provides a way for the + batch rollout process to automatically check certain + metrics before moving to the next batch + items: + description: CanaryMetric holds the reference + to metrics used for canary analysis + properties: + interval: + description: Interval represents the windows + size + type: string + metricsRange: + description: Range value accepted for this + metric + properties: + max: + anyOf: + - type: integer + - type: string + description: Maximum value + x-kubernetes-int-or-string: true + min: + anyOf: + - type: integer + - type: string + description: Minimum value + x-kubernetes-int-or-string: true + type: object + name: + description: Name of the metric + type: string + templateRef: + description: TemplateRef references a metric + template object + 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 + required: + - name + type: object + type: array + instanceInterval: + description: The wait time, in seconds, between + instances upgrades, default = 0 + format: int32 + type: integer + maxUnavailable: + anyOf: + - type: integer + - type: string + description: MaxUnavailable is the max allowed number + of pods that is unavailable during the upgrade. + We will mark the batch as ready as long as there + are less or equal number of pods unavailable than + this number. default = 0 + x-kubernetes-int-or-string: true + podList: + description: The list of Pods to get upgraded it + is mutually exclusive with the Replicas field + items: + type: string + type: array + replicas: + anyOf: + - type: integer + - type: string + description: 'Replicas is the number of pods to + upgrade in this batch it can be an absolute number + (ex: 5) or a percentage of total pods we will + ignore the percentage of the last batch to just + fill the gap it is mutually exclusive with the + PodList field' + x-kubernetes-int-or-string: true + type: object + type: array + rolloutStrategy: + description: RolloutStrategy defines strategies for the + rollout plan The default is IncreaseFirstRolloutStrategyType + type: string + rolloutWebhooks: + description: RolloutWebhooks provide a way for the rollout + to interact with an external process + items: + description: RolloutWebhook holds the reference to external + checks used for canary analysis + properties: + expectedStatus: + description: ExpectedStatus contains all the expected + http status code that we will accept as success + items: + type: integer + type: array + metadata: + additionalProperties: + type: string + description: Metadata (key-value pairs) for this + webhook + type: object + method: + description: Method the HTTP call method, default + is POST + type: string + name: + description: Name of this webhook + type: string + type: + description: Type of this webhook + type: string + url: + description: URL address of this webhook + type: string + required: + - name + - type + - url + type: object + type: array + targetSize: + description: The size of the target resource. The default + is the same as the size of the source resource. + format: int32 + type: integer + type: object + required: + - components + type: object + status: + description: AppStatus defines the observed state of Application + properties: + appliedResources: + description: AppliedResources record the resources that the workflow + step apply. + items: + description: ClusterObjectReference defines the object reference + with cluster. + properties: + apiVersion: + description: API version of the referent. + type: string + cluster: + type: string + creator: + 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: array + components: + description: Components record the related Components created + by Application Controller + items: + 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: array + 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 + latestRevision: + description: LatestRevision of the application configuration + it generates + properties: + name: + type: string + revision: + format: int64 + type: integer + revisionHash: + description: RevisionHash record the hash value of the + spec of ApplicationRevision object. + type: string + required: + - name + - revision + type: object + observedGeneration: + description: The generation observed by the application controller. + format: int64 + type: integer + policy: + description: PolicyStatus records the status of policy Deprecated + This field is only used by EnvBinding Policy which is deprecated. + items: + description: PolicyStatus records the status of policy Deprecated + properties: + name: + type: string + status: + type: object + x-kubernetes-preserve-unknown-fields: true + type: + type: string + required: + - name + - type + type: object + type: array + services: + description: Services record the status of the application + services + items: + description: ApplicationComponentStatus record the health + status of App component + properties: + cluster: + type: string + env: + type: string + healthy: + type: boolean + message: + type: string + name: + type: string + namespace: + type: string + scopes: + items: + 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: array + traits: + items: + description: ApplicationTraitStatus records the trait + health status + properties: + healthy: + type: boolean + message: + type: string + type: + type: string + required: + - healthy + - type + type: object + type: array + workloadDefinition: + description: WorkloadDefinition is the definition of + a WorkloadDefinition, such as deployments/apps.v1 + properties: + apiVersion: + type: string + kind: + type: string + required: + - apiVersion + - kind + type: object + required: + - healthy + - name + type: object + type: array + status: + description: ApplicationPhase is a label for the condition + of an application at the current time + type: string + workflow: + description: Workflow record the status of workflow + properties: + appRevision: + type: string + 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 + endTime: + format: date-time + type: string + finished: + type: boolean + message: + type: string + mode: + type: string + startTime: + format: date-time + type: string + status: + description: WorkflowRunPhase is a label for the condition + of a WorkflowRun at the current time + type: string + steps: + items: + description: WorkflowStepStatus record the status of + a workflow step, include step status and subStep status + properties: + firstExecuteTime: + description: FirstExecuteTime is the first time + this step execution. + format: date-time + type: string + id: + type: string + lastExecuteTime: + description: LastExecuteTime is the last time this + step execution. + format: date-time + type: string + 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 + subSteps: + items: + description: StepStatus record the base status + of workflow step, which could be workflow step + or subStep + properties: + firstExecuteTime: + description: FirstExecuteTime is the first + time this step execution. + format: date-time + type: string + id: + type: string + lastExecuteTime: + description: LastExecuteTime is the last time + this step execution. + format: date-time + type: string + 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 + type: + type: string + required: + - id + type: object + type: array + type: + type: string + required: + - id + type: object + type: array + suspend: + type: boolean + suspendState: + type: string + terminated: + type: boolean + required: + - finished + - mode + - suspend + - terminated + type: object + type: object + type: object + applicationConfiguration: + description: ApplicationConfiguration records the rendered applicationConfiguration + from Application, it will contains the whole K8s CR of trait and + the reference component in it. + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + componentDefinitions: + additionalProperties: + description: ComponentDefinition is the Schema for the componentdefinitions + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: ComponentDefinitionSpec defines the desired state + of ComponentDefinition + properties: + childResourceKinds: + description: ChildResourceKinds are the list of GVK of the + child resources this workload generates + items: + description: A ChildResourceKind defines a child Kubernetes + resource kind with a selector + properties: + apiVersion: + description: APIVersion of the child resource + type: string + kind: + description: Kind of the child resource + type: string + selector: + additionalProperties: + type: string + description: Selector to select the child resources + that the workload wants to expose to traits + type: object + required: + - apiVersion + - kind + type: object + type: array + extension: + description: Extension is used for extension needs by OAM + platform builders + type: object + x-kubernetes-preserve-unknown-fields: true + podSpecPath: + description: PodSpecPath indicates where/if this workload + has K8s podSpec field if one workload has podSpec, trait + can do lot's of assumption such as port, env, volume fields. + type: string + revisionLabel: + description: RevisionLabel indicates which label for underlying + resources(e.g. pods) of this workload can be used by trait + to create resource selectors(e.g. label selector for pods). + type: string + schematic: + description: Schematic defines the data format and template + of the encapsulation of the workload + properties: + cue: + description: CUE defines the encapsulation in CUE format + properties: + template: + description: Template defines the abstraction template + data of the capability, it will replace the old + CUE template in extension field. Template is a + required field if CUE is defined in Capability + Definition. + type: string + required: + - template + type: object + helm: + description: A Helm represents resources used by a Helm + module + properties: + release: + description: Release records a Helm release used + by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + repository: + description: HelmRelease records a Helm repository + used by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - release + - repository + type: object + kube: + description: Kube defines the encapsulation in raw Kubernetes + resource format + properties: + parameters: + description: Parameters defines configurable parameters + items: + description: A KubeParameter defines a configurable + parameter of a component. + properties: + description: + description: Description of this parameter. + type: string + fieldPaths: + description: "FieldPaths specifies an array + of fields within this workload that will + be overwritten by the value of this parameter. + \tAll fields must be of the same type. Fields + are specified as JSON field paths without + a leading dot, for example 'spec.replicas'." + items: + type: string + type: array + name: + description: Name of this parameter + type: string + required: + default: false + description: Required specifies whether or + not a value for this parameter must be supplied + when authoring an Application. + type: boolean + type: + description: 'ValueType indicates the type + of the parameter value, and only supports + basic data types: string, number, boolean.' + enum: + - string + - number + - boolean + type: string + required: + - fieldPaths + - name + - type + type: object + type: array + template: + description: Template defines the raw Kubernetes + resource + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - template + type: object + terraform: + description: Terraform is the struct to describe cloud + resources managed by Hashicorp Terraform + properties: + configuration: + description: Configuration is Terraform Configuration + type: string + customRegion: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string + deleteResource: + default: true + description: DeleteResource will determine whether + provisioned cloud resources will be deleted when + CR is deleted + type: boolean + path: + description: Path is the sub-directory of remote + git repository. It's valid when remote is set + type: string + providerRef: + description: ProviderReference specifies the reference + to Provider + properties: + name: + description: Name of the referenced object. + type: string + namespace: + default: default + description: Namespace of the referenced object. + type: string + required: + - name + type: object + type: + default: hcl + description: Type specifies which Terraform configuration + it is, HCL or JSON syntax + enum: + - hcl + - json + - remote + type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object + required: + - configuration + type: object + type: object + status: + description: Status defines the custom health policy and + status message for workload + properties: + customStatus: + description: CustomStatus defines the custom status + message that could display to user + type: string + healthPolicy: + description: HealthPolicy defines the health check policy + for the abstraction + type: string + type: object + workload: + description: Workload is a workload type descriptor + properties: + definition: + description: Definition mutually exclusive to workload.type, + a embedded WorkloadDefinition + properties: + apiVersion: + type: string + kind: + type: string + required: + - apiVersion + - kind + type: object + type: + description: Type ref to a WorkloadDefinition via name + type: string + type: object + required: + - workload + type: object + status: + description: ComponentDefinitionStatus is the status of ComponentDefinition + 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 + configMapRef: + description: ConfigMapRef refer to a ConfigMap which contains + OpenAPI V3 JSON schema of Component parameters. + type: string + latestRevision: + description: LatestRevision of the component definition + properties: + name: + type: string + revision: + format: int64 + type: integer + revisionHash: + description: RevisionHash record the hash value of the + spec of ApplicationRevision object. + type: string + required: + - name + - revision + type: object + type: object + type: object + description: ComponentDefinitions records the snapshot of the componentDefinitions + related with the created/modified Application + type: object + components: + items: + description: RawComponent record raw component + properties: + raw: + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + required: + - raw + type: object + type: array + scopeDefinitions: + additionalProperties: + description: A ScopeDefinition registers a kind of Kubernetes custom + resource as a valid OAM scope kind by referencing its CustomResourceDefinition. + The CRD is used to validate the schema of the scope when it is + embedded in an OAM ApplicationConfiguration. + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: A ScopeDefinitionSpec defines the desired state + of a ScopeDefinition. + properties: + allowComponentOverlap: + description: AllowComponentOverlap specifies whether an + OAM component may exist in multiple instances of this + kind of scope. + type: boolean + definitionRef: + description: Reference to the CustomResourceDefinition that + defines this scope kind. + properties: + name: + description: Name of the referenced CustomResourceDefinition. + type: string + version: + description: Version indicate which version should be + used if CRD has multiple versions by default it will + use the first one if not specified + type: string + required: + - name + type: object + extension: + description: Extension is used for extension needs by OAM + platform builders + type: object + x-kubernetes-preserve-unknown-fields: true + workloadRefsPath: + description: WorkloadRefsPath indicates if/where a scope + accepts workloadRef objects + type: string + required: + - allowComponentOverlap + - definitionRef + type: object + type: object + description: ScopeDefinitions records the snapshot of the scopeDefinitions + related with the created/modified Application + type: object + traitDefinitions: + additionalProperties: + description: A TraitDefinition registers a kind of Kubernetes custom + resource as a valid OAM trait kind by referencing its CustomResourceDefinition. + The CRD is used to validate the schema of the trait when it is + embedded in an OAM ApplicationConfiguration. + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: A TraitDefinitionSpec defines the desired state + of a TraitDefinition. + properties: + appliesToWorkloads: + description: AppliesToWorkloads specifies the list of workload + kinds this trait applies to. Workload kinds are specified + in kind.group/version format, e.g. server.core.oam.dev/v1alpha2. + Traits that omit this field apply to all workload kinds. + items: + type: string + type: array + conflictsWith: + description: 'ConflictsWith specifies the list of traits(CRD + name, Definition name, CRD group) which could not apply + to the same workloads with this trait. Traits that omit + this field can work with any other traits. Example rules: + "service" # Trait definition name "services.k8s.io" # + API resource/crd name "*.networking.k8s.io" # API group + "labelSelector:foo=bar" # label selector labelSelector + format: https://pkg.go.dev/k8s.io/apimachinery/pkg/labels#Parse' + items: + type: string + type: array + definitionRef: + description: Reference to the CustomResourceDefinition that + defines this trait kind. + properties: + name: + description: Name of the referenced CustomResourceDefinition. + type: string + version: + description: Version indicate which version should be + used if CRD has multiple versions by default it will + use the first one if not specified + type: string + required: + - name + type: object + extension: + description: Extension is used for extension needs by OAM + platform builders + type: object + x-kubernetes-preserve-unknown-fields: true + podDisruptive: + description: PodDisruptive specifies whether using the trait + will cause the pod to restart or not. + type: boolean + revisionEnabled: + description: Revision indicates whether a trait is aware + of component revision + type: boolean + schematic: + description: Schematic defines the data format and template + of the encapsulation of the trait + properties: + cue: + description: CUE defines the encapsulation in CUE format + properties: + template: + description: Template defines the abstraction template + data of the capability, it will replace the old + CUE template in extension field. Template is a + required field if CUE is defined in Capability + Definition. + type: string + required: + - template + type: object + helm: + description: A Helm represents resources used by a Helm + module + properties: + release: + description: Release records a Helm release used + by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + repository: + description: HelmRelease records a Helm repository + used by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - release + - repository + type: object + kube: + description: Kube defines the encapsulation in raw Kubernetes + resource format + properties: + parameters: + description: Parameters defines configurable parameters + items: + description: A KubeParameter defines a configurable + parameter of a component. + properties: + description: + description: Description of this parameter. + type: string + fieldPaths: + description: "FieldPaths specifies an array + of fields within this workload that will + be overwritten by the value of this parameter. + \tAll fields must be of the same type. Fields + are specified as JSON field paths without + a leading dot, for example 'spec.replicas'." + items: + type: string + type: array + name: + description: Name of this parameter + type: string + required: + default: false + description: Required specifies whether or + not a value for this parameter must be supplied + when authoring an Application. + type: boolean + type: + description: 'ValueType indicates the type + of the parameter value, and only supports + basic data types: string, number, boolean.' + enum: + - string + - number + - boolean + type: string + required: + - fieldPaths + - name + - type + type: object + type: array + template: + description: Template defines the raw Kubernetes + resource + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - template + type: object + terraform: + description: Terraform is the struct to describe cloud + resources managed by Hashicorp Terraform + properties: + configuration: + description: Configuration is Terraform Configuration + type: string + customRegion: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string + deleteResource: + default: true + description: DeleteResource will determine whether + provisioned cloud resources will be deleted when + CR is deleted + type: boolean + path: + description: Path is the sub-directory of remote + git repository. It's valid when remote is set + type: string + providerRef: + description: ProviderReference specifies the reference + to Provider + properties: + name: + description: Name of the referenced object. + type: string + namespace: + default: default + description: Namespace of the referenced object. + type: string + required: + - name + type: object + type: + default: hcl + description: Type specifies which Terraform configuration + it is, HCL or JSON syntax + enum: + - hcl + - json + - remote + type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object + required: + - configuration + type: object + type: object + status: + description: Status defines the custom health policy and + status message for trait + properties: + customStatus: + description: CustomStatus defines the custom status + message that could display to user + type: string + healthPolicy: + description: HealthPolicy defines the health check policy + for the abstraction + type: string + type: object + workloadRefPath: + description: WorkloadRefPath indicates where/if a trait + accepts a workloadRef object + type: string + type: object + status: + description: TraitDefinitionStatus is the status of TraitDefinition + 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 + configMapRef: + description: ConfigMapRef refer to a ConfigMap which contains + OpenAPI V3 JSON schema of Component parameters. + type: string + latestRevision: + description: LatestRevision of the trait definition + properties: + name: + type: string + revision: + format: int64 + type: integer + revisionHash: + description: RevisionHash record the hash value of the + spec of ApplicationRevision object. + type: string + required: + - name + - revision + type: object + type: object + type: object + description: TraitDefinitions records the snapshot of the traitDefinitions + related with the created/modified Application + type: object + workloadDefinitions: + additionalProperties: + description: A WorkloadDefinition registers a kind of Kubernetes + custom resource as a valid OAM workload kind by referencing its + CustomResourceDefinition. The CRD is used to validate the schema + of the workload when it is embedded in an OAM Component. + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: A WorkloadDefinitionSpec defines the desired state + of a WorkloadDefinition. + properties: + childResourceKinds: + description: ChildResourceKinds are the list of GVK of the + child resources this workload generates + items: + description: A ChildResourceKind defines a child Kubernetes + resource kind with a selector + properties: + apiVersion: + description: APIVersion of the child resource + type: string + kind: + description: Kind of the child resource + type: string + selector: + additionalProperties: + type: string + description: Selector to select the child resources + that the workload wants to expose to traits + type: object + required: + - apiVersion + - kind + type: object + type: array + definitionRef: + description: Reference to the CustomResourceDefinition that + defines this workload kind. + properties: + name: + description: Name of the referenced CustomResourceDefinition. + type: string + version: + description: Version indicate which version should be + used if CRD has multiple versions by default it will + use the first one if not specified + type: string + required: + - name + type: object + extension: + description: Extension is used for extension needs by OAM + platform builders + type: object + x-kubernetes-preserve-unknown-fields: true + podSpecPath: + description: PodSpecPath indicates where/if this workload + has K8s podSpec field if one workload has podSpec, trait + can do lot's of assumption such as port, env, volume fields. + type: string + revisionLabel: + description: RevisionLabel indicates which label for underlying + resources(e.g. pods) of this workload can be used by trait + to create resource selectors(e.g. label selector for pods). + type: string + schematic: + description: Schematic defines the data format and template + of the encapsulation of the workload + properties: + cue: + description: CUE defines the encapsulation in CUE format + properties: + template: + description: Template defines the abstraction template + data of the capability, it will replace the old + CUE template in extension field. Template is a + required field if CUE is defined in Capability + Definition. + type: string + required: + - template + type: object + helm: + description: A Helm represents resources used by a Helm + module + properties: + release: + description: Release records a Helm release used + by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + repository: + description: HelmRelease records a Helm repository + used by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - release + - repository + type: object + kube: + description: Kube defines the encapsulation in raw Kubernetes + resource format + properties: + parameters: + description: Parameters defines configurable parameters + items: + description: A KubeParameter defines a configurable + parameter of a component. + properties: + description: + description: Description of this parameter. + type: string + fieldPaths: + description: "FieldPaths specifies an array + of fields within this workload that will + be overwritten by the value of this parameter. + \tAll fields must be of the same type. Fields + are specified as JSON field paths without + a leading dot, for example 'spec.replicas'." + items: + type: string + type: array + name: + description: Name of this parameter + type: string + required: + default: false + description: Required specifies whether or + not a value for this parameter must be supplied + when authoring an Application. + type: boolean + type: + description: 'ValueType indicates the type + of the parameter value, and only supports + basic data types: string, number, boolean.' + enum: + - string + - number + - boolean + type: string + required: + - fieldPaths + - name + - type + type: object + type: array + template: + description: Template defines the raw Kubernetes + resource + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - template + type: object + terraform: + description: Terraform is the struct to describe cloud + resources managed by Hashicorp Terraform + properties: + configuration: + description: Configuration is Terraform Configuration + type: string + customRegion: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string + deleteResource: + default: true + description: DeleteResource will determine whether + provisioned cloud resources will be deleted when + CR is deleted + type: boolean + path: + description: Path is the sub-directory of remote + git repository. It's valid when remote is set + type: string + providerRef: + description: ProviderReference specifies the reference + to Provider + properties: + name: + description: Name of the referenced object. + type: string + namespace: + default: default + description: Namespace of the referenced object. + type: string + required: + - name + type: object + type: + default: hcl + description: Type specifies which Terraform configuration + it is, HCL or JSON syntax + enum: + - hcl + - json + - remote + type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object + required: + - configuration + type: object + type: object + status: + description: Status defines the custom health policy and + status message for workload + properties: + customStatus: + description: CustomStatus defines the custom status + message that could display to user + type: string + healthPolicy: + description: HealthPolicy defines the health check policy + for the abstraction + type: string + type: object + required: + - definitionRef + type: object + status: + description: WorkloadDefinitionStatus is the status of WorkloadDefinition + properties: + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this + condition transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this + condition's last transition from one status to another, + if any. + type: string + reason: + description: A Reason for this condition's last transition + from one status to another. + type: string + status: + description: Status of this condition; is it currently + True, False, or Unknown? + type: string + type: + description: Type of this condition. At most one of + each condition type may apply to a resource at any + point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + type: object + type: object + description: WorkloadDefinitions records the snapshot of the workloadDefinitions + related with the created/modified Application + type: object + required: + - application + - applicationConfiguration + type: object + type: object + served: true + storage: false + subresources: {} + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + - jsonPath: .metadata.annotations['app\.oam\.dev\/publishVersion'] + name: PUBLISH_VERSION + type: string + - jsonPath: .status.succeeded + name: SUCCEEDED + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: ApplicationRevision is the Schema for the ApplicationRevision + 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: ApplicationRevisionSpec is the spec of ApplicationRevision + properties: + application: + description: Application records the snapshot of the created/modified + Application + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: ApplicationSpec is the spec of Application + properties: + components: + items: + description: ApplicationComponent describe the component + of application + properties: + dependsOn: + items: + type: string + type: array + externalRevision: + description: ExternalRevision specified the component + revisionName + type: string + inputs: + description: StepInputs defines variable input of WorkflowStep + items: + properties: + from: + type: string + parameterKey: + type: string + required: + - from + - parameterKey + type: object + type: array + name: + 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 + scopes: + additionalProperties: + type: string + description: scopes in ApplicationComponent defines + the component-level scopes the format is + pairs, the key represents type of `ScopeDefinition` + while the value represent the name of scope instance. + type: object + x-kubernetes-preserve-unknown-fields: true + traits: + description: Traits define the trait of one component, + the type must be array to keep the order. + items: + description: ApplicationTrait defines the trait of + application + properties: + properties: + type: object + x-kubernetes-preserve-unknown-fields: true + type: + type: string + required: + - type + type: object + type: array + type: + type: string + required: + - name + - type + type: object + type: array + policies: + description: Policies defines the global policies for all + components in the app, e.g. security, metrics, gitops, multi-cluster + placement rules, etc. Policies are applied after components + are rendered and before workflow steps are executed. + items: + description: AppPolicy defines a global policy for all components + in the app. + properties: + name: + description: Name is the unique name of the policy. + type: string + properties: + type: object + x-kubernetes-preserve-unknown-fields: true + type: + type: string + required: + - name + - type + type: object + type: array + workflow: + description: 'Workflow defines how to customize the control + logic. If workflow is specified, Vela won''t apply any resource, + but provide rendered output in AppRevision. Workflow steps + are executed in array order, and each step: - will have + a context in annotation. - should mark "finish" phase in + status.conditions.' + properties: + mode: + description: WorkflowExecuteMode defines the mode of workflow + execution + properties: + steps: + description: Steps is the mode of workflow steps execution + type: string + subSteps: + description: SubSteps is the mode of workflow sub + steps execution + type: string + type: object + ref: + type: string + steps: + items: + description: WorkflowStep defines how to execute a workflow + step. + properties: + dependsOn: + description: DependsOn is the dependency of the + step + items: + type: string + type: array + if: + description: If is the if condition of the step + type: string + inputs: + description: Inputs is the inputs of the step + items: + properties: + from: + type: string + parameterKey: + type: string + required: + - from + - parameterKey + type: object + type: array + meta: + description: Meta is the meta data of the workflow + step. + properties: + alias: + type: string + type: object + name: + description: Name is the unique name of the workflow + step. + type: string + outputs: + description: Outputs is the outputs of the step + items: + properties: + name: + type: string + valueFrom: + type: string + required: + - name + - valueFrom + type: object + type: array + properties: + description: Properties is the properties of the + step + type: object + x-kubernetes-preserve-unknown-fields: true + subSteps: + items: + description: WorkflowStepBase defines the workflow + step base + properties: + dependsOn: + description: DependsOn is the dependency of + the step + items: + type: string + type: array + if: + description: If is the if condition of the + step + type: string + inputs: + description: Inputs is the inputs of the step + items: + properties: + from: + type: string + parameterKey: + type: string + required: + - from + - parameterKey + type: object + type: array + meta: + description: Meta is the meta data of the + workflow step. + properties: + alias: + type: string + type: object + name: + description: Name is the unique name of the + workflow step. + type: string + outputs: + description: Outputs is the outputs of the + step + items: + properties: + name: + type: string + valueFrom: + type: string + required: + - name + - valueFrom + type: object + type: array + properties: + description: Properties is the properties + of the step + type: object + x-kubernetes-preserve-unknown-fields: true + timeout: + description: Timeout is the timeout of the + step + type: string + type: + description: Type is the type of the workflow + step. + type: string + required: + - name + - type + type: object + type: array + timeout: + description: Timeout is the timeout of the step + type: string + type: + description: Type is the type of the workflow step. + type: string + required: + - name + - type + type: object + type: array + type: object + required: + - components + type: object + status: + description: AppStatus defines the observed state of Application + properties: + appliedResources: + description: AppliedResources record the resources that the workflow + step apply. + items: + description: ClusterObjectReference defines the object reference + with cluster. + properties: + apiVersion: + description: API version of the referent. + type: string + cluster: + type: string + creator: + 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: array + components: + description: Components record the related Components created + by Application Controller + items: + 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: array + 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 + latestRevision: + description: LatestRevision of the application configuration + it generates + properties: + name: + type: string + revision: + format: int64 + type: integer + revisionHash: + description: RevisionHash record the hash value of the + spec of ApplicationRevision object. + type: string + required: + - name + - revision + type: object + observedGeneration: + description: The generation observed by the application controller. + format: int64 + type: integer + policy: + description: PolicyStatus records the status of policy Deprecated + This field is only used by EnvBinding Policy which is deprecated. + items: + description: PolicyStatus records the status of policy Deprecated + properties: + name: + type: string + status: + type: object + x-kubernetes-preserve-unknown-fields: true + type: + type: string + required: + - name + - type + type: object + type: array + services: + description: Services record the status of the application + services + items: + description: ApplicationComponentStatus record the health + status of App component + properties: + cluster: + type: string + env: + type: string + healthy: + type: boolean + message: + type: string + name: + type: string + namespace: + type: string + scopes: + items: + 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: array + traits: + items: + description: ApplicationTraitStatus records the trait + health status + properties: + healthy: + type: boolean + message: + type: string + type: + type: string + required: + - healthy + - type + type: object + type: array + workloadDefinition: + description: WorkloadDefinition is the definition of + a WorkloadDefinition, such as deployments/apps.v1 + properties: + apiVersion: + type: string + kind: + type: string + required: + - apiVersion + - kind + type: object + required: + - healthy + - name + type: object + type: array + status: + description: ApplicationPhase is a label for the condition + of an application at the current time + type: string + workflow: + description: Workflow record the status of workflow + properties: + appRevision: + type: string + 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 + endTime: + format: date-time + type: string + finished: + type: boolean + message: + type: string + mode: + type: string + startTime: + format: date-time + type: string + status: + description: WorkflowRunPhase is a label for the condition + of a WorkflowRun at the current time + type: string + steps: + items: + description: WorkflowStepStatus record the status of + a workflow step, include step status and subStep status + properties: + firstExecuteTime: + description: FirstExecuteTime is the first time + this step execution. + format: date-time + type: string + id: + type: string + lastExecuteTime: + description: LastExecuteTime is the last time this + step execution. + format: date-time + type: string + 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 + subSteps: + items: + description: StepStatus record the base status + of workflow step, which could be workflow step + or subStep + properties: + firstExecuteTime: + description: FirstExecuteTime is the first + time this step execution. + format: date-time + type: string + id: + type: string + lastExecuteTime: + description: LastExecuteTime is the last time + this step execution. + format: date-time + type: string + 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 + type: + type: string + required: + - id + type: object + type: array + type: + type: string + required: + - id + type: object + type: array + suspend: + type: boolean + suspendState: + type: string + terminated: + type: boolean + required: + - finished + - mode + - suspend + - terminated + type: object + type: object + type: object + componentDefinitions: + additionalProperties: + description: ComponentDefinition is the Schema for the componentdefinitions + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: ComponentDefinitionSpec defines the desired state + of ComponentDefinition + properties: + childResourceKinds: + description: ChildResourceKinds are the list of GVK of the + child resources this workload generates + items: + description: A ChildResourceKind defines a child Kubernetes + resource kind with a selector + properties: + apiVersion: + description: APIVersion of the child resource + type: string + kind: + description: Kind of the child resource + type: string + selector: + additionalProperties: + type: string + description: Selector to select the child resources + that the workload wants to expose to traits + type: object + required: + - apiVersion + - kind + type: object + type: array + extension: + description: Extension is used for extension needs by OAM + platform builders + type: object + x-kubernetes-preserve-unknown-fields: true + podSpecPath: + description: PodSpecPath indicates where/if this workload + has K8s podSpec field if one workload has podSpec, trait + can do lot's of assumption such as port, env, volume fields. + type: string + revisionLabel: + description: RevisionLabel indicates which label for underlying + resources(e.g. pods) of this workload can be used by trait + to create resource selectors(e.g. label selector for pods). + type: string + schematic: + description: Schematic defines the data format and template + of the encapsulation of the workload + properties: + cue: + description: CUE defines the encapsulation in CUE format + properties: + template: + description: Template defines the abstraction template + data of the capability, it will replace the old + CUE template in extension field. Template is a + required field if CUE is defined in Capability + Definition. + type: string + required: + - template + type: object + helm: + description: A Helm represents resources used by a Helm + module + properties: + release: + description: Release records a Helm release used + by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + repository: + description: HelmRelease records a Helm repository + used by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - release + - repository + type: object + kube: + description: Kube defines the encapsulation in raw Kubernetes + resource format + properties: + parameters: + description: Parameters defines configurable parameters + items: + description: A KubeParameter defines a configurable + parameter of a component. + properties: + description: + description: Description of this parameter. + type: string + fieldPaths: + description: "FieldPaths specifies an array + of fields within this workload that will + be overwritten by the value of this parameter. + \tAll fields must be of the same type. Fields + are specified as JSON field paths without + a leading dot, for example 'spec.replicas'." + items: + type: string + type: array + name: + description: Name of this parameter + type: string + required: + default: false + description: Required specifies whether or + not a value for this parameter must be supplied + when authoring an Application. + type: boolean + type: + description: 'ValueType indicates the type + of the parameter value, and only supports + basic data types: string, number, boolean.' + enum: + - string + - number + - boolean + type: string + required: + - fieldPaths + - name + - type + type: object + type: array + template: + description: Template defines the raw Kubernetes + resource + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - template + type: object + terraform: + description: Terraform is the struct to describe cloud + resources managed by Hashicorp Terraform + properties: + configuration: + description: Configuration is Terraform Configuration + type: string + customRegion: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string + deleteResource: + default: true + description: DeleteResource will determine whether + provisioned cloud resources will be deleted when + CR is deleted + type: boolean + path: + description: Path is the sub-directory of remote + git repository. It's valid when remote is set + type: string + providerRef: + description: ProviderReference specifies the reference + to Provider + properties: + name: + description: Name of the referenced object. + type: string + namespace: + default: default + description: Namespace of the referenced object. + type: string + required: + - name + type: object + type: + default: hcl + description: Type specifies which Terraform configuration + it is, HCL or JSON syntax + enum: + - hcl + - json + - remote + type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object + required: + - configuration + type: object + type: object + status: + description: Status defines the custom health policy and + status message for workload + properties: + customStatus: + description: CustomStatus defines the custom status + message that could display to user + type: string + healthPolicy: + description: HealthPolicy defines the health check policy + for the abstraction + type: string + type: object + workload: + description: Workload is a workload type descriptor + properties: + definition: + description: Definition mutually exclusive to workload.type, + a embedded WorkloadDefinition + properties: + apiVersion: + type: string + kind: + type: string + required: + - apiVersion + - kind + type: object + type: + description: Type ref to a WorkloadDefinition via name + type: string + type: object + required: + - workload + type: object + status: + description: ComponentDefinitionStatus is the status of ComponentDefinition + 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 + configMapRef: + description: ConfigMapRef refer to a ConfigMap which contains + OpenAPI V3 JSON schema of Component parameters. + type: string + latestRevision: + description: LatestRevision of the component definition + properties: + name: + type: string + revision: + format: int64 + type: integer + revisionHash: + description: RevisionHash record the hash value of the + spec of ApplicationRevision object. + type: string + required: + - name + - revision + type: object + type: object + type: object + description: ComponentDefinitions records the snapshot of the componentDefinitions + related with the created/modified Application + type: object + policies: + additionalProperties: + description: Policy is the Schema for the policy 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + properties: + type: object + x-kubernetes-preserve-unknown-fields: true + type: + type: string + required: + - type + type: object + description: Policies records the external policies + type: object + policyDefinitions: + additionalProperties: + description: PolicyDefinition is the Schema for the policydefinitions + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: PolicyDefinitionSpec defines the desired state + of PolicyDefinition + properties: + definitionRef: + description: Reference to the CustomResourceDefinition that + defines this trait kind. + properties: + name: + description: Name of the referenced CustomResourceDefinition. + type: string + version: + description: Version indicate which version should be + used if CRD has multiple versions by default it will + use the first one if not specified + type: string + required: + - name + type: object + manageHealthCheck: + description: ManageHealthCheck means the policy will handle + health checking and skip application controller built-in + health checking. + type: boolean + schematic: + description: Schematic defines the data format and template + of the encapsulation of the policy definition. Only CUE + schematic is supported for now. + properties: + cue: + description: CUE defines the encapsulation in CUE format + properties: + template: + description: Template defines the abstraction template + data of the capability, it will replace the old + CUE template in extension field. Template is a + required field if CUE is defined in Capability + Definition. + type: string + required: + - template + type: object + helm: + description: A Helm represents resources used by a Helm + module + properties: + release: + description: Release records a Helm release used + by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + repository: + description: HelmRelease records a Helm repository + used by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - release + - repository + type: object + kube: + description: Kube defines the encapsulation in raw Kubernetes + resource format + properties: + parameters: + description: Parameters defines configurable parameters + items: + description: A KubeParameter defines a configurable + parameter of a component. + properties: + description: + description: Description of this parameter. + type: string + fieldPaths: + description: "FieldPaths specifies an array + of fields within this workload that will + be overwritten by the value of this parameter. + \tAll fields must be of the same type. Fields + are specified as JSON field paths without + a leading dot, for example 'spec.replicas'." + items: + type: string + type: array + name: + description: Name of this parameter + type: string + required: + default: false + description: Required specifies whether or + not a value for this parameter must be supplied + when authoring an Application. + type: boolean + type: + description: 'ValueType indicates the type + of the parameter value, and only supports + basic data types: string, number, boolean.' + enum: + - string + - number + - boolean + type: string + required: + - fieldPaths + - name + - type + type: object + type: array + template: + description: Template defines the raw Kubernetes + resource + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - template + type: object + terraform: + description: Terraform is the struct to describe cloud + resources managed by Hashicorp Terraform + properties: + configuration: + description: Configuration is Terraform Configuration + type: string + customRegion: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string + deleteResource: + default: true + description: DeleteResource will determine whether + provisioned cloud resources will be deleted when + CR is deleted + type: boolean + path: + description: Path is the sub-directory of remote + git repository. It's valid when remote is set + type: string + providerRef: + description: ProviderReference specifies the reference + to Provider + properties: + name: + description: Name of the referenced object. + type: string + namespace: + default: default + description: Namespace of the referenced object. + type: string + required: + - name + type: object + type: + default: hcl + description: Type specifies which Terraform configuration + it is, HCL or JSON syntax + enum: + - hcl + - json + - remote + type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object + required: + - configuration + type: object + type: object + type: object + status: + description: PolicyDefinitionStatus is the status of PolicyDefinition + properties: + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this + condition transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this + condition's last transition from one status to another, + if any. + type: string + reason: + description: A Reason for this condition's last transition + from one status to another. + type: string + status: + description: Status of this condition; is it currently + True, False, or Unknown? + type: string + type: + description: Type of this condition. At most one of + each condition type may apply to a resource at any + point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + configMapRef: + description: ConfigMapRef refer to a ConfigMap which contains + OpenAPI V3 JSON schema of Component parameters. + type: string + latestRevision: + description: LatestRevision of the component definition + properties: + name: + type: string + revision: + format: int64 + type: integer + revisionHash: + description: RevisionHash record the hash value of the + spec of ApplicationRevision object. + type: string + required: + - name + - revision + type: object + type: object + type: object + description: PolicyDefinitions records the snapshot of the PolicyDefinitions + related with the created/modified Application + type: object + referredObjects: + description: ReferredObjects records the referred objects used in + the ref-object typed components + items: + description: ReferredObject the referred Kubernetes object + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + type: array + x-kubernetes-preserve-unknown-fields: true + scopeDefinitions: + additionalProperties: + description: A ScopeDefinition registers a kind of Kubernetes custom + resource as a valid OAM scope kind by referencing its CustomResourceDefinition. + The CRD is used to validate the schema of the scope when it is + embedded in an OAM ApplicationConfiguration. + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: A ScopeDefinitionSpec defines the desired state + of a ScopeDefinition. + properties: + allowComponentOverlap: + description: AllowComponentOverlap specifies whether an + OAM component may exist in multiple instances of this + kind of scope. + type: boolean + definitionRef: + description: Reference to the CustomResourceDefinition that + defines this scope kind. + properties: + name: + description: Name of the referenced CustomResourceDefinition. + type: string + version: + description: Version indicate which version should be + used if CRD has multiple versions by default it will + use the first one if not specified + type: string + required: + - name + type: object + extension: + description: Extension is used for extension needs by OAM + platform builders + type: object + x-kubernetes-preserve-unknown-fields: true + workloadRefsPath: + description: WorkloadRefsPath indicates if/where a scope + accepts workloadRef objects + type: string + required: + - allowComponentOverlap + - definitionRef + type: object + type: object + description: ScopeDefinitions records the snapshot of the scopeDefinitions + related with the created/modified Application + type: object + scopeGVK: + additionalProperties: + description: GroupVersionKind unambiguously identifies a kind. It + doesn't anonymously include GroupVersion to avoid automatic coercion. It + doesn't use a GroupVersion to avoid custom marshalling + properties: + group: + type: string + kind: + type: string + version: + type: string + required: + - group + - kind + - version + type: object + description: ScopeGVK records the apiVersion to GVK mapping + type: object + traitDefinitions: + additionalProperties: + description: A TraitDefinition registers a kind of Kubernetes custom + resource as a valid OAM trait kind by referencing its CustomResourceDefinition. + The CRD is used to validate the schema of the trait when it is + embedded in an OAM ApplicationConfiguration. + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: A TraitDefinitionSpec defines the desired state + of a TraitDefinition. + properties: + appliesToWorkloads: + description: AppliesToWorkloads specifies the list of workload + kinds this trait applies to. Workload kinds are specified + in resource.group/version format, e.g. server.core.oam.dev/v1alpha2. + Traits that omit this field apply to all workload kinds. + items: + type: string + type: array + conflictsWith: + description: 'ConflictsWith specifies the list of traits(CRD + name, Definition name, CRD group) which could not apply + to the same workloads with this trait. Traits that omit + this field can work with any other traits. Example rules: + "service" # Trait definition name "services.k8s.io" # + API resource/crd name "*.networking.k8s.io" # API group + "labelSelector:foo=bar" # label selector labelSelector + format: https://pkg.go.dev/k8s.io/apimachinery/pkg/labels#Parse' + items: + type: string + type: array + controlPlaneOnly: + description: ControlPlaneOnly defines which cluster is dispatched + to + type: boolean + definitionRef: + description: Reference to the CustomResourceDefinition that + defines this trait kind. + properties: + name: + description: Name of the referenced CustomResourceDefinition. + type: string + version: + description: Version indicate which version should be + used if CRD has multiple versions by default it will + use the first one if not specified + type: string + required: + - name + type: object + extension: + description: Extension is used for extension needs by OAM + platform builders + type: object + x-kubernetes-preserve-unknown-fields: true + manageWorkload: + description: ManageWorkload defines the trait would be responsible + for creating the workload + type: boolean + podDisruptive: + description: PodDisruptive specifies whether using the trait + will cause the pod to restart or not. + type: boolean + revisionEnabled: + description: Revision indicates whether a trait is aware + of component revision + type: boolean + schematic: + description: Schematic defines the data format and template + of the encapsulation of the trait. Only CUE and Kube schematic + are supported for now. + properties: + cue: + description: CUE defines the encapsulation in CUE format + properties: + template: + description: Template defines the abstraction template + data of the capability, it will replace the old + CUE template in extension field. Template is a + required field if CUE is defined in Capability + Definition. + type: string + required: + - template + type: object + helm: + description: A Helm represents resources used by a Helm + module + properties: + release: + description: Release records a Helm release used + by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + repository: + description: HelmRelease records a Helm repository + used by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - release + - repository + type: object + kube: + description: Kube defines the encapsulation in raw Kubernetes + resource format + properties: + parameters: + description: Parameters defines configurable parameters + items: + description: A KubeParameter defines a configurable + parameter of a component. + properties: + description: + description: Description of this parameter. + type: string + fieldPaths: + description: "FieldPaths specifies an array + of fields within this workload that will + be overwritten by the value of this parameter. + \tAll fields must be of the same type. Fields + are specified as JSON field paths without + a leading dot, for example 'spec.replicas'." + items: + type: string + type: array + name: + description: Name of this parameter + type: string + required: + default: false + description: Required specifies whether or + not a value for this parameter must be supplied + when authoring an Application. + type: boolean + type: + description: 'ValueType indicates the type + of the parameter value, and only supports + basic data types: string, number, boolean.' + enum: + - string + - number + - boolean + type: string + required: + - fieldPaths + - name + - type + type: object + type: array + template: + description: Template defines the raw Kubernetes + resource + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - template + type: object + terraform: + description: Terraform is the struct to describe cloud + resources managed by Hashicorp Terraform + properties: + configuration: + description: Configuration is Terraform Configuration + type: string + customRegion: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string + deleteResource: + default: true + description: DeleteResource will determine whether + provisioned cloud resources will be deleted when + CR is deleted + type: boolean + path: + description: Path is the sub-directory of remote + git repository. It's valid when remote is set + type: string + providerRef: + description: ProviderReference specifies the reference + to Provider + properties: + name: + description: Name of the referenced object. + type: string + namespace: + default: default + description: Namespace of the referenced object. + type: string + required: + - name + type: object + type: + default: hcl + description: Type specifies which Terraform configuration + it is, HCL or JSON syntax + enum: + - hcl + - json + - remote + type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object + required: + - configuration + type: object + type: object + stage: + description: Stage defines the stage information to which + this trait resource processing belongs. Currently, PreDispatch + and PostDispatch are provided, which are used to control + resource pre-process and post-process respectively. + type: string + status: + description: Status defines the custom health policy and + status message for trait + properties: + customStatus: + description: CustomStatus defines the custom status + message that could display to user + type: string + healthPolicy: + description: HealthPolicy defines the health check policy + for the abstraction + type: string + type: object + workloadRefPath: + description: WorkloadRefPath indicates where/if a trait + accepts a workloadRef object + type: string + type: object + status: + description: TraitDefinitionStatus is the status of TraitDefinition + 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 + configMapRef: + description: ConfigMapRef refer to a ConfigMap which contains + OpenAPI V3 JSON schema of Component parameters. + type: string + latestRevision: + description: LatestRevision of the component definition + properties: + name: + type: string + revision: + format: int64 + type: integer + revisionHash: + description: RevisionHash record the hash value of the + spec of ApplicationRevision object. + type: string + required: + - name + - revision + type: object + type: object + type: object + description: TraitDefinitions records the snapshot of the traitDefinitions + related with the created/modified Application + type: object + workflow: + description: Workflow records the external workflow + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + mode: + description: WorkflowExecuteMode defines the mode of workflow + execution + properties: + steps: + description: Steps is the mode of workflow steps execution + type: string + subSteps: + description: SubSteps is the mode of workflow sub steps execution + type: string + type: object + steps: + items: + description: WorkflowStep defines how to execute a workflow + step. + properties: + dependsOn: + description: DependsOn is the dependency of the step + items: + type: string + type: array + if: + description: If is the if condition of the step + type: string + inputs: + description: Inputs is the inputs of the step + items: + properties: + from: + type: string + parameterKey: + type: string + required: + - from + - parameterKey + type: object + type: array + meta: + description: Meta is the meta data of the workflow step. + properties: + alias: + type: string + type: object + name: + description: Name is the unique name of the workflow step. + type: string + outputs: + description: Outputs is the outputs of the step + items: + properties: + name: + type: string + valueFrom: + type: string + required: + - name + - valueFrom + type: object + type: array + properties: + description: Properties is the properties of the step + type: object + x-kubernetes-preserve-unknown-fields: true + subSteps: + items: + description: WorkflowStepBase defines the workflow step + base + properties: + dependsOn: + description: DependsOn is the dependency of the step + items: + type: string + type: array + if: + description: If is the if condition of the step + type: string + inputs: + description: Inputs is the inputs of the step + items: + properties: + from: + type: string + parameterKey: + type: string + required: + - from + - parameterKey + type: object + type: array + meta: + description: Meta is the meta data of the workflow + step. + properties: + alias: + type: string + type: object + name: + description: Name is the unique name of the workflow + step. + type: string + outputs: + description: Outputs is the outputs of the step + items: + properties: + name: + type: string + valueFrom: + type: string + required: + - name + - valueFrom + type: object + type: array + properties: + description: Properties is the properties of the step + type: object + x-kubernetes-preserve-unknown-fields: true + timeout: + description: Timeout is the timeout of the step + type: string + type: + description: Type is the type of the workflow step. + type: string + required: + - name + - type + type: object + type: array + timeout: + description: Timeout is the timeout of the step + type: string + type: + description: Type is the type of the workflow step. + type: string + required: + - name + - type + type: object + type: array + type: object + workflowStepDefinitions: + additionalProperties: + description: WorkflowStepDefinition is the Schema for the workflowstepdefinitions + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: WorkflowStepDefinitionSpec defines the desired + state of WorkflowStepDefinition + properties: + definitionRef: + description: Reference to the CustomResourceDefinition that + defines this trait kind. + properties: + name: + description: Name of the referenced CustomResourceDefinition. + type: string + version: + description: Version indicate which version should be + used if CRD has multiple versions by default it will + use the first one if not specified + type: string + required: + - name + type: object + schematic: + description: Schematic defines the data format and template + of the encapsulation of the workflow step definition. + Only CUE schematic is supported for now. + properties: + cue: + description: CUE defines the encapsulation in CUE format + properties: + template: + description: Template defines the abstraction template + data of the capability, it will replace the old + CUE template in extension field. Template is a + required field if CUE is defined in Capability + Definition. + type: string + required: + - template + type: object + helm: + description: A Helm represents resources used by a Helm + module + properties: + release: + description: Release records a Helm release used + by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + repository: + description: HelmRelease records a Helm repository + used by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - release + - repository + type: object + kube: + description: Kube defines the encapsulation in raw Kubernetes + resource format + properties: + parameters: + description: Parameters defines configurable parameters + items: + description: A KubeParameter defines a configurable + parameter of a component. + properties: + description: + description: Description of this parameter. + type: string + fieldPaths: + description: "FieldPaths specifies an array + of fields within this workload that will + be overwritten by the value of this parameter. + \tAll fields must be of the same type. Fields + are specified as JSON field paths without + a leading dot, for example 'spec.replicas'." + items: + type: string + type: array + name: + description: Name of this parameter + type: string + required: + default: false + description: Required specifies whether or + not a value for this parameter must be supplied + when authoring an Application. + type: boolean + type: + description: 'ValueType indicates the type + of the parameter value, and only supports + basic data types: string, number, boolean.' + enum: + - string + - number + - boolean + type: string + required: + - fieldPaths + - name + - type + type: object + type: array + template: + description: Template defines the raw Kubernetes + resource + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - template + type: object + terraform: + description: Terraform is the struct to describe cloud + resources managed by Hashicorp Terraform + properties: + configuration: + description: Configuration is Terraform Configuration + type: string + customRegion: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string + deleteResource: + default: true + description: DeleteResource will determine whether + provisioned cloud resources will be deleted when + CR is deleted + type: boolean + path: + description: Path is the sub-directory of remote + git repository. It's valid when remote is set + type: string + providerRef: + description: ProviderReference specifies the reference + to Provider + properties: + name: + description: Name of the referenced object. + type: string + namespace: + default: default + description: Namespace of the referenced object. + type: string + required: + - name + type: object + type: + default: hcl + description: Type specifies which Terraform configuration + it is, HCL or JSON syntax + enum: + - hcl + - json + - remote + type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object + required: + - configuration + type: object + type: object + type: object + status: + description: WorkflowStepDefinitionStatus is the status of WorkflowStepDefinition + properties: + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this + condition transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this + condition's last transition from one status to another, + if any. + type: string + reason: + description: A Reason for this condition's last transition + from one status to another. + type: string + status: + description: Status of this condition; is it currently + True, False, or Unknown? + type: string + type: + description: Type of this condition. At most one of + each condition type may apply to a resource at any + point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + configMapRef: + description: ConfigMapRef refer to a ConfigMap which contains + OpenAPI V3 JSON schema of Component parameters. + type: string + latestRevision: + description: LatestRevision of the component definition + properties: + name: + type: string + revision: + format: int64 + type: integer + revisionHash: + description: RevisionHash record the hash value of the + spec of ApplicationRevision object. + type: string + required: + - name + - revision + type: object + type: object + type: object + description: WorkflowStepDefinitions records the snapshot of the WorkflowStepDefinitions + related with the created/modified Application + type: object + workloadDefinitions: + additionalProperties: + description: A WorkloadDefinition registers a kind of Kubernetes + custom resource as a valid OAM workload kind by referencing its + CustomResourceDefinition. The CRD is used to validate the schema + of the workload when it is embedded in an OAM Component. + 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: + properties: + annotations: + additionalProperties: + type: string + type: object + finalizers: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + type: object + spec: + description: A WorkloadDefinitionSpec defines the desired state + of a WorkloadDefinition. + properties: + childResourceKinds: + description: ChildResourceKinds are the list of GVK of the + child resources this workload generates + items: + description: A ChildResourceKind defines a child Kubernetes + resource kind with a selector + properties: + apiVersion: + description: APIVersion of the child resource + type: string + kind: + description: Kind of the child resource + type: string + selector: + additionalProperties: + type: string + description: Selector to select the child resources + that the workload wants to expose to traits + type: object + required: + - apiVersion + - kind + type: object + type: array + definitionRef: + description: Reference to the CustomResourceDefinition that + defines this workload kind. + properties: + name: + description: Name of the referenced CustomResourceDefinition. + type: string + version: + description: Version indicate which version should be + used if CRD has multiple versions by default it will + use the first one if not specified + type: string + required: + - name + type: object + extension: + description: Extension is used for extension needs by OAM + platform builders + type: object + x-kubernetes-preserve-unknown-fields: true + podSpecPath: + description: PodSpecPath indicates where/if this workload + has K8s podSpec field if one workload has podSpec, trait + can do lot's of assumption such as port, env, volume fields. + type: string + revisionLabel: + description: RevisionLabel indicates which label for underlying + resources(e.g. pods) of this workload can be used by trait + to create resource selectors(e.g. label selector for pods). + type: string + schematic: + description: Schematic defines the data format and template + of the encapsulation of the workload + properties: + cue: + description: CUE defines the encapsulation in CUE format + properties: + template: + description: Template defines the abstraction template + data of the capability, it will replace the old + CUE template in extension field. Template is a + required field if CUE is defined in Capability + Definition. + type: string + required: + - template + type: object + helm: + description: A Helm represents resources used by a Helm + module + properties: + release: + description: Release records a Helm release used + by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + repository: + description: HelmRelease records a Helm repository + used by a Helm module workload. + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - release + - repository + type: object + kube: + description: Kube defines the encapsulation in raw Kubernetes + resource format + properties: + parameters: + description: Parameters defines configurable parameters + items: + description: A KubeParameter defines a configurable + parameter of a component. + properties: + description: + description: Description of this parameter. + type: string + fieldPaths: + description: "FieldPaths specifies an array + of fields within this workload that will + be overwritten by the value of this parameter. + \tAll fields must be of the same type. Fields + are specified as JSON field paths without + a leading dot, for example 'spec.replicas'." + items: + type: string + type: array + name: + description: Name of this parameter + type: string + required: + default: false + description: Required specifies whether or + not a value for this parameter must be supplied + when authoring an Application. + type: boolean + type: + description: 'ValueType indicates the type + of the parameter value, and only supports + basic data types: string, number, boolean.' + enum: + - string + - number + - boolean + type: string + required: + - fieldPaths + - name + - type + type: object + type: array + template: + description: Template defines the raw Kubernetes + resource + type: object + x-kubernetes-preserve-unknown-fields: true + required: + - template + type: object + terraform: + description: Terraform is the struct to describe cloud + resources managed by Hashicorp Terraform + properties: + configuration: + description: Configuration is Terraform Configuration + type: string + customRegion: + description: Region is cloud provider's region. + It will override the region in the region field + of ProviderReference + type: string + deleteResource: + default: true + description: DeleteResource will determine whether + provisioned cloud resources will be deleted when + CR is deleted + type: boolean + path: + description: Path is the sub-directory of remote + git repository. It's valid when remote is set + type: string + providerRef: + description: ProviderReference specifies the reference + to Provider + properties: + name: + description: Name of the referenced object. + type: string + namespace: + default: default + description: Namespace of the referenced object. + type: string + required: + - name + type: object + type: + default: hcl + description: Type specifies which Terraform configuration + it is, HCL or JSON syntax + enum: + - hcl + - json + - remote + type: string + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies + the namespace and name of a Secret to which any + connection details for this managed resource should + be written. Connection details frequently include + the endpoint, username, and password required + to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + type: object + required: + - configuration + type: object + type: object + status: + description: Status defines the custom health policy and + status message for workload + properties: + customStatus: + description: CustomStatus defines the custom status + message that could display to user + type: string + healthPolicy: + description: HealthPolicy defines the health check policy + for the abstraction + type: string + type: object + required: + - definitionRef + type: object + status: + description: WorkloadDefinitionStatus is the status of WorkloadDefinition + properties: + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this + condition transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this + condition's last transition from one status to another, + if any. + type: string + reason: + description: A Reason for this condition's last transition + from one status to another. + type: string + status: + description: Status of this condition; is it currently + True, False, or Unknown? + type: string + type: + description: Type of this condition. At most one of + each condition type may apply to a resource at any + point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + type: object + type: object + description: WorkloadDefinitions records the snapshot of the workloadDefinitions + related with the created/modified Application + type: object + required: + - application + type: object + status: + description: ApplicationRevisionStatus is the status of ApplicationRevision + properties: + succeeded: + description: Succeeded records if the workflow finished running with + success + type: boolean + workflow: + description: Workflow the running status of the workflow + properties: + appRevision: + type: string + 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 + endTime: + format: date-time + type: string + finished: + type: boolean + message: + type: string + mode: + type: string + startTime: + format: date-time + type: string + status: + description: WorkflowRunPhase is a label for the condition of + a WorkflowRun at the current time + type: string + steps: + items: + description: WorkflowStepStatus record the status of a workflow + step, include step status and subStep status + properties: + firstExecuteTime: + description: FirstExecuteTime is the first time this step + execution. + format: date-time + type: string + id: + type: string + lastExecuteTime: + description: LastExecuteTime is the last time this step + execution. + format: date-time + type: string + 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 + subSteps: + items: + description: StepStatus record the base status of workflow + step, which could be workflow step or subStep + properties: + firstExecuteTime: + description: FirstExecuteTime is the first time this + step execution. + format: date-time + type: string + id: + type: string + lastExecuteTime: + description: LastExecuteTime is the last time this + step execution. + format: date-time + type: string + 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 + type: + type: string + required: + - id + type: object + type: array + type: + type: string + required: + - id + type: object + type: array + suspend: + type: boolean + suspendState: + type: string + terminated: + type: boolean + required: + - finished + - mode + - suspend + - terminated + type: object + required: + - succeeded + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] \ No newline at end of file diff --git a/cmd/core/app/server.go b/cmd/core/app/server.go index f6feb2d26..7d6db4147 100644 --- a/cmd/core/app/server.go +++ b/cmd/core/app/server.go @@ -38,6 +38,7 @@ import ( "github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1" "github.com/oam-dev/kubevela/apis/types" + "github.com/oam-dev/kubevela/cmd/core/app/hooks" "github.com/oam-dev/kubevela/cmd/core/app/options" "github.com/oam-dev/kubevela/pkg/auth" standardcontroller "github.com/oam-dev/kubevela/pkg/controller" @@ -227,6 +228,12 @@ func run(ctx context.Context, s *options.CoreOptions) error { klog.Info("Start the vela controller manager") + for _, hook := range []hooks.PreStartHook{hooks.NewSystemCRDValidationHook()} { + if err = hook.Run(ctx); err != nil { + return fmt.Errorf("failed to run hook %T: %w", hook, err) + } + } + if err := mgr.Start(ctx); err != nil { klog.ErrorS(err, "Failed to run manager") return err diff --git a/go.mod b/go.mod index a0ba3c303..c8b2da898 100644 --- a/go.mod +++ b/go.mod @@ -68,6 +68,7 @@ require ( github.com/oam-dev/terraform-controller v0.7.8 github.com/olekukonko/tablewriter v0.0.5 github.com/onsi/ginkgo v1.16.5 + github.com/onsi/ginkgo/v2 v2.1.6 github.com/onsi/gomega v1.20.2 github.com/openkruise/kruise-api v1.1.0 github.com/pkg/errors v0.9.1 @@ -87,10 +88,10 @@ require ( github.com/xlab/treeprint v1.1.0 go.mongodb.org/mongo-driver v1.5.1 go.uber.org/zap v1.21.0 // indirect - golang.org/x/crypto v0.3.0 + golang.org/x/crypto v0.4.0 golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 - golang.org/x/term v0.2.0 - golang.org/x/text v0.4.0 + golang.org/x/term v0.3.0 + golang.org/x/text v0.5.0 gomodules.xyz/jsonpatch/v2 v2.2.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools v2.2.0+incompatible @@ -300,9 +301,9 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.7.0 // indirect golang.org/x/mod v0.6.0 // indirect - golang.org/x/net v0.2.0 // indirect + golang.org/x/net v0.3.0 // indirect golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect - golang.org/x/sys v0.2.0 // indirect + golang.org/x/sys v0.3.0 // indirect golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect golang.org/x/tools v0.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 2e5342f84..8bf9512c0 100644 --- a/go.sum +++ b/go.sum @@ -1609,6 +1609,7 @@ github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vv github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= +github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -2226,8 +2227,9 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= +golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2356,8 +2358,9 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -2551,8 +2554,9 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2560,8 +2564,9 @@ golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2574,8 +2579,9 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20161028155119-f51c12702a4d/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/pkg/oam/labels.go b/pkg/oam/labels.go index 826c66a50..50678c6b2 100644 --- a/pkg/oam/labels.go +++ b/pkg/oam/labels.go @@ -110,6 +110,9 @@ const ( // LabelControllerName indicates the controller name LabelControllerName = "controller.oam.dev/name" + + // LabelPreCheck indicates if the target resource is for pre-check test + LabelPreCheck = "core.oam.dev/pre-check" ) const ( diff --git a/references/common/application_test.go b/references/common/application_test.go index 69440f731..f2e384031 100644 --- a/references/common/application_test.go +++ b/references/common/application_test.go @@ -87,7 +87,7 @@ func TestPrepareToForceDeleteTerraformComponents(t *testing.T) { k8sClient1 := fake.NewClientBuilder().WithScheme(s).WithObjects(app1, def1, conf1).Build() - k8sClient2 := fake.NewClientBuilder().Build() + k8sClient2 := fake.NewClientBuilder().WithScheme(runtime.NewScheme()).Build() k8sClient3 := fake.NewClientBuilder().WithScheme(s).WithObjects(app1).Build()