Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the proxy read from autoupdate_agent_rollout #49380

Merged
merged 5 commits into from
Dec 5, 2024

Conversation

hugoShaka
Copy link
Contributor

@hugoShaka hugoShaka commented Nov 22, 2024

As described in #47126, This PR makes the proxy service read the autoupdate_agent_rollout resource and modulate the update response based on the resource content and the updater group.

Sorry for the PR size, but 3/4 of the locs are tests 😅

Basically, autoupdate_agent_rollout looks like:

kind: autoupdate_agent_rollout
spec:
  start_version: v1
  target_version: v2
  schedule: regular
  strategy: halt-on-failure
  mode: enabled
status:
  groups:
    - name: dev
      start_time: 2020-12-09T16:09:53+00:00
      state: active
    - name: staging
      start_time: 0000-00-00
      state: unstarted

Depending on the requested group state, the proxy will tell the agent to update or not. In this example, "dev" agents should update now to v2 while "staging" agents should not update and their desired version is still v1.

In addition to the RFD original design I aligned the configuration and answers between the new RFD184 updates, and the existing RFD109 updates APIs. Now:

  • RFD 109 channels honour the content of autoupdate_agent_rollout if it's here
  • In the absence of autoupdate_agent_rollout, the RFD 184 API will also fallback to RFD 109 channels to ensure maximal compatibility and a seamless transition between both systems.

Those changes ensure that both RFD109 and RFD184 APIs answer the same thing and update agents at the same time. The goal is to make the transition seamless for users, so they don't have to deal with 2 separate configurations, update schedules, and sets of agents.

Note

Existing systemd-based updaters and old kube-agent-updaters will still rely on the agent-exported maintenance windows. Those might cause updates to happen outside of the RFD184 rollout plan (although the target version will be correct). We could try to predict when maintenance will happen and change the way auth exports windows to the agent. However this would b accurate only for time-based rollouts as we cannot predict if a group will get updated with the "halt-on-failure" strategy.

This PR also contains the following minor changes:

  • makes the /find endpoint cache per-group (we obviously won't be able continue this when we'll add per UUID reponse, but I think it is still desirable to do the least work possible in the find endpoint).
  • reuse the same constant for the group parameter name

Goal (internal): https://github.com/gravitational/cloud/issues/10289

Depends on: #49484 (renaming AU-related content in lib/web)
Depends on: #49101 (running the autoupdate_agent_rollout controller in auth)

@hugoShaka hugoShaka marked this pull request as draft November 22, 2024 23:42
@hugoShaka hugoShaka changed the title Add autoupdate_agent_rollout support Make the proxy read from autoupdate_agent_rollout Nov 22, 2024
@hugoShaka hugoShaka added the no-changelog Indicates that a PR does not require a changelog entry label Nov 22, 2024
@hugoShaka hugoShaka force-pushed the hugo/autoupdate-server-implem branch 2 times, most recently from 2c00768 to f605d57 Compare November 26, 2024 22:00
@hugoShaka hugoShaka changed the base branch from master to hugo/split-autoupdate-by-rfd-in-proxy November 26, 2024 22:07
@hugoShaka hugoShaka marked this pull request as ready for review November 26, 2024 22:16
Copy link
Member

@creack creack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Comments only on nitpick styling. Keep in mind I am very new here, I may not be familiar with existing patterns / style.

lib/web/autoupdate_common.go Outdated Show resolved Hide resolved
lib/web/autoupdate_common.go Show resolved Hide resolved
lib/web/autoupdate_common.go Outdated Show resolved Hide resolved
lib/web/apiserver.go Show resolved Hide resolved
lib/web/autoupdate_common.go Outdated Show resolved Hide resolved
lib/web/autoupdate_common.go Outdated Show resolved Hide resolved
lib/web/autoupdate_rfd109.go Outdated Show resolved Hide resolved
lib/web/autoupdate_rfd184.go Outdated Show resolved Hide resolved
Base automatically changed from hugo/split-autoupdate-by-rfd-in-proxy to master November 27, 2024 19:40
@hugoShaka hugoShaka force-pushed the hugo/autoupdate-server-implem branch 2 times, most recently from a907f07 to 3c71861 Compare November 27, 2024 21:14
Comment on lines 50 to 56
const (
AgentUpdateGroupParameter = "group"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add godoc on exported identifier?

lib/web/autoupdate_common.go Outdated Show resolved Hide resolved
lib/web/autoupdate_common.go Outdated Show resolved Hide resolved
lib/web/autoupdate_common.go Outdated Show resolved Hide resolved
@hugoShaka hugoShaka force-pushed the hugo/autoupdate-server-implem branch from 7791545 to 0240b0f Compare December 4, 2024 20:23
Copy link
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot.

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from timothyb89 December 5, 2024 22:19
@hugoShaka hugoShaka added this pull request to the merge queue Dec 5, 2024
Merged via the queue into master with commit a33473d Dec 5, 2024
41 checks passed
@hugoShaka hugoShaka deleted the hugo/autoupdate-server-implem branch December 5, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a PR does not require a changelog entry size/lg size/md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants