From caa0b7f2eae95e6e372dbc147fed44d15f2818df Mon Sep 17 00:00:00 2001 From: Periklis Tsirakidis Date: Thu, 16 Dec 2021 15:57:15 +0100 Subject: [PATCH] Add missing index-gateway to pod status map --- operator/api/v1beta1/lokistack_types.go | 11 +++++++++-- operator/api/v1beta1/zz_generated.deepcopy.go | 15 +++++++++++++++ .../loki-operator.clusterserviceversion.yaml | 10 ++++++++-- .../manifests/loki.openshift.io_lokistacks.yaml | 12 ++++++++++-- .../crd/bases/loki.openshift.io_lokistacks.yaml | 11 +++++++++-- .../loki-operator.clusterserviceversion.yaml | 10 ++++++++-- .../external/k8s/k8sfakes/fake_builder.go | 2 +- operator/internal/status/components.go | 7 ++++++- 8 files changed, 66 insertions(+), 12 deletions(-) diff --git a/operator/api/v1beta1/lokistack_types.go b/operator/api/v1beta1/lokistack_types.go index a6a7903843..681017ec03 100644 --- a/operator/api/v1beta1/lokistack_types.go +++ b/operator/api/v1beta1/lokistack_types.go @@ -579,6 +579,13 @@ type LokiStackComponentStatus struct { // +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:com.tectonic.ui:podStatuses",displayName="Distributor",order=1 Distributor PodStatusMap `json:"distributor,omitempty"` + // IndexGateway is a map to the per pod status of the index gateway statefulset + // + // +optional + // +kubebuilder:validation:Optional + // +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:com.tectonic.ui:podStatuses",displayName="IndexGateway",order=6 + IndexGateway PodStatusMap `json:"indexGateway,omitempty"` + // Ingester is a map to the per pod status of the ingester statefulset // // +optional @@ -586,14 +593,14 @@ type LokiStackComponentStatus struct { // +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:com.tectonic.ui:podStatuses",displayName="Ingester",order=2 Ingester PodStatusMap `json:"ingester,omitempty"` - // Querier is a map to the per pod status of the querier statefulset + // Querier is a map to the per pod status of the querier deployment // // +optional // +kubebuilder:validation:Optional // +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:com.tectonic.ui:podStatuses",displayName="Querier",order=3 Querier PodStatusMap `json:"querier,omitempty"` - // QueryFrontend is a map to the per pod status of the query frontend deployment. + // QueryFrontend is a map to the per pod status of the query frontend deployment // // +optional // +kubebuilder:validation:Optional diff --git a/operator/api/v1beta1/zz_generated.deepcopy.go b/operator/api/v1beta1/zz_generated.deepcopy.go index b568023199..81108bddc7 100644 --- a/operator/api/v1beta1/zz_generated.deepcopy.go +++ b/operator/api/v1beta1/zz_generated.deepcopy.go @@ -220,6 +220,21 @@ func (in *LokiStackComponentStatus) DeepCopyInto(out *LokiStackComponentStatus) (*out)[key] = outVal } } + if in.IndexGateway != nil { + in, out := &in.IndexGateway, &out.IndexGateway + *out = make(PodStatusMap, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } if in.Ingester != nil { in, out := &in.Ingester, &out.Ingester *out = make(PodStatusMap, len(*in)) diff --git a/operator/bundle/manifests/loki-operator.clusterserviceversion.yaml b/operator/bundle/manifests/loki-operator.clusterserviceversion.yaml index c3c2104e51..5be1a4a466 100644 --- a/operator/bundle/manifests/loki-operator.clusterserviceversion.yaml +++ b/operator/bundle/manifests/loki-operator.clusterserviceversion.yaml @@ -382,13 +382,13 @@ spec: path: components.ingester x-descriptors: - urn:alm:descriptor:com.tectonic.ui:podStatuses - - description: Querier is a map to the per pod status of the querier statefulset + - description: Querier is a map to the per pod status of the querier deployment displayName: Querier path: components.querier x-descriptors: - urn:alm:descriptor:com.tectonic.ui:podStatuses - description: QueryFrontend is a map to the per pod status of the query frontend - deployment. + deployment displayName: Query Frontend path: components.queryFrontend x-descriptors: @@ -404,6 +404,12 @@ spec: path: components.gateway x-descriptors: - urn:alm:descriptor:com.tectonic.ui:podStatuses + - description: IndexGateway is a map to the per pod status of the index gateway + statefulset + displayName: IndexGateway + path: components.indexGateway + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:podStatuses - description: Conditions of the Loki deployment health. displayName: Conditions path: conditions diff --git a/operator/bundle/manifests/loki.openshift.io_lokistacks.yaml b/operator/bundle/manifests/loki.openshift.io_lokistacks.yaml index ac7c29d73f..7a866508a7 100644 --- a/operator/bundle/manifests/loki.openshift.io_lokistacks.yaml +++ b/operator/bundle/manifests/loki.openshift.io_lokistacks.yaml @@ -834,6 +834,14 @@ spec: description: Gateway is a map to the per pod status of the lokistack gateway deployment. type: object + indexGateway: + additionalProperties: + items: + type: string + type: array + description: IndexGateway is a map to the per pod status of the + index gateway statefulset + type: object ingester: additionalProperties: items: @@ -848,7 +856,7 @@ spec: type: string type: array description: Querier is a map to the per pod status of the querier - statefulset + deployment type: object queryFrontend: additionalProperties: @@ -856,7 +864,7 @@ spec: type: string type: array description: QueryFrontend is a map to the per pod status of the - query frontend deployment. + query frontend deployment type: object type: object conditions: diff --git a/operator/config/crd/bases/loki.openshift.io_lokistacks.yaml b/operator/config/crd/bases/loki.openshift.io_lokistacks.yaml index 86d42e1d07..6f531e379d 100644 --- a/operator/config/crd/bases/loki.openshift.io_lokistacks.yaml +++ b/operator/config/crd/bases/loki.openshift.io_lokistacks.yaml @@ -608,6 +608,13 @@ spec: type: array description: Gateway is a map to the per pod status of the lokistack gateway deployment. type: object + indexGateway: + additionalProperties: + items: + type: string + type: array + description: IndexGateway is a map to the per pod status of the index gateway statefulset + type: object ingester: additionalProperties: items: @@ -620,14 +627,14 @@ spec: items: type: string type: array - description: Querier is a map to the per pod status of the querier statefulset + description: Querier is a map to the per pod status of the querier deployment type: object queryFrontend: additionalProperties: items: type: string type: array - description: QueryFrontend is a map to the per pod status of the query frontend deployment. + description: QueryFrontend is a map to the per pod status of the query frontend deployment type: object type: object conditions: diff --git a/operator/config/manifests/bases/loki-operator.clusterserviceversion.yaml b/operator/config/manifests/bases/loki-operator.clusterserviceversion.yaml index 9b31c256a0..da1f6988e5 100644 --- a/operator/config/manifests/bases/loki-operator.clusterserviceversion.yaml +++ b/operator/config/manifests/bases/loki-operator.clusterserviceversion.yaml @@ -361,13 +361,13 @@ spec: path: components.ingester x-descriptors: - urn:alm:descriptor:com.tectonic.ui:podStatuses - - description: Querier is a map to the per pod status of the querier statefulset + - description: Querier is a map to the per pod status of the querier deployment displayName: Querier path: components.querier x-descriptors: - urn:alm:descriptor:com.tectonic.ui:podStatuses - description: QueryFrontend is a map to the per pod status of the query frontend - deployment. + deployment displayName: Query Frontend path: components.queryFrontend x-descriptors: @@ -383,6 +383,12 @@ spec: path: components.gateway x-descriptors: - urn:alm:descriptor:com.tectonic.ui:podStatuses + - description: IndexGateway is a map to the per pod status of the index gateway + statefulset + displayName: IndexGateway + path: components.indexGateway + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:podStatuses - description: Conditions of the Loki deployment health. displayName: Conditions path: conditions diff --git a/operator/internal/external/k8s/k8sfakes/fake_builder.go b/operator/internal/external/k8s/k8sfakes/fake_builder.go index 19b6b751ae..b0702d2e54 100644 --- a/operator/internal/external/k8s/k8sfakes/fake_builder.go +++ b/operator/internal/external/k8s/k8sfakes/fake_builder.go @@ -4,8 +4,8 @@ package k8sfakes import ( "sync" - "github.com/grafana/loki-operator/internal/external/k8s" "github.com/go-logr/logr" + "github.com/grafana/loki-operator/internal/external/k8s" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" diff --git a/operator/internal/status/components.go b/operator/internal/status/components.go index 901cedf310..5fc69e8567 100644 --- a/operator/internal/status/components.go +++ b/operator/internal/status/components.go @@ -46,11 +46,16 @@ func SetComponentsStatus(ctx context.Context, k k8s.Client, req ctrl.Request) er return kverrors.Wrap(err, "failed lookup LokiStack component pods status", "name", manifests.LabelQueryFrontendComponent) } - s.Status.Components.Ingester, err = appendPodStatus(ctx, k, manifests.LabelIngesterComponent, s.Name, s.Namespace) + s.Status.Components.IndexGateway, err = appendPodStatus(ctx, k, manifests.LabelIndexGatewayComponent, s.Name, s.Namespace) if err != nil { return kverrors.Wrap(err, "failed lookup LokiStack component pods status", "name", manifests.LabelIngesterComponent) } + s.Status.Components.Ingester, err = appendPodStatus(ctx, k, manifests.LabelIngesterComponent, s.Name, s.Namespace) + if err != nil { + return kverrors.Wrap(err, "failed lookup LokiStack component pods status", "name", manifests.LabelIndexGatewayComponent) + } + s.Status.Components.Gateway, err = appendPodStatus(ctx, k, manifests.LabelGatewayComponent, s.Name, s.Namespace) if err != nil { return kverrors.Wrap(err, "failed lookup LokiStack component pods status", "name", manifests.LabelGatewayComponent)