mirror of
https://github.com/traefik/traefik.git
synced 2025-05-05 23:43:01 +00:00
Merge branch v2.11 into v3.3
This commit is contained in:
commit
05eb438ae1
2
Makefile
2
Makefile
@ -175,7 +175,7 @@ docs-pull-images:
|
|||||||
.PHONY: generate-crd
|
.PHONY: generate-crd
|
||||||
#? generate-crd: Generate CRD clientset and CRD manifests
|
#? generate-crd: Generate CRD clientset and CRD manifests
|
||||||
generate-crd:
|
generate-crd:
|
||||||
@$(CURDIR)/script/code-gen-docker.sh
|
@$(CURDIR)/script/code-gen.sh
|
||||||
|
|
||||||
.PHONY: generate-genconf
|
.PHONY: generate-genconf
|
||||||
#? generate-genconf: Generate code from dynamic configuration github.com/traefik/genconf
|
#? generate-genconf: Generate code from dynamic configuration github.com/traefik/genconf
|
||||||
|
@ -325,7 +325,8 @@ _Optional_
|
|||||||
If `region` is not provided, it is resolved from the EC2 metadata endpoint for EC2 tasks.
|
If `region` is not provided, it is resolved from the EC2 metadata endpoint for EC2 tasks.
|
||||||
In a FARGATE context it is resolved from the `AWS_REGION` environment variable.
|
In a FARGATE context it is resolved from the `AWS_REGION` environment variable.
|
||||||
|
|
||||||
If `accessKeyID` and `secretAccessKey` are not provided, credentials are resolved in the following order:
|
If `accessKeyID` and `secretAccessKey` are not provided, credentials are resolved in the order specified by the
|
||||||
|
[default credential chain of AWS SDK for Go V2](https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-gosdk.html#specifying-credentials):
|
||||||
|
|
||||||
- Using the environment variables `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN`.
|
- Using the environment variables `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN`.
|
||||||
- Using shared credentials, determined by `AWS_PROFILE` and `AWS_SHARED_CREDENTIALS_FILE`, defaults to `default` and `~/.aws/credentials`.
|
- Using shared credentials, determined by `AWS_PROFILE` and `AWS_SHARED_CREDENTIALS_FILE`, defaults to `default` and `~/.aws/credentials`.
|
||||||
|
@ -10,6 +10,12 @@ A Story of KV store & Containers
|
|||||||
|
|
||||||
Store your configuration in Redis and let Traefik do the rest!
|
Store your configuration in Redis and let Traefik do the rest!
|
||||||
|
|
||||||
|
!!! tip "Dynamic configuration updates"
|
||||||
|
|
||||||
|
Dynamic configuration updates require Redis [keyspace notifications](https://redis.io/docs/latest/develop/use/keyspace-notifications) to be enabled.
|
||||||
|
Cloud-managed Redis services (e.g., GCP Memorystore, AWS ElastiCache) may disable this by default due to CPU performance issues.
|
||||||
|
For more information, see the [Redis](https://redis.io/docs/latest/develop/use/keyspace-notifications/) documentation or refer to your cloud provider's documentation for specific configuration steps.
|
||||||
|
|
||||||
## Routing Configuration
|
## Routing Configuration
|
||||||
|
|
||||||
See the dedicated section in [routing](../routing/providers/kv.md).
|
See the dedicated section in [routing](../routing/providers/kv.md).
|
||||||
|
34
go.mod
34
go.mod
@ -8,7 +8,13 @@ require (
|
|||||||
github.com/abbot/go-http-auth v0.0.0-00010101000000-000000000000 // No tag on the repo.
|
github.com/abbot/go-http-auth v0.0.0-00010101000000-000000000000 // No tag on the repo.
|
||||||
github.com/andybalholm/brotli v1.1.1
|
github.com/andybalholm/brotli v1.1.1
|
||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
|
||||||
github.com/aws/aws-sdk-go v1.44.327
|
github.com/aws/aws-sdk-go-v2 v1.36.2
|
||||||
|
github.com/aws/aws-sdk-go-v2/config v1.28.7
|
||||||
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.48
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/ec2 v1.203.1
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/ecs v1.53.15
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.13
|
||||||
|
github.com/aws/smithy-go v1.22.2
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0
|
github.com/cenkalti/backoff/v4 v4.3.0
|
||||||
github.com/containous/alice v0.0.0-20181107144136-d83ebdd94cbd // No tag on the repo.
|
github.com/containous/alice v0.0.0-20181107144136-d83ebdd94cbd // No tag on the repo.
|
||||||
github.com/coreos/go-systemd/v22 v22.5.0
|
github.com/coreos/go-systemd/v22 v22.5.0
|
||||||
@ -90,7 +96,7 @@ require (
|
|||||||
golang.org/x/mod v0.22.0
|
golang.org/x/mod v0.22.0
|
||||||
golang.org/x/net v0.33.0
|
golang.org/x/net v0.33.0
|
||||||
golang.org/x/sync v0.10.0
|
golang.org/x/sync v0.10.0
|
||||||
golang.org/x/sys v0.28.0
|
golang.org/x/sys v0.29.0
|
||||||
golang.org/x/text v0.21.0
|
golang.org/x/text v0.21.0
|
||||||
golang.org/x/time v0.8.0
|
golang.org/x/time v0.8.0
|
||||||
golang.org/x/tools v0.28.0
|
golang.org/x/tools v0.28.0
|
||||||
@ -142,21 +148,17 @@ require (
|
|||||||
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 // indirect
|
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 // indirect
|
||||||
github.com/aliyun/alibaba-cloud-sdk-go v1.63.72 // indirect
|
github.com/aliyun/alibaba-cloud-sdk-go v1.63.72 // indirect
|
||||||
github.com/armon/go-metrics v0.4.1 // indirect
|
github.com/armon/go-metrics v0.4.1 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2 v1.32.7 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2/config v1.28.7 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.48 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 // indirect
|
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 // indirect
|
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.33 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 // indirect
|
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.33 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
|
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
|
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 // indirect
|
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.14 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/lightsail v1.42.8 // indirect
|
github.com/aws/aws-sdk-go-v2/service/lightsail v1.42.8 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/route53 v1.46.4 // indirect
|
github.com/aws/aws-sdk-go-v2/service/route53 v1.46.4 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 // indirect
|
github.com/aws/aws-sdk-go-v2/service/sso v1.24.11 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 // indirect
|
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.10 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 // indirect
|
github.com/aws/aws-sdk-go-v2/service/sts v1.33.9 // indirect
|
||||||
github.com/aws/smithy-go v1.22.1 // indirect
|
|
||||||
github.com/benbjohnson/clock v1.3.0 // indirect
|
github.com/benbjohnson/clock v1.3.0 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
|
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
|
||||||
@ -187,7 +189,7 @@ require (
|
|||||||
github.com/ghodss/yaml v1.0.0 // indirect
|
github.com/ghodss/yaml v1.0.0 // indirect
|
||||||
github.com/gin-gonic/gin v1.9.1 // indirect
|
github.com/gin-gonic/gin v1.9.1 // indirect
|
||||||
github.com/go-errors/errors v1.0.1 // indirect
|
github.com/go-errors/errors v1.0.1 // indirect
|
||||||
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
|
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
|
||||||
github.com/go-logfmt/logfmt v0.5.1 // indirect
|
github.com/go-logfmt/logfmt v0.5.1 // indirect
|
||||||
github.com/go-logr/logr v1.4.2 // indirect
|
github.com/go-logr/logr v1.4.2 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
@ -359,10 +361,10 @@ require (
|
|||||||
go.uber.org/ratelimit v0.3.0 // indirect
|
go.uber.org/ratelimit v0.3.0 // indirect
|
||||||
go.uber.org/zap v1.26.0 // indirect
|
go.uber.org/zap v1.26.0 // indirect
|
||||||
golang.org/x/arch v0.4.0 // indirect
|
golang.org/x/arch v0.4.0 // indirect
|
||||||
golang.org/x/crypto v0.31.0 // indirect
|
golang.org/x/crypto v0.32.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20241210194714-1829a127f884 // indirect
|
golang.org/x/exp v0.0.0-20241210194714-1829a127f884 // indirect
|
||||||
golang.org/x/oauth2 v0.24.0 // indirect
|
golang.org/x/oauth2 v0.24.0 // indirect
|
||||||
golang.org/x/term v0.27.0 // indirect
|
golang.org/x/term v0.28.0 // indirect
|
||||||
google.golang.org/api v0.214.0 // indirect
|
google.golang.org/api v0.214.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 // indirect
|
google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 // indirect
|
||||||
|
62
go.sum
62
go.sum
@ -149,41 +149,45 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
|
|||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||||
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
|
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
|
||||||
github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
|
github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
|
||||||
github.com/aws/aws-sdk-go v1.44.327 h1:ZS8oO4+7MOBLhkdwIhgtVeDzCeWOlTfKJS7EgggbIEY=
|
|
||||||
github.com/aws/aws-sdk-go v1.44.327/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
|
||||||
github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4=
|
github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4=
|
||||||
github.com/aws/aws-sdk-go-v2 v1.32.7 h1:ky5o35oENWi0JYWUZkB7WYvVPP+bcRF5/Iq7JWSb5Rw=
|
github.com/aws/aws-sdk-go-v2 v1.36.2 h1:Ub6I4lq/71+tPb/atswvToaLGVMxKZvjYDVOWEExOcU=
|
||||||
github.com/aws/aws-sdk-go-v2 v1.32.7/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U=
|
github.com/aws/aws-sdk-go-v2 v1.36.2/go.mod h1:LLXuLpgzEbD766Z5ECcRmi8AzSwfZItDtmABVkRLGzg=
|
||||||
github.com/aws/aws-sdk-go-v2/config v1.28.7 h1:GduUnoTXlhkgnxTD93g1nv4tVPILbdNQOzav+Wpg7AE=
|
github.com/aws/aws-sdk-go-v2/config v1.28.7 h1:GduUnoTXlhkgnxTD93g1nv4tVPILbdNQOzav+Wpg7AE=
|
||||||
github.com/aws/aws-sdk-go-v2/config v1.28.7/go.mod h1:vZGX6GVkIE8uECSUHB6MWAUsd4ZcG2Yq/dMa4refR3M=
|
github.com/aws/aws-sdk-go-v2/config v1.28.7/go.mod h1:vZGX6GVkIE8uECSUHB6MWAUsd4ZcG2Yq/dMa4refR3M=
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.48 h1:IYdLD1qTJ0zanRavulofmqut4afs45mOWEI+MzZtTfQ=
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.48 h1:IYdLD1qTJ0zanRavulofmqut4afs45mOWEI+MzZtTfQ=
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.48/go.mod h1:tOscxHN3CGmuX9idQ3+qbkzrjVIx32lqDSU1/0d/qXs=
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.48/go.mod h1:tOscxHN3CGmuX9idQ3+qbkzrjVIx32lqDSU1/0d/qXs=
|
||||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 h1:kqOrpojG71DxJm/KDPO+Z/y1phm1JlC8/iT+5XRmAn8=
|
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 h1:kqOrpojG71DxJm/KDPO+Z/y1phm1JlC8/iT+5XRmAn8=
|
||||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22/go.mod h1:NtSFajXVVL8TA2QNngagVZmUtXciyrHOt7xgz4faS/M=
|
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22/go.mod h1:NtSFajXVVL8TA2QNngagVZmUtXciyrHOt7xgz4faS/M=
|
||||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 h1:I/5wmGMffY4happ8NOCuIUEWGUvvFp5NSeQcXl9RHcI=
|
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.33 h1:knLyPMw3r3JsU8MFHWctE4/e2qWbPaxDYLlohPvnY8c=
|
||||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26/go.mod h1:FR8f4turZtNy6baO0KJ5FJUmXH/cSkI9fOngs0yl6mA=
|
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.33/go.mod h1:EBp2HQ3f+XCB+5J+IoEbGhoV7CpJbnrsd4asNXmTL0A=
|
||||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 h1:zXFLuEuMMUOvEARXFUVJdfqZ4bvvSgdGRq/ATcrQxzM=
|
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.33 h1:K0+Ne08zqti8J9jwENxZ5NoUyBnaFDTu3apwQJWrwwA=
|
||||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26/go.mod h1:3o2Wpy0bogG1kyOPrgkXA8pgIfEEv0+m19O9D5+W8y8=
|
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.33/go.mod h1:K97stwwzaWzmqxO8yLGHhClbVW1tC6VT1pDLk1pGrq4=
|
||||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ=
|
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ=
|
||||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
|
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
|
||||||
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o=
|
github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o=
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y=
|
github.com/aws/aws-sdk-go-v2/service/ec2 v1.203.1 h1:ZgY9zeVAe+54Qa7o1GXKRNTez79lffCeJSSinhl+qec=
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE=
|
github.com/aws/aws-sdk-go-v2/service/ec2 v1.203.1/go.mod h1:0naMk66LtdeTmE+1CWQTKwtzOQ2t8mavOhMhR0Pv1m0=
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 h1:8eUsivBQzZHqe/3FE+cqwfH+0p5Jo8PFM/QYQSmeZ+M=
|
github.com/aws/aws-sdk-go-v2/service/ecs v1.53.15 h1:uH0DMwDjLGgjjYMk3M1MXHggk37trTiJIvwyJNP17Ig=
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7/go.mod h1:kLPQvGUmxn/fqiCrDeohwG33bq2pQpGeY62yRO6Nrh0=
|
github.com/aws/aws-sdk-go-v2/service/ecs v1.53.15/go.mod h1:49tE5yYdlAHqZIO8u5+u9Xy9k8IaV0v5cstZrjnX5+c=
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 h1:eAh2A4b5IzM/lum78bZ590jy36+d/aFLgKF/4Vd1xPE=
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3/go.mod h1:0yKJC/kb8sAnmlYa6Zs3QVYqaC8ug2AbnNChv5Ox3uA=
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.14 h1:2scbY6//jy/s8+5vGrk7l1+UtHl0h9A4MjOO2k/TM2E=
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.14/go.mod h1:bRpZPHZpSe5YRHmPfK3h1M7UBFCn2szHzyx0rw04zro=
|
||||||
github.com/aws/aws-sdk-go-v2/service/lightsail v1.42.8 h1:+lmJoqxuUoPlSfGk5JYQQivd9YFjUvRZR6RPY+Wcx48=
|
github.com/aws/aws-sdk-go-v2/service/lightsail v1.42.8 h1:+lmJoqxuUoPlSfGk5JYQQivd9YFjUvRZR6RPY+Wcx48=
|
||||||
github.com/aws/aws-sdk-go-v2/service/lightsail v1.42.8/go.mod h1:Gg8/myP4+rgRi4+j9gQdbOEnMtwMAUUIeXo+nKCFVj8=
|
github.com/aws/aws-sdk-go-v2/service/lightsail v1.42.8/go.mod h1:Gg8/myP4+rgRi4+j9gQdbOEnMtwMAUUIeXo+nKCFVj8=
|
||||||
github.com/aws/aws-sdk-go-v2/service/route53 v1.46.4 h1:0jMtawybbfpFEIMy4wvfyW2Z4YLr7mnuzT0fhR67Nrc=
|
github.com/aws/aws-sdk-go-v2/service/route53 v1.46.4 h1:0jMtawybbfpFEIMy4wvfyW2Z4YLr7mnuzT0fhR67Nrc=
|
||||||
github.com/aws/aws-sdk-go-v2/service/route53 v1.46.4/go.mod h1:xlMODgumb0Pp8bzfpojqelDrf8SL9rb5ovwmwKJl+oU=
|
github.com/aws/aws-sdk-go-v2/service/route53 v1.46.4/go.mod h1:xlMODgumb0Pp8bzfpojqelDrf8SL9rb5ovwmwKJl+oU=
|
||||||
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 h1:CvuUmnXI7ebaUAhbJcDy9YQx8wHR69eZ9I7q5hszt/g=
|
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.13 h1:JfPeW7F6Y+VqBg6p+8zQv4wlgceguYu5ZT0USEGZ89g=
|
||||||
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8/go.mod h1:XDeGv1opzwm8ubxddF0cgqkZWsyOtw4lr6dxwmb6YQg=
|
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.13/go.mod h1:EonGQFn66wZkJJrrKXrryrxoS3V30rcHvaWvc6oGHCI=
|
||||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 h1:F2rBfNAL5UyswqoeWv9zs74N/NanhK16ydHW1pahX6E=
|
github.com/aws/aws-sdk-go-v2/service/sso v1.24.11 h1:kuIyu4fTT38Kj7YCC7ouNbVZSSpqkZ+LzIfhCr6Dg+I=
|
||||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7/go.mod h1:JfyQ0g2JG8+Krq0EuZNnRwX0mU0HrwY/tG6JNfcqh4k=
|
github.com/aws/aws-sdk-go-v2/service/sso v1.24.11/go.mod h1:Ro744S4fKiCCuZECXgOi760TiYylUM8ZBf6OGiZzJtY=
|
||||||
github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 h1:Xgv/hyNgvLda/M9l9qxXc4UFSgppnRczLxlMs5Ae/QY=
|
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.10 h1:l+dgv/64iVlQ3WsBbnn+JSbkj01jIi+SM0wYsj3y/hY=
|
||||||
github.com/aws/aws-sdk-go-v2/service/sts v1.33.3/go.mod h1:5Gn+d+VaaRgsjewpMvGazt0WfcFO+Md4wLOuBfGR9Bc=
|
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.10/go.mod h1:Fzsj6lZEb8AkTE5S68OhcbBqeWPsR8RnGuKPr8Todl8=
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/sts v1.33.9 h1:BRVDbewN6VZcwr+FBOszDKvYeXY1kJ+GGMCcpghlw0U=
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/sts v1.33.9/go.mod h1:f6vjfZER1M17Fokn0IzssOTMT2N8ZSq+7jnNF0tArvw=
|
||||||
github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
|
github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
|
||||||
github.com/aws/smithy-go v1.22.1 h1:/HPHZQ0g7f4eUeK6HKglFz8uwVfZKgoI25rb/J+dnro=
|
github.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ=
|
||||||
github.com/aws/smithy-go v1.22.1/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
|
github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
|
||||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||||
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
|
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
|
||||||
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||||
@ -364,8 +368,8 @@ github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm
|
|||||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||||
github.com/go-jose/go-jose/v4 v4.0.4 h1:VsjPI33J0SB9vQM6PLmNjoHqMQNGPiZ0rHL7Ni7Q6/E=
|
github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3AaE=
|
||||||
github.com/go-jose/go-jose/v4 v4.0.4/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc=
|
github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs=
|
github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs=
|
||||||
@ -1384,8 +1388,8 @@ golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIi
|
|||||||
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||||
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@ -1481,7 +1485,6 @@ golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qx
|
|||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
|
||||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||||
@ -1602,12 +1605,11 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
|
||||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||||
@ -1615,8 +1617,8 @@ golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
|
|||||||
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
|
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
|
||||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||||
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
|
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
|
||||||
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package logs
|
package logs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/smithy-go/logging"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewAWSWrapper(logger zerolog.Logger) aws.LoggerFunc {
|
func NewAWSWrapper(logger zerolog.Logger) logging.LoggerFunc {
|
||||||
if logger.GetLevel() > zerolog.DebugLevel {
|
if logger.GetLevel() > zerolog.DebugLevel {
|
||||||
return func(args ...interface{}) {}
|
return func(classification logging.Classification, format string, args ...interface{}) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
return func(args ...interface{}) {
|
return func(classification logging.Classification, format string, args ...interface{}) {
|
||||||
logger.Debug().CallerSkipFrame(2).MsgFunc(msgFunc(args...))
|
logger.Debug().CallerSkipFrame(2).MsgFunc(msgFunc(args...))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/aws/smithy-go/logging"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@ -18,7 +19,7 @@ func TestNewAWSWrapper(t *testing.T) {
|
|||||||
|
|
||||||
logger := NewAWSWrapper(zerolog.New(out).With().Caller().Logger())
|
logger := NewAWSWrapper(zerolog.New(out).With().Caller().Logger())
|
||||||
|
|
||||||
logger.Log("foo")
|
logger.Logf(logging.Debug, "%s", "foo")
|
||||||
|
|
||||||
assert.Equal(t, "<nil> DBG aws_test.go:21 > foo\n", buf.String())
|
assert.Equal(t, "<nil> DBG aws_test.go:22 > foo\n", buf.String())
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package ecs
|
package ecs
|
||||||
|
|
||||||
import "github.com/aws/aws-sdk-go/service/ecs"
|
import (
|
||||||
|
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
||||||
|
ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types"
|
||||||
|
)
|
||||||
|
|
||||||
func instance(ops ...func(*ecsInstance)) ecsInstance {
|
func instance(ops ...func(*ecsInstance)) ecsInstance {
|
||||||
e := &ecsInstance{
|
e := &ecsInstance{
|
||||||
containerDefinition: &ecs.ContainerDefinition{},
|
containerDefinition: &ecstypes.ContainerDefinition{},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, op := range ops {
|
for _, op := range ops {
|
||||||
@ -36,7 +39,7 @@ func iMachine(opts ...func(*machine)) func(*ecsInstance) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func mState(state string) func(*machine) {
|
func mState(state ec2types.InstanceStateName) func(*machine) {
|
||||||
return func(m *machine) {
|
return func(m *machine) {
|
||||||
m.state = state
|
m.state = state
|
||||||
}
|
}
|
||||||
@ -48,7 +51,7 @@ func mPrivateIP(ip string) func(*machine) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func mHealthStatus(status string) func(*machine) {
|
func mHealthStatus(status ecstypes.HealthStatus) func(*machine) {
|
||||||
return func(m *machine) {
|
return func(m *machine) {
|
||||||
m.healthStatus = status
|
m.healthStatus = status
|
||||||
}
|
}
|
||||||
@ -64,10 +67,10 @@ func mPorts(opts ...func(*portMapping)) func(*machine) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func mPort(containerPort, hostPort int32, protocol string) func(*portMapping) {
|
func mPort(containerPort, hostPort int32, protocol ecstypes.TransportProtocol) func(*portMapping) {
|
||||||
return func(pm *portMapping) {
|
return func(pm *portMapping) {
|
||||||
pm.containerPort = int64(containerPort)
|
pm.containerPort = containerPort
|
||||||
pm.hostPort = int64(hostPort)
|
pm.hostPort = hostPort
|
||||||
pm.protocol = protocol
|
pm.protocol = protocol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
||||||
|
ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types"
|
||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/traefik/traefik/v3/pkg/config/dynamic"
|
"github.com/traefik/traefik/v3/pkg/config/dynamic"
|
||||||
@ -161,12 +161,12 @@ func (p *Provider) filterInstance(ctx context.Context, instance ecsInstance) boo
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.ToLower(instance.machine.state) != ec2.InstanceStateNameRunning {
|
if instance.machine.state != ec2types.InstanceStateNameRunning {
|
||||||
logger.Debug().Msgf("Filtering ecs instance with an incorrect state %s (%s) (state = %s)", instance.Name, instance.ID, instance.machine.state)
|
logger.Debug().Msgf("Filtering ecs instance with an incorrect state %s (%s) (state = %s)", instance.Name, instance.ID, instance.machine.state)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if instance.machine.healthStatus == "UNHEALTHY" {
|
if instance.machine.healthStatus == ecstypes.HealthStatusUnhealthy {
|
||||||
logger.Debug().Msgf("Filtering unhealthy ecs instance %s (%s)", instance.Name, instance.ID)
|
logger.Debug().Msgf("Filtering unhealthy ecs instance %s (%s)", instance.Name, instance.ID)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -291,9 +291,9 @@ func (p *Provider) getIPPort(instance ecsInstance, serverPort string) (string, s
|
|||||||
func getPort(instance ecsInstance, serverPort string) string {
|
func getPort(instance ecsInstance, serverPort string) string {
|
||||||
if len(serverPort) > 0 {
|
if len(serverPort) > 0 {
|
||||||
for _, port := range instance.machine.ports {
|
for _, port := range instance.machine.ports {
|
||||||
containerPort := strconv.FormatInt(port.containerPort, 10)
|
containerPort := strconv.FormatInt(int64(port.containerPort), 10)
|
||||||
if serverPort == containerPort {
|
if serverPort == containerPort {
|
||||||
return strconv.FormatInt(port.hostPort, 10)
|
return strconv.FormatInt(int64(port.hostPort), 10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ func getPort(instance ecsInstance, serverPort string) string {
|
|||||||
|
|
||||||
var ports []nat.Port
|
var ports []nat.Port
|
||||||
for _, port := range instance.machine.ports {
|
for _, port := range instance.machine.ports {
|
||||||
natPort, err := nat.NewPort(port.protocol, strconv.FormatInt(port.hostPort, 10))
|
natPort, err := nat.NewPort(string(port.protocol), strconv.FormatInt(int64(port.hostPort), 10))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
||||||
|
ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
ptypes "github.com/traefik/paerser/types"
|
ptypes "github.com/traefik/paerser/types"
|
||||||
@ -31,10 +32,10 @@ func TestDefaultRule(t *testing.T) {
|
|||||||
id("1"),
|
id("1"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("10.0.0.1"),
|
mPrivateIP("10.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 1337, "TCP"),
|
mPort(0, 1337, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -89,10 +90,10 @@ func TestDefaultRule(t *testing.T) {
|
|||||||
name("Test"),
|
name("Test"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -149,10 +150,10 @@ func TestDefaultRule(t *testing.T) {
|
|||||||
"traefik.domain": "foo.bar",
|
"traefik.domain": "foo.bar",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -207,10 +208,10 @@ func TestDefaultRule(t *testing.T) {
|
|||||||
name("Test"),
|
name("Test"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -259,10 +260,10 @@ func TestDefaultRule(t *testing.T) {
|
|||||||
name("Test"),
|
name("Test"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -311,10 +312,10 @@ func TestDefaultRule(t *testing.T) {
|
|||||||
name("Test"),
|
name("Test"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -406,10 +407,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.test": "",
|
"traefik.http.services.test": "",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -445,10 +446,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.tcp.services.test": "",
|
"traefik.tcp.services.test": "",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -484,10 +485,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.udp.services.test": "",
|
"traefik.udp.services.test": "",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -521,10 +522,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
name("Test"),
|
name("Test"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -578,10 +579,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
name("Test"),
|
name("Test"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -589,10 +590,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
name("Test2"),
|
name("Test2"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -665,10 +666,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
name("Test"),
|
name("Test"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -677,10 +678,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
name("Test"),
|
name("Test"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -739,10 +740,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -800,10 +801,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.service": "Service1",
|
"traefik.http.routers.Router1.service": "Service1",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -858,10 +859,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -917,10 +918,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -977,10 +978,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service2.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service2.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1044,10 +1045,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.service": "Service1",
|
"traefik.http.routers.Router1.service": "Service1",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1103,10 +1104,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1117,10 +1118,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "false",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "false",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1163,10 +1164,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "false",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "false",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1177,10 +1178,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1191,10 +1192,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1237,10 +1238,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1251,10 +1252,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1313,10 +1314,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1379,10 +1380,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1393,10 +1394,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1462,10 +1463,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1476,10 +1477,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.middlewares.Middleware1.inflightreq.amount": "41",
|
"traefik.http.middlewares.Middleware1.inflightreq.amount": "41",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1539,10 +1540,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1553,10 +1554,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.middlewares.Middleware1.inflightreq.amount": "41",
|
"traefik.http.middlewares.Middleware1.inflightreq.amount": "41",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1567,10 +1568,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.middlewares.Middleware1.inflightreq.amount": "40",
|
"traefik.http.middlewares.Middleware1.inflightreq.amount": "40",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.3"),
|
mPrivateIP("127.0.0.3"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1633,10 +1634,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1647,10 +1648,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`bar.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`bar.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1704,10 +1705,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1718,10 +1719,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`bar.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`bar.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1732,10 +1733,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`foobar.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`foobar.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.3"),
|
mPrivateIP("127.0.0.3"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1792,10 +1793,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1807,10 +1808,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1868,10 +1869,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1881,10 +1882,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
"traefik.http.routers.Router1.rule": "Host(`foo.com`)",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1947,10 +1948,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.wrong.label": "42",
|
"traefik.wrong.label": "42",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2007,10 +2008,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.LoadBalancer.server.port": "80",
|
"traefik.http.services.Service1.LoadBalancer.server.port": "80",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(80, 8080, "tcp"),
|
mPort(80, 8080, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2067,10 +2068,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.LoadBalancer.server.port": "8040",
|
"traefik.http.services.Service1.LoadBalancer.server.port": "8040",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(80, 8080, "tcp"),
|
mPort(80, 8080, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2131,11 +2132,11 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service2.LoadBalancer.server.port": "4444",
|
"traefik.http.services.Service2.LoadBalancer.server.port": "4444",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(4444, 32123, "tcp"),
|
mPort(4444, 32123, ecstypes.TransportProtocolTcp),
|
||||||
mPort(4445, 32124, "tcp"),
|
mPort(4445, 32124, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2208,10 +2209,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service2.LoadBalancer.server.port": "8080",
|
"traefik.http.services.Service2.LoadBalancer.server.port": "8080",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2272,7 +2273,7 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
name("Test"),
|
name("Test"),
|
||||||
labels(map[string]string{}),
|
labels(map[string]string{}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(),
|
mPorts(),
|
||||||
),
|
),
|
||||||
@ -2309,7 +2310,7 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
"traefik.http.middlewares.Middleware1.inflightreq.amount": "42",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(),
|
mPorts(),
|
||||||
),
|
),
|
||||||
@ -2346,10 +2347,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.enable": "false",
|
"traefik.enable": "false",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2385,11 +2386,11 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.enable": "false",
|
"traefik.enable": "false",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mHealthStatus("UNHEALTHY"),
|
mHealthStatus(ecstypes.HealthStatusUnhealthy),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2425,10 +2426,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.enable": "false",
|
"traefik.enable": "false",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNamePending),
|
mState(ec2types.InstanceStateNamePending),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2464,10 +2465,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.tags": "foo",
|
"traefik.tags": "foo",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2504,10 +2505,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.tags": "foo",
|
"traefik.tags": "foo",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2565,10 +2566,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.routers.Test.middlewares": "Middleware1",
|
"traefik.http.routers.Test.middlewares": "Middleware1",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2636,10 +2637,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.tcp.routers.Test.middlewares": "Middleware1",
|
"traefik.tcp.routers.Test.middlewares": "Middleware1",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2698,10 +2699,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.tcp.routers.foo.tls": "true",
|
"traefik.tcp.routers.foo.tls": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2753,10 +2754,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.udp.routers.foo.entrypoints": "mydns",
|
"traefik.udp.routers.foo.entrypoints": "mydns",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "udp"),
|
mPort(0, 80, ecstypes.TransportProtocolUdp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2807,10 +2808,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.tcp.routers.foo.tls": "true",
|
"traefik.tcp.routers.foo.tls": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2858,10 +2859,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.tcp.services.foo.loadbalancer.server.port": "80",
|
"traefik.tcp.services.foo.loadbalancer.server.port": "80",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(80, 8080, "tcp"),
|
mPort(80, 8080, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2916,10 +2917,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.udp.services.foo.loadbalancer.server.port": "80",
|
"traefik.udp.services.foo.loadbalancer.server.port": "80",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(80, 8080, "udp"),
|
mPort(80, 8080, ecstypes.TransportProtocolUdp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2972,10 +2973,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2988,10 +2989,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
"traefik.http.services.Service1.loadbalancer.passhostheader": "true",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.2"),
|
mPrivateIP("127.0.0.2"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -3068,10 +3069,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.udp.services.foo.loadbalancer.server.port": "8080",
|
"traefik.udp.services.foo.loadbalancer.server.port": "8080",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -3118,10 +3119,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.tcp.services.foo.loadbalancer.server.port": "80",
|
"traefik.tcp.services.foo.loadbalancer.server.port": "80",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(80, 8080, "tcp"),
|
mPort(80, 8080, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -3169,10 +3170,10 @@ func Test_buildConfiguration(t *testing.T) {
|
|||||||
"traefik.tls.stores.default.defaultgeneratedcert.domain.sans": "foobar, fiibar",
|
"traefik.tls.stores.default.defaultgeneratedcert.domain.sans": "foobar, fiibar",
|
||||||
}),
|
}),
|
||||||
iMachine(
|
iMachine(
|
||||||
mState(ec2.InstanceStateNameRunning),
|
mState(ec2types.InstanceStateNameRunning),
|
||||||
mPrivateIP("127.0.0.1"),
|
mPrivateIP("127.0.0.1"),
|
||||||
mPorts(
|
mPorts(
|
||||||
mPort(0, 80, "tcp"),
|
mPort(0, 80, ecstypes.TransportProtocolTcp),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -3,21 +3,21 @@ package ecs
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"iter"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go-v2/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/credentials"
|
"github.com/aws/aws-sdk-go-v2/config"
|
||||||
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
|
"github.com/aws/aws-sdk-go-v2/credentials"
|
||||||
"github.com/aws/aws-sdk-go/aws/defaults"
|
"github.com/aws/aws-sdk-go-v2/service/ec2"
|
||||||
"github.com/aws/aws-sdk-go/aws/ec2metadata"
|
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go-v2/service/ecs"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
ecstypes "github.com/aws/aws-sdk-go-v2/service/ecs/types"
|
||||||
"github.com/aws/aws-sdk-go/service/ecs"
|
"github.com/aws/aws-sdk-go-v2/service/ssm"
|
||||||
"github.com/aws/aws-sdk-go/service/ssm"
|
ssmtypes "github.com/aws/aws-sdk-go-v2/service/ssm/types"
|
||||||
"github.com/aws/aws-sdk-go/service/sts"
|
|
||||||
"github.com/cenkalti/backoff/v4"
|
"github.com/cenkalti/backoff/v4"
|
||||||
"github.com/patrickmn/go-cache"
|
"github.com/patrickmn/go-cache"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
@ -50,29 +50,29 @@ type Provider struct {
|
|||||||
type ecsInstance struct {
|
type ecsInstance struct {
|
||||||
Name string
|
Name string
|
||||||
ID string
|
ID string
|
||||||
containerDefinition *ecs.ContainerDefinition
|
containerDefinition *ecstypes.ContainerDefinition
|
||||||
machine *machine
|
machine *machine
|
||||||
Labels map[string]string
|
Labels map[string]string
|
||||||
ExtraConf configuration
|
ExtraConf configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
type portMapping struct {
|
type portMapping struct {
|
||||||
containerPort int64
|
containerPort int32
|
||||||
hostPort int64
|
hostPort int32
|
||||||
protocol string
|
protocol ecstypes.TransportProtocol
|
||||||
}
|
}
|
||||||
|
|
||||||
type machine struct {
|
type machine struct {
|
||||||
state string
|
state ec2types.InstanceStateName
|
||||||
privateIP string
|
privateIP string
|
||||||
ports []portMapping
|
ports []portMapping
|
||||||
healthStatus string
|
healthStatus ecstypes.HealthStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
type awsClient struct {
|
type awsClient struct {
|
||||||
ecs *ecs.ECS
|
ecs *ecs.Client
|
||||||
ec2 *ec2.EC2
|
ec2 *ec2.Client
|
||||||
ssm *ssm.SSM
|
ssm *ssm.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultTemplateRule The default template for the default rule.
|
// DefaultTemplateRule The default template for the default rule.
|
||||||
@ -104,54 +104,38 @@ func (p *Provider) Init() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Provider) createClient(logger zerolog.Logger) (*awsClient, error) {
|
func (p *Provider) createClient(ctx context.Context, logger zerolog.Logger) (*awsClient, error) {
|
||||||
sess, err := session.NewSessionWithOptions(session.Options{
|
optFns := []func(*config.LoadOptions) error{
|
||||||
SharedConfigState: session.SharedConfigEnable,
|
config.WithLogger(logs.NewAWSWrapper(logger)),
|
||||||
})
|
}
|
||||||
|
if p.Region != "" {
|
||||||
|
optFns = append(optFns, config.WithRegion(p.Region))
|
||||||
|
} else {
|
||||||
|
logger.Info().Msg("No region provided, will retrieve region from the EC2 Metadata service")
|
||||||
|
optFns = append(optFns, config.WithEC2IMDSRegion())
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.AccessKeyID != "" && p.SecretAccessKey != "" {
|
||||||
|
// From https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-gosdk.html#specify-credentials-programmatically:
|
||||||
|
// "If you explicitly provide credentials, as in this example, the SDK uses only those credentials."
|
||||||
|
// this makes sure that user-defined credentials always have the highest priority
|
||||||
|
staticCreds := aws.NewCredentialsCache(credentials.NewStaticCredentialsProvider(p.AccessKeyID, p.SecretAccessKey, ""))
|
||||||
|
optFns = append(optFns, config.WithCredentialsProvider(staticCreds))
|
||||||
|
|
||||||
|
// If the access key and secret access key are not provided, config.LoadDefaultConfig
|
||||||
|
// will look for the credentials in the default credential chain.
|
||||||
|
// See https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-gosdk.html#specifying-credentials.
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg, err := config.LoadDefaultConfig(ctx, optFns...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ec2meta := ec2metadata.New(sess)
|
|
||||||
if p.Region == "" && ec2meta.Available() {
|
|
||||||
logger.Info().Msg("No region provided, querying instance metadata endpoint...")
|
|
||||||
identity, err := ec2meta.GetInstanceIdentityDocument()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
p.Region = identity.Region
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg := aws.NewConfig().
|
|
||||||
WithCredentials(credentials.NewChainCredentials([]credentials.Provider{
|
|
||||||
&credentials.StaticProvider{
|
|
||||||
Value: credentials.Value{
|
|
||||||
AccessKeyID: p.AccessKeyID,
|
|
||||||
SecretAccessKey: p.SecretAccessKey,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&credentials.EnvProvider{},
|
|
||||||
&credentials.SharedCredentialsProvider{},
|
|
||||||
defaults.RemoteCredProvider(*(defaults.Config()), defaults.Handlers()),
|
|
||||||
stscreds.NewWebIdentityRoleProviderWithOptions(
|
|
||||||
sts.New(sess),
|
|
||||||
os.Getenv("AWS_ROLE_ARN"),
|
|
||||||
"",
|
|
||||||
stscreds.FetchTokenPath(os.Getenv("AWS_WEB_IDENTITY_TOKEN_FILE")),
|
|
||||||
),
|
|
||||||
}))
|
|
||||||
|
|
||||||
// Set the region if it is defined by the user or resolved from the EC2 metadata.
|
|
||||||
if p.Region != "" {
|
|
||||||
cfg.Region = &p.Region
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg.WithLogger(logs.NewAWSWrapper(logger))
|
|
||||||
|
|
||||||
return &awsClient{
|
return &awsClient{
|
||||||
ecs.New(sess, cfg),
|
ecs.NewFromConfig(cfg),
|
||||||
ec2.New(sess, cfg),
|
ec2.NewFromConfig(cfg),
|
||||||
ssm.New(sess, cfg),
|
ssm.NewFromConfig(cfg),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +146,7 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
|
|||||||
ctxLog := logger.WithContext(routineCtx)
|
ctxLog := logger.WithContext(routineCtx)
|
||||||
|
|
||||||
operation := func() error {
|
operation := func() error {
|
||||||
awsClient, err := p.createClient(logger)
|
awsClient, err := p.createClient(ctxLog, logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to create AWS client: %w", err)
|
return fmt.Errorf("unable to create AWS client: %w", err)
|
||||||
}
|
}
|
||||||
@ -220,28 +204,19 @@ func (p *Provider) loadConfiguration(ctx context.Context, client *awsClient, con
|
|||||||
func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsInstance, error) {
|
func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsInstance, error) {
|
||||||
logger := log.Ctx(ctx)
|
logger := log.Ctx(ctx)
|
||||||
|
|
||||||
var clustersArn []*string
|
|
||||||
var clusters []string
|
var clusters []string
|
||||||
|
|
||||||
if p.AutoDiscoverClusters {
|
if p.AutoDiscoverClusters {
|
||||||
input := &ecs.ListClustersInput{}
|
input := &ecs.ListClustersInput{}
|
||||||
for {
|
|
||||||
result, err := client.ecs.ListClusters(input)
|
paginator := ecs.NewListClustersPaginator(client.ecs, input)
|
||||||
|
for paginator.HasMorePages() {
|
||||||
|
page, err := paginator.NextPage(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if result != nil {
|
|
||||||
clustersArn = append(clustersArn, result.ClusterArns...)
|
clusters = append(clusters, page.ClusterArns...)
|
||||||
input.NextToken = result.NextToken
|
|
||||||
if result.NextToken == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, cArn := range clustersArn {
|
|
||||||
clusters = append(clusters, *cArn)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clusters = p.Clusters
|
clusters = p.Clusters
|
||||||
@ -253,13 +228,19 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
|
|||||||
for _, c := range clusters {
|
for _, c := range clusters {
|
||||||
input := &ecs.ListTasksInput{
|
input := &ecs.ListTasksInput{
|
||||||
Cluster: &c,
|
Cluster: &c,
|
||||||
DesiredStatus: aws.String(ecs.DesiredStatusRunning),
|
DesiredStatus: ecstypes.DesiredStatusRunning,
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks := make(map[string]*ecs.Task)
|
tasks := make(map[string]ecstypes.Task)
|
||||||
err := client.ecs.ListTasksPagesWithContext(ctx, input, func(page *ecs.ListTasksOutput, lastPage bool) bool {
|
|
||||||
|
paginator := ecs.NewListTasksPaginator(client.ecs, input)
|
||||||
|
for paginator.HasMorePages() {
|
||||||
|
page, err := paginator.NextPage(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("listing tasks: %w", err)
|
||||||
|
}
|
||||||
if len(page.TaskArns) > 0 {
|
if len(page.TaskArns) > 0 {
|
||||||
resp, err := client.ecs.DescribeTasksWithContext(ctx, &ecs.DescribeTasksInput{
|
resp, err := client.ecs.DescribeTasks(ctx, &ecs.DescribeTasksInput{
|
||||||
Tasks: page.TaskArns,
|
Tasks: page.TaskArns,
|
||||||
Cluster: &c,
|
Cluster: &c,
|
||||||
})
|
})
|
||||||
@ -267,19 +248,15 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
|
|||||||
logger.Error().Msgf("Unable to describe tasks for %v", page.TaskArns)
|
logger.Error().Msgf("Unable to describe tasks for %v", page.TaskArns)
|
||||||
} else {
|
} else {
|
||||||
for _, t := range resp.Tasks {
|
for _, t := range resp.Tasks {
|
||||||
if p.HealthyTasksOnly && aws.StringValue(t.HealthStatus) != ecs.HealthStatusHealthy {
|
if p.HealthyTasksOnly && t.HealthStatus != ecstypes.HealthStatusHealthy {
|
||||||
logger.Debug().Msgf("Skipping unhealthy task %s", aws.StringValue(t.TaskArn))
|
logger.Debug().Msgf("Skipping unhealthy task %s", aws.ToString(t.TaskArn))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks[aws.StringValue(t.TaskArn)] = t
|
tasks[aws.ToString(t.TaskArn)] = t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !lastPage
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("listing tasks: %w", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip to the next cluster if there are no tasks found on
|
// Skip to the next cluster if there are no tasks found on
|
||||||
@ -293,7 +270,7 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
miInstances := make(map[string]*ssm.InstanceInformation)
|
miInstances := make(map[string]ssmtypes.InstanceInformation)
|
||||||
if p.ECSAnywhere {
|
if p.ECSAnywhere {
|
||||||
// Try looking up for instances on ECS Anywhere
|
// Try looking up for instances on ECS Anywhere
|
||||||
miInstances, err = p.lookupMiInstances(ctx, client, &c, tasks)
|
miInstances, err = p.lookupMiInstances(ctx, client, &c, tasks)
|
||||||
@ -308,74 +285,67 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
|
|||||||
}
|
}
|
||||||
|
|
||||||
for key, task := range tasks {
|
for key, task := range tasks {
|
||||||
containerInstance := ec2Instances[aws.StringValue(task.ContainerInstanceArn)]
|
containerInstance, hasContainerInstance := ec2Instances[aws.ToString(task.ContainerInstanceArn)]
|
||||||
taskDef := taskDefinitions[key]
|
taskDef := taskDefinitions[key]
|
||||||
|
|
||||||
for _, container := range task.Containers {
|
for _, container := range task.Containers {
|
||||||
var containerDefinition *ecs.ContainerDefinition
|
var containerDefinition *ecstypes.ContainerDefinition
|
||||||
for _, def := range taskDef.ContainerDefinitions {
|
for _, def := range taskDef.ContainerDefinitions {
|
||||||
if aws.StringValue(container.Name) == aws.StringValue(def.Name) {
|
if aws.ToString(container.Name) == aws.ToString(def.Name) {
|
||||||
containerDefinition = def
|
containerDefinition = &def
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if containerDefinition == nil {
|
if containerDefinition == nil {
|
||||||
logger.Debug().Msgf("Unable to find container definition for %s", aws.StringValue(container.Name))
|
logger.Debug().Msgf("Unable to find container definition for %s", aws.ToString(container.Name))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var mach *machine
|
var mach *machine
|
||||||
if aws.StringValue(taskDef.NetworkMode) == "awsvpc" && len(task.Attachments) != 0 {
|
if taskDef.NetworkMode == ecstypes.NetworkModeAwsvpc && len(task.Attachments) != 0 {
|
||||||
if len(container.NetworkInterfaces) == 0 {
|
if len(container.NetworkInterfaces) == 0 {
|
||||||
logger.Error().Msgf("Skip container %s: no network interfaces", aws.StringValue(container.Name))
|
logger.Error().Msgf("Skip container %s: no network interfaces", aws.ToString(container.Name))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var ports []portMapping
|
var ports []portMapping
|
||||||
for _, mapping := range containerDefinition.PortMappings {
|
for _, mapping := range containerDefinition.PortMappings {
|
||||||
if mapping != nil {
|
ports = append(ports, portMapping{
|
||||||
protocol := "TCP"
|
hostPort: aws.ToInt32(mapping.HostPort),
|
||||||
if aws.StringValue(mapping.Protocol) == "udp" {
|
containerPort: aws.ToInt32(mapping.ContainerPort),
|
||||||
protocol = "UDP"
|
protocol: mapping.Protocol,
|
||||||
}
|
})
|
||||||
|
|
||||||
ports = append(ports, portMapping{
|
|
||||||
hostPort: aws.Int64Value(mapping.HostPort),
|
|
||||||
containerPort: aws.Int64Value(mapping.ContainerPort),
|
|
||||||
protocol: protocol,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mach = &machine{
|
mach = &machine{
|
||||||
privateIP: aws.StringValue(container.NetworkInterfaces[0].PrivateIpv4Address),
|
privateIP: aws.ToString(container.NetworkInterfaces[0].PrivateIpv4Address),
|
||||||
ports: ports,
|
ports: ports,
|
||||||
state: aws.StringValue(task.LastStatus),
|
state: ec2types.InstanceStateName(strings.ToLower(aws.ToString(task.LastStatus))),
|
||||||
healthStatus: aws.StringValue(task.HealthStatus),
|
healthStatus: task.HealthStatus,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
miContainerInstance := miInstances[aws.StringValue(task.ContainerInstanceArn)]
|
miContainerInstance, hasMiContainerInstance := miInstances[aws.ToString(task.ContainerInstanceArn)]
|
||||||
if containerInstance == nil && miContainerInstance == nil {
|
if !hasContainerInstance && !hasMiContainerInstance {
|
||||||
logger.Error().Msgf("Unable to find container instance information for %s", aws.StringValue(container.Name))
|
logger.Error().Msgf("Unable to find container instance information for %s", aws.ToString(container.Name))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var ports []portMapping
|
var ports []portMapping
|
||||||
for _, mapping := range container.NetworkBindings {
|
for _, mapping := range container.NetworkBindings {
|
||||||
if mapping != nil {
|
ports = append(ports, portMapping{
|
||||||
ports = append(ports, portMapping{
|
hostPort: aws.ToInt32(mapping.HostPort),
|
||||||
hostPort: aws.Int64Value(mapping.HostPort),
|
containerPort: aws.ToInt32(mapping.ContainerPort),
|
||||||
containerPort: aws.Int64Value(mapping.ContainerPort),
|
protocol: mapping.Protocol,
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var privateIPAddress, stateName string
|
var privateIPAddress string
|
||||||
if containerInstance != nil {
|
var stateName ec2types.InstanceStateName
|
||||||
privateIPAddress = aws.StringValue(containerInstance.PrivateIpAddress)
|
if hasContainerInstance {
|
||||||
stateName = aws.StringValue(containerInstance.State.Name)
|
privateIPAddress = aws.ToString(containerInstance.PrivateIpAddress)
|
||||||
} else if miContainerInstance != nil {
|
stateName = containerInstance.State.Name
|
||||||
privateIPAddress = aws.StringValue(miContainerInstance.IPAddress)
|
} else if hasMiContainerInstance {
|
||||||
stateName = aws.StringValue(task.LastStatus)
|
privateIPAddress = aws.ToString(miContainerInstance.IPAddress)
|
||||||
|
stateName = ec2types.InstanceStateName(strings.ToLower(aws.ToString(task.LastStatus)))
|
||||||
}
|
}
|
||||||
|
|
||||||
mach = &machine{
|
mach = &machine{
|
||||||
@ -386,11 +356,11 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
|
|||||||
}
|
}
|
||||||
|
|
||||||
instance := ecsInstance{
|
instance := ecsInstance{
|
||||||
Name: fmt.Sprintf("%s-%s", strings.Replace(aws.StringValue(task.Group), ":", "-", 1), *container.Name),
|
Name: fmt.Sprintf("%s-%s", strings.Replace(aws.ToString(task.Group), ":", "-", 1), aws.ToString(container.Name)),
|
||||||
ID: key[len(key)-12:],
|
ID: key[len(key)-12:],
|
||||||
containerDefinition: containerDefinition,
|
containerDefinition: containerDefinition,
|
||||||
machine: mach,
|
machine: mach,
|
||||||
Labels: aws.StringValueMap(containerDefinition.DockerLabels),
|
Labels: containerDefinition.DockerLabels,
|
||||||
}
|
}
|
||||||
|
|
||||||
extraConf, err := p.getConfiguration(instance)
|
extraConf, err := p.getConfiguration(instance)
|
||||||
@ -408,21 +378,21 @@ func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsI
|
|||||||
return instances, nil
|
return instances, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Provider) lookupMiInstances(ctx context.Context, client *awsClient, clusterName *string, ecsDatas map[string]*ecs.Task) (map[string]*ssm.InstanceInformation, error) {
|
func (p *Provider) lookupMiInstances(ctx context.Context, client *awsClient, clusterName *string, ecsDatas map[string]ecstypes.Task) (map[string]ssmtypes.InstanceInformation, error) {
|
||||||
instanceIDs := make(map[string]string)
|
instanceIDs := make(map[string]string)
|
||||||
miInstances := make(map[string]*ssm.InstanceInformation)
|
miInstances := make(map[string]ssmtypes.InstanceInformation)
|
||||||
|
|
||||||
var containerInstancesArns []*string
|
var containerInstancesArns []string
|
||||||
var instanceArns []*string
|
var instanceArns []string
|
||||||
|
|
||||||
for _, task := range ecsDatas {
|
for _, task := range ecsDatas {
|
||||||
if task.ContainerInstanceArn != nil {
|
if task.ContainerInstanceArn != nil {
|
||||||
containerInstancesArns = append(containerInstancesArns, task.ContainerInstanceArn)
|
containerInstancesArns = append(containerInstancesArns, *task.ContainerInstanceArn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, arns := range p.chunkIDs(containerInstancesArns) {
|
for arns := range chunkIDs(containerInstancesArns) {
|
||||||
resp, err := client.ecs.DescribeContainerInstancesWithContext(ctx, &ecs.DescribeContainerInstancesInput{
|
resp, err := client.ecs.DescribeContainerInstances(ctx, &ecs.DescribeContainerInstancesInput{
|
||||||
ContainerInstances: arns,
|
ContainerInstances: arns,
|
||||||
Cluster: clusterName,
|
Cluster: clusterName,
|
||||||
})
|
})
|
||||||
@ -431,23 +401,21 @@ func (p *Provider) lookupMiInstances(ctx context.Context, client *awsClient, clu
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, container := range resp.ContainerInstances {
|
for _, container := range resp.ContainerInstances {
|
||||||
instanceIDs[aws.StringValue(container.Ec2InstanceId)] = aws.StringValue(container.ContainerInstanceArn)
|
instanceIDs[aws.ToString(container.Ec2InstanceId)] = aws.ToString(container.ContainerInstanceArn)
|
||||||
|
|
||||||
// Disallow EC2 Instance IDs
|
// Disallow EC2 Instance IDs
|
||||||
// This prevents considering EC2 instances in ECS
|
// This prevents considering EC2 instances in ECS
|
||||||
// and getting InvalidInstanceID.Malformed error when calling the describe-instances endpoint.
|
// and getting InvalidInstanceID.Malformed error when calling the describe-instances endpoint.
|
||||||
if !strings.HasPrefix(aws.StringValue(container.Ec2InstanceId), "mi-") {
|
if strings.HasPrefix(aws.ToString(container.Ec2InstanceId), "mi-") {
|
||||||
continue
|
instanceArns = append(instanceArns, *container.Ec2InstanceId)
|
||||||
}
|
}
|
||||||
|
|
||||||
instanceArns = append(instanceArns, container.Ec2InstanceId)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(instanceArns) > 0 {
|
if len(instanceArns) > 0 {
|
||||||
for _, ids := range p.chunkIDs(instanceArns) {
|
for ids := range chunkIDs(instanceArns) {
|
||||||
input := &ssm.DescribeInstanceInformationInput{
|
input := &ssm.DescribeInstanceInformationInput{
|
||||||
Filters: []*ssm.InstanceInformationStringFilter{
|
Filters: []ssmtypes.InstanceInformationStringFilter{
|
||||||
{
|
{
|
||||||
Key: aws.String("InstanceIds"),
|
Key: aws.String("InstanceIds"),
|
||||||
Values: ids,
|
Values: ids,
|
||||||
@ -455,18 +423,18 @@ func (p *Provider) lookupMiInstances(ctx context.Context, client *awsClient, clu
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
err := client.ssm.DescribeInstanceInformationPagesWithContext(ctx, input, func(page *ssm.DescribeInstanceInformationOutput, lastPage bool) bool {
|
paginator := ssm.NewDescribeInstanceInformationPaginator(client.ssm, input)
|
||||||
if len(page.InstanceInformationList) > 0 {
|
for paginator.HasMorePages() {
|
||||||
for _, i := range page.InstanceInformationList {
|
page, err := paginator.NextPage(ctx)
|
||||||
if i.InstanceId != nil {
|
if err != nil {
|
||||||
miInstances[instanceIDs[aws.StringValue(i.InstanceId)]] = i
|
return nil, fmt.Errorf("describing instances: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, i := range page.InstanceInformationList {
|
||||||
|
if i.InstanceId != nil {
|
||||||
|
miInstances[instanceIDs[aws.ToString(i.InstanceId)]] = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !lastPage
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("describing instances: %w", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -474,21 +442,21 @@ func (p *Provider) lookupMiInstances(ctx context.Context, client *awsClient, clu
|
|||||||
return miInstances, nil
|
return miInstances, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Provider) lookupEc2Instances(ctx context.Context, client *awsClient, clusterName *string, ecsDatas map[string]*ecs.Task) (map[string]*ec2.Instance, error) {
|
func (p *Provider) lookupEc2Instances(ctx context.Context, client *awsClient, clusterName *string, ecsDatas map[string]ecstypes.Task) (map[string]ec2types.Instance, error) {
|
||||||
instanceIDs := make(map[string]string)
|
instanceIDs := make(map[string]string)
|
||||||
ec2Instances := make(map[string]*ec2.Instance)
|
ec2Instances := make(map[string]ec2types.Instance)
|
||||||
|
|
||||||
var containerInstancesArns []*string
|
var containerInstancesArns []string
|
||||||
var instanceArns []*string
|
var instanceArns []string
|
||||||
|
|
||||||
for _, task := range ecsDatas {
|
for _, task := range ecsDatas {
|
||||||
if task.ContainerInstanceArn != nil {
|
if task.ContainerInstanceArn != nil {
|
||||||
containerInstancesArns = append(containerInstancesArns, task.ContainerInstanceArn)
|
containerInstancesArns = append(containerInstancesArns, *task.ContainerInstanceArn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, arns := range p.chunkIDs(containerInstancesArns) {
|
for arns := range chunkIDs(containerInstancesArns) {
|
||||||
resp, err := client.ecs.DescribeContainerInstancesWithContext(ctx, &ecs.DescribeContainerInstancesInput{
|
resp, err := client.ecs.DescribeContainerInstances(ctx, &ecs.DescribeContainerInstancesInput{
|
||||||
ContainerInstances: arns,
|
ContainerInstances: arns,
|
||||||
Cluster: clusterName,
|
Cluster: clusterName,
|
||||||
})
|
})
|
||||||
@ -497,38 +465,38 @@ func (p *Provider) lookupEc2Instances(ctx context.Context, client *awsClient, cl
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, container := range resp.ContainerInstances {
|
for _, container := range resp.ContainerInstances {
|
||||||
instanceIDs[aws.StringValue(container.Ec2InstanceId)] = aws.StringValue(container.ContainerInstanceArn)
|
instanceIDs[aws.ToString(container.Ec2InstanceId)] = aws.ToString(container.ContainerInstanceArn)
|
||||||
// Disallow Instance IDs of the form mi-*
|
// Disallow Instance IDs of the form mi-*
|
||||||
// This prevents considering external instances in ECS Anywhere setups
|
// This prevents considering external instances in ECS Anywhere setups
|
||||||
// and getting InvalidInstanceID.Malformed error when calling the describe-instances endpoint.
|
// and getting InvalidInstanceID.Malformed error when calling the describe-instances endpoint.
|
||||||
if strings.HasPrefix(aws.StringValue(container.Ec2InstanceId), "mi-") {
|
if strings.HasPrefix(aws.ToString(container.Ec2InstanceId), "mi-") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if container.Ec2InstanceId != nil {
|
||||||
instanceArns = append(instanceArns, container.Ec2InstanceId)
|
instanceArns = append(instanceArns, *container.Ec2InstanceId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(instanceArns) > 0 {
|
if len(instanceArns) > 0 {
|
||||||
for _, ids := range p.chunkIDs(instanceArns) {
|
for ids := range chunkIDs(instanceArns) {
|
||||||
input := &ec2.DescribeInstancesInput{
|
input := &ec2.DescribeInstancesInput{
|
||||||
InstanceIds: ids,
|
InstanceIds: ids,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := client.ec2.DescribeInstancesPagesWithContext(ctx, input, func(page *ec2.DescribeInstancesOutput, lastPage bool) bool {
|
paginator := ec2.NewDescribeInstancesPaginator(client.ec2, input)
|
||||||
if len(page.Reservations) > 0 {
|
for paginator.HasMorePages() {
|
||||||
for _, r := range page.Reservations {
|
page, err := paginator.NextPage(ctx)
|
||||||
for _, i := range r.Instances {
|
if err != nil {
|
||||||
if i.InstanceId != nil {
|
return nil, fmt.Errorf("describing instances: %w", err)
|
||||||
ec2Instances[instanceIDs[aws.StringValue(i.InstanceId)]] = i
|
}
|
||||||
}
|
for _, r := range page.Reservations {
|
||||||
|
for _, i := range r.Instances {
|
||||||
|
if i.InstanceId != nil {
|
||||||
|
ec2Instances[instanceIDs[aws.ToString(i.InstanceId)]] = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !lastPage
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("describing instances: %w", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -536,16 +504,16 @@ func (p *Provider) lookupEc2Instances(ctx context.Context, client *awsClient, cl
|
|||||||
return ec2Instances, nil
|
return ec2Instances, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Provider) lookupTaskDefinitions(ctx context.Context, client *awsClient, taskDefArns map[string]*ecs.Task) (map[string]*ecs.TaskDefinition, error) {
|
func (p *Provider) lookupTaskDefinitions(ctx context.Context, client *awsClient, taskDefArns map[string]ecstypes.Task) (map[string]*ecstypes.TaskDefinition, error) {
|
||||||
logger := log.Ctx(ctx)
|
logger := log.Ctx(ctx)
|
||||||
taskDef := make(map[string]*ecs.TaskDefinition)
|
taskDef := make(map[string]*ecstypes.TaskDefinition)
|
||||||
|
|
||||||
for arn, task := range taskDefArns {
|
for arn, task := range taskDefArns {
|
||||||
if definition, ok := existingTaskDefCache.Get(arn); ok {
|
if definition, ok := existingTaskDefCache.Get(arn); ok {
|
||||||
taskDef[arn] = definition.(*ecs.TaskDefinition)
|
taskDef[arn] = definition.(*ecstypes.TaskDefinition)
|
||||||
logger.Debug().Msgf("Found cached task definition for %s. Skipping the call", arn)
|
logger.Debug().Msgf("Found cached task definition for %s. Skipping the call", arn)
|
||||||
} else {
|
} else {
|
||||||
resp, err := client.ecs.DescribeTaskDefinitionWithContext(ctx, &ecs.DescribeTaskDefinitionInput{
|
resp, err := client.ecs.DescribeTaskDefinition(ctx, &ecs.DescribeTaskDefinitionInput{
|
||||||
TaskDefinition: task.TaskDefinitionArn,
|
TaskDefinition: task.TaskDefinitionArn,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -561,16 +529,6 @@ func (p *Provider) lookupTaskDefinitions(ctx context.Context, client *awsClient,
|
|||||||
|
|
||||||
// chunkIDs ECS expects no more than 100 parameters be passed to a API call;
|
// chunkIDs ECS expects no more than 100 parameters be passed to a API call;
|
||||||
// thus, pack each string into an array capped at 100 elements.
|
// thus, pack each string into an array capped at 100 elements.
|
||||||
func (p *Provider) chunkIDs(ids []*string) [][]*string {
|
func chunkIDs(ids []string) iter.Seq[[]string] {
|
||||||
var chunked [][]*string
|
return slices.Chunk(ids, 100)
|
||||||
for i := 0; i < len(ids); i += 100 {
|
|
||||||
var sliceEnd int
|
|
||||||
if i+100 < len(ids) {
|
|
||||||
sliceEnd = i + 100
|
|
||||||
} else {
|
|
||||||
sliceEnd = len(ids)
|
|
||||||
}
|
|
||||||
chunked = append(chunked, ids[i:sliceEnd])
|
|
||||||
}
|
|
||||||
return chunked
|
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,10 @@ package ecs
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChunkIDs(t *testing.T) {
|
func TestChunkIDs(t *testing.T) {
|
||||||
provider := &Provider{}
|
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
desc string
|
desc string
|
||||||
count int
|
count int
|
||||||
@ -71,13 +68,13 @@ func TestChunkIDs(t *testing.T) {
|
|||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
var IDs []*string
|
var IDs []string
|
||||||
for range test.count {
|
for range test.count {
|
||||||
IDs = append(IDs, aws.String("a"))
|
IDs = append(IDs, "a")
|
||||||
}
|
}
|
||||||
|
|
||||||
var outCount []int
|
var outCount []int
|
||||||
for _, el := range provider.chunkIDs(IDs) {
|
for el := range chunkIDs(IDs) {
|
||||||
outCount = append(outCount, len(el))
|
outCount = append(outCount, len(el))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# shellcheck disable=SC2046
|
|
||||||
|
|
||||||
set -e -o pipefail
|
|
||||||
|
|
||||||
export PROJECT_MODULE="github.com/traefik/traefik"
|
|
||||||
export MODULE_VERSION="v3"
|
|
||||||
IMAGE_NAME="kubernetes-codegen:latest"
|
|
||||||
CURRENT_DIR="$(pwd)"
|
|
||||||
|
|
||||||
echo "Building codegen Docker image..."
|
|
||||||
docker build --build-arg KUBE_VERSION=v0.29.8 \
|
|
||||||
--build-arg USER="${USER}" \
|
|
||||||
--build-arg UID="$(id -u)" \
|
|
||||||
--build-arg GID="$(id -g)" \
|
|
||||||
-f "./script/codegen.Dockerfile" \
|
|
||||||
-t "${IMAGE_NAME}" \
|
|
||||||
"."
|
|
||||||
|
|
||||||
echo "Generating Traefik clientSet code and DeepCopy code ..."
|
|
||||||
docker run --rm \
|
|
||||||
-v "${CURRENT_DIR}:/go/src/${PROJECT_MODULE}" \
|
|
||||||
-w "/go/src/${PROJECT_MODULE}" \
|
|
||||||
-e "PROJECT_MODULE=${PROJECT_MODULE}" \
|
|
||||||
-e "MODULE_VERSION=${MODULE_VERSION}" \
|
|
||||||
"${IMAGE_NAME}" \
|
|
||||||
bash ./script/code-gen.sh
|
|
||||||
|
|
||||||
echo "Generating the CRD definitions for the documentation ..."
|
|
||||||
docker run --rm \
|
|
||||||
-v "${CURRENT_DIR}:/go/src/${PROJECT_MODULE}" \
|
|
||||||
-w "/go/src/${PROJECT_MODULE}" \
|
|
||||||
"${IMAGE_NAME}" \
|
|
||||||
controller-gen crd:crdVersions=v1 \
|
|
||||||
paths={./pkg/provider/kubernetes/crd/traefikio/v1alpha1/...} \
|
|
||||||
output:dir=./docs/content/reference/dynamic-configuration/
|
|
||||||
|
|
||||||
echo "Concatenate the CRD definitions for publication and integration tests ..."
|
|
||||||
cat "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/traefik.io_*.yaml > "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml
|
|
||||||
cp -f "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml "${CURRENT_DIR}"/integration/fixtures/k8s/01-traefik-crd.yml
|
|
@ -2,30 +2,35 @@
|
|||||||
|
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
|
PROJECT_MODULE="github.com/traefik/traefik"
|
||||||
|
MODULE_VERSION="v3"
|
||||||
|
KUBE_VERSION=v0.30.10
|
||||||
|
CURRENT_DIR="$(pwd)"
|
||||||
|
|
||||||
|
go install "k8s.io/code-generator/cmd/deepcopy-gen@${KUBE_VERSION}"
|
||||||
|
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.1
|
||||||
|
|
||||||
|
CODEGEN_PKG="$(go env GOPATH)/pkg/mod/k8s.io/code-generator@${KUBE_VERSION}"
|
||||||
# shellcheck disable=SC1091 # Cannot check source of this file
|
# shellcheck disable=SC1091 # Cannot check source of this file
|
||||||
source /go/src/k8s.io/code-generator/kube_codegen.sh
|
source "${CODEGEN_PKG}/kube_codegen.sh"
|
||||||
|
|
||||||
git config --global --add safe.directory "/go/src/${PROJECT_MODULE}"
|
|
||||||
|
|
||||||
rm -rf "/go/src/${PROJECT_MODULE}/${MODULE_VERSION}"
|
|
||||||
mkdir -p "/go/src/${PROJECT_MODULE}/${MODULE_VERSION}/"
|
|
||||||
|
|
||||||
# TODO: remove the workaround when the issue is solved in the code-generator
|
|
||||||
# (https://github.com/kubernetes/code-generator/issues/165).
|
|
||||||
# Here, we create the soft link named "${PROJECT_MODULE}" to the parent directory of
|
|
||||||
# Traefik to ensure the layout required by the kube_codegen.sh script.
|
|
||||||
ln -s "/go/src/${PROJECT_MODULE}/pkg" "/go/src/${PROJECT_MODULE}/${MODULE_VERSION}/"
|
|
||||||
|
|
||||||
|
echo "# Generating Traefik clientset and deepcopy code ..."
|
||||||
kube::codegen::gen_helpers \
|
kube::codegen::gen_helpers \
|
||||||
--input-pkg-root "${PROJECT_MODULE}/pkg" \
|
--boilerplate "$(dirname "${BASH_SOURCE[0]}")/boilerplate.go.tmpl" \
|
||||||
--output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \
|
"${CURRENT_DIR}"
|
||||||
--boilerplate "/go/src/${PROJECT_MODULE}/script/boilerplate.go.tmpl"
|
|
||||||
|
|
||||||
kube::codegen::gen_client \
|
kube::codegen::gen_client \
|
||||||
--with-watch \
|
--with-watch \
|
||||||
--input-pkg-root "${PROJECT_MODULE}/${MODULE_VERSION}/pkg/provider/kubernetes/crd" \
|
--output-dir "${CURRENT_DIR}/pkg/provider/kubernetes/crd/generated" \
|
||||||
--output-pkg-root "${PROJECT_MODULE}/${MODULE_VERSION}/pkg/provider/kubernetes/crd/generated" \
|
--output-pkg "${PROJECT_MODULE}/${MODULE_VERSION}/pkg/provider/kubernetes/crd/generated" \
|
||||||
--output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \
|
--boilerplate "$(dirname "${BASH_SOURCE[0]}")/boilerplate.go.tmpl" \
|
||||||
--boilerplate "/go/src/${PROJECT_MODULE}/script/boilerplate.go.tmpl"
|
"${CURRENT_DIR}/pkg/provider/kubernetes/crd"
|
||||||
|
|
||||||
rm -rf "/go/src/${PROJECT_MODULE}/${MODULE_VERSION}"
|
echo "# Generating the CRD definitions for the documentation ..."
|
||||||
|
controller-gen crd:crdVersions=v1 \
|
||||||
|
paths={./pkg/provider/kubernetes/crd/traefikio/v1alpha1/...} \
|
||||||
|
output:dir=./docs/content/reference/dynamic-configuration/
|
||||||
|
|
||||||
|
echo "# Concatenate the CRD definitions for publication and integration tests ..."
|
||||||
|
cat "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/traefik.io_*.yaml > "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml
|
||||||
|
cp -f "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml "${CURRENT_DIR}"/integration/fixtures/k8s/01-traefik-crd.yml
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
FROM golang:1.23
|
|
||||||
|
|
||||||
ARG USER=$USER
|
|
||||||
ARG UID=$UID
|
|
||||||
ARG GID=$GID
|
|
||||||
RUN useradd -l -m ${USER} --uid=${UID} && echo "${USER}:" chpasswd
|
|
||||||
USER ${UID}:${GID}
|
|
||||||
|
|
||||||
ARG KUBE_VERSION
|
|
||||||
|
|
||||||
RUN go install k8s.io/code-generator/cmd/defaulter-gen@$KUBE_VERSION
|
|
||||||
RUN go install k8s.io/code-generator/cmd/client-gen@$KUBE_VERSION
|
|
||||||
RUN go install k8s.io/code-generator/cmd/lister-gen@$KUBE_VERSION
|
|
||||||
RUN go install k8s.io/code-generator/cmd/informer-gen@$KUBE_VERSION
|
|
||||||
RUN go install k8s.io/code-generator/cmd/deepcopy-gen@$KUBE_VERSION
|
|
||||||
RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.1
|
|
||||||
|
|
||||||
RUN mkdir -p $GOPATH/src/k8s.io/code-generator
|
|
||||||
RUN cp -R $GOPATH/pkg/mod/k8s.io/code-generator@$KUBE_VERSION/* $GOPATH/src/k8s.io/code-generator/
|
|
||||||
RUN chmod +x $GOPATH/src/k8s.io/code-generator/kube_codegen.sh
|
|
||||||
|
|
||||||
WORKDIR $GOPATH/src/k8s.io/code-generator
|
|
Loading…
x
Reference in New Issue
Block a user