Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- k8s scopes can now pin the traffic-manager sidecar version cluster-wide via the container-orchestration provider's `traffic_manager.version`, instead of only per-scope
- Publish containers and scheduled task scopes as docker images
- Remove unused cloudwatch annotations from deployment objects
- Fix: log queries on k8s scopes now return the time range that was selected, instead of the most recent lines whatever range was chosen
Expand Down
7 changes: 5 additions & 2 deletions k8s/deployment/build_context
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,13 @@ fi

SCOPE_TRAFFIC_PROTOCOL=$(echo "$CONTEXT" | jq -r .scope.capabilities.protocol)

TRAFFIC_CONTAINER_VERSION="latest"

if [[ "$SCOPE_TRAFFIC_PROTOCOL" == "web_sockets" ]]; then
TRAFFIC_CONTAINER_VERSION="websocket2"
else
TRAFFIC_CONTAINER_VERSION=$(get_config_value \
--provider '.providers["container-orchestration"].traffic_manager.version' \
--default "latest"
)
fi

TRAFFIC_CONTAINER_IMAGE=$(get_config_value \
Expand Down
56 changes: 42 additions & 14 deletions k8s/deployment/tests/build_context.bats
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,50 @@ teardown() {
# =============================================================================
# Traffic Container Image Version Tests
# =============================================================================
@test "traffic container: uses websocket2 for web_sockets, latest for http" {
# web_sockets protocol
SCOPE_TRAFFIC_PROTOCOL="web_sockets"
TRAFFIC_CONTAINER_VERSION="latest"
if [[ "$SCOPE_TRAFFIC_PROTOCOL" == "web_sockets" ]]; then
TRAFFIC_CONTAINER_VERSION="websocket2"
resolve_traffic_container_version() {
local protocol="$1"
if [[ "$protocol" == "web_sockets" ]]; then
echo "websocket2"
else
get_config_value \
--provider '.providers["container-orchestration"].traffic_manager.version' \
--default "latest"
fi
assert_equal "$TRAFFIC_CONTAINER_VERSION" "websocket2"
}

# http protocol
SCOPE_TRAFFIC_PROTOCOL="http"
TRAFFIC_CONTAINER_VERSION="latest"
if [[ "$SCOPE_TRAFFIC_PROTOCOL" == "web_sockets" ]]; then
TRAFFIC_CONTAINER_VERSION="websocket2"
fi
assert_equal "$TRAFFIC_CONTAINER_VERSION" "latest"
@test "traffic container: uses websocket2 for web_sockets, latest for http" {
result=$(resolve_traffic_container_version "web_sockets")
assert_equal "$result" "websocket2"

result=$(resolve_traffic_container_version "http")
assert_equal "$result" "latest"
}

@test "traffic container: http protocol uses container-orchestration provider version when set" {
export CONTEXT=$(echo "$CONTEXT" | jq '.providers["container-orchestration"] = {"traffic_manager": {"version": "1.8.0"}}')

result=$(resolve_traffic_container_version "http")
assert_equal "$result" "1.8.0"
}

@test "traffic container: web_sockets protocol ignores container-orchestration provider version" {
export CONTEXT=$(echo "$CONTEXT" | jq '.providers["container-orchestration"] = {"traffic_manager": {"version": "1.8.0"}}')

result=$(resolve_traffic_container_version "web_sockets")
assert_equal "$result" "websocket2"
}

@test "traffic container: provider version flows into the default image when no full-image override is set" {
export CONTEXT=$(echo "$CONTEXT" | jq '.providers["container-orchestration"] = {"traffic_manager": {"version": "1.8.0"}}')
unset TRAFFIC_CONTAINER_IMAGE

TRAFFIC_CONTAINER_VERSION=$(resolve_traffic_container_version "http")
result=$(get_config_value \
--env TRAFFIC_CONTAINER_IMAGE \
--provider '.providers["scope-configurations"].deployment.traffic_container_image' \
--default "public.ecr.aws/nullplatform/k8s-traffic-manager:$TRAFFIC_CONTAINER_VERSION"
)
assert_equal "$result" "public.ecr.aws/nullplatform/k8s-traffic-manager:1.8.0"
}

# =============================================================================
Expand Down
Loading