From 81988e6d2c266458ce56282c63eeaa71c8d7ef7f Mon Sep 17 00:00:00 2001 From: Peter Braun Date: Tue, 5 Feb 2019 09:53:30 +0100 Subject: [PATCH 1/2] rename namespace selector --- deploy/crds/Grafana.yaml | 2 +- deploy/examples/Grafana.yaml | 2 +- pkg/apis/integreatly/v1alpha1/grafana_types.go | 2 +- pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go | 4 ++-- pkg/controller/grafana/grafana_controller.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deploy/crds/Grafana.yaml b/deploy/crds/Grafana.yaml index 6075d56af..529876cd1 100644 --- a/deploy/crds/Grafana.yaml +++ b/deploy/crds/Grafana.yaml @@ -16,7 +16,7 @@ spec: properties: spec: properties: - monitoringNamespaceSelector: + dashboardNamespaceSelector: description: A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches diff --git a/deploy/examples/Grafana.yaml b/deploy/examples/Grafana.yaml index c298337e0..8baac8422 100644 --- a/deploy/examples/Grafana.yaml +++ b/deploy/examples/Grafana.yaml @@ -4,6 +4,6 @@ metadata: name: example-grafana spec: prometheusUrl: "http://prometheus-application-monitoring:9090" - monitoringNamespaceSelector: + dashboardNamespaceSelector: matchLabels: monitoring-key: middleware diff --git a/pkg/apis/integreatly/v1alpha1/grafana_types.go b/pkg/apis/integreatly/v1alpha1/grafana_types.go index 77a8258a8..2ee3c2bb6 100644 --- a/pkg/apis/integreatly/v1alpha1/grafana_types.go +++ b/pkg/apis/integreatly/v1alpha1/grafana_types.go @@ -12,7 +12,7 @@ type GrafanaSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file PrometheusUrl string `json:"prometheusUrl"` - MonitoringNamespaceSelector *metav1.LabelSelector `json:"monitoringNamespaceSelector,omitempty"` + DashboardNamespaceSelector *metav1.LabelSelector `json:"dashboardNamespaceSelector,omitempty"` } // GrafanaStatus defines the observed state of Grafana diff --git a/pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go index 036caed52..51cd3f3ce 100644 --- a/pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go @@ -182,8 +182,8 @@ func (in *GrafanaList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GrafanaSpec) DeepCopyInto(out *GrafanaSpec) { *out = *in - if in.MonitoringNamespaceSelector != nil { - in, out := &in.MonitoringNamespaceSelector, &out.MonitoringNamespaceSelector + if in.DashboardNamespaceSelector != nil { + in, out := &in.DashboardNamespaceSelector, &out.DashboardNamespaceSelector *out = new(v1.LabelSelector) (*in).DeepCopyInto(*out) } diff --git a/pkg/controller/grafana/grafana_controller.go b/pkg/controller/grafana/grafana_controller.go index 3a862ab8d..06cb04302 100644 --- a/pkg/controller/grafana/grafana_controller.go +++ b/pkg/controller/grafana/grafana_controller.go @@ -127,7 +127,7 @@ func (r *ReconcileGrafana) Reconcile(request reconcile.Request) (reconcile.Resul } func (r *ReconcileGrafana) ReconcileNamespaces(cr *integreatly.Grafana) (reconcile.Result, error) { - namespaces, err := r.helper.getMonitoringNamespaces(cr.Spec.MonitoringNamespaceSelector) + namespaces, err := r.helper.getMonitoringNamespaces(cr.Spec.DashboardNamespaceSelector) if err != nil { log.Error(err, "Error listing namespaces") return reconcile.Result{}, err From ee92a2d8be715a8779c44c3175ca74565f6ec445 Mon Sep 17 00:00:00 2001 From: Peter Braun Date: Tue, 5 Feb 2019 09:58:20 +0100 Subject: [PATCH 2/2] linter fixes --- pkg/apis/integreatly/v1alpha1/grafana_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/apis/integreatly/v1alpha1/grafana_types.go b/pkg/apis/integreatly/v1alpha1/grafana_types.go index 2ee3c2bb6..09c2b6255 100644 --- a/pkg/apis/integreatly/v1alpha1/grafana_types.go +++ b/pkg/apis/integreatly/v1alpha1/grafana_types.go @@ -11,7 +11,7 @@ import ( type GrafanaSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file - PrometheusUrl string `json:"prometheusUrl"` + PrometheusUrl string `json:"prometheusUrl"` DashboardNamespaceSelector *metav1.LabelSelector `json:"dashboardNamespaceSelector,omitempty"` }