From 3896688049e40268199506ae88753d277dc4d57d Mon Sep 17 00:00:00 2001 From: Vincent Mercier Date: Thu, 2 Nov 2023 16:28:36 +0100 Subject: [PATCH 1/2] chore(linter): Add YAML linter --- .github/workflows/linter.yaml | 9 +++++++++ .pre-commit-config.yaml | 9 +++++++-- .yamllint.yaml | 12 ++++++++++++ CONTRIBUTING.md | 2 ++ 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .yamllint.yaml diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 27f825f..b52e99a 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -49,3 +49,12 @@ jobs: # Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. # install-mode: "goinstall" + + yamllint: + name: yamllint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Lint YAML files + run: yamllint . # YAML lint is already installed in ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 80ea0e7..2d3b91d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +--- repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 @@ -16,8 +17,12 @@ repos: - repo: https://github.com/Bahjat/pre-commit-golang rev: v1.0.3 hooks: - - id: gofumpt # requires github.com/mvdan/gofumpt + - id: gofumpt # requires https://github.com/mvdan/gofumpt - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.37.0 hooks: - - id: markdownlint + - id: markdownlint # requires https://github.com/DavidAnson/markdownlint-cli2 + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.32.0 + hooks: + - id: yamllint # requires https://github.com/adrienverge/yamllint diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..69c41b4 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,12 @@ +--- +extends: default + +rules: + line-length: + max: 160 + level: warning + +ignore: + - dist/ + - prometheus-rds-exporter.yaml + - configs/helm/templates/*.yaml # Helm templates are invalid due to Go template language diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ab40dd5..c68d710 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,6 +39,8 @@ We use: * [`markdownlint-cli2`](https://github.com/DavidAnson/markdownlint-cli2) for linting the Markdown documents. +* [`yamllint`](https://github.com/adrienverge/yamllint) for linting the YAML documents. + ## Pull Request Checklist * Branch from the `main` branch and, if needed, rebase to the current main branch before submitting your pull request. If it doesn't merge cleanly with main you may be asked to rebase your changes. From 8442150bc44983ef2d4ec6adb8f1eb8fdba1a2a8 Mon Sep 17 00:00:00 2001 From: Vincent Mercier Date: Thu, 2 Nov 2023 16:28:50 +0100 Subject: [PATCH 2/2] refact(yaml): Fix YAML linter --- .github/workflows/build.yaml | 13 +- .github/workflows/linter.yaml | 5 +- .github/workflows/test.yaml | 3 +- .golangci.yml | 1 + .goreleaser.yaml | 121 +++++++++--------- .markdownlint.yaml | 1 + configs/helm/Chart.yaml | 1 + configs/helm/templates/deployment.yaml | 1 + configs/helm/templates/ingress.yaml | 1 + configs/helm/templates/service.yaml | 1 + configs/helm/templates/serviceaccount.yaml | 1 + configs/helm/templates/servicemonitor.yaml | 3 +- configs/helm/tests/deployment_test.yaml | 3 +- configs/helm/tests/serviceaccount_test.yaml | 1 + configs/helm/tests/servicemonitor_test.yaml | 1 + .../tests/values/with_additional_labels.yaml | 1 + .../values/with_awsCredentialsSecret.yaml | 1 + .../values/with_deployment_priorityclass.yaml | 1 + .../values/with_environment_variables.yaml | 1 + configs/helm/tests/values/with_image_tag.yaml | 1 + .../tests/values/with_serviceaccount.yaml | 1 + .../tests/values/with_servicemonitor.yaml | 1 + configs/helm/values.yaml | 18 ++- .../prometheus-rds-exporter.yaml | 24 ++-- .../provisioning/dashboards/default.yaml | 5 +- .../provisioning/datasources/default.yaml | 1 + scripts/prometheus/docker-compose.yml | 1 + scripts/prometheus/prometheus.yml | 7 +- 28 files changed, 122 insertions(+), 98 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2c5ae7f..6fe6533 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,13 +1,14 @@ +--- name: build run-name: building and publishing new release -on: +on: # yamllint disable-line rule:truthy push: # run only against tags tags: - "*" permissions: - contents: write # allows the action to create a Github release - id-token: write # This is required for requesting the AWS JWT + contents: write # allows the action to create a Github release + id-token: write # This is required for requesting the AWS JWT jobs: build-publish: @@ -21,7 +22,7 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: us-east-1 # ECR Public can only be logged into from the us-east-1 region + aws-region: us-east-1 # ECR Public can only be logged into from the us-east-1 region role-to-assume: arn:aws:iam::202662887508:role/ecr-prometheus-rds-exporter role-session-name: githubActions @@ -52,7 +53,7 @@ jobs: - name: Configure AWS credentials for helm chart uses: aws-actions/configure-aws-credentials@v4 with: - aws-region: us-east-1 # ECR Public can only be logged into from the us-east-1 region + aws-region: us-east-1 # ECR Public can only be logged into from the us-east-1 region role-to-assume: arn:aws:iam::202662887508:role/ecr-prometheus-rds-exporter-chart role-session-name: githubActions @@ -62,7 +63,7 @@ jobs: registry-type: public mask-password: 'true' - - name: Downgrade Helm # 1.13.0 has bug that block push charts on OCI + - name: Downgrade Helm # 1.13.0 has bug that block push charts on OCI run: | curl -sSLo /tmp/helm.tar.gz "https://get.helm.sh/helm-v3.12.0-linux-amd64.tar.gz" && \ tar --strip-components=1 -C /tmp -xzvf /tmp/helm.tar.gz linux-amd64/helm && \ diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index b52e99a..fc5af2a 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -1,5 +1,6 @@ +--- name: linter -on: +on: # yamllint disable-line rule:truthy push: branches: - "*" @@ -57,4 +58,4 @@ jobs: - uses: actions/checkout@v3 - name: Lint YAML files - run: yamllint . # YAML lint is already installed in ubuntu-latest + run: yamllint . # YAML lint is already installed in ubuntu-latest diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3be6d1a..5f0cdb3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,5 +1,6 @@ +--- name: unittest -on: +on: # yamllint disable-line rule:truthy push: branches: - "*" diff --git a/.golangci.yml b/.golangci.yml index 9da1faf..5ed6719 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,3 +1,4 @@ +--- run: concurrency: 4 deadline: 2m diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ba50ada..38b8fc8 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,4 +1,5 @@ # yaml-language-server: $schema=https://goreleaser.com/static/schema.json +--- env: - BUILD_INFO_PACKAGE_PATH=github.com/qonto/prometheus-rds-exporter/internal/infra/build - DOCKER_REGISTRY=public.ecr.aws/qonto @@ -8,11 +9,11 @@ builds: - env: - CGO_ENABLED=0 ldflags: - - '-s' - - '-w' - - '-X "{{ .Env.BUILD_INFO_PACKAGE_PATH }}.Version={{.Version}}"' - - '-X "{{ .Env.BUILD_INFO_PACKAGE_PATH }}.CommitSHA={{.Commit}}"' - - '-X "{{ .Env.BUILD_INFO_PACKAGE_PATH }}.Date={{.Date}}"' + - '-s' + - '-w' + - '-X "{{ .Env.BUILD_INFO_PACKAGE_PATH }}.Version={{.Version}}"' + - '-X "{{ .Env.BUILD_INFO_PACKAGE_PATH }}.CommitSHA={{.Commit}}"' + - '-X "{{ .Env.BUILD_INFO_PACKAGE_PATH }}.Date={{.Date}}"' goos: - linux - darwin @@ -58,8 +59,8 @@ archives: {{- if .Arm }}v{{ .Arm }}{{ end }} # use zip for windows archives format_overrides: - - goos: windows - format: zip + - goos: windows + format: zip files: - src: configs/prometheus-rds-exporter/prometheus-rds-exporter.yaml dst: prometheus-rds-exporter.yaml @@ -105,61 +106,61 @@ changelog: order: 9999 dockers: -- image_templates: - - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}-amd64" - - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}-amd64" - - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}-amd64" - - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest-amd64" - dockerfile: configs/goreleaser/Dockerfile - build_flag_templates: - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/qonto/prometheus-rds-exporter - - --label=org.opencontainers.image.source=https://github.com/qonto/prometheus-rds-exporter - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - --label=org.opencontainers.image.licenses=MIT - - "--pull" - - "--platform=linux/amd64" - use: buildx -- image_templates: - - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}-arm64" - - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}-arm64" - - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}-arm64" - - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest-arm64" - dockerfile: configs/goreleaser/Dockerfile - build_flag_templates: - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/qonto/prometheus-rds-exporter - - --label=org.opencontainers.image.source=https://github.com/qonto/prometheus-rds-exporter - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - --label=org.opencontainers.image.licenses=MIT - - "--pull" - - "--platform=linux/arm64" - use: buildx - goarch: arm64 + - image_templates: + - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}-amd64" + - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}-amd64" + - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}-amd64" + - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest-amd64" + dockerfile: configs/goreleaser/Dockerfile + build_flag_templates: + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://github.com/qonto/prometheus-rds-exporter + - --label=org.opencontainers.image.source=https://github.com/qonto/prometheus-rds-exporter + - --label=org.opencontainers.image.version={{ .Version }} + - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - --label=org.opencontainers.image.revision={{ .FullCommit }} + - --label=org.opencontainers.image.licenses=MIT + - "--pull" + - "--platform=linux/amd64" + use: buildx + - image_templates: + - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}-arm64" + - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}-arm64" + - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}-arm64" + - "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest-arm64" + dockerfile: configs/goreleaser/Dockerfile + build_flag_templates: + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://github.com/qonto/prometheus-rds-exporter + - --label=org.opencontainers.image.source=https://github.com/qonto/prometheus-rds-exporter + - --label=org.opencontainers.image.version={{ .Version }} + - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - --label=org.opencontainers.image.revision={{ .FullCommit }} + - --label=org.opencontainers.image.licenses=MIT + - "--pull" + - "--platform=linux/arm64" + use: buildx + goarch: arm64 docker_manifests: -- name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}' - image_templates: - - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}-amd64' - - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}-arm64' -- name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}' - image_templates: - - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}-amd64' - - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}-arm64' -- name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}' - image_templates: - - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}-amd64' - - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}-arm64' -- name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest' - image_templates: - - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest-amd64' - - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest-arm64' + - name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}' + image_templates: + - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}-amd64' + - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ .Tag }}-arm64' + - name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}' + image_templates: + - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}-amd64' + - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}-arm64' + - name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}' + image_templates: + - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}-amd64' + - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:v{{ .Major }}.{{ .Minor }}-arm64' + - name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest' + image_templates: + - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest-amd64' + - '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest-arm64' release: github: diff --git a/.markdownlint.yaml b/.markdownlint.yaml index ce89b9e..948176b 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,3 +1,4 @@ +--- # https://github.com/DavidAnson/markdownlint # MD013/line-length - Line length diff --git a/configs/helm/Chart.yaml b/configs/helm/Chart.yaml index fbff13e..e27ce6c 100644 --- a/configs/helm/Chart.yaml +++ b/configs/helm/Chart.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v2 type: application diff --git a/configs/helm/templates/deployment.yaml b/configs/helm/templates/deployment.yaml index b385e0f..4783111 100644 --- a/configs/helm/templates/deployment.yaml +++ b/configs/helm/templates/deployment.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: diff --git a/configs/helm/templates/ingress.yaml b/configs/helm/templates/ingress.yaml index 137b655..5ebb4b9 100644 --- a/configs/helm/templates/ingress.yaml +++ b/configs/helm/templates/ingress.yaml @@ -1,4 +1,5 @@ {{- if .Values.ingress.enabled -}} +--- {{- $fullName := include "prometheus-rds-exporter.fullname" . -}} {{- $svcPort := .Values.service.port -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} diff --git a/configs/helm/templates/service.yaml b/configs/helm/templates/service.yaml index bea891b..f4af801 100644 --- a/configs/helm/templates/service.yaml +++ b/configs/helm/templates/service.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: diff --git a/configs/helm/templates/serviceaccount.yaml b/configs/helm/templates/serviceaccount.yaml index 38660bc..07d8ad4 100644 --- a/configs/helm/templates/serviceaccount.yaml +++ b/configs/helm/templates/serviceaccount.yaml @@ -1,4 +1,5 @@ {{- if .Values.serviceAccount.create -}} +--- apiVersion: v1 kind: ServiceAccount metadata: diff --git a/configs/helm/templates/servicemonitor.yaml b/configs/helm/templates/servicemonitor.yaml index 7c04ce3..3ab9c53 100644 --- a/configs/helm/templates/servicemonitor.yaml +++ b/configs/helm/templates/servicemonitor.yaml @@ -1,5 +1,6 @@ {{- if .Values.serviceMonitor.enabled -}} -# CRD documentation available on https://github.com/prometheus-operator/prometheus-operator/blob/v0.68.0/Documentation/api.md#servicemonitor +--- +# CRD documentation available on https://github.com/prometheus-operator/prometheus-operator/blob/v0.68.0/Documentation/api.md#servicemonitor apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: diff --git a/configs/helm/tests/deployment_test.yaml b/configs/helm/tests/deployment_test.yaml index f1491cd..b2d3c30 100644 --- a/configs/helm/tests/deployment_test.yaml +++ b/configs/helm/tests/deployment_test.yaml @@ -1,4 +1,5 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json suite: deployment tests templates: - deployment.yaml diff --git a/configs/helm/tests/serviceaccount_test.yaml b/configs/helm/tests/serviceaccount_test.yaml index b815ff9..321f3e5 100644 --- a/configs/helm/tests/serviceaccount_test.yaml +++ b/configs/helm/tests/serviceaccount_test.yaml @@ -1,4 +1,5 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json +--- suite: service account tests templates: - serviceaccount.yaml diff --git a/configs/helm/tests/servicemonitor_test.yaml b/configs/helm/tests/servicemonitor_test.yaml index ab118cb..815814d 100644 --- a/configs/helm/tests/servicemonitor_test.yaml +++ b/configs/helm/tests/servicemonitor_test.yaml @@ -1,4 +1,5 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json +--- suite: service monitor tests templates: - servicemonitor.yaml diff --git a/configs/helm/tests/values/with_additional_labels.yaml b/configs/helm/tests/values/with_additional_labels.yaml index 3aa48fa..0fa9559 100644 --- a/configs/helm/tests/values/with_additional_labels.yaml +++ b/configs/helm/tests/values/with_additional_labels.yaml @@ -1,3 +1,4 @@ +--- additionalLabels: label1: value1 label2: value2 diff --git a/configs/helm/tests/values/with_awsCredentialsSecret.yaml b/configs/helm/tests/values/with_awsCredentialsSecret.yaml index 11928b0..c2c77eb 100644 --- a/configs/helm/tests/values/with_awsCredentialsSecret.yaml +++ b/configs/helm/tests/values/with_awsCredentialsSecret.yaml @@ -1 +1,2 @@ +--- awsCredentialsSecret: my_aws_credentials diff --git a/configs/helm/tests/values/with_deployment_priorityclass.yaml b/configs/helm/tests/values/with_deployment_priorityclass.yaml index 3a2a02a..339afe7 100644 --- a/configs/helm/tests/values/with_deployment_priorityclass.yaml +++ b/configs/helm/tests/values/with_deployment_priorityclass.yaml @@ -1 +1,2 @@ +--- priorityClassName: high-priority diff --git a/configs/helm/tests/values/with_environment_variables.yaml b/configs/helm/tests/values/with_environment_variables.yaml index 72b14b0..211ccf5 100644 --- a/configs/helm/tests/values/with_environment_variables.yaml +++ b/configs/helm/tests/values/with_environment_variables.yaml @@ -1,3 +1,4 @@ +--- env: variable1: value1 variable2: value2 diff --git a/configs/helm/tests/values/with_image_tag.yaml b/configs/helm/tests/values/with_image_tag.yaml index 410f024..3dee3ec 100644 --- a/configs/helm/tests/values/with_image_tag.yaml +++ b/configs/helm/tests/values/with_image_tag.yaml @@ -1,2 +1,3 @@ +--- image: tag: "1.0" diff --git a/configs/helm/tests/values/with_serviceaccount.yaml b/configs/helm/tests/values/with_serviceaccount.yaml index d5a2842..e0b81ec 100644 --- a/configs/helm/tests/values/with_serviceaccount.yaml +++ b/configs/helm/tests/values/with_serviceaccount.yaml @@ -1,3 +1,4 @@ +--- serviceAccount: annotations: "eks.amazonaws.com/role-arn": "arn:aws:iam::012345678901:role/prometheus-rds-exporter" diff --git a/configs/helm/tests/values/with_servicemonitor.yaml b/configs/helm/tests/values/with_servicemonitor.yaml index 08ced51..4e0c284 100644 --- a/configs/helm/tests/values/with_servicemonitor.yaml +++ b/configs/helm/tests/values/with_servicemonitor.yaml @@ -1,3 +1,4 @@ +--- serviceMonitor: enabled: true interval: 120s diff --git a/configs/helm/values.yaml b/configs/helm/values.yaml index 9c245c3..97e9f92 100644 --- a/configs/helm/values.yaml +++ b/configs/helm/values.yaml @@ -1,3 +1,4 @@ +--- # Default values for prometheus-rds-exporter. replicaCount: 1 @@ -5,7 +6,7 @@ replicaCount: 1 image: repository: public.ecr.aws/qonto/prometheus-rds-exporter pullPolicy: IfNotPresent - tag: "" # Defined by chart appVersion parameter + tag: "" # Defined by chart appVersion parameter # Define environment variables env: {} @@ -32,14 +33,13 @@ serviceAccount: podAnnotations: {} podSecurityContext: {} - # fsGroup: 2000 priorityClassName: "" securityContext: capabilities: drop: - - ALL + - ALL readOnlyRootFilesystem: true runAsNonRoot: true runAsGroup: 1001 @@ -53,8 +53,6 @@ ingress: enabled: false className: "" annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" hosts: - host: prometheus-rds-exporter.local paths: @@ -68,11 +66,11 @@ ingress: serviceMonitor: enabled: true interval: 60s - #scrapeTimeout: 30s - additionalLabels: {} # The labels to add on ServiceMonitor CRD - relabelings: [] # RelabelConfigs to apply to samples before scraping - metricRelabelings: [] # MetricRelabelConfigs to apply to samples before ingestion - sampleLimit: 0 # SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. + # scrapeTimeout: 30s + additionalLabels: {} # The labels to add on ServiceMonitor CRD + relabelings: [] # RelabelConfigs to apply to samples before scraping + metricRelabelings: [] # MetricRelabelConfigs to apply to samples before ingestion + sampleLimit: 0 # SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. resources: limits: # cpu: 100m diff --git a/configs/prometheus-rds-exporter/prometheus-rds-exporter.yaml b/configs/prometheus-rds-exporter/prometheus-rds-exporter.yaml index 1e15a73..da15253 100644 --- a/configs/prometheus-rds-exporter/prometheus-rds-exporter.yaml +++ b/configs/prometheus-rds-exporter/prometheus-rds-exporter.yaml @@ -3,45 +3,45 @@ # # Enable debug mode -#debug: false +# debug: false # Path under which to expose metrics -#metrics-path: /metrics +# metrics-path: /metrics # Address to listen on for web interface -#listen-address: ":9043" +# listen-address: ":9043" # Log format (text or json) -#log-format: json +# log-format: json # # AWS credentials # # AWS IAM ARN role to assume to fetch metrics -#aws-assume-role-arn: arn:aws:iam::000000000000:role/prometheus-rds-exporter +# aws-assume-role-arn: arn:aws:iam::000000000000:role/prometheus-rds-exporter # AWS assume role session name -#aws-assume-role-session: prometheus-rds-exporter +# aws-assume-role-session: prometheus-rds-exporter # # Metrics # # Collect AWS instances metrics (AWS Cloudwatch API) -#collect-instance-metrics: true +# collect-instance-metrics: true # Collect AWS instance types information (AWS EC2 API) -#collect-instance-types: true +# collect-instance-types: true # Collect AWS instances logs size (AWS RDS API) -#collect-logs-size: true +# collect-logs-size: true # Collect AWS instances maintenances (AWS RDS API) -#collect-maintenances: true +# collect-maintenances: true # Collect AWS RDS quotas (AWS quotas API) -#collect-quotas: true +# collect-quotas: true # Collect AWS RDS usages (AWS Cloudwatch API) -#collect-usages: true +# collect-usages: true diff --git a/scripts/prometheus/configuration/grafana/provisioning/dashboards/default.yaml b/scripts/prometheus/configuration/grafana/provisioning/dashboards/default.yaml index 1408296..c3ecd9f 100644 --- a/scripts/prometheus/configuration/grafana/provisioning/dashboards/default.yaml +++ b/scripts/prometheus/configuration/grafana/provisioning/dashboards/default.yaml @@ -1,3 +1,4 @@ +--- apiVersion: 1 providers: @@ -5,7 +6,7 @@ providers: folder: '' folderUid: '' type: file - allowUiUpdates: true # Allow change from UI - disableDeletion: true # Do not delete dashboard + allowUiUpdates: true # Allow change from UI + disableDeletion: true # Do not delete dashboard options: path: /var/tmp/dashboards diff --git a/scripts/prometheus/configuration/grafana/provisioning/datasources/default.yaml b/scripts/prometheus/configuration/grafana/provisioning/datasources/default.yaml index 921f7fe..7777b43 100644 --- a/scripts/prometheus/configuration/grafana/provisioning/datasources/default.yaml +++ b/scripts/prometheus/configuration/grafana/provisioning/datasources/default.yaml @@ -1,3 +1,4 @@ +--- apiVersion: 1 datasources: diff --git a/scripts/prometheus/docker-compose.yml b/scripts/prometheus/docker-compose.yml index 6f77e18..ebed44f 100644 --- a/scripts/prometheus/docker-compose.yml +++ b/scripts/prometheus/docker-compose.yml @@ -1,3 +1,4 @@ +--- version: '3.1' volumes: diff --git a/scripts/prometheus/prometheus.yml b/scripts/prometheus/prometheus.yml index 69f8f19..889c235 100644 --- a/scripts/prometheus/prometheus.yml +++ b/scripts/prometheus/prometheus.yml @@ -1,10 +1,11 @@ +--- global: - scrape_interval: 30s # Set the scrape interval. Default is every 1 minute. - evaluation_interval: 30s # Evaluate rules every. The default is every 1 minute. + scrape_interval: 30s # Set the scrape interval. Default is every 1 minute. + evaluation_interval: 30s # Evaluate rules every. The default is every 1 minute. scrape_timeout: 10s # Scrape configuration scrape_configs: - job_name: 'rds-exporter' static_configs: - - targets: ['rds-exporter:9043'] + - targets: ['rds-exporter:9043']