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

kubeadm: add a Timeouts struct to v1beta4 #122529

Merged
merged 6 commits into from
Jan 15, 2024

Commits on Jan 5, 2024

  1. kubeadm: add a Timeouts struct to v1beta4

    The struct is included in InitConfiguration, JoinConfiguration
    and ResetConfiguration.
    
    Add conversion and update defaulters and fuzzers.
    Include a timeoututils.go that contains a function
    to default the internal Timeouts struct.
    neolit123 committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    492c061 View commit details
    Browse the repository at this point in the history
  2. kubeadm: implement mutators for "config migrate"

    When upconverting from v1beta3 to v1beta4, it appears there is no
    easy way to migrate some of the timeout values such as:
      ClusterConfiguration.APIServer.TimeoutForControlPlane
    to a new location:
      InitConfiguration.Timeouts.<some-timeout-field>
    
    Yes, the internal InitConfiguratio does embed a ClusterConfiguration,
    but during conversion the ClusterConfiguration is converted from an
    empty source.
    
    K8s' API machinery has ways to register custom conversion functions,
    such as v1beta3.ClusterConfiguration -> internal.InitConfiguration,
    but these must be triggered explicitly with a decoder.
    The overall migration of fields seems very awkward.
    
    There might be hacks around that, such as storing intermediate state,
    while trying to make the fuzzer rountrip happy, but instead
    mutation functions can be implemented for the internal types when
    calling kubeadm's migrate code. This seems much cleaner.
    neolit123 committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    ea0fa41 View commit details
    Browse the repository at this point in the history
  3. kubeadm: make the active timeouts structure accessible from anywhere

    Currently, timeouts are only accessible if a kubeadm runtime.Object{}
    like InitConfiguration is passed around.
    
    Any time a config is loaded or defaulted, store the Timeouts
    structure in a thread-safe way in the main kubeadm API package
    with SetActiveTimeouts(). Optionally, a deep-copy can be
    performed before calling SetActiveTimeouts(). Make this struct
    accessible with GetActiveTimeouts(). Ensure these functions
    are thread safe.
    
    On init() make sure the struct is defaulted, so that unit
    tests can work with these values.
    neolit123 committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    d9e4870 View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2024

  1. kubeadm: replace deprecated wait.Poll() and wait.PollImmediate()

    Replace the usage of the deprecated wait.Poll() and
    wait.PollImmediate() functions with wait.PollUntilContextTimeout().
    Since we don't have piping of context around kubeadm,
    use context.Background() everywhere.
    
    Some wait.Poll() functions were converted to "immediate" as there
    is no point for them to not be. This is done for consistency.
    
    Replace the only instance of wait.JitterUntil with
    wait.PollUntilContextTimeout. JitterUntil is not deprecated
    but this is also done for consistency.
    neolit123 committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    374e41c View commit details
    Browse the repository at this point in the history
  2. kubeadm: start using the Timeouts struct values

    Propagate usage of the Timeout struct values.
    Apply sanitazation to timeout constants in contants.go.
    neolit123 committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    caf5311 View commit details
    Browse the repository at this point in the history
  3. kubeadm: switch from ExponentialBackoff() to PollUntilContextTimeout()

    Switch to PollUntilContextTimeout() everywhere to allow
    usage of the exposed timeouts in the kubeadm API. Exponential backoff
    options are more difficult to expose in this regard and a bit too
    detailed for the common user - i.e. have "steps", "factor" and so on.
    neolit123 committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    5f876b9 View commit details
    Browse the repository at this point in the history