Skip to content

Commit

Permalink
feat(api): create BuildConfiguration to host config
Browse files Browse the repository at this point in the history
This commit introduce the object we'll use to include later all builder config.

Ref apache#4177
  • Loading branch information
squakez committed May 4, 2023
1 parent 66b44ca commit 0770077
Show file tree
Hide file tree
Showing 17 changed files with 326 additions and 83 deletions.
68 changes: 52 additions & 16 deletions config/crd/bases/camel.apache.org_integrationplatforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,31 @@ spec:
description: the timeout (in seconds) to use when creating the
build tools container image
type: string
buildStrategy:
description: the strategy to adopt for building an Integration
base image
enum:
- routine
- pod
type: string
buildconfiguration:
description: the configuration required to build an Integration
container image
properties:
limitCPU:
description: The maximum amount of CPU required.
type: string
limitMemory:
description: The maximum amount of memory required.
type: string
requestCPU:
description: The minimum amount of CPU required.
type: string
requestMemory:
description: The minimum amount of memory required.
type: string
strategy:
description: the strategy to adopt
enum:
- routine
- pod
type: string
required:
- strategy
type: object
maven:
description: Maven configuration used to build the Camel/Camel-Quarkus
applications
Expand Down Expand Up @@ -249,7 +267,7 @@ spec:
type: integer
publishStrategy:
description: the strategy to adopt for publishing an Integration
base image
container image
type: string
registry:
description: the image registry used to push/pull Integration
Expand Down Expand Up @@ -1671,13 +1689,31 @@ spec:
description: the timeout (in seconds) to use when creating the
build tools container image
type: string
buildStrategy:
description: the strategy to adopt for building an Integration
base image
enum:
- routine
- pod
type: string
buildconfiguration:
description: the configuration required to build an Integration
container image
properties:
limitCPU:
description: The maximum amount of CPU required.
type: string
limitMemory:
description: The maximum amount of memory required.
type: string
requestCPU:
description: The minimum amount of CPU required.
type: string
requestMemory:
description: The minimum amount of memory required.
type: string
strategy:
description: the strategy to adopt
enum:
- routine
- pod
type: string
required:
- strategy
type: object
maven:
description: Maven configuration used to build the Camel/Camel-Quarkus
applications
Expand Down Expand Up @@ -1836,7 +1872,7 @@ spec:
type: integer
publishStrategy:
description: the strategy to adopt for publishing an Integration
base image
container image
type: string
registry:
description: the image registry used to push/pull Integration
Expand Down
65 changes: 59 additions & 6 deletions docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,58 @@ A human-readable message indicating details about the transition.
BuildConditionType --
[#_camel_apache_org_v1_BuildConfiguration]
=== BuildConfiguration
*Appears on:*
* <<#_camel_apache_org_v1_IntegrationPlatformBuildSpec, IntegrationPlatformBuildSpec>>
BuildConfiguration represent the configuration required to build the runtime
[cols="2,2a",options="header"]
|===
|Field
|Description
|`strategy` +
*xref:#_camel_apache_org_v1_BuildStrategy[BuildStrategy]*
|
the strategy to adopt
|`requestCPU` +
string
|
The minimum amount of CPU required.
|`requestMemory` +
string
|
The minimum amount of memory required.
|`limitCPU` +
string
|
The maximum amount of CPU required.
|`limitMemory` +
string
|
The maximum amount of memory required.
|===
[#_camel_apache_org_v1_BuildPhase]
=== BuildPhase(`string` alias)
Expand Down Expand Up @@ -668,11 +720,12 @@ https://github.com/OAI/OpenAPI-Specification/issues/845
*Appears on:*
* <<#_camel_apache_org_v1_BuildConfiguration, BuildConfiguration>>
* <<#_camel_apache_org_v1_BuildSpec, BuildSpec>>
* <<#_camel_apache_org_v1_IntegrationPlatformBuildSpec, IntegrationPlatformBuildSpec>>
BuildStrategy specifies how the Build should be executed.
It will trigger a Maven process that will take care of producing the expected Camel/Camel-Quarkus runtime.
It will trigger a Maven process (either as an Operator routine or Kubernetes Pod execution) that
will take care of producing the expected Camel/Camel-Quarkus runtime.
[#_camel_apache_org_v1_BuildahTask]
Expand Down Expand Up @@ -2416,19 +2469,19 @@ You can define the build strategy, the image registry to use and the Maven confi
|Field
|Description
|`buildStrategy` +
*xref:#_camel_apache_org_v1_BuildStrategy[BuildStrategy]*
|`buildconfiguration` +
*xref:#_camel_apache_org_v1_BuildConfiguration[BuildConfiguration]*
|
the strategy to adopt for building an Integration base image
the configuration required to build an Integration container image
|`publishStrategy` +
*xref:#_camel_apache_org_v1_IntegrationPlatformBuildPublishStrategy[IntegrationPlatformBuildPublishStrategy]*
|
the strategy to adopt for publishing an Integration base image
the strategy to adopt for publishing an Integration container image
|`runtimeVersion` +
string
Expand Down
2 changes: 1 addition & 1 deletion e2e/commonwithcustominstall/local_platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestLocalPlatform(t *testing.T) {

local := Platform(ns1)()
Expect(local.Status.Build.PublishStrategy).To(Equal(pl.Status.Build.PublishStrategy))
Expect(local.Status.Build.BuildStrategy).To(Equal(pl.Status.Build.BuildStrategy))
Expect(local.Status.Build.BuildConfiguration.Strategy).To(Equal(pl.Status.Build.BuildConfiguration.Strategy))
Expect(local.Status.Build.Maven.LocalRepository).To(Equal(pl.Status.Build.Maven.LocalRepository))
Expect(local.Status.Build.Maven.CLIOptions).To(ContainElements(pl.Status.Build.Maven.CLIOptions))
Expect(local.Status.Build.Maven.Extension).To(BeEmpty())
Expand Down
68 changes: 52 additions & 16 deletions helm/camel-k/crds/crd-integration-platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,31 @@ spec:
description: the timeout (in seconds) to use when creating the
build tools container image
type: string
buildStrategy:
description: the strategy to adopt for building an Integration
base image
enum:
- routine
- pod
type: string
buildconfiguration:
description: the configuration required to build an Integration
container image
properties:
limitCPU:
description: The maximum amount of CPU required.
type: string
limitMemory:
description: The maximum amount of memory required.
type: string
requestCPU:
description: The minimum amount of CPU required.
type: string
requestMemory:
description: The minimum amount of memory required.
type: string
strategy:
description: the strategy to adopt
enum:
- routine
- pod
type: string
required:
- strategy
type: object
maven:
description: Maven configuration used to build the Camel/Camel-Quarkus
applications
Expand Down Expand Up @@ -249,7 +267,7 @@ spec:
type: integer
publishStrategy:
description: the strategy to adopt for publishing an Integration
base image
container image
type: string
registry:
description: the image registry used to push/pull Integration
Expand Down Expand Up @@ -1671,13 +1689,31 @@ spec:
description: the timeout (in seconds) to use when creating the
build tools container image
type: string
buildStrategy:
description: the strategy to adopt for building an Integration
base image
enum:
- routine
- pod
type: string
buildconfiguration:
description: the configuration required to build an Integration
container image
properties:
limitCPU:
description: The maximum amount of CPU required.
type: string
limitMemory:
description: The maximum amount of memory required.
type: string
requestCPU:
description: The minimum amount of CPU required.
type: string
requestMemory:
description: The minimum amount of memory required.
type: string
strategy:
description: the strategy to adopt
enum:
- routine
- pod
type: string
required:
- strategy
type: object
maven:
description: Maven configuration used to build the Camel/Camel-Quarkus
applications
Expand Down Expand Up @@ -1836,7 +1872,7 @@ spec:
type: integer
publishStrategy:
description: the strategy to adopt for publishing an Integration
base image
container image
type: string
registry:
description: the image registry used to push/pull Integration
Expand Down
17 changes: 16 additions & 1 deletion pkg/apis/camel/v1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,23 @@ const (
PlatformSelectorAnnotation = "camel.apache.org/platform.id"
)

// BuildConfiguration represent the configuration required to build the runtime
type BuildConfiguration struct {
// the strategy to adopt
Strategy BuildStrategy `json:"strategy"`
// The minimum amount of CPU required.
RequestCPU string `property:"request-cpu" json:"requestCPU,omitempty"`
// The minimum amount of memory required.
RequestMemory string `property:"request-memory" json:"requestMemory,omitempty"`
// The maximum amount of CPU required.
LimitCPU string `property:"limit-cpu" json:"limitCPU,omitempty"`
// The maximum amount of memory required.
LimitMemory string `property:"limit-memory" json:"limitMemory,omitempty"`
}

// BuildStrategy specifies how the Build should be executed.
// It will trigger a Maven process that will take care of producing the expected Camel/Camel-Quarkus runtime.
// It will trigger a Maven process (either as an Operator routine or Kubernetes Pod execution) that
// will take care of producing the expected Camel/Camel-Quarkus runtime.
// +kubebuilder:validation:Enum=routine;pod
type BuildStrategy string

Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/camel/v1/integrationplatform_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ var AllIntegrationPlatformClusters = []IntegrationPlatformCluster{IntegrationPla
// This configuration can be used to tune the behavior of the Integration/IntegrationKit image builds.
// You can define the build strategy, the image registry to use and the Maven configuration to adopt.
type IntegrationPlatformBuildSpec struct {
// the strategy to adopt for building an Integration base image
BuildStrategy BuildStrategy `json:"buildStrategy,omitempty"`
// the strategy to adopt for publishing an Integration base image
// the configuration required to build an Integration container image
BuildConfiguration BuildConfiguration `json:"buildconfiguration,omitempty"`
// the strategy to adopt for publishing an Integration container image
PublishStrategy IntegrationPlatformBuildPublishStrategy `json:"publishStrategy,omitempty"`
// the Camel K Runtime dependency version
RuntimeVersion string `json:"runtimeVersion,omitempty"`
Expand Down
16 changes: 16 additions & 0 deletions pkg/apis/camel/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0770077

Please # to comment.