You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2020/07/01 07:08:25 UTC

[camel-k] 18/24: fix(crd): Validation is not generated for embedded ObjectMeta fields

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 4a76430f5cfa5a2f5df9b8fe7c4f74649b058370
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Jun 16 12:00:26 2020 +0200

    fix(crd): Validation is not generated for embedded ObjectMeta fields
---
 deploy/crd-build.yaml            |  1 +
 pkg/apis/camel/v1/build_types.go | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/deploy/crd-build.yaml b/deploy/crd-build.yaml
index 0eda499..81dabf1 100644
--- a/deploy/crd-build.yaml
+++ b/deploy/crd-build.yaml
@@ -804,6 +804,7 @@ spec:
                             type: object
                           meta:
                             type: object
+                            x-kubernetes-preserve-unknown-fields: true
                           name:
                             type: string
                           properties:
diff --git a/pkg/apis/camel/v1/build_types.go b/pkg/apis/camel/v1/build_types.go
index d10ace3..9311965 100644
--- a/pkg/apis/camel/v1/build_types.go
+++ b/pkg/apis/camel/v1/build_types.go
@@ -65,7 +65,9 @@ type ImageTask struct {
 
 // BuilderTask --
 type BuilderTask struct {
-	BaseTask     `json:",inline"`
+	BaseTask `json:",inline"`
+	// This is required until https://github.com/kubernetes-sigs/controller-tools/pull/395 gets merged
+	// +kubebuilder:pruning:PreserveUnknownFields
 	Meta         metav1.ObjectMeta `json:"meta,omitempty"`
 	Image        string            `json:"image,omitempty"`
 	BaseImage    string            `json:"baseImage,omitempty"`
@@ -82,13 +84,13 @@ type BuilderTask struct {
 
 // BuildStatus defines the observed state of Build
 type BuildStatus struct {
-	Phase      BuildPhase       `json:"phase,omitempty"`
-	Image      string           `json:"image,omitempty"`
-	Digest     string           `json:"digest,omitempty"`
-	BaseImage  string           `json:"baseImage,omitempty"`
-	Artifacts  []Artifact       `json:"artifacts,omitempty"`
-	Error      string           `json:"error,omitempty"`
-	Failure    *Failure         `json:"failure,omitempty"`
+	Phase     BuildPhase `json:"phase,omitempty"`
+	Image     string     `json:"image,omitempty"`
+	Digest    string     `json:"digest,omitempty"`
+	BaseImage string     `json:"baseImage,omitempty"`
+	Artifacts []Artifact `json:"artifacts,omitempty"`
+	Error     string     `json:"error,omitempty"`
+	Failure   *Failure   `json:"failure,omitempty"`
 	// +nullable
 	StartedAt  metav1.Time      `json:"startedAt,omitempty"`
 	Platform   string           `json:"platform,omitempty"`