Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions hack/cluster-monitoring-operator-role.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ rules:
- apiGroups: ["config.openshift.io"]
resources: ["clusterversions"]
verbs: ["get"]
- apiGroups: ["config.openshift.io"]
resources: ["infrastructures"]
verbs: ["get"]
- apiGroups: ["config.openshift.io"]
resources: ["proxies"]
verbs: ["get"]
Expand Down
32 changes: 15 additions & 17 deletions jsonnet/jsonnetfile.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 1,
"dependencies": [
{
"name": "kube-prometheus",
"source": {
"git": {
"remote": "https://github.com/coreos/kube-prometheus",
Expand All @@ -11,17 +11,15 @@
"version": "release-0.3"
},
{
"name": "kube-thanos",
"source": {
"git": {
"remote": "https://github.com/thanos-io/kube-thanos",
"subdir": "jsonnet/kube-thanos"
"remote": "https://github.com/coreos/prometheus-operator",
"subdir": "jsonnet/prometheus-operator"
}
},
"version": "release-0.1"
"version": "release-0.34"
},
{
"name": "kubernetes-mixin",
"source": {
"git": {
"remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin",
Expand All @@ -31,34 +29,34 @@
"version": "release-0.2"
},
{
"name": "openshift-state-metrics",
"source": {
"git": {
"remote": "https://github.com/openshift/openshift-state-metrics",
"subdir": "jsonnet"
}
},
"version": "release-4.3"
"version": "release-4.3",
"name": "openshift-state-metrics"
},
{
"name": "prometheus-operator",
"source": {
"git": {
"remote": "https://github.com/coreos/prometheus-operator",
"subdir": "jsonnet/prometheus-operator"
"remote": "https://github.com/openshift/telemeter",
"subdir": "jsonnet/telemeter"
}
},
"version": "release-0.34"
"version": "release-4.3",
"name": "telemeter-client"
},
{
"name": "telemeter-client",
"source": {
"git": {
"remote": "https://github.com/openshift/telemeter",
"subdir": "jsonnet/telemeter"
"remote": "https://github.com/thanos-io/kube-thanos",
"subdir": "jsonnet/kube-thanos"
}
},
"version": "release-4.3"
"version": "release-0.1"
}
]
],
"legacyImports": true
}
116 changes: 54 additions & 62 deletions jsonnet/jsonnetfile.lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{
"version": 1,
"dependencies": [
{
"name": "etcd-mixin",
"source": {
"git": {
"remote": "https://github.com/brancz/kubernetes-grafana",
"subdir": "grafana"
}
},
"version": "539a90dbf63c812ad0194d8078dd776868a11c81",
"sum": "b8faWX1qqLGyN67sA36oRqYZ5HX+tHBRMPtrWRqIysE="
},
{
"source": {
"git": {
"remote": "https://github.com/coreos/etcd",
Expand All @@ -12,29 +22,26 @@
"sum": "Ko3qhNfC2vN/houLh6C0Ryacjv70gl0DVPGU/PQ4OD0="
},
{
"name": "grafana",
"source": {
"git": {
"remote": "https://github.com/brancz/kubernetes-grafana",
"subdir": "grafana"
"remote": "https://github.com/coreos/kube-prometheus",
"subdir": "jsonnet/kube-prometheus"
}
},
"version": "539a90dbf63c812ad0194d8078dd776868a11c81",
"sum": "b8faWX1qqLGyN67sA36oRqYZ5HX+tHBRMPtrWRqIysE="
"version": "ed71719c8e3573db358c3c6e76c3c65ca1fad719",
"sum": "qaE0WINXp2AT83A7Qi+3sy6mhHy3QEK6Ae02a0ejsEU="
},
{
"name": "grafana-builder",
"source": {
"git": {
"remote": "https://github.com/grafana/jsonnet-libs",
"subdir": "grafana-builder"
"remote": "https://github.com/coreos/prometheus-operator",
"subdir": "jsonnet/prometheus-operator"
}
},
"version": "7ac7da1a0fe165b68cdb718b2521b560d51bd1f4",
"sum": "slxrtftVDiTlQK22ertdfrg4Epnq97gdrLI63ftUfaE="
"version": "1aa773ddbbbd9b05405e9785e0190b975b1faadc",
"sum": "PlruMWn3QMjgLQVzn0DqlD1G8ijkew9icNNW4cpwRVA="
},
{
"name": "grafonnet",
"source": {
"git": {
"remote": "https://github.com/grafana/grafonnet-lib",
Expand All @@ -45,40 +52,27 @@
"sum": "CeM3LRgUCUJTolTdMnerfMPGYmhClx7gX5ajrQVEY2Y="
},
{
"name": "ksonnet",
"source": {
"git": {
"remote": "https://github.com/ksonnet/ksonnet-lib",
"subdir": ""
}
},
"version": "0d2f82676817bbf9e4acf6495b2090205f323b9f",
"sum": "h28BXZ7+vczxYJ2sCt8JuR9+yznRtU/iA6DCpQUrtEg="
},
{
"name": "kube-prometheus",
"source": {
"git": {
"remote": "https://github.com/coreos/kube-prometheus",
"subdir": "jsonnet/kube-prometheus"
"remote": "https://github.com/grafana/jsonnet-libs",
"subdir": "grafana-builder"
}
},
"version": "ed71719c8e3573db358c3c6e76c3c65ca1fad719",
"sum": "qaE0WINXp2AT83A7Qi+3sy6mhHy3QEK6Ae02a0ejsEU="
"version": "7ac7da1a0fe165b68cdb718b2521b560d51bd1f4",
"sum": "slxrtftVDiTlQK22ertdfrg4Epnq97gdrLI63ftUfaE="
},
{
"name": "kube-thanos",
"source": {
"git": {
"remote": "https://github.com/thanos-io/kube-thanos",
"subdir": "jsonnet/kube-thanos"
"remote": "https://github.com/ksonnet/ksonnet-lib",
"subdir": ""
}
},
"version": "05d490681404e9dae6e42284b6a2776493a9355c",
"sum": "rTPcq23U6UNXoN2Fpxt5JzIYTnylMuG794lr9Pt4xEc="
"version": "0d2f82676817bbf9e4acf6495b2090205f323b9f",
"sum": "h28BXZ7+vczxYJ2sCt8JuR9+yznRtU/iA6DCpQUrtEg=",
"name": "ksonnet"
},
{
"name": "kubernetes-mixin",
"source": {
"git": {
"remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin",
Expand All @@ -89,70 +83,68 @@
"sum": "aD1RSVL8mCfpiZc+koGJFz4/u/IPUV7hJlIXKCCDyiI="
},
{
"name": "node-mixin",
"source": {
"git": {
"remote": "https://github.com/prometheus/node_exporter",
"subdir": "docs/node-mixin"
"remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin",
"subdir": "lib/promgrafonnet"
}
},
"version": "eac3e30f7f7f564c2bd110c7bb97390711e45e32",
"sum": "7vEamDTP9AApeiF4Zu9ZyXzDIs3rYHzwf9k7g8X+wsg="
"version": "92309e9c7a7637c38a12c0964e62a7aeccaf49ae",
"sum": "VhgBM39yv0f4bKv8VfGg4FXkg573evGDRalip9ypKbc="
},
{
"name": "openshift-state-metrics",
"source": {
"git": {
"remote": "https://github.com/openshift/openshift-state-metrics",
"subdir": "jsonnet"
}
},
"version": "c01d2de651071389d2621c46e934fd9cb2bf4b8d",
"sum": "CHoXXlCYfTLaqKSaydhDr8+wn5KEceZD0aJuvh2BgQQ="
"sum": "CHoXXlCYfTLaqKSaydhDr8+wn5KEceZD0aJuvh2BgQQ=",
"name": "openshift-state-metrics"
},
{
"name": "prometheus",
"source": {
"git": {
"remote": "https://github.com/prometheus/prometheus",
"subdir": "documentation/prometheus-mixin"
"remote": "https://github.com/openshift/telemeter",
"subdir": "jsonnet/telemeter"
}
},
"version": "a3369086782879d7ed8393168cb580b8e4682bc1",
"sum": "u1YS9CVuBTcw2vks0PZbLb1gtlI/7bVGDVBZsjWFLTw="
"version": "227ae59d226d17eee26a60621bc884f4e8e83254",
"sum": "9avi9p5cB8ESzgjhw13WkCDxrablWodHUUTAasHJ8WA=",
"name": "telemeter-client"
},
{
"name": "prometheus-operator",
"source": {
"git": {
"remote": "https://github.com/coreos/prometheus-operator",
"subdir": "jsonnet/prometheus-operator"
"remote": "https://github.com/prometheus/node_exporter",
"subdir": "docs/node-mixin"
}
},
"version": "1aa773ddbbbd9b05405e9785e0190b975b1faadc",
"sum": "PlruMWn3QMjgLQVzn0DqlD1G8ijkew9icNNW4cpwRVA="
"version": "eac3e30f7f7f564c2bd110c7bb97390711e45e32",
"sum": "7vEamDTP9AApeiF4Zu9ZyXzDIs3rYHzwf9k7g8X+wsg="
},
{
"name": "promgrafonnet",
"source": {
"git": {
"remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin",
"subdir": "lib/promgrafonnet"
"remote": "https://github.com/prometheus/prometheus",
"subdir": "documentation/prometheus-mixin"
}
},
"version": "92309e9c7a7637c38a12c0964e62a7aeccaf49ae",
"sum": "VhgBM39yv0f4bKv8VfGg4FXkg573evGDRalip9ypKbc="
"version": "a3369086782879d7ed8393168cb580b8e4682bc1",
"sum": "u1YS9CVuBTcw2vks0PZbLb1gtlI/7bVGDVBZsjWFLTw=",
"name": "prometheus"
},
{
"name": "telemeter-client",
"source": {
"git": {
"remote": "https://github.com/openshift/telemeter",
"subdir": "jsonnet/telemeter"
"remote": "https://github.com/thanos-io/kube-thanos",
"subdir": "jsonnet/kube-thanos"
}
},
"version": "227ae59d226d17eee26a60621bc884f4e8e83254",
"sum": "9avi9p5cB8ESzgjhw13WkCDxrablWodHUUTAasHJ8WA="
"version": "05d490681404e9dae6e42284b6a2776493a9355c",
"sum": "rTPcq23U6UNXoN2Fpxt5JzIYTnylMuG794lr9Pt4xEc="
}
]
],
"legacyImports": false
}
6 changes: 6 additions & 0 deletions manifests/0000_50_cluster_monitoring_operator_02-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ rules:
- clusterversions
verbs:
- get
- apiGroups:
- config.openshift.io
resources:
- infrastructures
verbs:
- get
- apiGroups:
- config.openshift.io
resources:
Expand Down
4 changes: 4 additions & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ func (c *Client) GetProxy(name string) (*configv1.Proxy, error) {
return c.oscclient.ConfigV1().Proxies().Get(name, metav1.GetOptions{})
}

func (c *Client) GetInfrastructure(name string) (*configv1.Infrastructure, error) {
return c.oscclient.ConfigV1().Infrastructures().Get(name, metav1.GetOptions{})
}

func (c *Client) GetConfigmap(namespace, name string) (*v1.ConfigMap, error) {
return c.kclient.CoreV1().ConfigMaps(namespace).Get(name, metav1.GetOptions{})
}
Expand Down
12 changes: 11 additions & 1 deletion pkg/manifests/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import (
)

type Config struct {
Images *Images `json:"-"`
Images *Images `json:"-"`
Platform configv1.PlatformType `json:"-"`

PrometheusOperatorConfig *PrometheusOperatorConfig `json:"prometheusOperator"`
PrometheusOperatorUserWorkloadConfig *PrometheusOperatorConfig `json:"prometheusOperatorUserWorkload"`
Expand Down Expand Up @@ -308,6 +309,15 @@ func (c *Config) LoadProxy(load func() (*configv1.Proxy, error)) error {
return nil
}

func (c *Config) LoadPlatform(load func() (*configv1.Infrastructure, error)) error {
i, err := load()
if err != nil {
return fmt.Errorf("error loading platform: %v", err)
}
c.Platform = i.Status.Platform
return nil
}

func NewConfigFromString(content string) (*Config, error) {
if content == "" {
return NewDefaultConfig(), nil
Expand Down
20 changes: 20 additions & 0 deletions pkg/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"strings"

monv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
configv1 "github.com/openshift/api/config/v1"
routev1 "github.com/openshift/api/route/v1"
securityv1 "github.com/openshift/api/security/v1"
"github.com/pkg/errors"
Expand Down Expand Up @@ -196,6 +197,10 @@ var (
AuthProxyRedirectURLFlag = "-redirect-url="
)

const (
IBMCloudPlatformType configv1.PlatformType = "IBMCloud"
)

func MustAssetReader(asset string) io.Reader {
return bytes.NewReader(MustAsset(asset))
}
Expand Down Expand Up @@ -776,6 +781,21 @@ func (f *Factory) PrometheusK8sRules() (*monv1.PrometheusRule, error) {
r.Spec.Groups = groups
}

if f.config.Platform == IBMCloudPlatformType {
groups := []monv1.RuleGroup{}
for _, g := range r.Spec.Groups {
switch g.Name {
case "kubernetes-system-apiserver",
"kubernetes-system-controller-manager",
"kubernetes-system-scheduler":
// skip
default:
groups = append(groups, g)
}
}
r.Spec.Groups = groups
}

return r, nil
}

Expand Down
Loading