diff --git a/charts/kured/README.md b/charts/kured/README.md index 5c4fffb..19afe31 100644 --- a/charts/kured/README.md +++ b/charts/kured/README.md @@ -61,12 +61,14 @@ The following changes have been made compared to the stable chart: | `serviceAccount.name` | Service account name to create (or use if `serviceAccount.create` is false) | (chart fullname) | | `podSecurityPolicy.create` | Create podSecurityPolicy | `false` | | `resources` | Resources requests and limits. | `{}` | -| `metrics.create` | Create a Service for the metrics endpoint | `false` | -| `metrics.serviceMonitor.create` | Create a ServiceMonitor for prometheus-operator | `true` | -| `metrics.serviceMonitor.namespace` | The namespace to create the ServiceMonitor in | `""` | -| `metrics.serviceMonitor.labels` | Additional labels for the ServiceMonitor | `{}` | -| `metrics.serviceMonitor.interval` | Interval prometheus should scrape the endpoint | `60s` | -| `metrics.serviceMonitor.scrapeTimeout` | A custom scrapeTimeout for prometheus | `""` | +| `metrics.create` | Create a ServiceMonitor for prometheus-operator | `false` | +| `metrics.namespace` | The namespace to create the ServiceMonitor in | `""` | +| `metrics.labels` | Additional labels for the ServiceMonitor | `{}` | +| `metrics.interval` | Interval prometheus should scrape the endpoint | `60s` | +| `metrics.scrapeTimeout` | A custom scrapeTimeout for prometheus | `""` | +| `service.create` | Create a Service for the metrics endpoint | `false` | +| `service.port` | Port of the service to expose | `8080` | +| `serviceAnnotations` | Annotations to apply to the service (eg to add Prometheus annotations) | `{}` | | `priorityClassName` | Priority Class to be used by the pods | `""` | | `tolerations` | Tolerations to apply to the daemonset (eg to allow running on master) | `[{"key": "node-role.kubernetes.io/master", "effect": "NoSchedule"}]`| | `affinity` | Affinity for the daemonset (ie, restrict which nodes kured runs on) | `{}` | @@ -95,8 +97,9 @@ metrics: #### Prometheus Annotations ```yaml -podAnnotations: - prometheus.io/scrape: "true" - prometheus.io/path: "/metrics" - prometheus.io/port: "8080" +service: + annotations: + prometheus.io/scrape: "true" + prometheus.io/path: "/metrics" + prometheus.io/port: "8080" ``` diff --git a/charts/kured/templates/service.yaml b/charts/kured/templates/service.yaml index 6bdcc4d..99f9a5a 100644 --- a/charts/kured/templates/service.yaml +++ b/charts/kured/templates/service.yaml @@ -1,15 +1,22 @@ -{{- if .Values.metrics.create }} +{{- if or .Values.service.create .Values.metrics.create }} apiVersion: v1 kind: Service metadata: name: {{ template "kured.fullname" . }} labels: {{- include "kured.labels" . | nindent 4 }} + {{- if .Values.service.annotations }} + annotations: + {{- range $key, $value := .Values.service.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} spec: type: ClusterIP ports: - name: metrics - port: 8080 + port: {{ .Values.service.port }} + targetPort: 8080 selector: {{- include "kured.labels" . | nindent 4 }} {{- end }} \ No newline at end of file diff --git a/charts/kured/templates/servicemonitor.yaml b/charts/kured/templates/servicemonitor.yaml index bf868f9..d52295f 100644 --- a/charts/kured/templates/servicemonitor.yaml +++ b/charts/kured/templates/servicemonitor.yaml @@ -1,21 +1,21 @@ -{{- if and .Values.metrics.create .Values.metrics.serviceMonitor.create }} +{{- if .Values.metrics.create }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "kured.fullname" . }} - {{- if .Values.metrics.serviceMonitor.namespace }} - namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- if .Values.metrics.namespace }} + namespace: {{ .Values.metrics.namespace }} {{- end }} labels: {{- include "kured.labels" . | nindent 4 }} - {{- if .Values.metrics.serviceMonitor.labels }} - {{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }} + {{- if .Values.metrics.labels }} + {{- toYaml .Values.metrics.labels | nindent 4 }} {{- end }} spec: endpoints: - - interval: {{ .Values.metrics.serviceMonitor.interval }} - {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} - scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + - interval: {{ .Values.metrics.interval }} + {{- if .Values.metrics.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.scrapeTimeout }} {{- end }} honorLabels: true targetPort: 8080 diff --git a/charts/kured/values.yaml b/charts/kured/values.yaml index 805079a..c4ea2c2 100644 --- a/charts/kured/values.yaml +++ b/charts/kured/values.yaml @@ -40,12 +40,15 @@ resources: {} metrics: create: false - serviceMonitor: - create: true - namespace: "" - labels: {} - interval: 60s - scrapeTimeout: "" + namespace: "" + labels: {} + interval: 60s + scrapeTimeout: "" + +service: + create: false + port: 8080 + annotations: {} priorityClassName: ""