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

Validate autoupdate_config and autoupdate_agent_rollout #50181

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hugoShaka
Copy link
Contributor

Part of: RFD-184

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

This PR removes the restrictions of the autoupdate_agent_rollout and autoupdate_config schedules but adds groups validation.

It also adds some optional server-side validation that should not be enforced at the resource level.

@hugoShaka hugoShaka changed the title Hugo/autoupdate config validation Validate autoupdate_config and autoupdate_agent_rollout Dec 12, 2024
@hugoShaka hugoShaka marked this pull request as ready for review December 13, 2024 16:07
lib/auth/autoupdate/autoupdatev1/service.go Outdated Show resolved Hide resolved
}

var maxGroups int
isCloud := modules.GetModules().Features().Cloud
Copy link
Member

Choose a reason for hiding this comment

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

We may want to relax these restrictions for some Cloud customers on a case-by-case basis. Would it be tricky to add an "unrestricted" feature? (Could be a separate PR)

Copy link
Contributor Author

@hugoShaka hugoShaka Dec 13, 2024

Choose a reason for hiding this comment

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

We will likely want to rely on entitlements. I'm not familiar with this mechanism and will have to ask cloud devs how to do this. If it's not easy, I'll just glue an ugly environment variable so we are not blocked.

@hugoShaka hugoShaka force-pushed the hugo/autoupdate_config-validation branch from f7451c1 to 3a91f1b Compare December 13, 2024 21:27
@hugoShaka hugoShaka force-pushed the hugo/autoupdate_config-validation branch from 3a91f1b to 2966633 Compare December 16, 2024 21:05
@hugoShaka
Copy link
Contributor Author

@sclevine and @vapopov I revamped the PR as we changed from wait_days to wait_hours. Could yo do a fresh review?

return trace.BadParameter("max groups (%d) exceeded for strategy %s, %s schedule contains %d groups", maxGroups, agentsSpec.GetStrategy(), update.AgentsScheduleRegular, len(agentsSpec.GetSchedules().GetRegular()))
}

if isCloud {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if isCloud {
if !isCloud {
return nil
}

nit: cleans up indent a bit

Copy link
Contributor

@vapopov vapopov left a comment

Choose a reason for hiding this comment

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

LGTM, seems like you need to adjust unit tests (nil struct in map)

@@ -47,7 +47,8 @@ const (
)

var (
defaultUpdateDays = []string{"Mon", "Tue", "Wed", "Thu"}
// DefaultUpdateDays is the default list of days when groups can be updated.
DefaultUpdateDays = []string{"Mon", "Tue", "Wed", "Thu"}
Copy link
Contributor

Choose a reason for hiding this comment

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

hope its not going to be modified externally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants