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 4cc932c3e787bf3c1ffcf00c3db622d16e535cd7 Author: Antonin Stefanutti <[email protected]> AuthorDate: Fri Jan 7 18:12:06 2022 +0100 chore(api): Remove Maven repositories from the platform API --- config/crd/bases/camel.apache.org_builds.yaml | 19 +++-- .../crd/bases/camel.apache.org_camelcatalogs.yaml | 6 +- .../camel.apache.org_integrationplatforms.yaml | 86 +--------------------- helm/camel-k/crds/crd-build.yaml | 19 +++-- helm/camel-k/crds/crd-camel-catalog.yaml | 6 +- helm/camel-k/crds/crd-integration-platform.yaml | 86 +--------------------- pkg/apis/camel/v1/build_types.go | 9 ++- pkg/apis/camel/v1/common_types.go | 30 -------- pkg/apis/camel/v1/maven_types.go | 39 +++++++++- pkg/apis/camel/v1/zz_generated.deepcopy.go | 27 +++++-- pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go | 1 - pkg/builder/project_test.go | 28 ++++--- 12 files changed, 118 insertions(+), 238 deletions(-) diff --git a/config/crd/bases/camel.apache.org_builds.yaml b/config/crd/bases/camel.apache.org_builds.yaml index 88b548c..efac42c 100644 --- a/config/crd/bases/camel.apache.org_builds.yaml +++ b/config/crd/bases/camel.apache.org_builds.yaml @@ -134,7 +134,7 @@ spec: type: string type: array maven: - description: MavenSpec -- + description: MavenBuildSpec -- properties: caSecret: description: The Secret name and key, containing the @@ -164,9 +164,9 @@ spec: - key type: object extension: - description: Maven build extensions https://maven.apache.org/guides/mini/guide-using-extensions.html + description: The Maven build extensions. See https://maven.apache.org/guides/mini/guide-using-extensions.html. items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -188,15 +188,17 @@ spec: description: The Maven properties. type: object repositories: + description: The Maven repositories. items: - description: Repository -- + description: Repository defines a Maven repository properties: id: type: string name: type: string releases: - description: RepositoryPolicy -- + description: RepositoryPolicy defines the policy + associated to a Maven repository properties: checksumPolicy: type: string @@ -208,7 +210,8 @@ spec: - enabled type: object snapshots: - description: RepositoryPolicy -- + description: RepositoryPolicy defines the policy + associated to a Maven repository properties: checksumPolicy: type: string @@ -316,7 +319,7 @@ spec: properties: dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -339,7 +342,7 @@ spec: type: object dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string diff --git a/config/crd/bases/camel.apache.org_camelcatalogs.yaml b/config/crd/bases/camel.apache.org_camelcatalogs.yaml index 4d33593..536db40 100644 --- a/config/crd/bases/camel.apache.org_camelcatalogs.yaml +++ b/config/crd/bases/camel.apache.org_camelcatalogs.yaml @@ -227,7 +227,7 @@ spec: type: string dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -264,7 +264,7 @@ spec: properties: dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -287,7 +287,7 @@ spec: type: object dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/config/crd/bases/camel.apache.org_integrationplatforms.yaml index 4307527..1a0edd6 100644 --- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml +++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml @@ -108,9 +108,9 @@ spec: - key type: object extension: - description: Maven build extensions https://maven.apache.org/guides/mini/guide-using-extensions.html + description: The Maven build extensions. See https://maven.apache.org/guides/mini/guide-using-extensions.html. items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -131,45 +131,6 @@ spec: type: string description: The Maven properties. type: object - repositories: - items: - description: Repository -- - properties: - id: - type: string - name: - type: string - releases: - description: RepositoryPolicy -- - properties: - checksumPolicy: - type: string - enabled: - type: boolean - updatePolicy: - type: string - required: - - enabled - type: object - snapshots: - description: RepositoryPolicy -- - properties: - checksumPolicy: - type: string - enabled: - type: boolean - updatePolicy: - type: string - required: - - enabled - type: object - url: - type: string - required: - - id - - url - type: object - type: array settings: description: A reference to the ConfigMap or Secret key that contains the Maven settings. @@ -349,9 +310,9 @@ spec: - key type: object extension: - description: Maven build extensions https://maven.apache.org/guides/mini/guide-using-extensions.html + description: The Maven build extensions. See https://maven.apache.org/guides/mini/guide-using-extensions.html. items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -372,45 +333,6 @@ spec: type: string description: The Maven properties. type: object - repositories: - items: - description: Repository -- - properties: - id: - type: string - name: - type: string - releases: - description: RepositoryPolicy -- - properties: - checksumPolicy: - type: string - enabled: - type: boolean - updatePolicy: - type: string - required: - - enabled - type: object - snapshots: - description: RepositoryPolicy -- - properties: - checksumPolicy: - type: string - enabled: - type: boolean - updatePolicy: - type: string - required: - - enabled - type: object - url: - type: string - required: - - id - - url - type: object - type: array settings: description: A reference to the ConfigMap or Secret key that contains the Maven settings. diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml index 88b548c..efac42c 100644 --- a/helm/camel-k/crds/crd-build.yaml +++ b/helm/camel-k/crds/crd-build.yaml @@ -134,7 +134,7 @@ spec: type: string type: array maven: - description: MavenSpec -- + description: MavenBuildSpec -- properties: caSecret: description: The Secret name and key, containing the @@ -164,9 +164,9 @@ spec: - key type: object extension: - description: Maven build extensions https://maven.apache.org/guides/mini/guide-using-extensions.html + description: The Maven build extensions. See https://maven.apache.org/guides/mini/guide-using-extensions.html. items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -188,15 +188,17 @@ spec: description: The Maven properties. type: object repositories: + description: The Maven repositories. items: - description: Repository -- + description: Repository defines a Maven repository properties: id: type: string name: type: string releases: - description: RepositoryPolicy -- + description: RepositoryPolicy defines the policy + associated to a Maven repository properties: checksumPolicy: type: string @@ -208,7 +210,8 @@ spec: - enabled type: object snapshots: - description: RepositoryPolicy -- + description: RepositoryPolicy defines the policy + associated to a Maven repository properties: checksumPolicy: type: string @@ -316,7 +319,7 @@ spec: properties: dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -339,7 +342,7 @@ spec: type: object dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string diff --git a/helm/camel-k/crds/crd-camel-catalog.yaml b/helm/camel-k/crds/crd-camel-catalog.yaml index 4d33593..536db40 100644 --- a/helm/camel-k/crds/crd-camel-catalog.yaml +++ b/helm/camel-k/crds/crd-camel-catalog.yaml @@ -227,7 +227,7 @@ spec: type: string dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -264,7 +264,7 @@ spec: properties: dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -287,7 +287,7 @@ spec: type: object dependencies: items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string diff --git a/helm/camel-k/crds/crd-integration-platform.yaml b/helm/camel-k/crds/crd-integration-platform.yaml index 4307527..1a0edd6 100644 --- a/helm/camel-k/crds/crd-integration-platform.yaml +++ b/helm/camel-k/crds/crd-integration-platform.yaml @@ -108,9 +108,9 @@ spec: - key type: object extension: - description: Maven build extensions https://maven.apache.org/guides/mini/guide-using-extensions.html + description: The Maven build extensions. See https://maven.apache.org/guides/mini/guide-using-extensions.html. items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -131,45 +131,6 @@ spec: type: string description: The Maven properties. type: object - repositories: - items: - description: Repository -- - properties: - id: - type: string - name: - type: string - releases: - description: RepositoryPolicy -- - properties: - checksumPolicy: - type: string - enabled: - type: boolean - updatePolicy: - type: string - required: - - enabled - type: object - snapshots: - description: RepositoryPolicy -- - properties: - checksumPolicy: - type: string - enabled: - type: boolean - updatePolicy: - type: string - required: - - enabled - type: object - url: - type: string - required: - - id - - url - type: object - type: array settings: description: A reference to the ConfigMap or Secret key that contains the Maven settings. @@ -349,9 +310,9 @@ spec: - key type: object extension: - description: Maven build extensions https://maven.apache.org/guides/mini/guide-using-extensions.html + description: The Maven build extensions. See https://maven.apache.org/guides/mini/guide-using-extensions.html. items: - description: MavenArtifact -- + description: MavenArtifact defines a Maven artifact properties: artifactId: type: string @@ -372,45 +333,6 @@ spec: type: string description: The Maven properties. type: object - repositories: - items: - description: Repository -- - properties: - id: - type: string - name: - type: string - releases: - description: RepositoryPolicy -- - properties: - checksumPolicy: - type: string - enabled: - type: boolean - updatePolicy: - type: string - required: - - enabled - type: object - snapshots: - description: RepositoryPolicy -- - properties: - checksumPolicy: - type: string - enabled: - type: boolean - updatePolicy: - type: string - required: - - enabled - type: object - url: - type: string - required: - - id - - url - type: object - type: array settings: description: A reference to the ConfigMap or Secret key that contains the Maven settings. diff --git a/pkg/apis/camel/v1/build_types.go b/pkg/apis/camel/v1/build_types.go index 7345702..3f40acc 100644 --- a/pkg/apis/camel/v1/build_types.go +++ b/pkg/apis/camel/v1/build_types.go @@ -62,10 +62,17 @@ type BuilderTask struct { Resources []ResourceSpec `json:"resources,omitempty"` Dependencies []string `json:"dependencies,omitempty"` Steps []string `json:"steps,omitempty"` - Maven MavenSpec `json:"maven,omitempty"` + Maven MavenBuildSpec `json:"maven,omitempty"` BuildDir string `json:"buildDir,omitempty"` } +// MavenBuildSpec -- +type MavenBuildSpec struct { + MavenSpec `json:",inline"` + // The Maven repositories. + Repositories []Repository `json:"repositories,omitempty"` +} + // PublishTask -- type PublishTask struct { ContextDir string `json:"contextDir,omitempty"` diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go index 45e9f91..5826a06 100644 --- a/pkg/apis/camel/v1/common_types.go +++ b/pkg/apis/camel/v1/common_types.go @@ -104,29 +104,6 @@ type Configurable interface { Configurations() []ConfigurationSpec } -// MavenSpec -- -type MavenSpec struct { - // The path of the local Maven repository. - LocalRepository string `json:"localRepository,omitempty"` - // The Maven properties. - Properties map[string]string `json:"properties,omitempty"` - // A reference to the ConfigMap or Secret key that contains - // the Maven settings. - Settings ValueSource `json:"settings,omitempty"` - // The Secret name and key, containing the CA certificate(s) used to connect - // to remote Maven repositories. - // It can contain X.509 certificates, and PKCS#7 formatted certificate chains. - // A JKS formatted keystore is automatically created to store the CA certificate(s), - // and configured to be used as a trusted certificate(s) by the Maven commands. - // Note that the root CA certificates are also imported into the created keystore. - CASecret *corev1.SecretKeySelector `json:"caSecret,omitempty"` - // Deprecated: use IntegrationPlatform.Spec.Build.Timeout instead - Timeout *metav1.Duration `json:"timeout,omitempty"` - Repositories []Repository `json:"repositories,omitempty"` - // Maven build extensions https://maven.apache.org/guides/mini/guide-using-extensions.html - Extension []MavenArtifact `json:"extension,omitempty"` -} - // RegistrySpec provides the configuration for the container registry type RegistrySpec struct { Insecure bool `json:"insecure,omitempty"` @@ -144,13 +121,6 @@ type ValueSource struct { SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"` } -// MavenArtifact -- -type MavenArtifact struct { - GroupID string `json:"groupId" yaml:"groupId" xml:"groupId"` - ArtifactID string `json:"artifactId" yaml:"artifactId" xml:"artifactId"` - Version string `json:"version,omitempty" yaml:"version,omitempty" xml:"version,omitempty"` -} - // RuntimeSpec -- type RuntimeSpec struct { Version string `json:"version" yaml:"version"` diff --git a/pkg/apis/camel/v1/maven_types.go b/pkg/apis/camel/v1/maven_types.go index 426f113..569336c 100644 --- a/pkg/apis/camel/v1/maven_types.go +++ b/pkg/apis/camel/v1/maven_types.go @@ -17,7 +17,35 @@ limitations under the License. package v1 -// Repository -- +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// MavenSpec -- +type MavenSpec struct { + // The path of the local Maven repository. + LocalRepository string `json:"localRepository,omitempty"` + // The Maven properties. + Properties map[string]string `json:"properties,omitempty"` + // A reference to the ConfigMap or Secret key that contains + // the Maven settings. + Settings ValueSource `json:"settings,omitempty"` + // The Secret name and key, containing the CA certificate(s) used to connect + // to remote Maven repositories. + // It can contain X.509 certificates, and PKCS#7 formatted certificate chains. + // A JKS formatted keystore is automatically created to store the CA certificate(s), + // and configured to be used as a trusted certificate(s) by the Maven commands. + // Note that the root CA certificates are also imported into the created keystore. + CASecret *corev1.SecretKeySelector `json:"caSecret,omitempty"` + // Deprecated: use IntegrationPlatform.Spec.Build.Timeout instead + Timeout *metav1.Duration `json:"timeout,omitempty"` + // The Maven build extensions. + // See https://maven.apache.org/guides/mini/guide-using-extensions.html. + Extension []MavenArtifact `json:"extension,omitempty"` +} + +// Repository defines a Maven repository type Repository struct { ID string `xml:"id" json:"id"` Name string `xml:"name,omitempty" json:"name,omitempty"` @@ -26,9 +54,16 @@ type Repository struct { Releases RepositoryPolicy `xml:"releases,omitempty" json:"releases,omitempty"` } -// RepositoryPolicy -- +// RepositoryPolicy defines the policy associated to a Maven repository type RepositoryPolicy struct { Enabled bool `xml:"enabled" json:"enabled"` UpdatePolicy string `xml:"updatePolicy,omitempty" json:"updatePolicy,omitempty"` ChecksumPolicy string `xml:"checksumPolicy,omitempty" json:"checksumPolicy,omitempty"` } + +// MavenArtifact defines a Maven artifact +type MavenArtifact struct { + GroupID string `json:"groupId" yaml:"groupId" xml:"groupId"` + ArtifactID string `json:"artifactId" yaml:"artifactId" xml:"artifactId"` + Version string `json:"version,omitempty" yaml:"version,omitempty" xml:"version,omitempty"` +} diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go index f23a7da..b9f63d7 100644 --- a/pkg/apis/camel/v1/zz_generated.deepcopy.go +++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated // Code generated by controller-gen. DO NOT EDIT. @@ -1240,6 +1239,27 @@ func (in *MavenArtifact) DeepCopy() *MavenArtifact { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MavenBuildSpec) DeepCopyInto(out *MavenBuildSpec) { + *out = *in + in.MavenSpec.DeepCopyInto(&out.MavenSpec) + if in.Repositories != nil { + in, out := &in.Repositories, &out.Repositories + *out = make([]Repository, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MavenBuildSpec. +func (in *MavenBuildSpec) DeepCopy() *MavenBuildSpec { + if in == nil { + return nil + } + out := new(MavenBuildSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MavenSpec) DeepCopyInto(out *MavenSpec) { *out = *in if in.Properties != nil { @@ -1260,11 +1280,6 @@ func (in *MavenSpec) DeepCopyInto(out *MavenSpec) { *out = new(metav1.Duration) **out = **in } - if in.Repositories != nil { - in, out := &in.Repositories, &out.Repositories - *out = make([]Repository, len(*in)) - copy(*out, *in) - } if in.Extension != nil { in, out := &in.Extension, &out.Extension *out = make([]MavenArtifact, len(*in)) diff --git a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go index be6e2c5..a5c99f3 100644 --- a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated // Code generated by controller-gen. DO NOT EDIT. diff --git a/pkg/builder/project_test.go b/pkg/builder/project_test.go index 9a1c7fa..5d8fdcf 100644 --- a/pkg/builder/project_test.go +++ b/pkg/builder/project_test.go @@ -58,13 +58,15 @@ func TestMavenSettingsFromConfigMap(t *testing.T) { Namespace: "ns", Build: v1.BuilderTask{ Runtime: catalog.Runtime, - Maven: v1.MavenSpec{ - Settings: v1.ValueSource{ - ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: "maven-settings", + Maven: v1.MavenBuildSpec{ + MavenSpec: v1.MavenSpec{ + Settings: v1.ValueSource{ + ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "maven-settings", + }, + Key: "settings.xml", }, - Key: "settings.xml", }, }, }, @@ -105,13 +107,15 @@ func TestMavenSettingsFromSecret(t *testing.T) { Namespace: "ns", Build: v1.BuilderTask{ Runtime: catalog.Runtime, - Maven: v1.MavenSpec{ - Settings: v1.ValueSource{ - SecretKeyRef: &corev1.SecretKeySelector{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: "maven-settings", + Maven: v1.MavenBuildSpec{ + MavenSpec: v1.MavenSpec{ + Settings: v1.ValueSource{ + SecretKeyRef: &corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "maven-settings", + }, + Key: "settings.xml", }, - Key: "settings.xml", }, }, },
