mirror of https://github.com/kubevela/kubevela.git
init ApplicationRevision CRD Object as revision of Application (#1214)
This commit is contained in:
parent
86b363c56c
commit
5b2b27e6a4
|
|
@ -25,6 +25,7 @@ coverage.txt
|
|||
*.swo
|
||||
*~
|
||||
.DS_Store
|
||||
_.yaml
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
vendor/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// ApplicationRevisionSpec is the spec of ApplicationRevision
|
||||
type ApplicationRevisionSpec struct {
|
||||
// Application records the snapshot of the created/modified Application
|
||||
Application *Application `json:"application"`
|
||||
|
||||
// ComponentDefinitions records the snapshot of the componentDefinitions related with the created/modified Application
|
||||
ComponentDefinitions []*ComponentDefinition `json:"componentDefinitions,omitempty"`
|
||||
|
||||
// WorkloadDefinitions records the snapshot of the workloadDefinitions related with the created/modified Application
|
||||
WorkloadDefinitions []*WorkloadDefinition `json:"workloadDefinitions,omitempty"`
|
||||
|
||||
// TraitDefinitions records the snapshot of the traitDefinitions related with the created/modified Application
|
||||
TraitDefinitions []*TraitDefinition `json:"traitDefinitions,omitempty"`
|
||||
|
||||
// Components records the rendered components from Application, it will contains the whole K8s CR of workload in it.
|
||||
Components []*Component `json:"components"`
|
||||
|
||||
// ApplicationConfiguration records the rendered applicationConfiguration from Application,
|
||||
// it will contains the whole K8s CR of trait and the reference component in it.
|
||||
ApplicationConfiguration *ApplicationConfiguration `json:"applicationConfiguration"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationRevision is the Schema for the ApplicationRevision API
|
||||
type ApplicationRevision struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApplicationRevisionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationRevisionList contains a list of ApplicationRevision
|
||||
type ApplicationRevisionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ApplicationRevision `json:"items"`
|
||||
}
|
||||
|
|
@ -349,9 +349,29 @@ type ComponentStatus struct {
|
|||
|
||||
// Revision has name and revision number
|
||||
type Revision struct {
|
||||
Name string `json:"name"`
|
||||
Revision int64 `json:"revision"`
|
||||
Name string `json:"name"`
|
||||
Revision int64 `json:"revision"`
|
||||
|
||||
// RevisionHash record the hash value of the spec of ApplicationConfiguration object.
|
||||
// We're going to deprecate that by using ApplicationRevision
|
||||
RevisionHash string `json:"revisionHash,omitempty"`
|
||||
|
||||
// AppRevisionHash record the detailed hash value of the spec of ApplicationRevision Object
|
||||
// We should replace it with 'revisionHash' after the refactor finished
|
||||
AppRevisionHash *AppRevisionHash `json:"appRevisionHash,omitempty"`
|
||||
}
|
||||
|
||||
// AppRevisionHash defines the hash value of the Application and its related definitions.
|
||||
type AppRevisionHash struct {
|
||||
ApplicationSpec string `json:"applicationSpec"`
|
||||
ComponentDefinitions []NameAndHashValue `json:"componentDefinitions,omitempty"`
|
||||
TraitDefinitions []NameAndHashValue `json:"traitDefinitions,omitempty"`
|
||||
}
|
||||
|
||||
// NameAndHashValue defines a structure contains the resource name and its hash value
|
||||
type NameAndHashValue struct {
|
||||
Name string `json:"name"`
|
||||
HashValue string `json:"hashValue"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ var (
|
|||
ApplicationKindVersionKind = SchemeGroupVersion.WithKind(ApplicationKind)
|
||||
)
|
||||
|
||||
// Application type metadata.
|
||||
// AppRollout type metadata.
|
||||
var (
|
||||
AppRolloutKind = reflect.TypeOf(AppRollout{}).Name()
|
||||
AppRolloutGroupKind = schema.GroupKind{Group: Group, Kind: AppRolloutKind}.String()
|
||||
|
|
@ -125,6 +125,14 @@ var (
|
|||
AppRolloutKindVersionKind = SchemeGroupVersion.WithKind(AppRolloutKind)
|
||||
)
|
||||
|
||||
// ApplicationRevision type metadata
|
||||
var (
|
||||
ApplicationRevisionKind = reflect.TypeOf(ApplicationRevision{}).Name()
|
||||
ApplicationRevisionGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationRevisionKind}.String()
|
||||
ApplicationRevisionKindAPIVersion = ApplicationRevisionKind + "." + SchemeGroupVersion.String()
|
||||
ApplicationRevisionGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationRevisionKind)
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&ComponentDefinition{}, &ComponentDefinitionList{})
|
||||
SchemeBuilder.Register(&WorkloadDefinition{}, &WorkloadDefinitionList{})
|
||||
|
|
@ -137,4 +145,5 @@ func init() {
|
|||
SchemeBuilder.Register(&HealthScope{}, &HealthScopeList{})
|
||||
SchemeBuilder.Register(&Application{}, &ApplicationList{})
|
||||
SchemeBuilder.Register(&AppRollout{}, &AppRolloutList{})
|
||||
SchemeBuilder.Register(&ApplicationRevision{}, &ApplicationRevisionList{})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,31 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *AppRevisionHash) DeepCopyInto(out *AppRevisionHash) {
|
||||
*out = *in
|
||||
if in.ComponentDefinitions != nil {
|
||||
in, out := &in.ComponentDefinitions, &out.ComponentDefinitions
|
||||
*out = make([]NameAndHashValue, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.TraitDefinitions != nil {
|
||||
in, out := &in.TraitDefinitions, &out.TraitDefinitions
|
||||
*out = make([]NameAndHashValue, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppRevisionHash.
|
||||
func (in *AppRevisionHash) DeepCopy() *AppRevisionHash {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AppRevisionHash)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *AppRollout) DeepCopyInto(out *AppRollout) {
|
||||
*out = *in
|
||||
|
|
@ -146,7 +171,7 @@ func (in *AppStatus) DeepCopyInto(out *AppStatus) {
|
|||
if in.LatestRevision != nil {
|
||||
in, out := &in.LatestRevision, &out.LatestRevision
|
||||
*out = new(Revision)
|
||||
**out = **in
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -425,6 +450,133 @@ func (in *ApplicationList) DeepCopyObject() runtime.Object {
|
|||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationRevision) DeepCopyInto(out *ApplicationRevision) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationRevision.
|
||||
func (in *ApplicationRevision) DeepCopy() *ApplicationRevision {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationRevision)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ApplicationRevision) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationRevisionList) DeepCopyInto(out *ApplicationRevisionList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ApplicationRevision, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationRevisionList.
|
||||
func (in *ApplicationRevisionList) DeepCopy() *ApplicationRevisionList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationRevisionList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ApplicationRevisionList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationRevisionSpec) DeepCopyInto(out *ApplicationRevisionSpec) {
|
||||
*out = *in
|
||||
if in.Application != nil {
|
||||
in, out := &in.Application, &out.Application
|
||||
*out = new(Application)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.ComponentDefinitions != nil {
|
||||
in, out := &in.ComponentDefinitions, &out.ComponentDefinitions
|
||||
*out = make([]*ComponentDefinition, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
in, out := &(*in)[i], &(*out)[i]
|
||||
*out = new(ComponentDefinition)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.WorkloadDefinitions != nil {
|
||||
in, out := &in.WorkloadDefinitions, &out.WorkloadDefinitions
|
||||
*out = make([]*WorkloadDefinition, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
in, out := &(*in)[i], &(*out)[i]
|
||||
*out = new(WorkloadDefinition)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.TraitDefinitions != nil {
|
||||
in, out := &in.TraitDefinitions, &out.TraitDefinitions
|
||||
*out = make([]*TraitDefinition, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
in, out := &(*in)[i], &(*out)[i]
|
||||
*out = new(TraitDefinition)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.Components != nil {
|
||||
in, out := &in.Components, &out.Components
|
||||
*out = make([]*Component, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
in, out := &(*in)[i], &(*out)[i]
|
||||
*out = new(Component)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.ApplicationConfiguration != nil {
|
||||
in, out := &in.ApplicationConfiguration, &out.ApplicationConfiguration
|
||||
*out = new(ApplicationConfiguration)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationRevisionSpec.
|
||||
func (in *ApplicationRevisionSpec) DeepCopy() *ApplicationRevisionSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationRevisionSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) {
|
||||
*out = *in
|
||||
|
|
@ -805,7 +957,7 @@ func (in *ComponentStatus) DeepCopyInto(out *ComponentStatus) {
|
|||
if in.LatestRevision != nil {
|
||||
in, out := &in.LatestRevision, &out.LatestRevision
|
||||
*out = new(Revision)
|
||||
**out = **in
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1730,9 +1882,29 @@ func (in *MemoryResources) DeepCopy() *MemoryResources {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NameAndHashValue) DeepCopyInto(out *NameAndHashValue) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NameAndHashValue.
|
||||
func (in *NameAndHashValue) DeepCopy() *NameAndHashValue {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NameAndHashValue)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Revision) DeepCopyInto(out *Revision) {
|
||||
*out = *in
|
||||
if in.AppRevisionHash != nil {
|
||||
in, out := &in.AppRevisionHash, &out.AppRevisionHash
|
||||
*out = new(AppRevisionHash)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Revision.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -358,12 +358,47 @@ spec:
|
|||
latestRevision:
|
||||
description: LatestRevision of the application configuration it generates
|
||||
properties:
|
||||
appRevisionHash:
|
||||
description: AppRevisionHash record the detailed hash value of the spec of ApplicationRevision Object We should replace it with 'revisionHash' after the refactor finished
|
||||
properties:
|
||||
applicationSpec:
|
||||
type: string
|
||||
componentDefinitions:
|
||||
items:
|
||||
description: NameAndHashValue defines a structure contains the resource name and its hash value
|
||||
properties:
|
||||
hashValue:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- hashValue
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
traitDefinitions:
|
||||
items:
|
||||
description: NameAndHashValue defines a structure contains the resource name and its hash value
|
||||
properties:
|
||||
hashValue:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- hashValue
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- applicationSpec
|
||||
type: object
|
||||
name:
|
||||
type: string
|
||||
revision:
|
||||
format: int64
|
||||
type: integer
|
||||
revisionHash:
|
||||
description: RevisionHash record the hash value of the spec of ApplicationConfiguration object. We're going to deprecate that by using ApplicationRevision
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
|
|
|
|||
|
|
@ -124,12 +124,47 @@ spec:
|
|||
latestRevision:
|
||||
description: LatestRevision of component
|
||||
properties:
|
||||
appRevisionHash:
|
||||
description: AppRevisionHash record the detailed hash value of the spec of ApplicationRevision Object We should replace it with 'revisionHash' after the refactor finished
|
||||
properties:
|
||||
applicationSpec:
|
||||
type: string
|
||||
componentDefinitions:
|
||||
items:
|
||||
description: NameAndHashValue defines a structure contains the resource name and its hash value
|
||||
properties:
|
||||
hashValue:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- hashValue
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
traitDefinitions:
|
||||
items:
|
||||
description: NameAndHashValue defines a structure contains the resource name and its hash value
|
||||
properties:
|
||||
hashValue:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- hashValue
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- applicationSpec
|
||||
type: object
|
||||
name:
|
||||
type: string
|
||||
revision:
|
||||
format: int64
|
||||
type: integer
|
||||
revisionHash:
|
||||
description: RevisionHash record the hash value of the spec of ApplicationConfiguration object. We're going to deprecate that by using ApplicationRevision
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -358,12 +358,47 @@ spec:
|
|||
latestRevision:
|
||||
description: LatestRevision of the application configuration it generates
|
||||
properties:
|
||||
appRevisionHash:
|
||||
description: AppRevisionHash record the detailed hash value of the spec of ApplicationRevision Object We should replace it with 'revisionHash' after the refactor finished
|
||||
properties:
|
||||
applicationSpec:
|
||||
type: string
|
||||
componentDefinitions:
|
||||
items:
|
||||
description: NameAndHashValue defines a structure contains the resource name and its hash value
|
||||
properties:
|
||||
hashValue:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- hashValue
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
traitDefinitions:
|
||||
items:
|
||||
description: NameAndHashValue defines a structure contains the resource name and its hash value
|
||||
properties:
|
||||
hashValue:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- hashValue
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- applicationSpec
|
||||
type: object
|
||||
name:
|
||||
type: string
|
||||
revision:
|
||||
format: int64
|
||||
type: integer
|
||||
revisionHash:
|
||||
description: RevisionHash record the hash value of the spec of ApplicationConfiguration object. We're going to deprecate that by using ApplicationRevision
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
|
|
|
|||
|
|
@ -124,12 +124,47 @@ spec:
|
|||
latestRevision:
|
||||
description: LatestRevision of component
|
||||
properties:
|
||||
appRevisionHash:
|
||||
description: AppRevisionHash record the detailed hash value of the spec of ApplicationRevision Object We should replace it with 'revisionHash' after the refactor finished
|
||||
properties:
|
||||
applicationSpec:
|
||||
type: string
|
||||
componentDefinitions:
|
||||
items:
|
||||
description: NameAndHashValue defines a structure contains the resource name and its hash value
|
||||
properties:
|
||||
hashValue:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- hashValue
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
traitDefinitions:
|
||||
items:
|
||||
description: NameAndHashValue defines a structure contains the resource name and its hash value
|
||||
properties:
|
||||
hashValue:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- hashValue
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- applicationSpec
|
||||
type: object
|
||||
name:
|
||||
type: string
|
||||
revision:
|
||||
format: int64
|
||||
type: integer
|
||||
revisionHash:
|
||||
description: RevisionHash record the hash value of the spec of ApplicationConfiguration object. We're going to deprecate that by using ApplicationRevision
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
|
|
|
|||
Loading…
Reference in New Issue