From 7c307712f03734a94e4dc233d713a21520941487 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 20 Nov 2024 13:12:00 +0100 Subject: [PATCH] Update Docker build (#1569) Signed-off-by: SuperQ --- .github/dependabot.yml | 33 +- .github/workflows/ci.yml | 29 ++ .github/workflows/go.yml | 61 ---- .github/workflows/golangci-lint.yml | 39 +++ .github/workflows/push.yml | 15 +- .github/workflows/release.yml | 47 +-- .gitignore | 3 +- .yamllint | 25 ++ Dockerfile | 38 +-- docker-compose/docker-compose.yaml | 6 +- docker-compose/prometheus.yaml | 12 +- examples/apprunner.yaml | 54 ++-- pkg/config/testdata/config_test.yml | 293 +++++++++--------- .../discovery_job_exported_tags_alias.bad.yml | 28 +- ...scovery_job_exported_tags_mismatch.bad.yml | 28 +- .../testdata/discovery_job_type_alias.bad.yml | 28 +- .../discovery_job_type_unknown.bad.yml | 14 +- pkg/config/testdata/empty_rolearn.ok.yml | 32 +- .../externalid_with_empty_rolearn.bad.yml | 34 +- .../externalid_without_rolearn.bad.yml | 32 +- pkg/config/testdata/multiple_roles.ok.yml | 36 +-- pkg/config/testdata/sts_region.ok.yml | 24 +- pkg/config/testdata/unknown_version.bad.yml | 269 ++++++++-------- 23 files changed, 599 insertions(+), 581 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .yamllint diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7de7b56b2..82ba3a97f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,21 +1,16 @@ version: 2 updates: -- package-ecosystem: gomod - directory: / - schedule: - interval: weekly - open-pull-requests-limit: 10 - groups: - aws-sdk-v2: - patterns: - - "github.com/aws/aws-sdk-go-v2*" -- package-ecosystem: github-actions - directory: / - schedule: - interval: weekly - open-pull-requests-limit: 10 -- package-ecosystem: docker - directory: / - schedule: - interval: weekly - open-pull-requests-limit: 10 + - package-ecosystem: gomod + directory: / + schedule: + interval: monthly + open-pull-requests-limit: 10 + groups: + aws-sdk-v2: + patterns: + - "github.com/aws/aws-sdk-go-v2*" + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + open-pull-requests-limit: 10 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..785c7fcce --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: Go + +on: + pull_request: + workflow_call: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + container: + image: quay.io/prometheus/golang-builder:1.23-base + steps: + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: prometheus/promci@52c7012f5f0070d7281b8db4a119e21341d43c91 # v0.4.5 + - uses: ./.github/promci/actions/setup_environment + - run: make + - run: git diff --exit-code + + verify-example-configs: + name: verify + runs-on: ubuntu-latest + container: + image: quay.io/prometheus/golang-builder:1.23-base + steps: + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - run: make build + - name: Verify example configs + run: find ./examples -name "*.yml" -print0 | xargs -0 -I % ./yace verify-config -config.file % diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 1438a1c6e..000000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Go - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - - name: Set up Go 1.x - uses: actions/setup-go@v5 - with: - go-version: ^1.23 - - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - - name: Get dependencies - run: go mod download - - - name: Build - run: make build - - - name: Test - run: make test - - golangci: - name: Lint - runs-on: ubuntu-latest - steps: - - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: ^1.23 - - - name: golangci-lint - uses: golangci/golangci-lint-action@v6.1.1 - with: - args: --timeout=5m - - verify-example-configs: - name: verify - runs-on: ubuntu-latest - steps: - - - name: Set up Go 1.x - uses: actions/setup-go@v5 - with: - go-version: ^1.23 - - - uses: actions/checkout@v4 - - - name: Verify example configs - run: find ./examples -name "*.yml" -print0 | xargs -0 -I % go run ./cmd/yace verify-config -config.file % diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 000000000..305146993 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,39 @@ +--- +# This action is synced from https://github.com/prometheus/prometheus +name: golangci-lint +on: + push: + paths: + - "go.sum" + - "go.mod" + - "**.go" + - "scripts/errcheck_excludes.txt" + - ".github/workflows/golangci-lint.yml" + - ".golangci.yml" + pull_request: + +permissions: # added using https://github.com/step-security/secure-repo + contents: read + +jobs: + golangci: + permissions: + contents: read # for actions/checkout to fetch code + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests + name: lint + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install Go + uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + with: + go-version: 1.23.x + - name: Install snmp_exporter/generator dependencies + run: sudo apt-get update && sudo apt-get -y install libsnmp-dev + if: github.repository == 'prometheus/snmp_exporter' + - name: Lint + uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 + with: + args: --verbose + version: v1.61.0 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 3abdefde0..68f9e69aa 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -3,9 +3,16 @@ on: push name: Build and test jobs: buildDockerImage: - name: Build docker image + name: Publish master branch artifacts runs-on: ubuntu-latest + needs: [build, verify] + if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' steps: - - uses: actions/checkout@v4 - - name: Build docker image - run: docker build -t yace --build-arg VERSION=${{github.event.release.tag_name}} . + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: prometheus/promci@52c7012f5f0070d7281b8db4a119e21341d43c91 # v0.4.5 + - uses: ./.github/promci/actions/publish_master + with: + docker_hub_login: ${{ secrets.docker_hub_login }} + docker_hub_password: ${{ secrets.docker_hub_password }} + quay_io_login: ${{ secrets.quay_io_login }} + quay_io_password: ${{ secrets.quay_io_password }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad36b7412..0e5c83377 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,39 +3,24 @@ name: Publish Docker image and binaries on: push: tags: - - 'v*' + - 'v*' jobs: buildDockerImage: - if: github.repository == 'nerdswords/yet-another-cloudwatch-exporter' - name: Build docker image + name: Publish release artefacts runs-on: ubuntu-latest + needs: [build, verify] + if: | + (*github.repository == 'prometheus-community/yet-another-cloudwatch-exporter') + && + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v.')) steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: ^1.23 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log into docker - env: - DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - DOCKER_REGISTRY_URL: ghcr.io - DOCKER_USERNAME: ${{ github.actor }} - run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL - - - name: Build and Publish docker image - run: docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t ghcr.io/nerdswords/yet-another-cloudwatch-exporter:${{github.ref_name}} --build-arg VERSION=${{github.ref_name}} --push . - - - name: Build && release binaries - uses: goreleaser/goreleaser-action@v6 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: release --clean + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: prometheus/promci@52c7012f5f0070d7281b8db4a119e21341d43c91 # v0.4.5 + - uses: ./.github/promci/actions/publish_release + with: + docker_hub_login: ${{ secrets.docker_hub_login }} + docker_hub_password: ${{ secrets.docker_hub_password }} + quay_io_login: ${{ secrets.quay_io_login }} + quay_io_password: ${{ secrets.quay_io_password }} + github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 7479d5f1b..ca8f72649 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ +.build yet-another-cloudwatch-exporter !charts/yet-another-cloudwatch-exporter vendor dist /yace -.idea +*.tar.gz diff --git a/.yamllint b/.yamllint new file mode 100644 index 000000000..8d09c375f --- /dev/null +++ b/.yamllint @@ -0,0 +1,25 @@ +--- +extends: default +ignore: | + **/node_modules + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + commas: disable + comments: disable + comments-indentation: disable + document-start: disable + indentation: + spaces: consistent + indent-sequences: consistent + key-duplicates: + ignore: | + config/testdata/section_key_dup.bad.yml + line-length: disable + truthy: + check-keys: false diff --git a/Dockerfile b/Dockerfile index a45f6dade..6691c920d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,15 @@ -FROM golang:1.23 as builder +ARG ARCH="amd64" +ARG OS="linux" +FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest +LABEL maintainer="The Prometheus Authors " -WORKDIR /opt/ +ARG ARCH="amd64" +ARG OS="linux" +COPY .build/${OS}-${ARCH}/yace /bin/yace -COPY go.mod go.sum ./ -RUN go mod download +COPY examples/ec2.yml /etc/yace/config.yml -COPY . ./ - -ENV GOOS linux -ENV CGO_ENABLED=0 - -ARG VERSION -RUN go build -v -ldflags "-X main.version=$VERSION" -o yace ./cmd/yace - -FROM alpine:3.20.3 - -EXPOSE 5000 -ENTRYPOINT ["yace"] -CMD ["--config.file=/tmp/config.yml"] -RUN addgroup -g 1000 exporter && \ - adduser -u 1000 -D -G exporter exporter -h /exporter - -WORKDIR /exporter/ - - -RUN apk --no-cache add ca-certificates -COPY --from=builder /opt/yace /usr/local/bin/yace -USER exporter +EXPOSE 5000 +USER nobody +ENTRYPOINT [ "/bin/yace" ] +CMD [ "--config.file=/etc/yace/config.yml" ] diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml index 53e8caf80..fb9927ab1 100644 --- a/docker-compose/docker-compose.yaml +++ b/docker-compose/docker-compose.yaml @@ -3,7 +3,7 @@ version: '3.8' networks: monitoring: driver: bridge - + volumes: prometheus_data: {} @@ -43,14 +43,14 @@ services: - monitoring yace: - build: + build: context: ../ dockerfile: Dockerfile restart: always environment: AWS_REGION: ${AWS_REGION} AWS_PROFILE: ${AWS_PROFILE} - expose: + expose: - 8080 volumes: - ./yace-config.yaml:/tmp/config.yml diff --git a/docker-compose/prometheus.yaml b/docker-compose/prometheus.yaml index 08ce1f6a2..4bcab0c9a 100644 --- a/docker-compose/prometheus.yaml +++ b/docker-compose/prometheus.yaml @@ -1,12 +1,12 @@ global: scrape_interval: 1m - scrape_configs: - - job_name: "prometheus" + - job_name: prometheus scrape_interval: 1m static_configs: - - targets: ["localhost:9090"] - - - job_name: "yace" + - targets: + - localhost:9090 + - job_name: yace static_configs: - - targets: ["yace:8080"] + - targets: + - yace:8080 diff --git a/examples/apprunner.yaml b/examples/apprunner.yaml index 8cedcb232..d399767a0 100644 --- a/examples/apprunner.yaml +++ b/examples/apprunner.yaml @@ -1,25 +1,35 @@ apiVersion: v1alpha1 discovery: jobs: - - regions: - - us-east-1 - period: 300 - length: 300 - type: AWS/AppRunner - metrics: - - name: MemoryUtilization - statistics: [Average, Maximum] - - name: CPUUtilization - statistics: [Average, Maximum] - - name: 2xxStatusResponses - statistics: [Sum] - - name: Requests - statistics: [Sum] - - name: RequestLatency - statistics: [Average] - - name: ActiveInstances - statistics: [Maximum] - - name: 4xxStatusResponses - statistics: [Sum] - - name: Concurrency - statistics: [Maximum] + - regions: + - us-east-1 + period: 300 + length: 300 + type: AWS/AppRunner + metrics: + - name: MemoryUtilization + statistics: + - Average + - Maximum + - name: CPUUtilization + statistics: + - Average + - Maximum + - name: 2xxStatusResponses + statistics: + - Sum + - name: Requests + statistics: + - Sum + - name: RequestLatency + statistics: + - Average + - name: ActiveInstances + statistics: + - Maximum + - name: 4xxStatusResponses + statistics: + - Sum + - name: Concurrency + statistics: + - Maximum diff --git a/pkg/config/testdata/config_test.yml b/pkg/config/testdata/config_test.yml index d38dcedec..5ab181b44 100644 --- a/pkg/config/testdata/config_test.yml +++ b/pkg/config/testdata/config_test.yml @@ -6,166 +6,167 @@ discovery: AWS/Kafka: - Name jobs: - - type: AWS/Billing - regions: - - us-east-1 - metrics: - - name: EstimatedCharges - statistics: - - Sum - period: 3600 - length: 87600 - - type: AWS/ES - regions: - - eu-west-1 - searchTags: - - key: Environment - value: qa - metrics: - - name: FreeStorageSpace - statistics: - - Sum - period: 60 - length: 600 - - name: ClusterStatus.green - statistics: + - type: AWS/Billing + regions: + - us-east-1 + metrics: + - name: EstimatedCharges + statistics: + - Sum + period: 3600 + length: 87600 + - type: AWS/ES + regions: + - eu-west-1 + searchTags: + - key: Environment + value: qa + metrics: + - name: FreeStorageSpace + statistics: + - Sum + period: 60 + length: 600 + - name: ClusterStatus.green + statistics: + - Minimum + period: 60 + length: 600 + - name: ClusterStatus.yellow + statistics: + - Maximum + period: 60 + length: 600 + - name: ClusterStatus.red + statistics: + - Maximum + period: 60 + length: 600 + - type: AWS/ELB + regions: + - eu-west-1 + length: 900 + delay: 120 + statistics: - Minimum - period: 60 - length: 600 - - name: ClusterStatus.yellow - statistics: - Maximum - period: 60 - length: 600 - - name: ClusterStatus.red - statistics: - - Maximum - period: 60 - length: 600 - - type: AWS/ELB - regions: - - eu-west-1 - length: 900 - delay: 120 - statistics: - - Minimum - - Maximum - - Sum - searchTags: - - key: KubernetesCluster - value: production-19 - metrics: - - name: HealthyHostCount - statistics: - - Minimum - period: 600 - length: 600 #(this will be ignored) - - name: HTTPCode_Backend_4XX - statistics: - Sum - period: 60 - length: 900 #(this will be ignored) - delay: 300 #(this will be ignored) - nilToZero: true - - name: HTTPCode_Backend_5XX - period: 60 - - type: AWS/ApplicationELB - regions: - - eu-west-1 - searchTags: - - key: kubernetes.io/service-name - value: .* - metrics: - - name: UnHealthyHostCount - statistics: [Maximum] - period: 60 - length: 600 - - type: AWS/VPN - regions: - - eu-west-1 - searchTags: - - key: kubernetes.io/service-name - value: .* - metrics: - - name: TunnelState - statistics: - - p90 - period: 60 - length: 300 - - type: AWS/Kinesis - regions: - - eu-west-1 - metrics: - - name: PutRecords.Success - statistics: - - Sum - period: 60 - length: 300 - - type: AWS/KMS - regions: - - eu-west-1 - metrics: - - name: SecondsUntilKeyMaterialExpiration - statistics: - - Minimum - period: 60 - length: 300 - - type: AWS/S3 - regions: - - eu-west-1 - searchTags: - - key: type - value: public - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 - - name: BucketSizeBytes - statistics: - - Average - period: 86400 - length: 172800 - - type: AWS/EBS - regions: - - eu-west-1 - searchTags: - - key: type - value: public - metrics: - - name: BurstBalance - statistics: - - Minimum - period: 600 - length: 600 - addCloudwatchTimestamp: true - - type: AWS/Kafka - regions: - - eu-west-1 - searchTags: - - key: env - value: dev - metrics: - - name: BytesOutPerSec - statistics: - - Average - period: 600 - length: 600 + searchTags: + - key: KubernetesCluster + value: production-19 + metrics: + - name: HealthyHostCount + statistics: + - Minimum + period: 600 + length: 600 #(this will be ignored) + - name: HTTPCode_Backend_4XX + statistics: + - Sum + period: 60 + length: 900 #(this will be ignored) + delay: 300 #(this will be ignored) + nilToZero: true + - name: HTTPCode_Backend_5XX + period: 60 + - type: AWS/ApplicationELB + regions: + - eu-west-1 + searchTags: + - key: kubernetes.io/service-name + value: .* + metrics: + - name: UnHealthyHostCount + statistics: + - Maximum + period: 60 + length: 600 + - type: AWS/VPN + regions: + - eu-west-1 + searchTags: + - key: kubernetes.io/service-name + value: .* + metrics: + - name: TunnelState + statistics: + - p90 + period: 60 + length: 300 + - type: AWS/Kinesis + regions: + - eu-west-1 + metrics: + - name: PutRecords.Success + statistics: + - Sum + period: 60 + length: 300 + - type: AWS/KMS + regions: + - eu-west-1 + metrics: + - name: SecondsUntilKeyMaterialExpiration + statistics: + - Minimum + period: 60 + length: 300 + - type: AWS/S3 + regions: + - eu-west-1 + searchTags: + - key: type + value: public + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 + - name: BucketSizeBytes + statistics: + - Average + period: 86400 + length: 172800 + - type: AWS/EBS + regions: + - eu-west-1 + searchTags: + - key: type + value: public + metrics: + - name: BurstBalance + statistics: + - Minimum + period: 600 + length: 600 + addCloudwatchTimestamp: true + - type: AWS/Kafka + regions: + - eu-west-1 + searchTags: + - key: env + value: dev + metrics: + - name: BytesOutPerSec + statistics: + - Average + period: 600 + length: 600 static: - namespace: AWS/AutoScaling name: must_be_set regions: - eu-west-1 dimensions: - - name: AutoScalingGroupName - value: Test + - name: AutoScalingGroupName + value: Test customTags: - key: CustomTag value: CustomValue metrics: - name: GroupInServiceInstances statistics: - - Minimum + - Minimum period: 60 length: 300 diff --git a/pkg/config/testdata/discovery_job_exported_tags_alias.bad.yml b/pkg/config/testdata/discovery_job_exported_tags_alias.bad.yml index 391ee6bb0..9e89b5506 100644 --- a/pkg/config/testdata/discovery_job_exported_tags_alias.bad.yml +++ b/pkg/config/testdata/discovery_job_exported_tags_alias.bad.yml @@ -4,17 +4,17 @@ discovery: s3: - BucketName jobs: - - type: AWS/S3 - regions: - - eu-west-1 - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 - - name: BucketSizeBytes - statistics: - - Average - period: 86400 - length: 172800 + - type: AWS/S3 + regions: + - eu-west-1 + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 + - name: BucketSizeBytes + statistics: + - Average + period: 86400 + length: 172800 diff --git a/pkg/config/testdata/discovery_job_exported_tags_mismatch.bad.yml b/pkg/config/testdata/discovery_job_exported_tags_mismatch.bad.yml index 6c066ffd8..a68217e1e 100644 --- a/pkg/config/testdata/discovery_job_exported_tags_mismatch.bad.yml +++ b/pkg/config/testdata/discovery_job_exported_tags_mismatch.bad.yml @@ -4,17 +4,17 @@ discovery: AWS/RDS: - ClusterName jobs: - - type: AWS/S3 - regions: - - eu-west-1 - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 - - name: BucketSizeBytes - statistics: - - Average - period: 86400 - length: 172800 + - type: AWS/S3 + regions: + - eu-west-1 + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 + - name: BucketSizeBytes + statistics: + - Average + period: 86400 + length: 172800 diff --git a/pkg/config/testdata/discovery_job_type_alias.bad.yml b/pkg/config/testdata/discovery_job_type_alias.bad.yml index 8b6950026..7640ed771 100644 --- a/pkg/config/testdata/discovery_job_type_alias.bad.yml +++ b/pkg/config/testdata/discovery_job_type_alias.bad.yml @@ -1,17 +1,17 @@ apiVersion: v1alpha1 discovery: jobs: - - type: s3 - regions: - - eu-west-1 - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 - - name: BucketSizeBytes - statistics: - - Average - period: 86400 - length: 172800 + - type: s3 + regions: + - eu-west-1 + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 + - name: BucketSizeBytes + statistics: + - Average + period: 86400 + length: 172800 diff --git a/pkg/config/testdata/discovery_job_type_unknown.bad.yml b/pkg/config/testdata/discovery_job_type_unknown.bad.yml index 3d4060515..da707bb93 100644 --- a/pkg/config/testdata/discovery_job_type_unknown.bad.yml +++ b/pkg/config/testdata/discovery_job_type_unknown.bad.yml @@ -1,10 +1,10 @@ apiVersion: v1alpha1 discovery: jobs: - - type: AWS/FancyNewNamespace - regions: - - eu-west-1 - metrics: - - name: SomeMetric - statistics: - - Average + - type: AWS/FancyNewNamespace + regions: + - eu-west-1 + metrics: + - name: SomeMetric + statistics: + - Average diff --git a/pkg/config/testdata/empty_rolearn.ok.yml b/pkg/config/testdata/empty_rolearn.ok.yml index 7b527d3cd..5ad8d2ef8 100644 --- a/pkg/config/testdata/empty_rolearn.ok.yml +++ b/pkg/config/testdata/empty_rolearn.ok.yml @@ -1,19 +1,19 @@ apiVersion: v1alpha1 discovery: jobs: - - type: AWS/S3 - regions: - - eu-west-1 - roles: - - roleArn: - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 - - name: BucketSizeBytes - statistics: - - Average - period: 86400 - length: 172800 + - type: AWS/S3 + regions: + - eu-west-1 + roles: + - roleArn: + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 + - name: BucketSizeBytes + statistics: + - Average + period: 86400 + length: 172800 diff --git a/pkg/config/testdata/externalid_with_empty_rolearn.bad.yml b/pkg/config/testdata/externalid_with_empty_rolearn.bad.yml index 5ae983340..fd527c407 100644 --- a/pkg/config/testdata/externalid_with_empty_rolearn.bad.yml +++ b/pkg/config/testdata/externalid_with_empty_rolearn.bad.yml @@ -1,20 +1,20 @@ apiVersion: v1alpha1 discovery: jobs: - - type: AWS/S3 - regions: - - eu-west-1 - roles: - - externalId: something - roleArn: - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 - - name: BucketSizeBytes - statistics: - - Average - period: 86400 - length: 172800 + - type: AWS/S3 + regions: + - eu-west-1 + roles: + - externalId: something + roleArn: + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 + - name: BucketSizeBytes + statistics: + - Average + period: 86400 + length: 172800 diff --git a/pkg/config/testdata/externalid_without_rolearn.bad.yml b/pkg/config/testdata/externalid_without_rolearn.bad.yml index 7f69fe743..f712d93a8 100644 --- a/pkg/config/testdata/externalid_without_rolearn.bad.yml +++ b/pkg/config/testdata/externalid_without_rolearn.bad.yml @@ -1,19 +1,19 @@ apiVersion: v1alpha1 discovery: jobs: - - type: AWS/S3 - regions: - - eu-west-1 - roles: - - externalId: something - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 - - name: BucketSizeBytes - statistics: - - Average - period: 86400 - length: 172800 + - type: AWS/S3 + regions: + - eu-west-1 + roles: + - externalId: something + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 + - name: BucketSizeBytes + statistics: + - Average + period: 86400 + length: 172800 diff --git a/pkg/config/testdata/multiple_roles.ok.yml b/pkg/config/testdata/multiple_roles.ok.yml index db5e7cc12..fb6516268 100644 --- a/pkg/config/testdata/multiple_roles.ok.yml +++ b/pkg/config/testdata/multiple_roles.ok.yml @@ -1,21 +1,21 @@ apiVersion: v1alpha1 discovery: jobs: - - type: AWS/S3 - regions: - - eu-west-1 - roles: - - roleArn: something - externalId: something - - roleArn: something - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 - - name: BucketSizeBytes - statistics: - - Average - period: 86400 - length: 172800 + - type: AWS/S3 + regions: + - eu-west-1 + roles: + - roleArn: something + externalId: something + - roleArn: something + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 + - name: BucketSizeBytes + statistics: + - Average + period: 86400 + length: 172800 diff --git a/pkg/config/testdata/sts_region.ok.yml b/pkg/config/testdata/sts_region.ok.yml index 03ffd72bd..55c79fcd2 100644 --- a/pkg/config/testdata/sts_region.ok.yml +++ b/pkg/config/testdata/sts_region.ok.yml @@ -2,15 +2,15 @@ apiVersion: v1alpha1 sts-region: eu-west-1 discovery: jobs: - - type: AWS/S3 - regions: - - eu-west-1 - roles: - - externalId: something - roleArn: something - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 + - type: AWS/S3 + regions: + - eu-west-1 + roles: + - externalId: something + roleArn: something + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 diff --git a/pkg/config/testdata/unknown_version.bad.yml b/pkg/config/testdata/unknown_version.bad.yml index 78958e6ee..13e125ff4 100644 --- a/pkg/config/testdata/unknown_version.bad.yml +++ b/pkg/config/testdata/unknown_version.bad.yml @@ -6,151 +6,152 @@ discovery: AWS/Kafka: - Name jobs: - - type: AWS/Billing - regions: - - us-east-1 - metrics: - - name: EstimatedCharges - statistics: - - Sum - period: 3600 - length: 87600 - - type: AWS/ES - regions: - - eu-west-1 - searchTags: - - key: Environment - value: qa - metrics: - - name: FreeStorageSpace - statistics: - - Sum - period: 60 - length: 600 - - name: ClusterStatus.green - statistics: - - Minimum - period: 60 - length: 600 - - name: ClusterStatus.yellow - statistics: - - Maximum - period: 60 - length: 600 - - name: ClusterStatus.red - statistics: - - Maximum - period: 60 - length: 600 - - type: AWS/ELB - regions: - - eu-west-1 - length: 900 - delay: 120 - searchTags: - - key: KubernetesCluster - value: production-19 - metrics: - - name: HealthyHostCount - statistics: - - Minimum - period: 600 - length: 600 #(this will be ignored) - - name: HTTPCode_Backend_4XX - statistics: - - Sum - period: 60 - length: 900 #(this will be ignored) - delay: 300 #(this will be ignored) - nilToZero: true - - type: AWS/ApplicationELB - regions: - - eu-west-1 - searchTags: - - key: kubernetes.io/service-name - value: .* - metrics: - - name: UnHealthyHostCount - statistics: [Maximum] - period: 60 - length: 600 - - type: AWS/VPN - regions: - - eu-west-1 - searchTags: - - key: kubernetes.io/service-name - value: .* - metrics: - - name: TunnelState - statistics: - - p90 - period: 60 - length: 300 - - type: AWS/Kinesis - regions: - - eu-west-1 - metrics: - - name: PutRecords.Success - statistics: - - Sum - period: 60 - length: 300 - - type: AWS/S3 - regions: - - eu-west-1 - searchTags: - - key: type - value: public - metrics: - - name: NumberOfObjects - statistics: - - Average - period: 86400 - length: 172800 - - name: BucketSizeBytes - statistics: - - Average - period: 86400 - length: 172800 - - type: AWS/EBS - regions: - - eu-west-1 - searchTags: - - key: type - value: public - metrics: - - name: BurstBalance - statistics: - - Minimum - period: 600 - length: 600 - addCloudwatchTimestamp: true - - type: AWS/Kafka - regions: - - eu-west-1 - searchTags: - - key: env - value: dev - metrics: - - name: BytesOutPerSec - statistics: - - Average - period: 600 - length: 600 + - type: AWS/Billing + regions: + - us-east-1 + metrics: + - name: EstimatedCharges + statistics: + - Sum + period: 3600 + length: 87600 + - type: AWS/ES + regions: + - eu-west-1 + searchTags: + - key: Environment + value: qa + metrics: + - name: FreeStorageSpace + statistics: + - Sum + period: 60 + length: 600 + - name: ClusterStatus.green + statistics: + - Minimum + period: 60 + length: 600 + - name: ClusterStatus.yellow + statistics: + - Maximum + period: 60 + length: 600 + - name: ClusterStatus.red + statistics: + - Maximum + period: 60 + length: 600 + - type: AWS/ELB + regions: + - eu-west-1 + length: 900 + delay: 120 + searchTags: + - key: KubernetesCluster + value: production-19 + metrics: + - name: HealthyHostCount + statistics: + - Minimum + period: 600 + length: 600 #(this will be ignored) + - name: HTTPCode_Backend_4XX + statistics: + - Sum + period: 60 + length: 900 #(this will be ignored) + delay: 300 #(this will be ignored) + nilToZero: true + - type: AWS/ApplicationELB + regions: + - eu-west-1 + searchTags: + - key: kubernetes.io/service-name + value: .* + metrics: + - name: UnHealthyHostCount + statistics: + - Maximum + period: 60 + length: 600 + - type: AWS/VPN + regions: + - eu-west-1 + searchTags: + - key: kubernetes.io/service-name + value: .* + metrics: + - name: TunnelState + statistics: + - p90 + period: 60 + length: 300 + - type: AWS/Kinesis + regions: + - eu-west-1 + metrics: + - name: PutRecords.Success + statistics: + - Sum + period: 60 + length: 300 + - type: AWS/S3 + regions: + - eu-west-1 + searchTags: + - key: type + value: public + metrics: + - name: NumberOfObjects + statistics: + - Average + period: 86400 + length: 172800 + - name: BucketSizeBytes + statistics: + - Average + period: 86400 + length: 172800 + - type: AWS/EBS + regions: + - eu-west-1 + searchTags: + - key: type + value: public + metrics: + - name: BurstBalance + statistics: + - Minimum + period: 600 + length: 600 + addCloudwatchTimestamp: true + - type: AWS/Kafka + regions: + - eu-west-1 + searchTags: + - key: env + value: dev + metrics: + - name: BytesOutPerSec + statistics: + - Average + period: 600 + length: 600 static: - namespace: AWS/AutoScaling name: must_be_set regions: - eu-west-1 dimensions: - - name: AutoScalingGroupName - value: Test + - name: AutoScalingGroupName + value: Test customTags: - key: CustomTag value: CustomValue metrics: - name: GroupInServiceInstances statistics: - - Minimum + - Minimum period: 60 length: 300