From a3c8b27cb1267c567264375d729b83df3edc6425 Mon Sep 17 00:00:00 2001 From: odubajDT Date: Mon, 26 Sep 2022 08:50:21 +0200 Subject: [PATCH] renaming owner Signed-off-by: odubajDT --- operator/api/v1alpha1/service_types.go | 10 +++--- operator/api/v1alpha1/servicerun_types.go | 8 ++--- .../api/v1alpha1/zz_generated.deepcopy.go | 11 ++++--- .../lifecycle.keptn.sh_applications.yaml | 32 +++++++++---------- .../bases/lifecycle.keptn.sh_serviceruns.yaml | 15 +++++++++ .../bases/lifecycle.keptn.sh_services.yaml | 30 ++++++++--------- operator/controllers/service_controller.go | 2 +- operator/webhooks/pod_mutating_webhook.go | 2 +- 8 files changed, 63 insertions(+), 47 deletions(-) diff --git a/operator/api/v1alpha1/service_types.go b/operator/api/v1alpha1/service_types.go index d7f01cec7da..7c4662f0363 100644 --- a/operator/api/v1alpha1/service_types.go +++ b/operator/api/v1alpha1/service_types.go @@ -23,7 +23,7 @@ import ( "k8s.io/apimachinery/pkg/types" ) -type Owner struct { +type ResourceReference struct { UID types.UID `json:"uid"` Kind string `json:"kind"` } @@ -33,10 +33,10 @@ type Owner struct { // ServiceSpec defines the desired state of Service type ServiceSpec struct { - ApplicationName string `json:"application"` - Version string `json:"version"` - PreDeploymentCheck EventSpec `json:"preDeploymentCheck"` - Owner Owner `json:"owner"` + ApplicationName string `json:"application"` + Version string `json:"version"` + PreDeploymentCheck EventSpec `json:"preDeploymentCheck"` + ResourceReference ResourceReference `json:"resourceReference"` } // ServiceStatus defines the observed state of Service diff --git a/operator/api/v1alpha1/servicerun_types.go b/operator/api/v1alpha1/servicerun_types.go index 07fd2bd3153..061db7959c6 100644 --- a/operator/api/v1alpha1/servicerun_types.go +++ b/operator/api/v1alpha1/servicerun_types.go @@ -25,10 +25,10 @@ import ( // ServiceRunSpec defines the desired state of ServiceRun type ServiceRunSpec struct { - PreDeploymentCheck EventSpec `json:"preDeploymentCheck"` - ApplicationName string `json:"application"` - Version string `json:"version"` - Owner Owner `json:"owner"` + PreDeploymentCheck EventSpec `json:"preDeploymentCheck"` + ApplicationName string `json:"application"` + Version string `json:"version"` + ResourceReference ResourceReference `json:"resourceReference"` } type ServiceRunPhase string diff --git a/operator/api/v1alpha1/zz_generated.deepcopy.go b/operator/api/v1alpha1/zz_generated.deepcopy.go index 5ce0787a7ee..dd3ca3ad2e0 100644 --- a/operator/api/v1alpha1/zz_generated.deepcopy.go +++ b/operator/api/v1alpha1/zz_generated.deepcopy.go @@ -222,16 +222,16 @@ func (in *EventStatus) DeepCopy() *EventStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Owner) DeepCopyInto(out *Owner) { +func (in *ResourceReference) DeepCopyInto(out *ResourceReference) { *out = *in } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Owner. -func (in *Owner) DeepCopy() *Owner { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceReference. +func (in *ResourceReference) DeepCopy() *ResourceReference { if in == nil { return nil } - out := new(Owner) + out := new(ResourceReference) in.DeepCopyInto(out) return out } @@ -358,6 +358,7 @@ func (in *ServiceRunList) DeepCopyObject() runtime.Object { func (in *ServiceRunSpec) DeepCopyInto(out *ServiceRunSpec) { *out = *in in.PreDeploymentCheck.DeepCopyInto(&out.PreDeploymentCheck) + out.ResourceReference = in.ResourceReference } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceRunSpec. @@ -389,7 +390,7 @@ func (in *ServiceRunStatus) DeepCopy() *ServiceRunStatus { func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) { *out = *in in.PreDeploymentCheck.DeepCopyInto(&out.PreDeploymentCheck) - out.Owner = in.Owner + out.ResourceReference = in.ResourceReference } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceSpec. diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_applications.yaml b/operator/config/crd/bases/lifecycle.keptn.sh_applications.yaml index 2a1391d0383..fe2521daf0e 100644 --- a/operator/config/crd/bases/lifecycle.keptn.sh_applications.yaml +++ b/operator/config/crd/bases/lifecycle.keptn.sh_applications.yaml @@ -66,21 +66,6 @@ spec: properties: application: type: string - owner: - properties: - kind: - type: string - uid: - description: UID is a type that holds unique ID values, - including UUIDs. Because we don't ONLY use UUIDs, - this is an alias to string. Being a type captures - intent and helps make sure that UIDs and names do - not get conflated. - type: string - required: - - kind - - uid - type: object preDeploymentCheck: description: EventSpec defines the desired state of Event properties: @@ -9706,12 +9691,27 @@ spec: service: type: string type: object + resourceReference: + properties: + kind: + type: string + uid: + description: UID is a type that holds unique ID values, + including UUIDs. Because we don't ONLY use UUIDs, + this is an alias to string. Being a type captures + intent and helps make sure that UIDs and names do + not get conflated. + type: string + required: + - kind + - uid + type: object version: type: string required: - application - - owner - preDeploymentCheck + - resourceReference - version type: object status: diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_serviceruns.yaml b/operator/config/crd/bases/lifecycle.keptn.sh_serviceruns.yaml index d63aa0c8021..a84d2e962c5 100644 --- a/operator/config/crd/bases/lifecycle.keptn.sh_serviceruns.yaml +++ b/operator/config/crd/bases/lifecycle.keptn.sh_serviceruns.yaml @@ -8114,11 +8114,26 @@ spec: service: type: string type: object + resourceReference: + properties: + kind: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - uid + type: object version: type: string required: - application - preDeploymentCheck + - resourceReference - version type: object status: diff --git a/operator/config/crd/bases/lifecycle.keptn.sh_services.yaml b/operator/config/crd/bases/lifecycle.keptn.sh_services.yaml index 32ae5fc4484..c73a21787ed 100644 --- a/operator/config/crd/bases/lifecycle.keptn.sh_services.yaml +++ b/operator/config/crd/bases/lifecycle.keptn.sh_services.yaml @@ -37,20 +37,6 @@ spec: properties: application: type: string - owner: - properties: - kind: - type: string - uid: - description: UID is a type that holds unique ID values, including - UUIDs. Because we don't ONLY use UUIDs, this is an alias to - string. Being a type captures intent and helps make sure that - UIDs and names do not get conflated. - type: string - required: - - kind - - uid - type: object preDeploymentCheck: description: EventSpec defines the desired state of Event properties: @@ -8128,12 +8114,26 @@ spec: service: type: string type: object + resourceReference: + properties: + kind: + type: string + uid: + description: UID is a type that holds unique ID values, including + UUIDs. Because we don't ONLY use UUIDs, this is an alias to + string. Being a type captures intent and helps make sure that + UIDs and names do not get conflated. + type: string + required: + - kind + - uid + type: object version: type: string required: - application - - owner - preDeploymentCheck + - resourceReference - version type: object status: diff --git a/operator/controllers/service_controller.go b/operator/controllers/service_controller.go index 5b130da2ef1..76addf92a9c 100644 --- a/operator/controllers/service_controller.go +++ b/operator/controllers/service_controller.go @@ -126,7 +126,7 @@ func (r *ServiceReconciler) createServiceRun(ctx context.Context, service *v1alp ApplicationName: service.Spec.ApplicationName, Version: service.Spec.Version, PreDeploymentCheck: service.Spec.PreDeploymentCheck, - Owner: service.Spec.Owner, + ResourceReference: service.Spec.ResourceReference, }, } return serviceRun, r.Create(ctx, serviceRun) diff --git a/operator/webhooks/pod_mutating_webhook.go b/operator/webhooks/pod_mutating_webhook.go index e50e0a479a4..f69d68c09a9 100644 --- a/operator/webhooks/pod_mutating_webhook.go +++ b/operator/webhooks/pod_mutating_webhook.go @@ -175,7 +175,7 @@ func (r *PodMutatingWebhook) generateService(ctx context.Context, pod *corev1.Po Spec: v1alpha1.ServiceSpec{ ApplicationName: applicationName, Version: version, - Owner: v1alpha1.Owner{ + ResourceReference: v1alpha1.ResourceReference{ UID: ownerUID, Kind: ownerKind, },