This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit b6b6f139d58ba5c1ed2512bd7964cac641c6d125 Author: Antonin Stefanutti <anto...@stefanutti.fr> AuthorDate: Tue Oct 12 12:26:46 2021 +0200 chore(builder): Self-defined Build spec --- config/crd/bases/camel.apache.org_builds.yaml | 21 ++++++++---- .../bases/camel.apache.org_integrationkits.yaml | 2 +- .../camel.apache.org_integrationplatforms.yaml | 20 ++++++++---- .../crd/bases/camel.apache.org_integrations.yaml | 2 +- config/crd/bases/camel.apache.org_kamelets.yaml | 2 +- e2e/common/cli/install_test.go | 4 +-- helm/camel-k/crds/crd-build.yaml | 21 ++++++++---- helm/camel-k/crds/crd-integration-kit.yaml | 2 +- helm/camel-k/crds/crd-integration-platform.yaml | 20 ++++++++---- helm/camel-k/crds/crd-integration.yaml | 2 +- helm/camel-k/crds/crd-kamelet.yaml | 2 +- pkg/apis/camel/v1/build_types.go | 37 ++++++++++------------ pkg/apis/camel/v1/build_types_support.go | 11 ------- pkg/apis/camel/v1/common_types.go | 32 +++++++++++++++---- pkg/apis/camel/v1/integration_types.go | 2 +- pkg/apis/camel/v1/integrationkit_types.go | 2 +- pkg/apis/camel/v1/integrationplatform_types.go | 31 ++---------------- pkg/apis/camel/v1/zz_generated.deepcopy.go | 30 +++++++++--------- pkg/apis/camel/v1alpha1/kamelet_types.go | 2 +- pkg/cmd/install.go | 8 ++--- pkg/controller/build/build_controller.go | 31 +++--------------- pkg/controller/build/initialize_pod.go | 2 +- pkg/controller/build/initialize_routine.go | 2 +- pkg/controller/build/schedule.go | 1 - pkg/controller/integrationkit/build.go | 5 +-- pkg/install/operator.go | 2 +- pkg/platform/defaults.go | 6 ++-- pkg/resources/resources.go | 14 ++++---- pkg/trait/builder_test.go | 2 +- pkg/trait/container_test.go | 14 ++++---- pkg/trait/cron_test.go | 4 +-- pkg/trait/knative_service_test.go | 6 ++-- pkg/trait/knative_test.go | 6 ++-- pkg/trait/route_test.go | 2 +- pkg/trait/service_test.go | 18 ++++++----- 35 files changed, 177 insertions(+), 191 deletions(-) diff --git a/config/crd/bases/camel.apache.org_builds.yaml b/config/crd/bases/camel.apache.org_builds.yaml index 7a142c9..88b548c 100644 --- a/config/crd/bases/camel.apache.org_builds.yaml +++ b/config/crd/bases/camel.apache.org_builds.yaml @@ -79,7 +79,15 @@ spec: spec: description: BuildSpec defines the Build to be executed properties: + strategy: + description: The strategy that should be used to perform the Build. + enum: + - routine + - pod + type: string tasks: + description: The sequence of Build tasks to be performed as part of + the Build execution. items: description: Task -- properties: @@ -97,7 +105,8 @@ spec: name: type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for + the container registry properties: address: type: string @@ -432,7 +441,8 @@ spec: name: type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for + the container registry properties: address: type: string @@ -470,7 +480,8 @@ spec: name: type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for + the container registry properties: address: type: string @@ -530,7 +541,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: @@ -587,8 +598,6 @@ spec: phase: description: BuildPhase -- type: string - platform: - type: string startedAt: format: date-time type: string diff --git a/config/crd/bases/camel.apache.org_integrationkits.yaml b/config/crd/bases/camel.apache.org_integrationkits.yaml index 89bae12..6d7ac30 100644 --- a/config/crd/bases/camel.apache.org_integrationkits.yaml +++ b/config/crd/bases/camel.apache.org_integrationkits.yaml @@ -153,7 +153,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/config/crd/bases/camel.apache.org_integrationplatforms.yaml index e7c66a0..a8c6699 100644 --- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml +++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml @@ -71,8 +71,10 @@ spec: baseImage: type: string buildStrategy: - description: IntegrationPlatformBuildStrategy enumerates all implemented - build strategies + description: BuildStrategy specifies how the Build should be executed + enum: + - routine + - pod type: string httpProxySecret: type: string @@ -222,7 +224,8 @@ spec: all implemented publish strategies type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for the container + registry properties: address: type: string @@ -309,8 +312,10 @@ spec: baseImage: type: string buildStrategy: - description: IntegrationPlatformBuildStrategy enumerates all implemented - build strategies + description: BuildStrategy specifies how the Build should be executed + enum: + - routine + - pod type: string httpProxySecret: type: string @@ -460,7 +465,8 @@ spec: all implemented publish strategies type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for the container + registry properties: address: type: string @@ -500,7 +506,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: diff --git a/config/crd/bases/camel.apache.org_integrations.yaml b/config/crd/bases/camel.apache.org_integrations.yaml index 5c47ee3..efba2f6 100644 --- a/config/crd/bases/camel.apache.org_integrations.yaml +++ b/config/crd/bases/camel.apache.org_integrations.yaml @@ -5411,7 +5411,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: diff --git a/config/crd/bases/camel.apache.org_kamelets.yaml b/config/crd/bases/camel.apache.org_kamelets.yaml index 17230ef..8dd01d6 100644 --- a/config/crd/bases/camel.apache.org_kamelets.yaml +++ b/config/crd/bases/camel.apache.org_kamelets.yaml @@ -442,7 +442,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: diff --git a/e2e/common/cli/install_test.go b/e2e/common/cli/install_test.go index f0c3c40..612ab75 100644 --- a/e2e/common/cli/install_test.go +++ b/e2e/common/cli/install_test.go @@ -71,8 +71,8 @@ func TestSkipRegistryInstallation(t *testing.T) { WithNewTestNamespace(t, func(ns string) { Expect(Kamel("install", "-n", ns, "--skip-registry-setup").Execute()).To(Succeed()) Eventually(Platform(ns)).ShouldNot(BeNil()) - Eventually(func() v1.IntegrationPlatformRegistrySpec { + Eventually(func() v1.RegistrySpec { return Platform(ns)().Spec.Build.Registry - }, TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformRegistrySpec{})) + }, TestTimeoutMedium).Should(Equal(v1.RegistrySpec{})) }) } diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml index 7a142c9..88b548c 100644 --- a/helm/camel-k/crds/crd-build.yaml +++ b/helm/camel-k/crds/crd-build.yaml @@ -79,7 +79,15 @@ spec: spec: description: BuildSpec defines the Build to be executed properties: + strategy: + description: The strategy that should be used to perform the Build. + enum: + - routine + - pod + type: string tasks: + description: The sequence of Build tasks to be performed as part of + the Build execution. items: description: Task -- properties: @@ -97,7 +105,8 @@ spec: name: type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for + the container registry properties: address: type: string @@ -432,7 +441,8 @@ spec: name: type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for + the container registry properties: address: type: string @@ -470,7 +480,8 @@ spec: name: type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for + the container registry properties: address: type: string @@ -530,7 +541,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: @@ -587,8 +598,6 @@ spec: phase: description: BuildPhase -- type: string - platform: - type: string startedAt: format: date-time type: string diff --git a/helm/camel-k/crds/crd-integration-kit.yaml b/helm/camel-k/crds/crd-integration-kit.yaml index 89bae12..6d7ac30 100644 --- a/helm/camel-k/crds/crd-integration-kit.yaml +++ b/helm/camel-k/crds/crd-integration-kit.yaml @@ -153,7 +153,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: diff --git a/helm/camel-k/crds/crd-integration-platform.yaml b/helm/camel-k/crds/crd-integration-platform.yaml index e7c66a0..a8c6699 100644 --- a/helm/camel-k/crds/crd-integration-platform.yaml +++ b/helm/camel-k/crds/crd-integration-platform.yaml @@ -71,8 +71,10 @@ spec: baseImage: type: string buildStrategy: - description: IntegrationPlatformBuildStrategy enumerates all implemented - build strategies + description: BuildStrategy specifies how the Build should be executed + enum: + - routine + - pod type: string httpProxySecret: type: string @@ -222,7 +224,8 @@ spec: all implemented publish strategies type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for the container + registry properties: address: type: string @@ -309,8 +312,10 @@ spec: baseImage: type: string buildStrategy: - description: IntegrationPlatformBuildStrategy enumerates all implemented - build strategies + description: BuildStrategy specifies how the Build should be executed + enum: + - routine + - pod type: string httpProxySecret: type: string @@ -460,7 +465,8 @@ spec: all implemented publish strategies type: string registry: - description: IntegrationPlatformRegistrySpec -- + description: RegistrySpec provides the configuration for the container + registry properties: address: type: string @@ -500,7 +506,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: diff --git a/helm/camel-k/crds/crd-integration.yaml b/helm/camel-k/crds/crd-integration.yaml index 5c47ee3..efba2f6 100644 --- a/helm/camel-k/crds/crd-integration.yaml +++ b/helm/camel-k/crds/crd-integration.yaml @@ -5411,7 +5411,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: diff --git a/helm/camel-k/crds/crd-kamelet.yaml b/helm/camel-k/crds/crd-kamelet.yaml index 17230ef..8dd01d6 100644 --- a/helm/camel-k/crds/crd-kamelet.yaml +++ b/helm/camel-k/crds/crd-kamelet.yaml @@ -442,7 +442,7 @@ spec: format: date-time type: string message: - description: A human readable message indicating details about + description: A human-readable message indicating details about the transition. type: string reason: diff --git a/pkg/apis/camel/v1/build_types.go b/pkg/apis/camel/v1/build_types.go index 36d72e9..7345702 100644 --- a/pkg/apis/camel/v1/build_types.go +++ b/pkg/apis/camel/v1/build_types.go @@ -27,7 +27,10 @@ import ( // BuildSpec defines the Build to be executed type BuildSpec struct { + // The sequence of Build tasks to be performed as part of the Build execution. Tasks []Task `json:"tasks,omitempty"` + // The strategy that should be used to perform the Build. + Strategy BuildStrategy `json:"strategy,omitempty"` // Timeout defines the Build maximum execution duration. // The Build deadline is set to the Build start time plus the Timeout duration. // If the Build deadline is exceeded, the Build context is canceled, @@ -53,22 +56,22 @@ type BaseTask struct { // BuilderTask -- type BuilderTask struct { BaseTask `json:",inline"` - BaseImage string `json:"baseImage,omitempty"` - Runtime RuntimeSpec `json:"runtime,omitempty"` - Sources []SourceSpec `json:"sources,omitempty"` - Resources []ResourceSpec `json:"resources,omitempty"` - Dependencies []string `json:"dependencies,omitempty"` - Steps []string `json:"steps,omitempty"` - Maven MavenSpec `json:"maven,omitempty"` - BuildDir string `json:"buildDir,omitempty"` + BaseImage string `json:"baseImage,omitempty"` + Runtime RuntimeSpec `json:"runtime,omitempty"` + Sources []SourceSpec `json:"sources,omitempty"` + Resources []ResourceSpec `json:"resources,omitempty"` + Dependencies []string `json:"dependencies,omitempty"` + Steps []string `json:"steps,omitempty"` + Maven MavenSpec `json:"maven,omitempty"` + BuildDir string `json:"buildDir,omitempty"` } // PublishTask -- type PublishTask struct { - ContextDir string `json:"contextDir,omitempty"` - BaseImage string `json:"baseImage,omitempty"` - Image string `json:"image,omitempty"` - Registry IntegrationPlatformRegistrySpec `json:"registry,omitempty"` + ContextDir string `json:"contextDir,omitempty"` + BaseImage string `json:"baseImage,omitempty"` + Image string `json:"image,omitempty"` + Registry RegistrySpec `json:"registry,omitempty"` } // BuildahTask -- @@ -117,7 +120,6 @@ type BuildStatus struct { Error string `json:"error,omitempty"` Failure *Failure `json:"failure,omitempty"` StartedAt *metav1.Time `json:"startedAt,omitempty"` - Platform string `json:"platform,omitempty"` Conditions []BuildCondition `json:"conditions,omitempty"` // Change to Duration / ISO 8601 when CRD uses OpenAPI spec v3 // https://github.com/OAI/OpenAPI-Specification/issues/845 @@ -138,8 +140,6 @@ const ( BuildPhaseNone BuildPhase = "" // BuildPhaseInitialization -- BuildPhaseInitialization BuildPhase = "Initialization" - // BuildPhaseWaitingForPlatform -- - BuildPhaseWaitingForPlatform BuildPhase = "Waiting For Platform" // BuildPhaseScheduling -- BuildPhaseScheduling BuildPhase = "Scheduling" // BuildPhasePending -- @@ -154,11 +154,6 @@ const ( BuildPhaseInterrupted = "Interrupted" // BuildPhaseError -- BuildPhaseError BuildPhase = "Error" - - // BuildConditionPlatformAvailable -- - BuildConditionPlatformAvailable BuildConditionType = "IntegrationPlatformAvailable" - // BuildConditionPlatformAvailableReason -- - BuildConditionPlatformAvailableReason string = "IntegrationPlatformAvailable" ) // +genclient @@ -203,6 +198,6 @@ type BuildCondition struct { LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` // The reason for the condition's last transition. Reason string `json:"reason,omitempty"` - // A human readable message indicating details about the transition. + // A human-readable message indicating details about the transition. Message string `json:"message,omitempty"` } diff --git a/pkg/apis/camel/v1/build_types_support.go b/pkg/apis/camel/v1/build_types_support.go index 31fc668..696b96b 100644 --- a/pkg/apis/camel/v1/build_types_support.go +++ b/pkg/apis/camel/v1/build_types_support.go @@ -48,17 +48,6 @@ func (buildPhase *BuildPhase) String() string { return string(*buildPhase) } -func (in *Build) SetIntegrationPlatform(platform *IntegrationPlatform) { - cs := corev1.ConditionTrue - - if platform.Status.Phase != IntegrationPlatformPhaseReady { - cs = corev1.ConditionFalse - } - - in.Status.SetCondition(BuildConditionPlatformAvailable, cs, BuildConditionPlatformAvailableReason, platform.Name) - in.Status.Platform = platform.Name -} - // GetCondition returns the condition with the provided type. func (in *BuildStatus) GetCondition(condType BuildConditionType) *BuildCondition { for i := range in.Conditions { diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go index 8c2cada..78aa968 100644 --- a/pkg/apis/camel/v1/common_types.go +++ b/pkg/apis/camel/v1/common_types.go @@ -27,6 +27,22 @@ const ( OperatorIDLabel = "camel.apache.org/operator.id" ) +// BuildStrategy specifies how the Build should be executed +// +kubebuilder:validation:Enum=routine;pod +type BuildStrategy string + +const ( + // BuildStrategyRoutine performs the build in a routine + BuildStrategyRoutine BuildStrategy = "routine" + // BuildStrategyPod performs the build in a pod + BuildStrategyPod BuildStrategy = "pod" +) + +var BuildStrategies = []BuildStrategy{ + BuildStrategyRoutine, + BuildStrategyPod, +} + // ConfigurationSpec -- type ConfigurationSpec struct { Type string `json:"type"` @@ -85,13 +101,6 @@ type Configurable interface { Configurations() []ConfigurationSpec } -// +kubebuilder:object:generate=false - -// PlatformInjectable -- -type PlatformInjectable interface { - SetIntegrationPlatform(platform *IntegrationPlatform) -} - // MavenSpec -- type MavenSpec struct { // The path of the local Maven repository. @@ -115,6 +124,15 @@ type MavenSpec struct { Extension []MavenArtifact `json:"extension,omitempty"` } +// RegistrySpec provides the configuration for the container registry +type RegistrySpec struct { + Insecure bool `json:"insecure,omitempty"` + Address string `json:"address,omitempty"` + Secret string `json:"secret,omitempty"` + CA string `json:"ca,omitempty"` + Organization string `json:"organization,omitempty"` +} + // ValueSource -- type ValueSource struct { // Selects a key of a ConfigMap. diff --git a/pkg/apis/camel/v1/integration_types.go b/pkg/apis/camel/v1/integration_types.go index b30b66b..0729413 100644 --- a/pkg/apis/camel/v1/integration_types.go +++ b/pkg/apis/camel/v1/integration_types.go @@ -225,7 +225,7 @@ type IntegrationCondition struct { FirstTruthyTime *metav1.Time `json:"firstTruthyTime,omitempty"` // The reason for the condition's last transition. Reason string `json:"reason,omitempty"` - // A human readable message indicating details about the transition. + // A human-readable message indicating details about the transition. Message string `json:"message,omitempty"` } type PodSpecTemplate struct { diff --git a/pkg/apis/camel/v1/integrationkit_types.go b/pkg/apis/camel/v1/integrationkit_types.go index 17203c5..2ed6b54 100644 --- a/pkg/apis/camel/v1/integrationkit_types.go +++ b/pkg/apis/camel/v1/integrationkit_types.go @@ -141,6 +141,6 @@ type IntegrationKitCondition struct { LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` // The reason for the condition's last transition. Reason string `json:"reason,omitempty"` - // A human readable message indicating details about the transition. + // A human-readable message indicating details about the transition. Message string `json:"message,omitempty"` } diff --git a/pkg/apis/camel/v1/integrationplatform_types.go b/pkg/apis/camel/v1/integrationplatform_types.go index a2cc133..1468e4b 100644 --- a/pkg/apis/camel/v1/integrationplatform_types.go +++ b/pkg/apis/camel/v1/integrationplatform_types.go @@ -106,12 +106,12 @@ var AllTraitProfiles = []TraitProfile{TraitProfileKubernetes, TraitProfileKnativ // IntegrationPlatformBuildSpec contains platform related build information type IntegrationPlatformBuildSpec struct { - BuildStrategy IntegrationPlatformBuildStrategy `json:"buildStrategy,omitempty"` + BuildStrategy BuildStrategy `json:"buildStrategy,omitempty"` PublishStrategy IntegrationPlatformBuildPublishStrategy `json:"publishStrategy,omitempty"` RuntimeVersion string `json:"runtimeVersion,omitempty"` RuntimeProvider RuntimeProvider `json:"runtimeProvider,omitempty"` BaseImage string `json:"baseImage,omitempty"` - Registry IntegrationPlatformRegistrySpec `json:"registry,omitempty"` + Registry RegistrySpec `json:"registry,omitempty"` Timeout *metav1.Duration `json:"timeout,omitempty"` PersistentVolumeClaim string `json:"persistentVolumeClaim,omitempty"` Maven MavenSpec `json:"maven,omitempty"` @@ -119,15 +119,6 @@ type IntegrationPlatformBuildSpec struct { KanikoBuildCache *bool `json:"kanikoBuildCache,omitempty"` } -// IntegrationPlatformRegistrySpec -- -type IntegrationPlatformRegistrySpec struct { - Insecure bool `json:"insecure,omitempty"` - Address string `json:"address,omitempty"` - Secret string `json:"secret,omitempty"` - CA string `json:"ca,omitempty"` - Organization string `json:"organization,omitempty"` -} - // IntegrationPlatformKameletSpec -- type IntegrationPlatformKameletSpec struct { Repositories []IntegrationPlatformKameletRepositorySpec `json:"repositories,omitempty"` @@ -138,22 +129,6 @@ type IntegrationPlatformKameletRepositorySpec struct { URI string `json:"uri,omitempty"` } -// IntegrationPlatformBuildStrategy enumerates all implemented build strategies -type IntegrationPlatformBuildStrategy string - -const ( - // IntegrationPlatformBuildStrategyRoutine performs the build in a routine - IntegrationPlatformBuildStrategyRoutine IntegrationPlatformBuildStrategy = "routine" - // IntegrationPlatformBuildStrategyPod performs the build in a pod - IntegrationPlatformBuildStrategyPod IntegrationPlatformBuildStrategy = "pod" -) - -// IntegrationPlatformBuildStrategies -- -var IntegrationPlatformBuildStrategies = []IntegrationPlatformBuildStrategy{ - IntegrationPlatformBuildStrategyRoutine, - IntegrationPlatformBuildStrategyPod, -} - // IntegrationPlatformBuildPublishStrategy enumerates all implemented publish strategies type IntegrationPlatformBuildPublishStrategy string @@ -212,6 +187,6 @@ type IntegrationPlatformCondition struct { LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` // The reason for the condition's last transition. Reason string `json:"reason,omitempty"` - // A human readable message indicating details about the transition. + // A human-readable message indicating details about the transition. Message string `json:"message,omitempty"` } diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go index 49986cc..bc44413 100644 --- a/pkg/apis/camel/v1/zz_generated.deepcopy.go +++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go @@ -968,21 +968,6 @@ func (in *IntegrationPlatformList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IntegrationPlatformRegistrySpec) DeepCopyInto(out *IntegrationPlatformRegistrySpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IntegrationPlatformRegistrySpec. -func (in *IntegrationPlatformRegistrySpec) DeepCopy() *IntegrationPlatformRegistrySpec { - if in == nil { - return nil - } - out := new(IntegrationPlatformRegistrySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IntegrationPlatformResourcesSpec) DeepCopyInto(out *IntegrationPlatformResourcesSpec) { *out = *in } @@ -1408,6 +1393,21 @@ func (in RawMessage) DeepCopy() RawMessage { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RegistrySpec) DeepCopyInto(out *RegistrySpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistrySpec. +func (in *RegistrySpec) DeepCopy() *RegistrySpec { + if in == nil { + return nil + } + out := new(RegistrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Repository) DeepCopyInto(out *Repository) { *out = *in out.Snapshots = in.Snapshots diff --git a/pkg/apis/camel/v1alpha1/kamelet_types.go b/pkg/apis/camel/v1alpha1/kamelet_types.go index 2b85920..5674c2f 100644 --- a/pkg/apis/camel/v1alpha1/kamelet_types.go +++ b/pkg/apis/camel/v1alpha1/kamelet_types.go @@ -94,7 +94,7 @@ type KameletCondition struct { LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` // The reason for the condition's last transition. Reason string `json:"reason,omitempty"` - // A human readable message indicating details about the transition. + // A human-readable message indicating details about the transition. Message string `json:"message,omitempty"` } diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go index 3620af0..ec9e63f 100644 --- a/pkg/cmd/install.go +++ b/pkg/cmd/install.go @@ -186,7 +186,7 @@ type installCmdOptions struct { ResourcesRequirements []string `mapstructure:"operator-resources"` EnvVars []string `mapstructure:"operator-env-vars"` - registry v1.IntegrationPlatformRegistrySpec + registry v1.RegistrySpec registryAuth registry.Auth RegistryAuthFile string `mapstructure:"registry-auth-file"` @@ -363,7 +363,7 @@ func (o *installCmdOptions) install(cobraCmd *cobra.Command, _ []string) error { platform.Spec.Build.BaseImage = o.BaseImage } if o.BuildStrategy != "" { - platform.Spec.Build.BuildStrategy = v1.IntegrationPlatformBuildStrategy(o.BuildStrategy) + platform.Spec.Build.BuildStrategy = v1.BuildStrategy(o.BuildStrategy) } if o.BuildPublishStrategy != "" { platform.Spec.Build.PublishStrategy = v1.IntegrationPlatformBuildPublishStrategy(o.BuildPublishStrategy) @@ -577,7 +577,7 @@ func (o *installCmdOptions) validate(_ *cobra.Command, _ []string) error { if o.BuildStrategy != "" { found := false - for _, s := range v1.IntegrationPlatformBuildStrategies { + for _, s := range v1.BuildStrategies { if string(s) == o.BuildStrategy { found = true break @@ -585,7 +585,7 @@ func (o *installCmdOptions) validate(_ *cobra.Command, _ []string) error { } if !found { var strategies []string - for _, s := range v1.IntegrationPlatformBuildStrategies { + for _, s := range v1.BuildStrategies { strategies = append(strategies, string(s)) } return fmt.Errorf("unknown build strategy: %s. One of [%s] is expected", o.BuildStrategy, strings.Join(strategies, ", ")) diff --git a/pkg/controller/build/build_controller.go b/pkg/controller/build/build_controller.go index e8c1a2d..14a053a 100644 --- a/pkg/controller/build/build_controller.go +++ b/pkg/controller/build/build_controller.go @@ -138,33 +138,10 @@ func (r *reconcileBuild) Reconcile(ctx context.Context, request reconcile.Reques target := instance.DeepCopy() targetLog := rlog.ForBuild(target) - pl, err := platform.GetOrFind(ctx, r.client, target.Namespace, target.Status.Platform, true) - if target.Status.Phase == v1.BuildPhaseNone || target.Status.Phase == v1.BuildPhaseWaitingForPlatform { - if err != nil || pl.Status.Phase != v1.IntegrationPlatformPhaseReady { - target.Status.Phase = v1.BuildPhaseWaitingForPlatform - } else { - target.Status.Phase = v1.BuildPhaseInitialization - } - - if instance.Status.Phase != target.Status.Phase { - if err != nil { - target.Status.SetErrorCondition(v1.BuildConditionPlatformAvailable, v1.BuildConditionPlatformAvailableReason, err) - } - - if pl != nil { - target.SetIntegrationPlatform(pl) - } - - return r.update(ctx, &instance, target) - } - - return reconcile.Result{}, err - } - var actions []Action - switch pl.Status.Build.BuildStrategy { - case v1.IntegrationPlatformBuildStrategyPod: + switch instance.Spec.Strategy { + case v1.BuildStrategyPod: actions = []Action{ newInitializePodAction(r.reader), newScheduleAction(r.reader), @@ -172,7 +149,7 @@ func (r *reconcileBuild) Reconcile(ctx context.Context, request reconcile.Reques newErrorRecoveryAction(), newErrorAction(), } - case v1.IntegrationPlatformBuildStrategyRoutine: + case v1.BuildStrategyRoutine: actions = []Action{ newInitializeRoutineAction(), newScheduleAction(r.reader), @@ -225,7 +202,7 @@ func (r *reconcileBuild) Reconcile(ctx context.Context, request reconcile.Reques return reconcile.Result{RequeueAfter: 5 * time.Second}, nil } - if pl.Status.Build.BuildStrategy == v1.IntegrationPlatformBuildStrategyPod && + if target.Spec.Strategy == v1.BuildStrategyPod && (target.Status.Phase == v1.BuildPhasePending || target.Status.Phase == v1.BuildPhaseRunning) { // Requeue running Build to poll Pod and signal timeout return reconcile.Result{RequeueAfter: 1 * time.Second}, nil diff --git a/pkg/controller/build/initialize_pod.go b/pkg/controller/build/initialize_pod.go index 4fd8cb8..e911c64 100644 --- a/pkg/controller/build/initialize_pod.go +++ b/pkg/controller/build/initialize_pod.go @@ -45,7 +45,7 @@ func (action *initializePodAction) Name() string { // CanHandle tells whether this action can handle the build func (action *initializePodAction) CanHandle(build *v1.Build) bool { - return build.Status.Phase == v1.BuildPhaseInitialization + return build.Status.Phase == "" || build.Status.Phase == v1.BuildPhaseInitialization } // Handle handles the builds diff --git a/pkg/controller/build/initialize_routine.go b/pkg/controller/build/initialize_routine.go index 6eb7368..f621da5 100644 --- a/pkg/controller/build/initialize_routine.go +++ b/pkg/controller/build/initialize_routine.go @@ -38,7 +38,7 @@ func (action *initializeRoutineAction) Name() string { // CanHandle tells whether this action can handle the build func (action *initializeRoutineAction) CanHandle(build *v1.Build) bool { - return build.Status.Phase == v1.BuildPhaseInitialization + return build.Status.Phase == "" || build.Status.Phase == v1.BuildPhaseInitialization } // Handle handles the builds diff --git a/pkg/controller/build/schedule.go b/pkg/controller/build/schedule.go index 93cffd9..28a2756 100644 --- a/pkg/controller/build/schedule.go +++ b/pkg/controller/build/schedule.go @@ -109,7 +109,6 @@ func (action *scheduleAction) toPendingPhase(ctx context.Context, build *v1.Buil Phase: v1.BuildPhasePending, StartedAt: &now, Failure: b.Status.Failure, - Platform: b.Status.Platform, Conditions: b.Status.Conditions, } }) diff --git a/pkg/controller/integrationkit/build.go b/pkg/controller/integrationkit/build.go index 5be8f7a..9f1c0ca 100644 --- a/pkg/controller/integrationkit/build.go +++ b/pkg/controller/integrationkit/build.go @@ -108,8 +108,9 @@ func (action *buildAction) handleBuildSubmitted(ctx context.Context, kit *v1.Int Labels: labels, }, Spec: v1.BuildSpec{ - Tasks: env.BuildTasks, - Timeout: timeout, + Strategy: env.Platform.Status.Build.BuildStrategy, + Tasks: env.BuildTasks, + Timeout: timeout, }, } diff --git a/pkg/install/operator.go b/pkg/install/operator.go index c4dc68f..75c7342 100644 --- a/pkg/install/operator.go +++ b/pkg/install/operator.go @@ -425,7 +425,7 @@ func installLeaseBindings(ctx context.Context, c client.Client, namespace string // PlatformOrCollect -- // nolint: lll -func PlatformOrCollect(ctx context.Context, c client.Client, clusterType string, namespace string, skipRegistrySetup bool, registry v1.IntegrationPlatformRegistrySpec, collection *kubernetes.Collection) (*v1.IntegrationPlatform, error) { +func PlatformOrCollect(ctx context.Context, c client.Client, clusterType string, namespace string, skipRegistrySetup bool, registry v1.RegistrySpec, collection *kubernetes.Collection) (*v1.IntegrationPlatform, error) { isOpenShift, err := isOpenShift(c, clusterType) if err != nil { return nil, err diff --git a/pkg/platform/defaults.go b/pkg/platform/defaults.go index 07f3ed6..0c94af8 100644 --- a/pkg/platform/defaults.go +++ b/pkg/platform/defaults.go @@ -79,10 +79,10 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl // Use the fastest strategy that they support (routine when possible) if p.Status.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategyS2I || p.Status.Build.PublishStrategy == v1.IntegrationPlatformBuildPublishStrategySpectrum { - p.Status.Build.BuildStrategy = v1.IntegrationPlatformBuildStrategyRoutine + p.Status.Build.BuildStrategy = v1.BuildStrategyRoutine } else { // The build output has to be shared via a volume - p.Status.Build.BuildStrategy = v1.IntegrationPlatformBuildStrategyPod + p.Status.Build.BuildStrategy = v1.BuildStrategyPod } } @@ -91,7 +91,7 @@ func ConfigureDefaults(ctx context.Context, c client.Client, p *v1.IntegrationPl return err } - if p.Status.Build.BuildStrategy == v1.IntegrationPlatformBuildStrategyPod { + if p.Status.Build.BuildStrategy == v1.BuildStrategyPod { if err := createBuilderServiceAccount(ctx, c, p); err != nil { return errors.Wrap(err, "cannot ensure service account is present") } diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go index bf3e684..203fdf9 100644 --- a/pkg/resources/resources.go +++ b/pkg/resources/resources.go @@ -117,9 +117,9 @@ var assets = func() http.FileSystem { "/crd/bases/camel.apache.org_builds.yaml": &vfsgen۰CompressedFileInfo{ name: "camel.apache.org_builds.yaml", modTime: time.Time{}, - uncompressedSize: 26330, + uncompressedSize: 26787, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3c\x5d\x73\xdb\xba\x72\xef\xfa\x15\x3b\xf1\x43\x92\x19\x8b\x4a\xce\xbd\xb7\x3d\x55\x1f\x3a\xba\x72\x32\x55\x93\xd8\x1e\x4b\x39\xb7\xe7\x71\x45\xae\x28\x1c\x91\x00\x0b\x80\x96\x75\x3a\xfd\xef\x1d\x00\xa4\x44\x59\xfc\x00\x6d\x79\x4e\xda\x63\xbc\xd8\x22\x81\xc5\x2e\x76\xb1\x5f\x00\xf7\x02\x86\xe7\x6b\x83\x0b\xf8\xca\x42\xe2\x8a\x22\xd0\x02\xf4\x9a\x60\x92\x61\xb8\x26\x98\x8b\x95\xde\xa2\x24\xf8\x2c\x72\x1e\xa1\x66\x [...] + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3d\x5d\x73\xdb\x3a\x76\xef\xfa\x15\x67\xe2\x87\x24\x33\x16\x75\xef\xdd\xdd\xf6\xd6\x7d\xe8\x68\x95\x64\xaa\x26\xb1\x3d\x96\x73\xb7\xfb\x78\x44\x1e\x51\x58\x91\x00\x0b\x80\x96\xb5\x9d\xfe\xf7\x0e\x3e\x28\x51\x16\x3f\x40\x47\x9e\x4d\x7b\x8d\x97\x44\x24\x70\x70\xbe\x70\xbe\x00\xc2\x17\x30\x3e\x5f\x1b\x5d\xc0\x17\x16\x13\x57\x94\x80\x16\xa0\xd7\x04\xd3\x02\xe3\x35\xc1\x42\xac\xf4\x16\x25\xc1\x27\x51\xf2\x04\x35\x13\x [...] }, "/crd/bases/camel.apache.org_camelcatalogs.yaml": &vfsgen۰CompressedFileInfo{ name: "camel.apache.org_camelcatalogs.yaml", @@ -133,21 +133,21 @@ var assets = func() http.FileSystem { modTime: time.Time{}, uncompressedSize: 8025, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\x5f\x8f\xe2\xc8\x11\x7f\xf7\xa7\x28\x2d\x0f\x77\x27\x8d\xcd\x6d\x92\x87\x88\x3c\x11\x76\x46\x41\xbb\x3b\x33\x1a\xd8\x3b\x9d\xb4\x2f\x85\x5d\x98\x3a\xec\x6e\xa7\xbb\x0d\x33\x89\xf2\xdd\xa3\xee\xb6\xc1\x1e\x6c\xc3\xb0\xbb\x7e\x02\x57\xd7\xff\x3f\xbf\x6a\x8f\x20\xfc\x7e\x4f\x30\x82\x4f\x1c\x93\xd0\x94\x80\x91\x60\x36\x04\xd3\x02\xe3\x0d\xc1\x42\xae\xcd\x1e\x15\xc1\x9d\x2c\x45\x82\x86\xa5\x80\x9f\xa7\x8b\xbb\x5f\x [...] + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\x5f\x8f\xe2\xc8\x11\x7f\xf7\xa7\x28\x2d\x0f\x77\x27\x8d\xcd\x6d\x92\x87\x88\x3c\x11\x76\x46\x41\xbb\x3b\x33\x1a\xd8\x3b\x9d\xb4\x2f\x85\x5d\x98\x3a\xec\x6e\xa7\xbb\x0d\x33\x89\xf2\xdd\xa3\xee\xb6\xc1\x1e\x6c\xc3\xb0\xbb\x7e\x02\x57\xd7\xff\x3f\xbf\x6a\x8f\x20\xfc\x7e\x4f\x30\x82\x4f\x1c\x93\xd0\x94\x80\x91\x60\x36\x04\xd3\x02\xe3\x0d\xc1\x42\xae\xcd\x1e\x15\xc1\x9d\x2c\x45\x82\x86\xa5\x80\x9f\xa7\x8b\xbb\x5f\x [...] }, "/crd/bases/camel.apache.org_integrationplatforms.yaml": &vfsgen۰CompressedFileInfo{ name: "camel.apache.org_integrationplatforms.yaml", modTime: time.Time{}, - uncompressedSize: 25774, + uncompressedSize: 25962, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\xdf\x8f\xe3\xb6\xf1\x7f\xf7\x5f\x31\x38\x3f\x5c\x02\xac\xe5\xe4\xfb\x6d\xd1\xd6\x7d\x28\x1c\xdf\x1d\xea\xee\xdd\xae\xb1\xf6\x25\xcd\x23\x2d\x8d\x65\xc6\x14\xa9\x92\xd4\xfa\x9c\xa2\xff\x7b\x31\xa4\x64\xcb\x6b\xfd\xf2\xee\x06\x0d\x12\xf1\xe5\x6e\x2d\x72\x38\xbf\x87\x43\x7d\xa0\x21\x8c\x5e\x6f\x0c\x86\xf0\x91\x87\x28\x0d\x46\x60\x15\xd8\x2d\xc2\x34\x65\xe1\x16\x61\xa9\x36\x76\xcf\x34\xc2\x07\x95\xc9\x88\x59\xae\x [...] + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\xdf\x93\xe2\xb8\xf1\x7f\xe7\xaf\xe8\x5a\x1e\xf6\xae\x6a\x30\x77\xdf\x6f\x52\x49\xc8\x43\x8a\x63\x77\x2b\x64\x76\x67\xa8\x81\xbd\xcb\x3d\x0a\xbb\x01\x1d\xb2\xe4\x48\xf2\xb0\x5c\x2a\xff\x7b\xaa\x25\x1b\xec\xc1\xbf\x98\x99\xab\x24\x77\xd6\xcb\xee\x60\xa9\xd5\xdd\xea\x9f\xf2\x07\x86\x30\x7a\xbd\x31\x18\xc2\x47\x1e\xa2\x34\x18\x81\x55\x60\x77\x08\xd3\x84\x85\x3b\x84\xa5\xda\xd8\x03\xd3\x08\x1f\x54\x2a\x23\x66\xb9\x [...] }, "/crd/bases/camel.apache.org_integrations.yaml": &vfsgen۰CompressedFileInfo{ name: "camel.apache.org_integrations.yaml", modTime: time.Time{}, uncompressedSize: 366985, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\xfb\x73\x1b\x37\x96\x30\xfa\x7b\xfe\x8a\x53\x4e\xea\x93\xb4\x11\x29\x3b\x99\x9d\xbb\xe3\x3b\xf5\xa5\x34\x92\x9c\xd5\x8d\x2d\xab\x2c\x25\xf9\x52\x4e\x36\x0b\x76\x83\x24\x56\xdd\x40\x2f\x80\xa6\xcc\xbd\xbe\xff\xfb\x2d\x1c\x00\xfd\xe0\xab\x81\x16\xe9\x38\x53\x8d\xa9\x9a\x98\x14\xfb\x34\x1e\xe7\x7d\x0e\xce\xf9\x12\x46\xfb\x1b\x5f\x7c\x09\xaf\x59\x42\xb9\xa2\x29\x68\x01\x7a\x4e\xe1\xbc\x20\xc9\x9c\xc2\x9d\x98\xea\x [...] + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\xfb\x73\x1b\x37\x96\x30\xfa\x7b\xfe\x8a\x53\x4e\xea\x93\xb4\x11\x29\x3b\x99\x9d\xbb\xe3\x3b\xf5\xa5\x34\x92\x9c\xd5\x8d\x2d\xab\x2c\x25\xf9\x52\x4e\x36\x0b\x76\x83\x24\x56\xdd\x40\x2f\x80\xa6\xcc\xbd\xbe\xff\xfb\x2d\x1c\x00\xfd\xe0\xab\x81\x16\xe9\x38\x53\x8d\xa9\x9a\x98\x14\xfb\x34\x1e\xe7\x7d\x0e\xce\xf9\x12\x46\xfb\x1b\x5f\x7c\x09\xaf\x59\x42\xb9\xa2\x29\x68\x01\x7a\x4e\xe1\xbc\x20\xc9\x9c\xc2\x9d\x98\xea\x [...] }, "/crd/bases/camel.apache.org_kameletbindings.yaml": &vfsgen۰CompressedFileInfo{ name: "camel.apache.org_kameletbindings.yaml", @@ -161,7 +161,7 @@ var assets = func() http.FileSystem { modTime: time.Time{}, uncompressedSize: 24256, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\x7d\x4f\xe3\x3a\xba\xff\xbf\x9f\xe2\x11\x1c\x69\x18\x89\x94\x96\xc2\x9c\x99\xde\x3f\x10\x07\x86\xbd\xbd\x87\x03\x88\xc2\xae\xce\x85\x59\xc9\x4d\x9e\xb6\x5e\x12\x3b\x6b\x3b\x14\xf6\xc0\x77\xbf\xb2\x9d\xa4\xe9\x4b\x12\xb7\x14\xf6\xe8\x6a\x2d\x8d\xa6\x49\xec\x9f\x9f\x37\x3f\x7e\xc9\x8f\x6c\x83\xb7\xb9\xd2\xd8\x86\x73\xea\x23\x93\x18\x80\xe2\xa0\xc6\x08\xc7\x31\xf1\xc7\x08\x7d\x3e\x54\x13\x22\x10\xce\x78\xc2\x02\x [...] + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5c\x7d\x4f\xe3\x3a\xba\xff\xbf\x9f\xe2\x11\x1c\x69\x18\x89\x94\x96\xc2\x9c\x99\xde\x3f\x10\x07\x86\xbd\xbd\x87\x03\x88\xc2\xae\xce\x85\x59\xc9\x4d\x9e\xb6\x5e\x12\x3b\x6b\x3b\x14\xf6\xc0\x77\xbf\xb2\x9d\xa4\xe9\x4b\x12\xb7\x14\xf6\xe8\x6a\x2d\x8d\xa6\x49\xec\x9f\x9f\x37\x3f\x7e\xc9\x8f\x6c\x83\xb7\xb9\xd2\xd8\x86\x73\xea\x23\x93\x18\x80\xe2\xa0\xc6\x08\xc7\x31\xf1\xc7\x08\x7d\x3e\x54\x13\x22\x10\xce\x78\xc2\x02\x [...] }, "/manager": &vfsgen۰DirInfo{ name: "manager", diff --git a/pkg/trait/builder_test.go b/pkg/trait/builder_test.go index 5093409..14dd278 100644 --- a/pkg/trait/builder_test.go +++ b/pkg/trait/builder_test.go @@ -130,7 +130,7 @@ func createBuilderTestEnv(cluster v1.IntegrationPlatformCluster, strategy v1.Int Cluster: cluster, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: strategy, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, RuntimeVersion: defaults.DefaultRuntimeVersion, RuntimeProvider: v1.RuntimeProviderQuarkus, KanikoBuildCache: &kanikoCache, diff --git a/pkg/trait/container_test.go b/pkg/trait/container_test.go index 5a77015..f36a0db 100644 --- a/pkg/trait/container_test.go +++ b/pkg/trait/container_test.go @@ -22,13 +22,13 @@ import ( "testing" "github.com/google/uuid" - "k8s.io/apimachinery/pkg/types" - "github.com/stretchr/testify/assert" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + ctrl "sigs.k8s.io/controller-runtime/pkg/client" v1 "github.com/apache/camel-k/pkg/apis/camel/v1" @@ -68,7 +68,7 @@ func TestContainerWithDefaults(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, @@ -128,7 +128,7 @@ func TestContainerWithCustomName(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, @@ -189,7 +189,7 @@ func TestContainerWithCustomImage(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, @@ -264,7 +264,7 @@ func TestContainerWithCustomImageAndIntegrationKit(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, @@ -315,7 +315,7 @@ func TestContainerWithCustomImageAndDeprecatedIntegrationKit(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, diff --git a/pkg/trait/cron_test.go b/pkg/trait/cron_test.go index af6a6ea..af4b89d 100644 --- a/pkg/trait/cron_test.go +++ b/pkg/trait/cron_test.go @@ -262,7 +262,7 @@ func TestCronDeps(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, }, @@ -336,7 +336,7 @@ func TestCronDepsFallback(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, }, diff --git a/pkg/trait/knative_service_test.go b/pkg/trait/knative_service_test.go index faa5ed5..4753164 100644 --- a/pkg/trait/knative_service_test.go +++ b/pkg/trait/knative_service_test.go @@ -104,7 +104,7 @@ func TestKnativeService(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, @@ -225,7 +225,7 @@ func TestKnativeServiceWithCustomContainerName(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, @@ -303,7 +303,7 @@ func TestKnativeServiceWithResr(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, diff --git a/pkg/trait/knative_test.go b/pkg/trait/knative_test.go index 5c22c68..5432c90 100644 --- a/pkg/trait/knative_test.go +++ b/pkg/trait/knative_test.go @@ -86,7 +86,7 @@ func TestKnativeEnvConfigurationFromTrait(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, }, @@ -205,7 +205,7 @@ func TestKnativeEnvConfigurationFromSource(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, }, @@ -388,7 +388,7 @@ func NewFakeEnvironment(t *testing.T, source v1.SourceSpec) Environment { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, Profile: v1.TraitProfileKnative, }, diff --git a/pkg/trait/route_test.go b/pkg/trait/route_test.go index a3f48ef..a8d9484 100644 --- a/pkg/trait/route_test.go +++ b/pkg/trait/route_test.go @@ -153,7 +153,7 @@ func createTestRouteEnvironment(t *testing.T, name string) *Environment { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, diff --git a/pkg/trait/service_test.go b/pkg/trait/service_test.go index 9258542..aea7279 100644 --- a/pkg/trait/service_test.go +++ b/pkg/trait/service_test.go @@ -20,15 +20,17 @@ package trait import ( "testing" + "github.com/stretchr/testify/assert" + + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/apache/camel-k/pkg/apis/camel/v1" "github.com/apache/camel-k/pkg/util/camel" "github.com/apache/camel-k/pkg/util/gzip" "github.com/apache/camel-k/pkg/util/kubernetes" "github.com/apache/camel-k/pkg/util/test" - "github.com/stretchr/testify/assert" - appsv1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) const ( @@ -86,7 +88,7 @@ func TestServiceWithDefaults(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, @@ -183,7 +185,7 @@ func TestService(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, @@ -262,7 +264,7 @@ func TestServiceWithCustomContainerName(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, }, @@ -344,7 +346,7 @@ func TestServiceWithNodePort(t *testing.T) { Cluster: v1.IntegrationPlatformClusterOpenShift, Build: v1.IntegrationPlatformBuildSpec{ PublishStrategy: v1.IntegrationPlatformBuildPublishStrategyS2I, - Registry: v1.IntegrationPlatformRegistrySpec{Address: "registry"}, + Registry: v1.RegistrySpec{Address: "registry"}, }, }, },