From 12eba65e8f486839b45a32e7066884ee1f20842a Mon Sep 17 00:00:00 2001 From: kvalliyurnatt <135071014+kvalliyurnatt@users.noreply.github.com> Date: Fri, 26 Jan 2024 09:30:35 -0800 Subject: [PATCH] Add resourceStatuses back into stack config policy status for backwards compatability (#7500) (#7506) (cherry picked from commit 76c6265ebef1024824880e03891630f5e1d06b54) --- config/crds/v1/all-crds.yaml | 34 +++++++++++++++++-- ...cy.k8s.elastic.co_stackconfigpolicies.yaml | 34 +++++++++++++++++-- .../eck-operator-crds/templates/all-crds.yaml | 34 +++++++++++++++++-- .../v1alpha1/stackconfigpolicy_types.go | 5 ++- .../v1alpha1/zz_generated.deepcopy.go | 7 ++++ 5 files changed, 107 insertions(+), 7 deletions(-) diff --git a/config/crds/v1/all-crds.yaml b/config/crds/v1/all-crds.yaml index 629c754710..61d688bc66 100644 --- a/config/crds/v1/all-crds.yaml +++ b/config/crds/v1/all-crds.yaml @@ -10769,8 +10769,38 @@ spec: resources: description: Resources is the number of resources to be configured. type: integer - required: - - details + resourcesStatuses: + additionalProperties: + description: ResourcePolicyStatus models the status of the policy + for one resource to be configured. + properties: + currentVersion: + description: CurrentVersion denotes the current version of filesettings + applied to the Elasticsearch cluster This field does not apply + to Kibana resources + format: int64 + type: integer + error: + properties: + message: + type: string + version: + format: int64 + type: integer + type: object + expectedVersion: + description: ExpectedVersion denotes the expected version of + filesettings that should be applied to the Elasticsearch cluster + This field does not apply to Kibana resources + format: int64 + type: integer + phase: + type: string + type: object + description: 'ResourcesStatuses holds the status for each resource + to be configured. Deprecated: Details is used to store the status + of resources from ECK 2.11' + type: object type: object type: object served: true diff --git a/config/crds/v1/bases/stackconfigpolicy.k8s.elastic.co_stackconfigpolicies.yaml b/config/crds/v1/bases/stackconfigpolicy.k8s.elastic.co_stackconfigpolicies.yaml index 3579ff9f3d..cec038108a 100644 --- a/config/crds/v1/bases/stackconfigpolicy.k8s.elastic.co_stackconfigpolicies.yaml +++ b/config/crds/v1/bases/stackconfigpolicy.k8s.elastic.co_stackconfigpolicies.yaml @@ -343,8 +343,38 @@ spec: resources: description: Resources is the number of resources to be configured. type: integer - required: - - details + resourcesStatuses: + additionalProperties: + description: ResourcePolicyStatus models the status of the policy + for one resource to be configured. + properties: + currentVersion: + description: CurrentVersion denotes the current version of filesettings + applied to the Elasticsearch cluster This field does not apply + to Kibana resources + format: int64 + type: integer + error: + properties: + message: + type: string + version: + format: int64 + type: integer + type: object + expectedVersion: + description: ExpectedVersion denotes the expected version of + filesettings that should be applied to the Elasticsearch cluster + This field does not apply to Kibana resources + format: int64 + type: integer + phase: + type: string + type: object + description: 'ResourcesStatuses holds the status for each resource + to be configured. Deprecated: Details is used to store the status + of resources from ECK 2.11' + type: object type: object type: object served: true diff --git a/deploy/eck-operator/charts/eck-operator-crds/templates/all-crds.yaml b/deploy/eck-operator/charts/eck-operator-crds/templates/all-crds.yaml index 89548fef48..d4b5809527 100644 --- a/deploy/eck-operator/charts/eck-operator-crds/templates/all-crds.yaml +++ b/deploy/eck-operator/charts/eck-operator-crds/templates/all-crds.yaml @@ -10829,8 +10829,38 @@ spec: resources: description: Resources is the number of resources to be configured. type: integer - required: - - details + resourcesStatuses: + additionalProperties: + description: ResourcePolicyStatus models the status of the policy + for one resource to be configured. + properties: + currentVersion: + description: CurrentVersion denotes the current version of filesettings + applied to the Elasticsearch cluster This field does not apply + to Kibana resources + format: int64 + type: integer + error: + properties: + message: + type: string + version: + format: int64 + type: integer + type: object + expectedVersion: + description: ExpectedVersion denotes the expected version of + filesettings that should be applied to the Elasticsearch cluster + This field does not apply to Kibana resources + format: int64 + type: integer + phase: + type: string + type: object + description: 'ResourcesStatuses holds the status for each resource + to be configured. Deprecated: Details is used to store the status + of resources from ECK 2.11' + type: object type: object type: object served: true diff --git a/pkg/apis/stackconfigpolicy/v1alpha1/stackconfigpolicy_types.go b/pkg/apis/stackconfigpolicy/v1alpha1/stackconfigpolicy_types.go index 6bc6c46b73..c933659fec 100644 --- a/pkg/apis/stackconfigpolicy/v1alpha1/stackconfigpolicy_types.go +++ b/pkg/apis/stackconfigpolicy/v1alpha1/stackconfigpolicy_types.go @@ -120,8 +120,11 @@ type IndexTemplates struct { } type StackConfigPolicyStatus struct { + // ResourcesStatuses holds the status for each resource to be configured. + // Deprecated: Details is used to store the status of resources from ECK 2.11 + ResourcesStatuses map[string]ResourcePolicyStatus `json:"resourcesStatuses,omitempty"` // Details holds the status details for each resource to be configured. - Details map[ResourceType]map[string]ResourcePolicyStatus `json:"details"` + Details map[ResourceType]map[string]ResourcePolicyStatus `json:"details,omitempty"` // Resources is the number of resources to be configured. Resources int `json:"resources,omitempty"` // Ready is the number of resources successfully configured. diff --git a/pkg/apis/stackconfigpolicy/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/stackconfigpolicy/v1alpha1/zz_generated.deepcopy.go index 302bd5cf61..ac4b01d00d 100644 --- a/pkg/apis/stackconfigpolicy/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/stackconfigpolicy/v1alpha1/zz_generated.deepcopy.go @@ -251,6 +251,13 @@ func (in *StackConfigPolicySpec) DeepCopy() *StackConfigPolicySpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StackConfigPolicyStatus) DeepCopyInto(out *StackConfigPolicyStatus) { *out = *in + if in.ResourcesStatuses != nil { + in, out := &in.ResourcesStatuses, &out.ResourcesStatuses + *out = make(map[string]ResourcePolicyStatus, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } if in.Details != nil { in, out := &in.Details, &out.Details *out = make(map[ResourceType]map[string]ResourcePolicyStatus, len(*in))