From ded934bdaaee0dbaf16585d5a5cbafe6ec4212f5 Mon Sep 17 00:00:00 2001 From: Zach Aller Date: Wed, 14 Jun 2023 12:11:40 -0500 Subject: [PATCH] feat: add merge key to analysis template (#2842) add merge key to analysis templates Signed-off-by: zachaller --- .../features/kustomize/rollout_cr_schema.json | 48 +++++++++++++++++++ pkg/apiclient/rollout/rollout.swagger.json | 2 +- pkg/apis/rollouts/v1alpha1/generated.proto | 2 + .../rollouts/v1alpha1/openapi_generated.go | 12 +++++ pkg/apis/rollouts/v1alpha1/types.go | 6 ++- 5 files changed, 67 insertions(+), 3 deletions(-) diff --git a/docs/features/kustomize/rollout_cr_schema.json b/docs/features/kustomize/rollout_cr_schema.json index d980188a93..9d11edb202 100644 --- a/docs/features/kustomize/rollout_cr_schema.json +++ b/docs/features/kustomize/rollout_cr_schema.json @@ -17124,6 +17124,22 @@ "type": "array", "x-kubernetes-patch-merge-key": "metricName", "x-kubernetes-patch-strategy": "merge" + }, + "templates": { + "items": { + "properties": { + "clusterScope": { + "type": "boolean" + }, + "templateName": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array", + "x-kubernetes-patch-merge-key": "templateName", + "x-kubernetes-patch-strategy": "merge" } }, "type": "object" @@ -17204,6 +17220,22 @@ "type": "array", "x-kubernetes-patch-merge-key": "metricName", "x-kubernetes-patch-strategy": "merge" + }, + "templates": { + "items": { + "properties": { + "clusterScope": { + "type": "boolean" + }, + "templateName": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array", + "x-kubernetes-patch-merge-key": "templateName", + "x-kubernetes-patch-strategy": "merge" } }, "type": "object" @@ -17292,6 +17324,22 @@ "type": "array", "x-kubernetes-patch-merge-key": "metricName", "x-kubernetes-patch-strategy": "merge" + }, + "templates": { + "items": { + "properties": { + "clusterScope": { + "type": "boolean" + }, + "templateName": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array", + "x-kubernetes-patch-merge-key": "templateName", + "x-kubernetes-patch-strategy": "merge" } }, "type": "object" diff --git a/pkg/apiclient/rollout/rollout.swagger.json b/pkg/apiclient/rollout/rollout.swagger.json index a34dbc3181..68b207b930 100755 --- a/pkg/apiclient/rollout/rollout.swagger.json +++ b/pkg/apiclient/rollout/rollout.swagger.json @@ -1224,7 +1224,7 @@ "items": { "$ref": "#/definitions/github.com.argoproj.argo_rollouts.pkg.apis.rollouts.v1alpha1.RolloutAnalysisTemplate" }, - "title": "Templates reference to a list of analysis templates to combine for an AnalysisRun" + "title": "Templates reference to a list of analysis templates to combine for an AnalysisRun\n+patchMergeKey=templateName\n+patchStrategy=merge" }, "args": { "type": "array", diff --git a/pkg/apis/rollouts/v1alpha1/generated.proto b/pkg/apis/rollouts/v1alpha1/generated.proto index 639bee70ed..ab5c65258e 100644 --- a/pkg/apis/rollouts/v1alpha1/generated.proto +++ b/pkg/apis/rollouts/v1alpha1/generated.proto @@ -1159,6 +1159,8 @@ message Rollout { // RolloutAnalysis defines a template that is used to create a analysisRun message RolloutAnalysis { // Templates reference to a list of analysis templates to combine for an AnalysisRun + // +patchMergeKey=templateName + // +patchStrategy=merge repeated RolloutAnalysisTemplate templates = 1; // Args the arguments that will be added to the AnalysisRuns diff --git a/pkg/apis/rollouts/v1alpha1/openapi_generated.go b/pkg/apis/rollouts/v1alpha1/openapi_generated.go index f4bf7ead1d..79251e03a0 100644 --- a/pkg/apis/rollouts/v1alpha1/openapi_generated.go +++ b/pkg/apis/rollouts/v1alpha1/openapi_generated.go @@ -3524,6 +3524,12 @@ func schema_pkg_apis_rollouts_v1alpha1_RolloutAnalysis(ref common.ReferenceCallb Type: []string{"object"}, Properties: map[string]spec.Schema{ "templates": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "templateName", + "x-kubernetes-patch-strategy": "merge", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Templates reference to a list of analysis templates to combine for an AnalysisRun", Type: []string{"array"}, @@ -3620,6 +3626,12 @@ func schema_pkg_apis_rollouts_v1alpha1_RolloutAnalysisBackground(ref common.Refe Type: []string{"object"}, Properties: map[string]spec.Schema{ "templates": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "templateName", + "x-kubernetes-patch-strategy": "merge", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Templates reference to a list of analysis templates to combine for an AnalysisRun", Type: []string{"array"}, diff --git a/pkg/apis/rollouts/v1alpha1/types.go b/pkg/apis/rollouts/v1alpha1/types.go index bf9209b994..6f93585fd9 100755 --- a/pkg/apis/rollouts/v1alpha1/types.go +++ b/pkg/apis/rollouts/v1alpha1/types.go @@ -695,8 +695,10 @@ type RolloutAnalysisBackground struct { // RolloutAnalysis defines a template that is used to create a analysisRun type RolloutAnalysis struct { - //Templates reference to a list of analysis templates to combine for an AnalysisRun - Templates []RolloutAnalysisTemplate `json:"templates,omitempty" protobuf:"bytes,1,rep,name=templates"` + // Templates reference to a list of analysis templates to combine for an AnalysisRun + // +patchMergeKey=templateName + // +patchStrategy=merge + Templates []RolloutAnalysisTemplate `json:"templates,omitempty" patchStrategy:"merge" patchMergeKey:"templateName" protobuf:"bytes,1,rep,name=templates"` // Args the arguments that will be added to the AnalysisRuns // +patchMergeKey=name // +patchStrategy=merge