From 64c959e018e4dfcaf75c86d706a2b9e0b160a241 Mon Sep 17 00:00:00 2001
From: Giancarlo Rubio <gianrubio@gmail.com>
Date: Fri, 5 May 2017 19:04:20 +0200
Subject: [PATCH] Add ability to authenticate an endpoint Write an example for
 basic auth

---
 manifests/examples/basic-auth/secrets.yaml    |  8 +++++++
 .../examples/basic-auth/service-monitor.yaml  | 22 +++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 manifests/examples/basic-auth/secrets.yaml
 create mode 100644 manifests/examples/basic-auth/service-monitor.yaml

diff --git a/manifests/examples/basic-auth/secrets.yaml b/manifests/examples/basic-auth/secrets.yaml
new file mode 100644
index 00000000..fa0dd897
--- /dev/null
+++ b/manifests/examples/basic-auth/secrets.yaml
@@ -0,0 +1,8 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: basic-auth
+data:
+  password: dG9vcg== # toor
+  user: YWRtaW4= # admin
+type: Opaque
\ No newline at end of file
diff --git a/manifests/examples/basic-auth/service-monitor.yaml b/manifests/examples/basic-auth/service-monitor.yaml
new file mode 100644
index 00000000..8d9549f0
--- /dev/null
+++ b/manifests/examples/basic-auth/service-monitor.yaml
@@ -0,0 +1,22 @@
+apiVersion: monitoring.coreos.com/v1alpha1
+kind: ServiceMonitor
+metadata:
+  labels:
+    k8s-apps: basic-auth-example
+  name: basic-auth-example
+spec:
+  endpoints:
+  - basicAuth:
+      password:
+        key: basic-auth
+        name: password
+      username:
+        key: basic-auth
+        name: user
+    port: metrics
+  namespaceSelector:
+    matchNames:
+    - logging
+  selector:
+    matchLabels:
+      app: myapp
\ No newline at end of file
-- 
GitLab