diff --git a/stable/opa/Chart.yaml b/stable/opa/Chart.yaml index 18cfafa568..8c07a3426a 100644 --- a/stable/opa/Chart.yaml +++ b/stable/opa/Chart.yaml @@ -6,7 +6,7 @@ keywords: - opa - admission control - policy -version: 1.14.3 +version: 1.14.4 home: https://www.openpolicyagent.org icon: https://raw.githubusercontent.com/open-policy-agent/opa/master/logo/logo.png sources: diff --git a/stable/opa/README.md b/stable/opa/README.md index c481a25810..26c133ffd8 100644 --- a/stable/opa/README.md +++ b/stable/opa/README.md @@ -84,6 +84,7 @@ Reference](https://www.openpolicyagent.org/docs/configuration.html). | `livenessProbe` | HTTP liveness probe for OPA container. | See [values.yaml](values.yaml) | | `opa` | OPA configuration. | See [values.yaml](values.yaml) | | `mgmt` | kube-mgmt configuration. | See [values.yaml](values.yaml) | +| `mgmt.port` | kube-mgmt/prometheus port used to communicate with opa. | See [values.yaml](values.yaml) | | `sar.resources` | CPU and memory limits for the sar container. | `{}` | | `priorityClassName` | The name of the priorityClass for the pods. | Unset | | `prometheus.enabled` | Flag to expose the `/metrics` endpoint to be scraped. | `false` | diff --git a/stable/opa/templates/deployment.yaml b/stable/opa/templates/deployment.yaml index d02c8a74be..0157497678 100644 --- a/stable/opa/templates/deployment.yaml +++ b/stable/opa/templates/deployment.yaml @@ -83,6 +83,13 @@ spec: {{- end }} containers: - name: opa + ports: + - name: https + containerPort: {{ .Values.port }} +{{- if .Values.prometheus.enabled }} + - name: http + containerPort: {{ .Values.mgmt.port }} +{{- end }} image: {{ .Values.image }}:{{ .Values.imageTag }} imagePullPolicy: {{ .Values.imagePullPolicy }} resources: @@ -104,9 +111,9 @@ spec: - "--ignore=.*" {{- end }} {{- if .Values.prometheus.enabled }} - - "--addr=http://0.0.0.0:8181" + - "--addr=http://0.0.0.0:{{ .Values.mgmt.port }}" {{- else if .Values.mgmt.enabled }} - - "--addr=http://127.0.0.1:8181" + - "--addr=http://127.0.0.1:{{ .Values.mgmt.port }}" {{- end }} {{- if or .Values.authz.enabled .Values.bootstrapPolicies }} - "/bootstrap" @@ -142,7 +149,7 @@ spec: {{- if .Values.authz.enabled }} - --opa-auth-token-file=/bootstrap/mgmt-token {{- end }} - - --opa-url=http://127.0.0.1:8181/v1 + - --opa-url=http://127.0.0.1:{{ .Values.mgmt.port }}/v1 - --replicate-path={{ .Values.mgmt.replicate.path }} - --enable-data={{ .Values.mgmt.data.enabled }} - --enable-policies={{ .Values.mgmt.configmapPolicies.enabled }} diff --git a/stable/opa/templates/service.yaml b/stable/opa/templates/service.yaml index e2df7494e9..090f8ada04 100644 --- a/stable/opa/templates/service.yaml +++ b/stable/opa/templates/service.yaml @@ -12,6 +12,10 @@ spec: protocol: TCP port: 443 targetPort: {{ .Values.port }} +{{- if .Values.prometheus.enabled }} + - name: http + port: {{ .Values.mgmt.port }} +{{- end }} {{- if .Values.extraPorts }} {{ toYaml .Values.extraPorts | indent 2}} {{- end }} diff --git a/stable/opa/templates/servicemonitor.yaml b/stable/opa/templates/servicemonitor.yaml index 13c5470dfc..f08869e349 100644 --- a/stable/opa/templates/servicemonitor.yaml +++ b/stable/opa/templates/servicemonitor.yaml @@ -6,7 +6,9 @@ metadata: app: {{ template "opa.name" . }} chart: {{ template "opa.chart" . }} heritage: {{ .Release.Service }} + {{- if not .Values.serviceMonitor.additionalLabels.release }} release: {{ .Release.Name }} + {{- end }} {{- if .Values.serviceMonitor.additionalLabels }} {{- toYaml .Values.serviceMonitor.additionalLabels | nindent 4}} {{- end }} @@ -16,15 +18,14 @@ metadata: {{- end }} spec: endpoints: - - targetPort: 8181 + - port: http interval: {{ .Values.serviceMonitor.interval }} - path: "/metrics" jobLabel: {{ template "opa.fullname" . }} namespaceSelector: matchNames: - {{ .Release.Namespace }} selector: matchLabels: - app: {{ template "opa.name" . }} + app: {{ template "opa.fullname" . }} release: {{ .Release.Name }} {{- end }} diff --git a/stable/opa/values.yaml b/stable/opa/values.yaml index fc7fbdcab6..787e80f105 100644 --- a/stable/opa/values.yaml +++ b/stable/opa/values.yaml @@ -125,6 +125,8 @@ mgmt: image: openpolicyagent/kube-mgmt imageTag: "0.10" imagePullPolicy: IfNotPresent +# NOTE insecure http port conjointly used for mgmt access and prometheus metrics export + port: 8181 extraArgs: [] resources: {} data: