diff --git a/Makefile b/Makefile index 75205e803..0a82efcc6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION := 0.2.1 +VERSION := 0.2.2 # Name of this service/application SERVICE_NAME := redis-operator diff --git a/operator/redisfailover/service/generator.go b/operator/redisfailover/service/generator.go index dedbc1ff0..3b277c692 100644 --- a/operator/redisfailover/service/generator.go +++ b/operator/redisfailover/service/generator.go @@ -54,6 +54,11 @@ func generateRedisService(rf *redisfailoverv1alpha2.RedisFailover, labels map[st Namespace: namespace, Labels: labels, OwnerReferences: ownerRefs, + Annotations: map[string]string{ + "prometheus.io/scrape": "true", + "prometheus.io/port": "http", + "prometheus.io/path": "/metrics", + }, }, Spec: corev1.ServiceSpec{ Type: corev1.ServiceTypeClusterIP, @@ -409,6 +414,17 @@ func createRedisExporterContainer() corev1.Container { Name: exporterContainerName, Image: exporterImage, ImagePullPolicy: "Always", + Env: []corev1.EnvVar{ + { + Name: "REDIS_ALIAS", + ValueFrom: + &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.name", + }, + }, + }, + }, Ports: []corev1.ContainerPort{ { Name: "metrics",