AETHER-3616 Refactoring to work with basic auth

Change-Id: I02cbca8041defdec81a45066ed852e1f4fc82204
diff --git a/monitoring/edge-maintenance-agent/Chart.yaml b/monitoring/edge-maintenance-agent/Chart.yaml
index 9d33e72..74ad78a 100644
--- a/monitoring/edge-maintenance-agent/Chart.yaml
+++ b/monitoring/edge-maintenance-agent/Chart.yaml
@@ -8,9 +8,9 @@
 # This is the chart version. This version number should be incremented each time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.1.1
+version: 0.2.0
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
 # follow Semantic Versioning. They should reflect the version the application is using.
-appVersion: 0.6.0
+appVersion: 0.7.20
diff --git a/monitoring/edge-maintenance-agent/templates/deployment.yaml b/monitoring/edge-maintenance-agent/templates/deployment.yaml
index 918f711..48a4e6a 100644
--- a/monitoring/edge-maintenance-agent/templates/deployment.yaml
+++ b/monitoring/edge-maintenance-agent/templates/deployment.yaml
@@ -41,6 +41,18 @@
           env:
             - name: AETHER_EDGE_STATUS_URL
               value: "{{ .Values.edgeMonitoringServerURL }}/{{ .Values.edgeName }}"
+            - name: AETHER_USERNAME
+              valueFrom:
+                secretKeyRef:
+                  name: {{ .Values.secretName }}
+                  key: username
+                  optional: false
+            - name: AETHER_PASSWORD
+              valueFrom:
+                secretKeyRef:
+                  name: {{ .Values.secretName }}
+                  key: password
+                  optional: false
           livenessProbe:
             httpGet:
               path: /healthz
diff --git a/monitoring/edge-maintenance-agent/templates/secret.yaml b/monitoring/edge-maintenance-agent/templates/secret.yaml
new file mode 100644
index 0000000..9494480
--- /dev/null
+++ b/monitoring/edge-maintenance-agent/templates/secret.yaml
@@ -0,0 +1,15 @@
+# Copyright 2022-present Open Networking Foundation
+# SPDX-License-Identifier: Apache-2.0
+
+{{- if not .Values.useExistingSecret }}
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ .Values.secretName }}
+  labels:
+    {{- include "edge-maintenance-agent.labels" . | nindent 4 }}
+type: kubernetes.io/basic-auth
+stringData:
+  username: {{ .Values.basicAuthUsername }}
+  password: {{ .Values.basicAuthPassword }}
+{{- end }}
diff --git a/monitoring/edge-maintenance-agent/values.yaml b/monitoring/edge-maintenance-agent/values.yaml
index 04683b2..3c6fc2c 100644
--- a/monitoring/edge-maintenance-agent/values.yaml
+++ b/monitoring/edge-maintenance-agent/values.yaml
@@ -10,16 +10,28 @@
 image:
   # The agent is bundled in the edge-monitoring-server image.
   repository: docker.io/omecproject/edge-monitoring-server
-  pullPolicy: Always
+  pullPolicy: IfNotPresent
   # Overrides the image tag whose default is the chart appVersion.
   tag: ""
 
-# URL of edge monitoring server that monitors maintenance calendar
+# Specify edge monitoring server URL, with /edges at end
+# E.g., https://monitoring.aetherproject.org/edges
 edgeMonitoringServerURL: ""
 
 # Name of edge in edge monitoring server output
 edgeName: ""
 
+# Secret containing basic auth username / password for edge monitoring server
+# Will be created if useExistingSecret = false
+secretName: "edge-maintenance-agent-secret"
+
+# Basic auth username and password (if not using existing secret)
+basicAuthUsername: ""
+basicAuthPassword: ""
+
+# Use existing secret; don't create it
+useExistingSecret: false
+
 prometheus:
   enabled: true