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

[release-4.4] Bug 1814729: Exclude Kubernetes control plane rules when running on IBM Cloud #712

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
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.4"
},
{
"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.2"
"version": "release-0.35"
},
{
"name": "kubernetes-mixin",
"source": {
"git": {
"remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin",
Expand All @@ -31,34 +29,34 @@
"version": "release-0.3"
},
{
"name": "openshift-state-metrics",
"source": {
"git": {
"remote": "https://github.com/openshift/openshift-state-metrics",
"subdir": "jsonnet"
}
},
"version": "release-4.4"
"version": "release-4.4",
"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.35"
"version": "release-4.4",
"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.4"
"version": "release-0.2"
}
]
],
"legacyImports": true
}
131 changes: 61 additions & 70 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": "ae589e91ce783e319ac4c9372ac95db136f4929f",
"sum": "BZqKu3GcqEkUrKHMso3mUbx0LbmIMi7iBxWRUfFXOzM="
},
{
"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": "37a843fb60515ec34220bebb06a8d70d3a10a9fd",
"sum": "yUHQC9cVIWqQkGST1urZq4a3OFZXuW0w8YC5jsb0kjE="
},
{
"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": "ae589e91ce783e319ac4c9372ac95db136f4929f",
"sum": "BZqKu3GcqEkUrKHMso3mUbx0LbmIMi7iBxWRUfFXOzM="
"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": "b6a6a410c594f05efcf535a8c18c51a662c09373",
"sum": "4F71yoLSRKIKQlDIZGmLVabNGo13/DDkk9odBWth7Co="
"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,81 +83,78 @@
"sum": "FlsxVGiAjbWyKzS75sDfMTwB3/fKg4eZBYiP9RZnW7E="
},
{
"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": "9bb37873a8757508853b14e6048a9c3418f3d667",
"sum": "7vEamDTP9AApeiF4Zu9ZyXzDIs3rYHzwf9k7g8X+wsg="
"version": "003c3e8db3aee2699b9e31fe8fd0cb906354a48f",
"sum": "VhgBM39yv0f4bKv8VfGg4FXkg573evGDRalip9ypKbc="
},
{
"name": "openshift-state-metrics",
"source": {
"git": {
"remote": "https://github.com/openshift/openshift-state-metrics",
"subdir": "jsonnet"
"remote": "https://github.com/metalmatze/slo-libsonnet",
"subdir": "slo-libsonnet"
}
},
"version": "803b239ebdd991639bb684d21bffab59a21af9d8",
"sum": "CHoXXlCYfTLaqKSaydhDr8+wn5KEceZD0aJuvh2BgQQ="
"version": "437c402c5f3ad86c3c16db8471f1649284fef0ee",
"sum": "2Zcyku1f558VrUpMaJnI78fahDksPLcS1idmxxwcQ7Q="
},
{
"name": "prometheus",
"source": {
"git": {
"remote": "https://github.com/prometheus/prometheus",
"subdir": "documentation/prometheus-mixin"
"remote": "https://github.com/openshift/openshift-state-metrics",
"subdir": "jsonnet"
}
},
"version": "fafb7940b1cdb24cada28a713fbcc01ed1e2d585",
"sum": "u1YS9CVuBTcw2vks0PZbLb1gtlI/7bVGDVBZsjWFLTw="
"version": "803b239ebdd991639bb684d21bffab59a21af9d8",
"sum": "CHoXXlCYfTLaqKSaydhDr8+wn5KEceZD0aJuvh2BgQQ=",
"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": "37a843fb60515ec34220bebb06a8d70d3a10a9fd",
"sum": "yUHQC9cVIWqQkGST1urZq4a3OFZXuW0w8YC5jsb0kjE="
"version": "7853182efa4a42f44e929f54860a3c84e99e2079",
"sum": "1/pVyXnhpBPaeyqlRVWI7I8nngGNiSgcv7xMWjHizC4=",
"name": "telemeter-client"
},
{
"name": "promgrafonnet",
"source": {
"git": {
"remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin",
"subdir": "lib/promgrafonnet"
"remote": "https://github.com/prometheus/node_exporter",
"subdir": "docs/node-mixin"
}
},
"version": "003c3e8db3aee2699b9e31fe8fd0cb906354a48f",
"sum": "VhgBM39yv0f4bKv8VfGg4FXkg573evGDRalip9ypKbc="
"version": "9bb37873a8757508853b14e6048a9c3418f3d667",
"sum": "7vEamDTP9AApeiF4Zu9ZyXzDIs3rYHzwf9k7g8X+wsg="
},
{
"name": "slo-libsonnet",
"source": {
"git": {
"remote": "https://github.com/metalmatze/slo-libsonnet",
"subdir": "slo-libsonnet"
"remote": "https://github.com/prometheus/prometheus",
"subdir": "documentation/prometheus-mixin"
}
},
"version": "437c402c5f3ad86c3c16db8471f1649284fef0ee",
"sum": "2Zcyku1f558VrUpMaJnI78fahDksPLcS1idmxxwcQ7Q="
"version": "fafb7940b1cdb24cada28a713fbcc01ed1e2d585",
"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": "7853182efa4a42f44e929f54860a3c84e99e2079",
"sum": "1/pVyXnhpBPaeyqlRVWI7I8nngGNiSgcv7xMWjHizC4="
"version": "b6a6a410c594f05efcf535a8c18c51a662c09373",
"sum": "4F71yoLSRKIKQlDIZGmLVabNGo13/DDkk9odBWth7Co="
}
]
],
"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
14 changes: 12 additions & 2 deletions pkg/manifests/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ import (
)

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

PrometheusOperatorConfig *PrometheusOperatorConfig `json:"prometheusOperator"`
PrometheusOperatorUserWorkloadConfig *PrometheusOperatorConfig `json:"prometheusOperatorUserWorkload"`
Expand Down Expand Up @@ -323,6 +324,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