Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump golangci-lint and switch to the revive #4089

Merged
merged 3 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.33
version: v1.40.1
args: --timeout 10m0s
check-metrics:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ run:

linters:
enable:
- golint
- revive

issues:
exclude-rules:
- path: _test.go
linters:
- errcheck
# TODO: fix linter errors before enabling it for the framework
- path: test/framework
linters:
- revive

linters-settings:
errcheck:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ shellcheck: $(SHELLCHECK_BINARY)

.PHONY: check-metrics
check-metrics: $(PROMLINTER_BINARY)
$(PROMLINTER_BINARY) .
$(PROMLINTER_BINARY) lint .

.PHONY: check-golang
check-golang: $(GOLANGCILINTER_BINARY)
Expand Down
12,149 changes: 9,261 additions & 2,888 deletions bundle.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func Main() int {
return 1
}

var tlsConfig *tls.Config = nil
var tlsConfig *tls.Config
if serverTLS {
if rawTLSCipherSuites != "" {
cfg.ServerTLSConfig.CipherSuites = strings.Split(rawTLSCipherSuites, ",")
Expand Down
22 changes: 15 additions & 7 deletions example/mixin/alerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ groups:
rules:
- alert: PrometheusOperatorListErrors
annotations:
description: Errors while performing List operations in controller {{$labels.controller}} in {{$labels.namespace}} namespace.
description: Errors while performing List operations in controller {{$labels.controller}}
in {{$labels.namespace}} namespace.
summary: Errors while performing list operations in controller.
expr: |
(sum by (controller,namespace) (rate(prometheus_operator_list_operations_failed_total{job="prometheus-operator"}[10m])) / sum by (controller,namespace) (rate(prometheus_operator_list_operations_total{job="prometheus-operator"}[10m]))) > 0.4
Expand All @@ -12,7 +13,8 @@ groups:
severity: warning
- alert: PrometheusOperatorWatchErrors
annotations:
description: Errors while performing watch operations in controller {{$labels.controller}} in {{$labels.namespace}} namespace.
description: Errors while performing watch operations in controller {{$labels.controller}}
in {{$labels.namespace}} namespace.
summary: Errors while performing watch operations in controller.
expr: |
(sum by (controller,namespace) (rate(prometheus_operator_watch_operations_failed_total{job="prometheus-operator"}[10m])) / sum by (controller,namespace) (rate(prometheus_operator_watch_operations_total{job="prometheus-operator"}[10m]))) > 0.4
Expand All @@ -21,7 +23,8 @@ groups:
severity: warning
- alert: PrometheusOperatorSyncFailed
annotations:
description: Controller {{ $labels.controller }} in {{ $labels.namespace }} namespace fails to reconcile {{ $value }} objects.
description: Controller {{ $labels.controller }} in {{ $labels.namespace }}
namespace fails to reconcile {{ $value }} objects.
summary: Last controller reconciliation failed
expr: |
min_over_time(prometheus_operator_syncs{status="failed",job="prometheus-operator"}[5m]) > 0
Expand All @@ -30,7 +33,8 @@ groups:
severity: warning
- alert: PrometheusOperatorReconcileErrors
annotations:
description: '{{ $value | humanizePercentage }} of reconciling operations failed for {{ $labels.controller }} controller in {{ $labels.namespace }} namespace.'
description: '{{ $value | humanizePercentage }} of reconciling operations failed
for {{ $labels.controller }} controller in {{ $labels.namespace }} namespace.'
summary: Errors while reconciling controller.
expr: |
(sum by (controller,namespace) (rate(prometheus_operator_reconcile_errors_total{job="prometheus-operator"}[5m]))) / (sum by (controller,namespace) (rate(prometheus_operator_reconcile_operations_total{job="prometheus-operator"}[5m]))) > 0.1
Expand All @@ -39,7 +43,8 @@ groups:
severity: warning
- alert: PrometheusOperatorNodeLookupErrors
annotations:
description: Errors while reconciling Prometheus in {{ $labels.namespace }} Namespace.
description: Errors while reconciling Prometheus in {{ $labels.namespace }}
Namespace.
summary: Errors while reconciling Prometheus.
expr: |
rate(prometheus_operator_node_address_lookup_errors_total{job="prometheus-operator"}[5m]) > 0.1
Expand All @@ -48,7 +53,8 @@ groups:
severity: warning
- alert: PrometheusOperatorNotReady
annotations:
description: Prometheus operator in {{ $labels.namespace }} namespace isn't ready to reconcile {{ $labels.controller }} resources.
description: Prometheus operator in {{ $labels.namespace }} namespace isn't
ready to reconcile {{ $labels.controller }} resources.
summary: Prometheus operator not ready
expr: |
min by(namespace, controller) (max_over_time(prometheus_operator_ready{job="prometheus-operator"}[5m]) == 0)
Expand All @@ -57,7 +63,9 @@ groups:
severity: warning
- alert: PrometheusOperatorRejectedResources
annotations:
description: Prometheus operator in {{ $labels.namespace }} namespace rejected {{ printf "%0.0f" $value }} {{ $labels.controller }}/{{ $labels.resource }} resources.
description: Prometheus operator in {{ $labels.namespace }} namespace rejected
{{ printf "%0.0f" $value }} {{ $labels.controller }}/{{ $labels.resource }}
resources.
summary: Resources rejected by Prometheus operator
expr: |
min_over_time(prometheus_operator_managed_resources{state="rejected",job="prometheus-operator"}[5m]) > 0
Expand Down