Skip to content

Commit

Permalink
Merge pull request #39 from Kyrremann/37_prometheus_annotation
Browse files Browse the repository at this point in the history
[#37] prometheus annotation
  • Loading branch information
jchanam authored Apr 6, 2018
2 parents 74ac2c3 + 1f196ab commit 0578b5f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := 0.2.1
VERSION := 0.2.2

# Name of this service/application
SERVICE_NAME := redis-operator
Expand Down
16 changes: 16 additions & 0 deletions operator/redisfailover/service/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 0578b5f

Please sign in to comment.