[v14] Support proxy version server#36220
Merged
bernardjkim merged 10 commits intobranch/v14from Jan 8, 2024
Merged
Conversation
This PR adds an embedded [version server](https://goteleport.com/docs/architecture/agent-update-management/#version-server-and-source-of-truth) in the proxy to address: gravitational/cloud#6773 The version server can be configured through `teleport.yaml`: ```yaml proxy_service: enabled: "yes" automatic_upgrades_channels: stable/cloud: forward_url: https://updates.releases.teleport.dev/v1/stable/cloud preview/cloud: static_version: v12.5.4 ``` The forwarded call results are cached for a minute.
* Use default upgrade channel This commit: - initializes default upgrade channels based on the server features - makes all integrations use the upgrade channels instead of hitting hardcoded s3 bucket - makes the version channel return its own version if the target version is too high - makes the NoVersion handler properly: returned as an error. This way soneone relying on the version getter doesn't have to check - moves the version kube-agent-updater lib in main teleport libs - add tests for noVersion channels * Update lib/web/join_tokens.go Co-authored-by: Bernard Kim <bernard@goteleport.com> * address marco's feedback * address marco's feedback pt.2 --------- Co-authored-by: Bernard Kim <bernard@goteleport.com>
* Move automaticupgrades packages in `lib/automaticupgrades` * Fix `kube-agent-udpater` Dockerfile
Contributor
Author
Testing
❯ curl https://bernard-dev.cloud.gravitational.io/webapi/automaticupgrades/channel/stable/cloud/version
v13.4.13%
❯ curl https://updates.releases.teleport.dev/v1/stable/cloud/version
v13.4.13
# teleport.yaml
proxy_service:
enabled: yes
automatic_upgrades_channels:
stable/cloud:
forward_url: https://updates.releases.teleport.dev/v1/stable/cloud/v14
stable/cloud/v13:
forward_url: https://updates.releases.teleport.dev/v1/stable/cloud/v13
stable/cloud/v14:
forward_url: https://updates.releases.teleport.dev/v1/stable/cloud/v14
static/cloud/v13:
static_version: v13.4.14
static/cloud/v14:
static_version: v14.3.0
static/cloud/v15:
static_version: v15.0.0 ❯ curl https://bernard-dev.cloud.gravitational.io/webapi/automaticupgrades/channel/stable/cloud/version
v14.2.4%
❯ curl https://bernard-dev.cloud.gravitational.io/webapi/automaticupgrades/channel/stable/cloud/v13/version
v13.4.13%
❯ curl https://bernard-dev.cloud.gravitational.io/webapi/automaticupgrades/channel/stable/cloud/v14/version
v14.2.4%
❯ curl https://bernard-dev.cloud.gravitational.io/webapi/automaticupgrades/channel/static/cloud/v13/version
v13.4.14%
❯ curl https://bernard-dev.cloud.gravitational.io/webapi/automaticupgrades/channel/static/cloud/v14/version
v14.3.0%
❯ curl https://bernard-dev.cloud.gravitational.io/webapi/automaticupgrades/channel/static/cloud/v15/version
14.3.0%
# k -n teleport logs teleport-agent-updater...
2024-01-03T02:16:04Z INFO starting the updater {"version": "14.3.0", "url": "https://bernard-dev.cloud.gravitational.io/webapi/automaticupgrades/channel/stable/cloud"}
...
2024-01-03T02:07:45Z DEBUG New version candidate {"controller": "statefulset", "controllerGroup": "apps", "controllerKind": "StatefulSet", "StatefulSet": {"name":"teleport-agent","namespace":"teleport"}, "namespace": "teleport", "name": "teleport-agent", "reconcileID": "ba23deda-d813-4654-ba04-cc92fc8c54a8", "namespacedname": {"name":"teleport-agent","namespace":"teleport"}, "kind": "StatefulSet", "nextVersion": "v14.2.4"}
2024-01-03T02:07:45Z DEBUG Version change is valid, building img candidate {"controller": "statefulset", "controllerGroup": "apps", "controllerKind": "StatefulSet", "StatefulSet": {"name":"teleport-agent","namespace":"teleport"}, "namespace": "teleport", "name": "teleport-agent", "reconcileID": "ba23deda-d813-4654-ba04-cc92fc8c54a8", "namespacedname": {"name":"teleport-agent","namespace":"teleport"}, "kind": "StatefulSet"}
2024-01-03T02:07:45Z DEBUG Verifying candidate img {"controller": "statefulset", "controllerGroup": "apps", "controllerKind": "StatefulSet", "StatefulSet": {"name":"teleport-agent","namespace":"teleport"}, "namespace": "teleport", "name": "teleport-agent", "reconcileID": "ba23deda-d813-4654-ba04-cc92fc8c54a8", "namespacedname": {"name":"teleport-agent","namespace":"teleport"}, "kind": "StatefulSet", "img": "public.ecr.aws/gravitational/teleport-ent-distroless:14.2.4"}
2024-01-03T02:07:45Z DEBUG Image approved by the validator {"controller": "statefulset", "controllerGroup": "apps", "controllerKind": "StatefulSet", "StatefulSet": {"name":"teleport-agent","namespace":"teleport"}, "namespace": "teleport", "name": "teleport-agent", "reconcileID": "ba23deda-d813-4654-ba04-cc92fc8c54a8", "namespacedname": {"name":"teleport-agent","namespace":"teleport"}, "kind": "StatefulSet", "image": "public.ecr.aws/gravitational/teleport-ent-distroless:14.2.4", "validator": "cosign signature validator-a55977c6d752759f68c4883ac10ad8a85f5cfd0f", "resolvedImages": "public.ecr.aws/gravitational/teleport-ent-distroless:14.2.4@sha256:15f8f4cd71569974f56a0b60cefe2945df6a56bf41e80adb92984cf200bd64ae"}
2024-01-03T02:07:45Z DEBUG The following image was verified {"controller": "statefulset", "controllerGroup": "apps", "controllerKind": "StatefulSet", "StatefulSet": {"name":"teleport-agent","namespace":"teleport"}, "namespace": "teleport", "name": "teleport-agent", "reconcileID": "ba23deda-d813-4654-ba04-cc92fc8c54a8", "namespacedname": {"name":"teleport-agent","namespace":"teleport"}, "kind": "StatefulSet", "verifiedImage": "public.ecr.aws/gravitational/teleport-ent-distroless:14.2.4@sha256:15f8f4cd71569974f56a0b60cefe2945df6a56bf41e80adb92984cf200bd64ae"}
2024-01-03T02:07:45Z INFO Updating podSpec with image {"controller": "statefulset", "controllerGroup": "apps", "controllerKind": "StatefulSet", "StatefulSet": {"name":"teleport-agent","namespace":"teleport"}, "namespace": "teleport", "name": "teleport-agent", "reconcileID": "ba23deda-d813-4654-ba04-cc92fc8c54a8", "namespacedname": {"name":"teleport-agent","namespace":"teleport"}, "kind": "StatefulSet", "image": "public.ecr.aws/gravitational/teleport-ent-distroless:14.2.4@sha256:15f8f4cd71569974f56a0b60cefe2945df6a56bf41e80adb92984cf200bd64ae"}
2024-01-03T02:07:45Z DEBUG statefulset managed pods {"controller": "statefulset", "controllerGroup": "apps", "controllerKind": "StatefulSet", "StatefulSet": {"name":"teleport-agent","namespace":"teleport"}, "namespace": "teleport", "name": "teleport-agent", "reconcileID": "ba23deda-d813-4654-ba04-cc92fc8c54a8", "namespacedname": {"name":"teleport-agent","namespace":"teleport"}, "kind": "StatefulSet", "managedPodsList": ["teleport-agent-0", "teleport-agent-1"]}
2024-01-03T02:07:45Z DEBUG no statefulset unhealthy pods from old revisions {"controller": "statefulset", "controllerGroup": "apps", "controllerKind": "StatefulSet", "StatefulSet": {"name":"teleport-agent","namespace":"teleport"}, "namespace": "teleport", "name": "teleport-agent", "reconcileID": "ba23deda-d813-4654-ba04-cc92fc8c54a8", "namespacedname": {"name":"teleport-agent","namespace":"teleport"}, "kind": "StatefulSet"}
# kube agent install command
$ helm install teleport-agent teleport/teleport-kube-agent -f prod-cluster-values.yaml --version 14.2.4 --create-namespace --namespace teleport# systemd agent install script
$ curl -fsSL https://bernard-dev.cloud.gravitational.io/scripts/.../install-node.sh | grep TELEPORT_VERSION -m 1
TELEPORT_VERSION='14.2.4' |
Contributor
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
tigrato
approved these changes
Jan 3, 2024
hugoShaka
approved these changes
Jan 3, 2024
marcoandredinis
approved these changes
Jan 4, 2024
r0mant
approved these changes
Jan 8, 2024
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport #35150, #35342, #35996, #35998 to branch/v14
changelog: Support running a version server in the proxy for automatic agent upgrades.