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 examples/tenant-prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,7 @@ spec:
podManagementPolicy: Parallel

prometheus:
image: "prom/prometheus"
sidecarimage: "alpine"
initimage: "busybox"
diskCapacityGB: 5
12 changes: 12 additions & 0 deletions helm/minio-operator/templates/minio.min.io_tenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,10 @@ spec:
type: object
diskCapacityGB:
type: integer
image:
type: string
initimage:
type: string
labels:
additionalProperties:
type: string
Expand Down Expand Up @@ -1510,6 +1514,8 @@ spec:
type: string
type: object
type: object
sidecarimage:
type: string
type: object
requestAutoCert:
type: boolean
Expand Down Expand Up @@ -5370,6 +5376,10 @@ spec:
type: object
diskCapacityGB:
type: integer
image:
type: string
initimage:
type: string
labels:
additionalProperties:
type: string
Expand Down Expand Up @@ -5459,6 +5469,8 @@ spec:
type: string
type: object
type: object
sidecarimage:
type: string
type: object
requestAutoCert:
type: boolean
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/minio.min.io/v2/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ const ConsoleCertPath = "/tmp/certs"
// PrometheusImage specifies the container image for prometheus server
const PrometheusImage = "quay.io/prometheus/prometheus:latest"

// PrometheusSideCarImage specifies the container image for prometheus sidecar
const PrometheusSideCarImage = "alpine"

// PrometheusInitImage specifies the init container image for prometheus server
const PrometheusInitImage = "busybox"

// PrometheusInstanceLabel is applied to the prometheus server pod
const PrometheusInstanceLabel = "v1.min.io/prometheus"

Expand Down
12 changes: 12 additions & 0 deletions pkg/apis/minio.min.io/v2/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ func (t *Tenant) EnsureDefaults() *Tenant {
}
}

if t.HasPrometheusEnabled() {
if t.Spec.Prometheus.Image == "" {
t.Spec.Prometheus.Image = PrometheusImage
}
if t.Spec.Prometheus.SideCarImage == "" {
t.Spec.Prometheus.SideCarImage = PrometheusSideCarImage
}
if t.Spec.Prometheus.InitImage == "" {
t.Spec.Prometheus.InitImage = PrometheusInitImage
}
}

return t
}

Expand Down
11 changes: 11 additions & 0 deletions pkg/apis/minio.min.io/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,17 @@ type AuditConfig struct {

// PrometheusConfig defines configuration for Prometheus metrics server
type PrometheusConfig struct {
// Image defines Prometheus container image.
// +optional
Image string `json:"image,omitempty"`
// SideCarImage defines container image to be used for sidecar
// Expects "alpine" image
// +optional
SideCarImage string `json:"sidecarimage,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think sidecars should be an array of Container's, similar to what we did for zones, that way if they need more sidecars it's easier to add

// InitImage defines init container image to be used for Prometheus
// Expects "busybox" image
// +optional
InitImage string `json:"initimage,omitempty"`
// DiskCapacityGB defines the disk capacity in GB available to the
// Prometheus server
// +optional
Expand Down
6 changes: 3 additions & 3 deletions pkg/resources/statefulsets/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func prometheusServerContainer(t *miniov2.Tenant) corev1.Container {
var runAsUser int64 = 1000
return corev1.Container{
Name: miniov2.PrometheusContainerName,
Image: miniov2.PrometheusImage,
Image: t.Spec.Prometheus.Image,
Ports: []corev1.ContainerPort{
{
ContainerPort: miniov2.PrometheusPort,
Expand Down Expand Up @@ -119,7 +119,7 @@ func prometheusServerContainer(t *miniov2.Tenant) corev1.Container {
func prometheusSidecarContainer(t *miniov2.Tenant) corev1.Container {
return corev1.Container{
Name: miniov2.PrometheusContainerName + "-sidecar",
Image: "alpine",
Image: t.Spec.Prometheus.SideCarImage,
ImagePullPolicy: t.Spec.ImagePullPolicy,
VolumeMounts: prometheusVolumeMounts(t),
Env: prometheusEnvVars(t),
Expand Down Expand Up @@ -189,7 +189,7 @@ func NewForPrometheus(t *miniov2.Tenant, serviceName string) *appsv1.StatefulSet
initContainers := []corev1.Container{
{
Name: "prometheus-init-chown-data",
Image: "busybox",
Image: t.Spec.Prometheus.InitImage,
Command: []string{
"chown",
"-R",
Expand Down
12 changes: 12 additions & 0 deletions resources/base/crds/minio.min.io_tenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,10 @@ spec:
type: object
diskCapacityGB:
type: integer
image:
type: string
initimage:
type: string
labels:
additionalProperties:
type: string
Expand Down Expand Up @@ -1510,6 +1514,8 @@ spec:
type: string
type: object
type: object
sidecarimage:
type: string
type: object
requestAutoCert:
type: boolean
Expand Down Expand Up @@ -5370,6 +5376,10 @@ spec:
type: object
diskCapacityGB:
type: integer
image:
type: string
initimage:
type: string
labels:
additionalProperties:
type: string
Expand Down Expand Up @@ -5459,6 +5469,8 @@ spec:
type: string
type: object
type: object
sidecarimage:
type: string
type: object
requestAutoCert:
type: boolean
Expand Down