diff --git a/api/addon.go b/api/addon.go index d08d5cb1a..152fa57ef 100644 --- a/api/addon.go +++ b/api/addon.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/gin-gonic/gin" - crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha1" + crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha2" core "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" k8s "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/api/task.go b/api/task.go index 95e827615..dc60ac87c 100644 --- a/api/task.go +++ b/api/task.go @@ -12,7 +12,7 @@ import ( "github.com/gin-gonic/gin" qf "github.com/konveyor/tackle2-hub/api/filter" - crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha1" + crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha2" "github.com/konveyor/tackle2-hub/model" "github.com/konveyor/tackle2-hub/tar" tasking "github.com/konveyor/tackle2-hub/task" diff --git a/api/taskgroup.go b/api/taskgroup.go index 2432b8b8d..ff6f9ea26 100644 --- a/api/taskgroup.go +++ b/api/taskgroup.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/gin-gonic/gin" - crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha1" + crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha2" "github.com/konveyor/tackle2-hub/model" tasking "github.com/konveyor/tackle2-hub/task" "gorm.io/gorm/clause" diff --git a/controller/addon.go b/controller/addon.go index 08d29af7d..0e5e4705b 100644 --- a/controller/addon.go +++ b/controller/addon.go @@ -5,7 +5,7 @@ import ( "github.com/go-logr/logr" logr2 "github.com/jortel/go-utils/logr" - api "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha1" + api "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha2" "github.com/konveyor/tackle2-hub/settings" "gorm.io/gorm" k8serr "k8s.io/apimachinery/pkg/api/errors" @@ -86,14 +86,16 @@ func (r Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (r } return } - - // + // migrate + migrated, err := r.alpha2Migration(addon) + if migrated || err != nil { + return + } // changed. err = r.addonChanged(addon) if err != nil { return } - // Apply changes. addon.Status.ObservedGeneration = addon.Generation err = r.Status().Update(context.TODO(), addon) @@ -113,3 +115,38 @@ func (r *Reconciler) addonChanged(addon *api.Addon) (err error) { func (r *Reconciler) addonDeleted(name string) (err error) { return } + +// alpha2Migration migrates to alpha2. +func (r *Reconciler) alpha2Migration(addon *api.Addon) (migrated bool, err error) { + if addon.Spec.Image != nil { + if addon.Spec.Container.Image == "" { + addon.Spec.Container.Image = *addon.Spec.Image + } + addon.Spec.Image = nil + migrated = true + } + if addon.Spec.Resources != nil { + if len(addon.Spec.Container.Resources.Limits) == 0 { + addon.Spec.Container.Resources.Limits = (*addon.Spec.Resources).Limits + } + if len(addon.Spec.Container.Resources.Requests) == 0 { + addon.Spec.Container.Resources.Requests = (*addon.Spec.Resources).Requests + } + addon.Spec.Resources = nil + migrated = true + } + if addon.Spec.ImagePullPolicy != nil { + if addon.Spec.Container.ImagePullPolicy == "" { + addon.Spec.Container.ImagePullPolicy = *addon.Spec.ImagePullPolicy + } + addon.Spec.ImagePullPolicy = nil + migrated = true + } + if migrated { + err = r.Update(context.TODO(), addon) + if err != nil { + return + } + } + return +} diff --git a/generated/crd/tackle.konveyor.io_addons.yaml b/generated/crd/tackle.konveyor.io_addons.yaml index 20e44294c..55b94c779 100644 --- a/generated/crd/tackle.konveyor.io_addons.yaml +++ b/generated/crd/tackle.konveyor.io_addons.yaml @@ -15,16 +15,10 @@ spec: singular: addon scope: Namespaced versions: - - additionalPrinterColumns: - - jsonPath: .status.conditions[?(@.type=='Ready')].status - name: READY - type: string - - jsonPath: .metadata.creationTimestamp - name: AGE - type: date - name: v1alpha1 + - name: v1alpha1 schema: openAPIV3Schema: + description: Addon defines an addon. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -39,10 +33,82 @@ spec: metadata: type: object spec: - description: AddonSpec defines the desired state of Addon + description: Spec defines the desired state of the resource. + properties: + image: + description: Addon fqin. + type: string + imagePullPolicy: + default: IfNotPresent + description: ImagePullPolicy an optional image pull policy. + enum: + - IfNotPresent + - Always + - Never + type: string + resources: + description: Resource requirements. + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object + required: + - image + type: object + status: + description: Status defines the observed state of the resource. + properties: + observedGeneration: + description: The most recent generation observed by the controller. + format: int64 + type: integer + type: object + type: object + served: false + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + 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: Spec defines the desired state of the resource. properties: container: - description: Container details. + description: Container defines the addon container. properties: args: description: 'Arguments to the entrypoint. The container image''s @@ -1239,27 +1305,61 @@ spec: required: - name type: object + image: + description: 'Deprecated: Addon is deprecated.' + type: string + imagePullPolicy: + description: 'Deprecated: ImagePullPolicy is deprecated.' + type: string metadata: description: Metadata details. type: object x-kubernetes-preserve-unknown-fields: true + resources: + description: 'Deprecated: Resources is deprecated.' + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Limits describes the maximum amount of compute resources + allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: 'Requests describes the minimum amount of compute + resources required. If Requests is omitted for a container, + it defaults to Limits if that is explicitly specified, otherwise + to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/' + type: object + type: object selector: - description: Selector + description: Selector defines criteria to be selected for a task. type: string task: - description: Task (kind) compatibility. + description: Task declares task (kind) compatibility. type: string required: - container type: object status: - description: AddonStatus defines the observed state of Addon + description: Status defines the observed state of the resource. properties: observedGeneration: description: The most recent generation observed by the controller. format: int64 type: integer type: object + required: + - spec type: object served: true storage: true diff --git a/generated/crd/tackle.konveyor.io_extensions.yaml b/generated/crd/tackle.konveyor.io_extensions.yaml index fa5f746f6..9d9ab9cc3 100644 --- a/generated/crd/tackle.konveyor.io_extensions.yaml +++ b/generated/crd/tackle.konveyor.io_extensions.yaml @@ -15,16 +15,32 @@ spec: singular: extension scope: Namespaced versions: - - additionalPrinterColumns: - - jsonPath: .status.conditions[?(@.type=='Ready')].status - name: READY - type: string - - jsonPath: .metadata.creationTimestamp - name: AGE - type: date - name: v1alpha1 + - name: v1alpha1 schema: openAPIV3Schema: + description: Extension defines an addon extension. + 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 + type: object + served: false + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: Extension defines an addon extension. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -39,13 +55,13 @@ spec: metadata: type: object spec: - description: ExtensionSpec defines the desired state of Extension + description: pec defines the desired state of the resource. properties: addon: - description: Addon compatibility. + description: Addon (name) declares addon compatibility. type: string container: - description: Container details. + description: Container defines the extension container. properties: args: description: 'Arguments to the entrypoint. The container image''s @@ -1247,20 +1263,23 @@ spec: type: object x-kubernetes-preserve-unknown-fields: true selector: - description: Selector + description: Selector defines criteria to be included in the addon + pod. type: string required: - addon - container type: object status: - description: ExtensionStatus defines the observed state of Extension + description: Status defines the observed state of the resource. properties: observedGeneration: description: The most recent generation observed by the controller. format: int64 type: integer type: object + required: + - spec type: object served: true storage: true diff --git a/generated/crd/tackle.konveyor.io_tackles.yaml b/generated/crd/tackle.konveyor.io_tackles.yaml new file mode 100644 index 000000000..c1b8af719 --- /dev/null +++ b/generated/crd/tackle.konveyor.io_tackles.yaml @@ -0,0 +1,77 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.10.0 + creationTimestamp: null + name: tackles.tackle.konveyor.io +spec: + group: tackle.konveyor.io + names: + kind: Tackle + listKind: TackleList + plural: tackles + singular: tackle + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Tackle defines a tackle 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: + type: object + spec: + description: Spec defines the desired state of the resource. + type: object + x-kubernetes-preserve-unknown-fields: true + status: + description: Status defines the observed state of the resource. + type: object + x-kubernetes-preserve-unknown-fields: true + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: Tackle defines a tackle 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: + type: object + spec: + description: Spec defines the desired state of the resource. + type: object + x-kubernetes-preserve-unknown-fields: true + status: + description: Status defines the observed state of the resource. + type: object + x-kubernetes-preserve-unknown-fields: true + type: object + served: true + storage: true + subresources: + status: {} diff --git a/generated/crd/tackle.konveyor.io_tasks.yaml b/generated/crd/tackle.konveyor.io_tasks.yaml index e8dcb2cff..9f4258947 100644 --- a/generated/crd/tackle.konveyor.io_tasks.yaml +++ b/generated/crd/tackle.konveyor.io_tasks.yaml @@ -18,6 +18,29 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: + description: Task defines a hub task. + 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 + type: object + served: false + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: Task defines a hub task. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -32,23 +55,24 @@ spec: metadata: type: object spec: - description: TaskSpec defines the desired state of Task + description: Spec defines the desired state the resource. properties: data: - description: Data object passed to the addon.. + description: Data object passed to the addon. type: object x-kubernetes-preserve-unknown-fields: true dependencies: - description: Dependencies + description: Dependencies defines a list of task names on which this + task depends. items: type: string type: array priority: - description: Priority + description: Priority defines the task priority (0-n). type: integer type: object status: - description: TaskStatus defines the observed state of Task + description: Status defines the observed state the resource. properties: observedGeneration: description: The most recent generation observed by the controller. diff --git a/k8s/api/all.go b/k8s/api/all.go index 3eac0fa82..83ccee910 100644 --- a/k8s/api/all.go +++ b/k8s/api/all.go @@ -17,7 +17,8 @@ limitations under the License. package api import ( - crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha1" + "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha1" + "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha2" "k8s.io/apimachinery/pkg/runtime" ) @@ -26,7 +27,8 @@ var AddToSchemes runtime.SchemeBuilder func init() { AddToSchemes = append( AddToSchemes, - crd.SchemeBuilder.AddToScheme) + v1alpha1.SchemeBuilder.AddToScheme, + v1alpha2.SchemeBuilder.AddToScheme) } func AddToScheme(s *runtime.Scheme) error { diff --git a/k8s/api/tackle/v1alpha1/addon.go b/k8s/api/tackle/v1alpha1/addon.go index deaf695ea..9dbbd2ea4 100644 --- a/k8s/api/tackle/v1alpha1/addon.go +++ b/k8s/api/tackle/v1alpha1/addon.go @@ -19,41 +19,43 @@ package v1alpha1 import ( core "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" ) -// AddonSpec defines the desired state of Addon +// AddonSpec defines the desired state of an Addon. type AddonSpec struct { - // Task (kind) compatibility. - Task string `json:"task,omitempty"` - // Selector - Selector string `json:"selector,omitempty"` - // Container details. - Container core.Container `json:"container"` - // Metadata details. - Metadata runtime.RawExtension `json:"metadata,omitempty"` + // Addon fqin. + Image string `json:"image"` + // ImagePullPolicy an optional image pull policy. + // +kubebuilder:default=IfNotPresent + // +kubebuilder:validation:Enum=IfNotPresent;Always;Never + ImagePullPolicy core.PullPolicy `json:"imagePullPolicy,omitempty"` + // Resource requirements. + Resources core.ResourceRequirements `json:"resources,omitempty"` } -// AddonStatus defines the observed state of Addon +// AddonStatus defines the observed state of an Addon. type AddonStatus struct { // The most recent generation observed by the controller. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` } +// Addon defines an addon. // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true +// +kubebuilder:unservedversion // +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="READY",type=string,JSONPath=".status.conditions[?(@.type=='Ready')].status" -// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" type Addon struct { meta.TypeMeta `json:",inline"` meta.ObjectMeta `json:"metadata,omitempty"` - Spec AddonSpec `json:"spec,omitempty"` - Status AddonStatus `json:"status,omitempty"` + // Spec defines the desired state of the resource. + Spec AddonSpec `json:"spec,omitempty"` + // Status defines the observed state of the resource. + Status AddonStatus `json:"status,omitempty"` } +// AddonList is a list of Addon. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type AddonList struct { meta.TypeMeta `json:",inline"` diff --git a/k8s/api/tackle/v1alpha1/extension.go b/k8s/api/tackle/v1alpha1/extension.go index 4076a66e4..03a3fb367 100644 --- a/k8s/api/tackle/v1alpha1/extension.go +++ b/k8s/api/tackle/v1alpha1/extension.go @@ -17,43 +17,21 @@ limitations under the License. package v1alpha1 import ( - core "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" ) -// ExtensionSpec defines the desired state of Extension -type ExtensionSpec struct { - // Addon compatibility. - Addon string `json:"addon"` - // Container details. - Container core.Container `json:"container"` - // Selector - Selector string `json:"selector,omitempty"` - // Metadata details. - Metadata runtime.RawExtension `json:"metadata,omitempty"` -} - -// ExtensionStatus defines the observed state of Extension -type ExtensionStatus struct { - // The most recent generation observed by the controller. - // +optional - ObservedGeneration int64 `json:"observedGeneration,omitempty"` -} - +// Extension defines an addon extension. // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true +// +kubebuilder:unservedversion // +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="READY",type=string,JSONPath=".status.conditions[?(@.type=='Ready')].status" -// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" type Extension struct { meta.TypeMeta `json:",inline"` meta.ObjectMeta `json:"metadata,omitempty"` - Spec ExtensionSpec `json:"spec,omitempty"` - Status ExtensionStatus `json:"status,omitempty"` } +// ExtensionList is a list of Extension. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type ExtensionList struct { meta.TypeMeta `json:",inline"` diff --git a/k8s/api/tackle/v1alpha1/tackle.go b/k8s/api/tackle/v1alpha1/tackle.go index fbbe22c90..b237e1475 100644 --- a/k8s/api/tackle/v1alpha1/tackle.go +++ b/k8s/api/tackle/v1alpha1/tackle.go @@ -18,20 +18,24 @@ package v1alpha1 import ( meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" ) +// Tackle defines a tackle application. // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true // +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="READY",type=string,JSONPath=".status.conditions[?(@.type=='Ready')].status" -// +kubebuilder:printcolumn:name="CONNECTED",type=string,JSONPath=".status.conditions[?(@.type=='ConnectionTestSucceeded')].status" -// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" type Tackle struct { meta.TypeMeta `json:",inline"` meta.ObjectMeta `json:"metadata,omitempty"` + // Spec defines the desired state of the resource. + Spec runtime.RawExtension `json:"spec,omitempty"` + // Status defines the observed state of the resource. + Status runtime.RawExtension `json:"status,omitempty"` } +// TackleList is a list of Tackle. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type TackleList struct { meta.TypeMeta `json:",inline"` diff --git a/k8s/api/tackle/v1alpha1/task.go b/k8s/api/tackle/v1alpha1/task.go index 9ab658489..4751b639f 100644 --- a/k8s/api/tackle/v1alpha1/task.go +++ b/k8s/api/tackle/v1alpha1/task.go @@ -18,49 +18,20 @@ package v1alpha1 import ( meta "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" ) -// TaskSpec defines the desired state of Task -type TaskSpec struct { - // Priority - Priority int `json:"priority,omitempty"` - // Dependencies - Dependencies []string `json:"dependencies,omitempty"` - // Data object passed to the addon.. - Data runtime.RawExtension `json:"data,omitempty"` -} - -// TaskStatus defines the observed state of Task -type TaskStatus struct { - // The most recent generation observed by the controller. - // +optional - ObservedGeneration int64 `json:"observedGeneration,omitempty"` -} - +// Task defines a hub task. // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:openapi-gen=true +// +kubebuilder:unservedversion // +kubebuilder:subresource:status type Task struct { meta.TypeMeta `json:",inline"` meta.ObjectMeta `json:"metadata,omitempty"` - Spec TaskSpec `json:"spec,omitempty"` - Status TaskStatus `json:"status,omitempty"` -} - -// HasDep return true if the task has the dependency. -func (r *Task) HasDep(name string) (found bool) { - for i := range r.Spec.Dependencies { - n := r.Spec.Dependencies[i] - if n == name { - found = true - break - } - } - return } +// TaskList is a list of Task. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type TaskList struct { meta.TypeMeta `json:",inline"` diff --git a/k8s/api/tackle/v1alpha1/zz_generated.deepcopy.go b/k8s/api/tackle/v1alpha1/zz_generated.deepcopy.go index 2ab858602..ec96a5bfa 100644 --- a/k8s/api/tackle/v1alpha1/zz_generated.deepcopy.go +++ b/k8s/api/tackle/v1alpha1/zz_generated.deepcopy.go @@ -87,8 +87,7 @@ func (in *AddonList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AddonSpec) DeepCopyInto(out *AddonSpec) { *out = *in - in.Container.DeepCopyInto(&out.Container) - in.Metadata.DeepCopyInto(&out.Metadata) + in.Resources.DeepCopyInto(&out.Resources) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonSpec. @@ -121,8 +120,6 @@ func (in *Extension) DeepCopyInto(out *Extension) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Extension. @@ -175,43 +172,13 @@ func (in *ExtensionList) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExtensionSpec) DeepCopyInto(out *ExtensionSpec) { - *out = *in - in.Container.DeepCopyInto(&out.Container) - in.Metadata.DeepCopyInto(&out.Metadata) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionSpec. -func (in *ExtensionSpec) DeepCopy() *ExtensionSpec { - if in == nil { - return nil - } - out := new(ExtensionSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExtensionStatus) DeepCopyInto(out *ExtensionStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionStatus. -func (in *ExtensionStatus) DeepCopy() *ExtensionStatus { - if in == nil { - return nil - } - out := new(ExtensionStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Tackle) DeepCopyInto(out *Tackle) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tackle. @@ -269,8 +236,6 @@ func (in *Task) DeepCopyInto(out *Task) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Task. @@ -322,39 +287,3 @@ func (in *TaskList) DeepCopyObject() runtime.Object { } return nil } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TaskSpec) DeepCopyInto(out *TaskSpec) { - *out = *in - if in.Dependencies != nil { - in, out := &in.Dependencies, &out.Dependencies - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.Data.DeepCopyInto(&out.Data) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskSpec. -func (in *TaskSpec) DeepCopy() *TaskSpec { - if in == nil { - return nil - } - out := new(TaskSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TaskStatus) DeepCopyInto(out *TaskStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskStatus. -func (in *TaskStatus) DeepCopy() *TaskStatus { - if in == nil { - return nil - } - out := new(TaskStatus) - in.DeepCopyInto(out) - return out -} diff --git a/k8s/api/tackle/v1alpha2/addon.go b/k8s/api/tackle/v1alpha2/addon.go new file mode 100644 index 000000000..e7689f221 --- /dev/null +++ b/k8s/api/tackle/v1alpha2/addon.go @@ -0,0 +1,78 @@ +/* +Copyright 2019 Red Hat Inc. + +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 ( + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// AddonSpec defines the desired state of the resource. +type AddonSpec struct { + // Deprecated: Addon is deprecated. + // +kubebuilder:validation:Optional + Image *string `json:"image,omitempty"` + // Deprecated: ImagePullPolicy is deprecated. + // +kubebuilder:validation:Optional + ImagePullPolicy *core.PullPolicy `json:"imagePullPolicy,omitempty"` + // Deprecated: Resources is deprecated. + // +kubebuilder:validation:Optional + Resources *core.ResourceRequirements `json:"resources,omitempty"` + // + // Task declares task (kind) compatibility. + Task string `json:"task,omitempty"` + // Selector defines criteria to be selected for a task. + Selector string `json:"selector,omitempty"` + // Container defines the addon container. + Container core.Container `json:"container"` + // Metadata details. + Metadata runtime.RawExtension `json:"metadata,omitempty"` +} + +// AddonStatus defines the observed state of the resource. +type AddonStatus struct { + // The most recent generation observed by the controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +type Addon struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + // Spec defines the desired state of the resource. + Spec AddonSpec `json:"spec"` + // Status defines the observed state of the resource. + Status AddonStatus `json:"status,omitempty"` +} + +// AddonList is a list of Addon. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type AddonList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + Items []Addon `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Addon{}, &AddonList{}) +} diff --git a/k8s/api/tackle/v1alpha2/extension.go b/k8s/api/tackle/v1alpha2/extension.go new file mode 100644 index 000000000..c2857fdc8 --- /dev/null +++ b/k8s/api/tackle/v1alpha2/extension.go @@ -0,0 +1,69 @@ +/* +Copyright 2019 Red Hat Inc. + +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 ( + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// ExtensionSpec defines the desired state of the resource. +type ExtensionSpec struct { + // Addon (name) declares addon compatibility. + Addon string `json:"addon"` + // Container defines the extension container. + Container core.Container `json:"container"` + // Selector defines criteria to be included in the addon pod. + Selector string `json:"selector,omitempty"` + // Metadata details. + Metadata runtime.RawExtension `json:"metadata,omitempty"` +} + +// ExtensionStatus defines the observed state of the resource. +type ExtensionStatus struct { + // The most recent generation observed by the controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` +} + +// Extension defines an addon extension. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +type Extension struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + // pec defines the desired state of the resource. + Spec ExtensionSpec `json:"spec"` + // Status defines the observed state of the resource. + Status ExtensionStatus `json:"status,omitempty"` +} + +// ExtensionList is a list of Extension. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ExtensionList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + Items []Extension `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Extension{}, &ExtensionList{}) +} diff --git a/k8s/api/tackle/v1alpha2/register.go b/k8s/api/tackle/v1alpha2/register.go new file mode 100644 index 000000000..4d8dd0a30 --- /dev/null +++ b/k8s/api/tackle/v1alpha2/register.go @@ -0,0 +1,35 @@ +/* +Copyright 2019 Red Hat Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha1 contains API Schema definitions for the migration v1alpha1 API group. +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/konveyor/tackle2-controller/pkg/apis/migration +// +k8s:defaulter-gen=TypeMeta +// +groupName=tackle.konveyor.io +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var SchemeGroupVersion = schema.GroupVersion{ + Group: "tackle.konveyor.io", + Version: "v1alpha2", +} + +var SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} diff --git a/k8s/api/tackle/v1alpha2/tackle.go b/k8s/api/tackle/v1alpha2/tackle.go new file mode 100644 index 000000000..92cdcf12b --- /dev/null +++ b/k8s/api/tackle/v1alpha2/tackle.go @@ -0,0 +1,42 @@ +/* +Copyright 2019 Red Hat Inc. + +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 ( + "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Tackle defines a tackle application. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +type Tackle v1alpha1.Tackle + +// TackleList is a list of Tackle. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type TackleList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + Items []Tackle `json:"items"` +} + +func init() { + SchemeBuilder.Register(&TackleList{}, &Tackle{}) +} diff --git a/k8s/api/tackle/v1alpha2/task.go b/k8s/api/tackle/v1alpha2/task.go new file mode 100644 index 000000000..89261c9a7 --- /dev/null +++ b/k8s/api/tackle/v1alpha2/task.go @@ -0,0 +1,78 @@ +/* +Copyright 2019 Red Hat Inc. + +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 ( + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// TaskSpec defines the desired state the resource. +type TaskSpec struct { + // Priority defines the task priority (0-n). + Priority int `json:"priority,omitempty"` + // Dependencies defines a list of task names on which this task depends. + Dependencies []string `json:"dependencies,omitempty"` + // Data object passed to the addon. + Data runtime.RawExtension `json:"data,omitempty"` +} + +// TaskStatus defines the observed state the resource. +type TaskStatus struct { + // The most recent generation observed by the controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` +} + +// Task defines a hub task. +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:openapi-gen=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +type Task struct { + meta.TypeMeta `json:",inline"` + meta.ObjectMeta `json:"metadata,omitempty"` + // Spec defines the desired state the resource. + Spec TaskSpec `json:"spec,omitempty"` + // Status defines the observed state the resource. + Status TaskStatus `json:"status,omitempty"` +} + +// HasDep return true if the task has the dependency. +func (r *Task) HasDep(name string) (found bool) { + for i := range r.Spec.Dependencies { + n := r.Spec.Dependencies[i] + if n == name { + found = true + break + } + } + return +} + +// TaskList is a list of Task. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type TaskList struct { + meta.TypeMeta `json:",inline"` + meta.ListMeta `json:"metadata,omitempty"` + Items []Task `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Task{}, &TaskList{}) +} diff --git a/k8s/api/tackle/v1alpha2/zz_generated.deepcopy.go b/k8s/api/tackle/v1alpha2/zz_generated.deepcopy.go new file mode 100644 index 000000000..244028496 --- /dev/null +++ b/k8s/api/tackle/v1alpha2/zz_generated.deepcopy.go @@ -0,0 +1,378 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2019 Red Hat Inc. + +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. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Addon) DeepCopyInto(out *Addon) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Addon. +func (in *Addon) DeepCopy() *Addon { + if in == nil { + return nil + } + out := new(Addon) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Addon) 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 *AddonList) DeepCopyInto(out *AddonList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Addon, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonList. +func (in *AddonList) DeepCopy() *AddonList { + if in == nil { + return nil + } + out := new(AddonList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AddonList) 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 *AddonSpec) DeepCopyInto(out *AddonSpec) { + *out = *in + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(string) + **out = **in + } + if in.ImagePullPolicy != nil { + in, out := &in.ImagePullPolicy, &out.ImagePullPolicy + *out = new(v1.PullPolicy) + **out = **in + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + in.Container.DeepCopyInto(&out.Container) + in.Metadata.DeepCopyInto(&out.Metadata) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonSpec. +func (in *AddonSpec) DeepCopy() *AddonSpec { + if in == nil { + return nil + } + out := new(AddonSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AddonStatus) DeepCopyInto(out *AddonStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonStatus. +func (in *AddonStatus) DeepCopy() *AddonStatus { + if in == nil { + return nil + } + out := new(AddonStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Extension) DeepCopyInto(out *Extension) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Extension. +func (in *Extension) DeepCopy() *Extension { + if in == nil { + return nil + } + out := new(Extension) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Extension) 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 *ExtensionList) DeepCopyInto(out *ExtensionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Extension, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionList. +func (in *ExtensionList) DeepCopy() *ExtensionList { + if in == nil { + return nil + } + out := new(ExtensionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ExtensionList) 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 *ExtensionSpec) DeepCopyInto(out *ExtensionSpec) { + *out = *in + in.Container.DeepCopyInto(&out.Container) + in.Metadata.DeepCopyInto(&out.Metadata) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionSpec. +func (in *ExtensionSpec) DeepCopy() *ExtensionSpec { + if in == nil { + return nil + } + out := new(ExtensionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtensionStatus) DeepCopyInto(out *ExtensionStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtensionStatus. +func (in *ExtensionStatus) DeepCopy() *ExtensionStatus { + if in == nil { + return nil + } + out := new(ExtensionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Tackle) DeepCopyInto(out *Tackle) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tackle. +func (in *Tackle) DeepCopy() *Tackle { + if in == nil { + return nil + } + out := new(Tackle) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Tackle) 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 *TackleList) DeepCopyInto(out *TackleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Tackle, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TackleList. +func (in *TackleList) DeepCopy() *TackleList { + if in == nil { + return nil + } + out := new(TackleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TackleList) 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 *Task) DeepCopyInto(out *Task) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Task. +func (in *Task) DeepCopy() *Task { + if in == nil { + return nil + } + out := new(Task) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Task) 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 *TaskList) DeepCopyInto(out *TaskList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Task, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskList. +func (in *TaskList) DeepCopy() *TaskList { + if in == nil { + return nil + } + out := new(TaskList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TaskList) 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 *TaskSpec) DeepCopyInto(out *TaskSpec) { + *out = *in + if in.Dependencies != nil { + in, out := &in.Dependencies, &out.Dependencies + *out = make([]string, len(*in)) + copy(*out, *in) + } + in.Data.DeepCopyInto(&out.Data) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskSpec. +func (in *TaskSpec) DeepCopy() *TaskSpec { + if in == nil { + return nil + } + out := new(TaskSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TaskStatus) DeepCopyInto(out *TaskStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TaskStatus. +func (in *TaskStatus) DeepCopy() *TaskStatus { + if in == nil { + return nil + } + out := new(TaskStatus) + in.DeepCopyInto(out) + return out +} diff --git a/task/manager.go b/task/manager.go index a2c0c9bdc..0ed8989df 100644 --- a/task/manager.go +++ b/task/manager.go @@ -16,7 +16,7 @@ import ( "github.com/jortel/go-utils/logr" "github.com/konveyor/tackle2-hub/auth" k8s2 "github.com/konveyor/tackle2-hub/k8s" - crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha1" + crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha2" "github.com/konveyor/tackle2-hub/metrics" "github.com/konveyor/tackle2-hub/model" "github.com/konveyor/tackle2-hub/settings" diff --git a/task/task_test.go b/task/task_test.go index 34a2aef02..fb0eff386 100644 --- a/task/task_test.go +++ b/task/task_test.go @@ -3,7 +3,7 @@ package task import ( "testing" - crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha1" + crd "github.com/konveyor/tackle2-hub/k8s/api/tackle/v1alpha2" "github.com/konveyor/tackle2-hub/model" "github.com/onsi/gomega" )