Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 2039119: assets: let CVO manage the CMO Service resource #1537

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 0 additions & 17 deletions assets/cluster-monitoring-operator/service.yaml

This file was deleted.

22 changes: 1 addition & 21 deletions jsonnet/components/cluster-monitoring-operator.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,6 @@ function(params) {
data: {},
},

service: {
apiVersion: 'v1',
kind: 'Service',
metadata: {
name: cfg.name,
namespace: cfg.namespace,
labels: { 'app.kubernetes.io/name': cfg.name },
annotations: {
'service.beta.openshift.io/serving-cert-secret-name': 'cluster-monitoring-operator-tls',
},
},
spec: {
ports: [
{ name: 'https', targetPort: 'https', port: 8443 },
],
selector: { 'app.kubernetes.io/name': cfg.name },
clusterIP: 'None',
},
},

serviceMonitor: {
apiVersion: 'monitoring.coreos.com/v1',
kind: 'ServiceMonitor',
Expand All @@ -106,7 +86,7 @@ function(params) {
},
spec: {
selector: {
matchLabels: cmo.service.metadata.labels,
matchLabels: { 'app.kubernetes.io/name': cfg.name },
},
endpoints: [
{
Expand Down
12 changes: 0 additions & 12 deletions pkg/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ var (
GrafanaServiceMonitor = "grafana/service-monitor.yaml"
GrafanaTrustedCABundle = "grafana/trusted-ca-bundle.yaml"

ClusterMonitoringOperatorService = "cluster-monitoring-operator/service.yaml"
ClusterMonitoringOperatorServiceMonitor = "cluster-monitoring-operator/service-monitor.yaml"
ClusterMonitoringClusterRoleView = "cluster-monitoring-operator/cluster-role-view.yaml"
ClusterMonitoringAlertmanagerEditRole = "cluster-monitoring-operator/monitoring-alertmanager-edit-role.yaml"
Expand Down Expand Up @@ -2737,17 +2736,6 @@ func (f *Factory) ClusterMonitoringAlertManagerEditRole() (*rbacv1.Role, error)
return cr, nil
}

func (f *Factory) ClusterMonitoringOperatorService() (*v1.Service, error) {
s, err := f.NewService(f.assets.MustNewAssetReader(ClusterMonitoringOperatorService))
if err != nil {
return nil, err
}

s.Namespace = f.namespace

return s, nil
}

func (f *Factory) ClusterMonitoringOperatorServiceMonitor() (*monv1.ServiceMonitor, error) {
sm, err := f.NewServiceMonitor(f.assets.MustNewAssetReader(ClusterMonitoringOperatorServiceMonitor))
if err != nil {
Expand Down
5 changes: 0 additions & 5 deletions pkg/manifests/manifests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,6 @@ func TestUnconfiguredManifests(t *testing.T) {
t.Fatal(err)
}

_, err = f.ClusterMonitoringOperatorService()
if err != nil {
t.Fatal(err)
}

_, err = f.ClusterMonitoringOperatorServiceMonitor()
if err != nil {
t.Fatal(err)
Expand Down
11 changes: 1 addition & 10 deletions pkg/tasks/clustermonitoringoperator.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package tasks

import (
"context"

"github.com/openshift/cluster-monitoring-operator/pkg/client"
"github.com/openshift/cluster-monitoring-operator/pkg/manifests"
"github.com/pkg/errors"
Expand Down Expand Up @@ -43,16 +44,6 @@ func NewClusterMonitoringOperatorTask(
}

func (t *ClusterMonitoringOperatorTask) Run(ctx context.Context) error {
svc, err := t.factory.ClusterMonitoringOperatorService()
if err != nil {
return errors.Wrap(err, "initializing Cluster Monitoring Operator Service failed")
}

err = t.client.CreateOrUpdateService(ctx, svc)
if err != nil {
return errors.Wrap(err, "reconciling Cluster Monitoring Operator Service failed")
}

for name, crf := range map[string]func() (*rbacv1.ClusterRole, error){
"cluster-monitoring-view": t.factory.ClusterMonitoringClusterRoleView,
"monitoring-rules-edit": t.factory.ClusterMonitoringRulesEditClusterRole,
Expand Down