Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{if .usingBareMetal}}
apiVersion: monitoring.coreos.com/v1
kind: Service
metadata:
name: metal3-baremetalhost-controller
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what the "name" here should be. But, "metal3-baremetalhost-controller" is the name of the baremetal_operator controller. See https://github.com/metal3-io/baremetal-operator/blob/master/pkg/controller/baremetalhost/baremetalhost_controller.go#L105

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: openshift-machine-api
labels:
app: ironic-exporter
spec:
ports:
- name: http
protocol: TCP
port: 9608
targetPort: 9608
selector:
app: ironic-exporter
clusterIP: None
type: ClusterIP
sessionAffinity: None
status:
loadBalancer: {}
{{- end}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{if .usingBareMetal}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app: ironic-exporter
name: metal3-baremetalhost-controller
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: openshift-machine-api
spec:
endpoints:
- port: "9608-tcp"
scheme: http
path: /metrics
targetPort: 9608
jobLabel: app
namespaceSelector:
matchNames:
- metal3-baremetalhost-controller
selector:
matchLabels:
app: ironic-exporter
{{- end}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{if .usingBareMetal}}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: metal3-baremetalhost-controller
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: openshift-machine-api
spec:
groups:
- name: metal3-baremetalhost-controller
rules:
- alert: HighCPUTemperature
annotations:
summary: "The baremetal node {{ $labels.node_name }} CPU {{ $labels.entity_id }} is too high"
description: "The baremetal node {{ $labels.node_name }} CPU {{ $labels.entity_id }} was too high in the past 5 minutes. Last measurement {{ $value }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this trigger for non baremetal envs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should porbably rename syncBaremetalControllers to something more generic e.g syncBaremetal
Then syncBaremetal calls syncBaremetalControllers and syncBaremetalMonitoring

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enxebre I don't think it would trigger in non baremetal envs, check @simonpasquier comment.
The sync part you are talking would be if we make the yamls go code right?

expr: baremetal_temp_celsius > 96
for: 5m
labels:
severity: warning
- alert: LowCPUTemperature
annotations:
summary: "The baremetal node {{ $labels.node_name }} CPU {{ $labels.entity_id }} is too low"
description: "The baremetal node {{ $labels.node_name }} CPU {{ $labels.entity_id }} was too low in the past 5 minutes. Last measurement {{ $value }}"
expr: baremetal_temp_celsius < 3
for: 5m
labels:
severity: warning
{{- end}}
16 changes: 16 additions & 0 deletions pkg/operator/baremetal_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ func newMetal3Containers(config *OperatorConfig, baremetalProvisioningConfig Bar
containers = append(containers, createContainerMetal3IronicApi(config, baremetalProvisioningConfig))
containers = append(containers, createContainerMetal3IronicInspector(config, baremetalProvisioningConfig))
containers = append(containers, createContainerMetal3StaticIpManager(config, baremetalProvisioningConfig))
containers = append(containers, createContainerMetal3IronicExporter(config))
return containers
}

Expand Down Expand Up @@ -424,3 +425,18 @@ func createContainerMetal3StaticIpManager(config *OperatorConfig, baremetalProvi
}
return container
}

func createContainerMetal3IronicExporter(config *OperatorConfig) corev1.Container {

container := corev1.Container{
Name: "metal3-ironic-exporter",
Image: config.BaremetalControllers.Ironic,
ImagePullPolicy: "Always",
SecurityContext: &corev1.SecurityContext{
Privileged: pointer.BoolPtr(true),
},
Command: []string{"/bin/runironic-exporter"},
VolumeMounts: volumeMounts,
}
return container
}