Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
prometheus-operator: allow to disable webhooks
Browse files Browse the repository at this point in the history
This is needed to install this component on AKS with Kubernetes 1.16.3.

See #219 for more details.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
  • Loading branch information
invidian committed Apr 24, 2020
1 parent 7161068 commit fd8b9f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Example:
| `alertmanager_external_url` | The external URL the Alertmanager instances will be available under. This is necessary to generate correct URLs. This is necessary if Alertmanager is not served from root of a DNS name. | "" | false |
| `alertmanager_config` | Provide YAML file path to configure Alertmanager. See [https://prometheus.io/docs/alerting/configuration/#configuration-file](https://prometheus.io/docs/alerting/configuration/#configuration-file). | `{"global":{"resolve_timeout":"5m"},"route":{"group_by":["job"],"group_wait":"30s","group_interval":"5m","repeat_interval":"12h","receiver":"null","routes":[{"match":{"alertname":"Watchdog"},"receiver":"null"}]},"receivers":[{"name":"null"}]}` | false |
| `alertmanager_node_selector` | Node selector to specify nodes where the AlertManager pods should be deployed. | {} | false |
| `disable_webhooks` | Disables validation and mutation webhooks. This might be required on older versions of Kubernetes to install successfully. | false | false |

## Applying

Expand Down
2 changes: 2 additions & 0 deletions pkg/components/prometheus-operator/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ type component struct {
AlertManagerExternalURL string `hcl:"alertmanager_external_url,optional"`
AlertManagerConfig string `hcl:"alertmanager_config,optional"`
AlertManagerNodeSelector map[string]string `hcl:"alertmanager_node_selector,optional"`

DisableWebhooks bool `hcl:"disable_webhooks,optional"`
}

func newComponent() *component {
Expand Down
10 changes: 9 additions & 1 deletion pkg/components/prometheus-operator/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,20 @@ kubeEtcd:
endpoints: {{.EtcdEndpoints}}
prometheus-node-exporter:
service: {}
{{ if .PrometheusOperatorNodeSelector }}
{{ if (or .PrometheusOperatorNodeSelector .DisableWebhooks) }}
prometheusOperator:
{{- if .DisableWebhooks }}
tlsProxy:
enabled: false
admissionWebhooks:
enabled: false
{{- end }}
{{- if .PrometheusOperatorNodeSelector }}
nodeSelector:
{{ range $key, $value := .PrometheusOperatorNodeSelector }}
{{ $key }}: {{ $value }}
{{ end }}
{{- end }}
{{ end }}
prometheus:
prometheusSpec:
Expand Down

0 comments on commit fd8b9f1

Please sign in to comment.