Commit eb617adc authored by Christian Kotzbauer's avatar Christian Kotzbauer
Browse files

restructured and improved service



Signed-off-by: default avatarChristian Kotzbauer <christian.kotzbauer@gmail.com>
parent 3eb7f17b
...@@ -61,12 +61,14 @@ The following changes have been made compared to the stable chart: ...@@ -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) | | `serviceAccount.name` | Service account name to create (or use if `serviceAccount.create` is false) | (chart fullname) |
| `podSecurityPolicy.create` | Create podSecurityPolicy | `false` | | `podSecurityPolicy.create` | Create podSecurityPolicy | `false` |
| `resources` | Resources requests and limits. | `{}` | | `resources` | Resources requests and limits. | `{}` |
| `metrics.create` | Create a Service for the metrics endpoint | `false` | | `metrics.create` | Create a ServiceMonitor for prometheus-operator | `false` |
| `metrics.serviceMonitor.create` | Create a ServiceMonitor for prometheus-operator | `true` | | `metrics.namespace` | The namespace to create the ServiceMonitor in | `""` |
| `metrics.serviceMonitor.namespace` | The namespace to create the ServiceMonitor in | `""` | | `metrics.labels` | Additional labels for the ServiceMonitor | `{}` |
| `metrics.serviceMonitor.labels` | Additional labels for the ServiceMonitor | `{}` | | `metrics.interval` | Interval prometheus should scrape the endpoint | `60s` |
| `metrics.serviceMonitor.interval` | Interval prometheus should scrape the endpoint | `60s` | | `metrics.scrapeTimeout` | A custom scrapeTimeout for prometheus | `""` |
| `metrics.serviceMonitor.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 | `""` | | `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"}]`| | `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) | `{}` | | `affinity` | Affinity for the daemonset (ie, restrict which nodes kured runs on) | `{}` |
...@@ -95,8 +97,9 @@ metrics: ...@@ -95,8 +97,9 @@ metrics:
#### Prometheus Annotations #### Prometheus Annotations
```yaml ```yaml
podAnnotations: service:
prometheus.io/scrape: "true" annotations:
prometheus.io/path: "/metrics" prometheus.io/scrape: "true"
prometheus.io/port: "8080" prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
``` ```
{{- if .Values.metrics.create }} {{- if or .Values.service.create .Values.metrics.create }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "kured.fullname" . }} name: {{ template "kured.fullname" . }}
labels: labels:
{{- include "kured.labels" . | nindent 4 }} {{- include "kured.labels" . | nindent 4 }}
{{- if .Values.service.annotations }}
annotations:
{{- range $key, $value := .Values.service.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec: spec:
type: ClusterIP type: ClusterIP
ports: ports:
- name: metrics - name: metrics
port: 8080 port: {{ .Values.service.port }}
targetPort: 8080
selector: selector:
{{- include "kured.labels" . | nindent 4 }} {{- include "kured.labels" . | nindent 4 }}
{{- end }} {{- end }}
\ No newline at end of file
{{- if and .Values.metrics.create .Values.metrics.serviceMonitor.create }} {{- if .Values.metrics.create }}
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor kind: ServiceMonitor
metadata: metadata:
name: {{ template "kured.fullname" . }} name: {{ template "kured.fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }} {{- if .Values.metrics.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace }} namespace: {{ .Values.metrics.namespace }}
{{- end }} {{- end }}
labels: labels:
{{- include "kured.labels" . | nindent 4 }} {{- include "kured.labels" . | nindent 4 }}
{{- if .Values.metrics.serviceMonitor.labels }} {{- if .Values.metrics.labels }}
{{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }} {{- toYaml .Values.metrics.labels | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
endpoints: endpoints:
- interval: {{ .Values.metrics.serviceMonitor.interval }} - interval: {{ .Values.metrics.interval }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }} {{- if .Values.metrics.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} scrapeTimeout: {{ .Values.metrics.scrapeTimeout }}
{{- end }} {{- end }}
honorLabels: true honorLabels: true
targetPort: 8080 targetPort: 8080
......
...@@ -40,12 +40,15 @@ resources: {} ...@@ -40,12 +40,15 @@ resources: {}
metrics: metrics:
create: false create: false
serviceMonitor: namespace: ""
create: true labels: {}
namespace: "" interval: 60s
labels: {} scrapeTimeout: ""
interval: 60s
scrapeTimeout: "" service:
create: false
port: 8080
annotations: {}
priorityClassName: "" priorityClassName: ""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment