Skip to content

Commit

Permalink
refact(yaml): Fix YAML linter
Browse files Browse the repository at this point in the history
  • Loading branch information
vmercierfr committed Nov 2, 2023
1 parent 3896688 commit ca269b2
Show file tree
Hide file tree
Showing 28 changed files with 123 additions and 98 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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 && \
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
name: linter
on:
on: # yamllint disable-line rule:truthy
push:
branches:
- "*"
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
name: unittest
on:
on: # yamllint disable-line rule:truthy
push:
branches:
- "*"
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
run:
concurrency: 4
deadline: 2m
Expand Down
122 changes: 62 additions & 60 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
---
version: 1
env:
- BUILD_INFO_PACKAGE_PATH=github.com/qonto/prometheus-rds-exporter/internal/infra/build
- DOCKER_REGISTRY=public.ecr.aws/qonto
Expand All @@ -8,11 +10,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
Expand Down Expand Up @@ -58,8 +60,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
Expand Down Expand Up @@ -105,61 +107,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:
Expand Down
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# https://github.com/DavidAnson/markdownlint

# MD013/line-length - Line length
Expand Down
1 change: 1 addition & 0 deletions configs/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v2
type: application

Expand Down
1 change: 1 addition & 0 deletions configs/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions configs/helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -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)) }}
Expand Down
1 change: 1 addition & 0 deletions configs/helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v1
kind: Service
metadata:
Expand Down
1 change: 1 addition & 0 deletions configs/helm/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.serviceAccount.create -}}
---
apiVersion: v1
kind: ServiceAccount
metadata:
Expand Down
3 changes: 2 additions & 1 deletion configs/helm/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
3 changes: 2 additions & 1 deletion configs/helm/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions configs/helm/tests/serviceaccount_test.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions configs/helm/tests/servicemonitor_test.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions configs/helm/tests/values/with_additional_labels.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
additionalLabels:
label1: value1
label2: value2
1 change: 1 addition & 0 deletions configs/helm/tests/values/with_awsCredentialsSecret.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
---
awsCredentialsSecret: my_aws_credentials
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
---
priorityClassName: high-priority
1 change: 1 addition & 0 deletions configs/helm/tests/values/with_environment_variables.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
env:
variable1: value1
variable2: value2
1 change: 1 addition & 0 deletions configs/helm/tests/values/with_image_tag.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
image:
tag: "1.0"
1 change: 1 addition & 0 deletions configs/helm/tests/values/with_serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
serviceAccount:
annotations:
"eks.amazonaws.com/role-arn": "arn:aws:iam::012345678901:role/prometheus-rds-exporter"
1 change: 1 addition & 0 deletions configs/helm/tests/values/with_servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
serviceMonitor:
enabled: true
interval: 120s
Expand Down
18 changes: 8 additions & 10 deletions configs/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
# Default values for prometheus-rds-exporter.

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: {}
Expand All @@ -32,14 +33,13 @@ serviceAccount:
podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

priorityClassName: ""

securityContext:
capabilities:
drop:
- ALL
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsGroup: 1001
Expand All @@ -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:
Expand All @@ -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
Expand Down
Loading

0 comments on commit ca269b2

Please sign in to comment.