Merge pull request #88124 from rosti/kubeadm-cc-upgrade-plan

kubeadm upgrade plan: print a component config state table
This commit is contained in:
Kubernetes Prow Robot
2020-07-03 05:02:47 -07:00
committed by GitHub
10 changed files with 687 additions and 12 deletions

View File

@@ -48,6 +48,26 @@ type ComponentUpgradePlan struct {
NewVersion string
}
// ComponentConfigVersionState describes the current and desired version of a component config
type ComponentConfigVersionState struct {
// Group points to the Kubernetes API group that covers the config
Group string
// CurrentVersion is the currently active component config version
// NOTE: This can be empty in case the config was not found on the cluster or it was unsupported
// kubeadm generated version
CurrentVersion string
// PreferredVersion is the component config version that is currently preferred by kubeadm for use.
// NOTE: As of today, this is the only version supported by kubeadm.
PreferredVersion string
// ManualUpgradeRequired indicates if users need to manually upgrade their component config versions. This happens if
// the CurrentVersion of the config is user supplied (or modified) and no longer supported. Users should upgrade
// their component configs to PreferredVersion or any other supported component config version.
ManualUpgradeRequired bool
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// UpgradePlan represents information about upgrade plan for the output
@@ -56,4 +76,6 @@ type UpgradePlan struct {
metav1.TypeMeta
Components []ComponentUpgradePlan
ConfigVersions []ComponentConfigVersionState
}

View File

@@ -48,6 +48,26 @@ type ComponentUpgradePlan struct {
NewVersion string `json:"newVersion"`
}
// ComponentConfigVersionState describes the current and desired version of a component config
type ComponentConfigVersionState struct {
// Group points to the Kubernetes API group that covers the config
Group string `json:"group"`
// CurrentVersion is the currently active component config version
// NOTE: This can be empty in case the config was not found on the cluster or it was unsupported
// kubeadm generated version
CurrentVersion string `json:"currentVersion"`
// PreferredVersion is the component config version that is currently preferred by kubeadm for use.
// NOTE: As of today, this is the only version supported by kubeadm.
PreferredVersion string `json:"preferredVersion"`
// ManualUpgradeRequired indicates if users need to manually upgrade their component config versions. This happens if
// the CurrentVersion of the config is user supplied (or modified) and no longer supported. Users should upgrade
// their component configs to PreferredVersion or any other supported component config version.
ManualUpgradeRequired bool `json:"manualUpgradeRequired"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// UpgradePlan represents information about upgrade plan for the output
@@ -56,4 +76,6 @@ type UpgradePlan struct {
metav1.TypeMeta
Components []ComponentUpgradePlan `json:"components"`
ConfigVersions []ComponentConfigVersionState `json:"configVersions"`
}

View File

@@ -45,6 +45,16 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*ComponentConfigVersionState)(nil), (*output.ComponentConfigVersionState)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ComponentConfigVersionState_To_output_ComponentConfigVersionState(a.(*ComponentConfigVersionState), b.(*output.ComponentConfigVersionState), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*output.ComponentConfigVersionState)(nil), (*ComponentConfigVersionState)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_output_ComponentConfigVersionState_To_v1alpha1_ComponentConfigVersionState(a.(*output.ComponentConfigVersionState), b.(*ComponentConfigVersionState), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*ComponentUpgradePlan)(nil), (*output.ComponentUpgradePlan)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ComponentUpgradePlan_To_output_ComponentUpgradePlan(a.(*ComponentUpgradePlan), b.(*output.ComponentUpgradePlan), scope)
}); err != nil {
@@ -98,6 +108,32 @@ func Convert_output_BootstrapToken_To_v1alpha1_BootstrapToken(in *output.Bootstr
return autoConvert_output_BootstrapToken_To_v1alpha1_BootstrapToken(in, out, s)
}
func autoConvert_v1alpha1_ComponentConfigVersionState_To_output_ComponentConfigVersionState(in *ComponentConfigVersionState, out *output.ComponentConfigVersionState, s conversion.Scope) error {
out.Group = in.Group
out.CurrentVersion = in.CurrentVersion
out.PreferredVersion = in.PreferredVersion
out.ManualUpgradeRequired = in.ManualUpgradeRequired
return nil
}
// Convert_v1alpha1_ComponentConfigVersionState_To_output_ComponentConfigVersionState is an autogenerated conversion function.
func Convert_v1alpha1_ComponentConfigVersionState_To_output_ComponentConfigVersionState(in *ComponentConfigVersionState, out *output.ComponentConfigVersionState, s conversion.Scope) error {
return autoConvert_v1alpha1_ComponentConfigVersionState_To_output_ComponentConfigVersionState(in, out, s)
}
func autoConvert_output_ComponentConfigVersionState_To_v1alpha1_ComponentConfigVersionState(in *output.ComponentConfigVersionState, out *ComponentConfigVersionState, s conversion.Scope) error {
out.Group = in.Group
out.CurrentVersion = in.CurrentVersion
out.PreferredVersion = in.PreferredVersion
out.ManualUpgradeRequired = in.ManualUpgradeRequired
return nil
}
// Convert_output_ComponentConfigVersionState_To_v1alpha1_ComponentConfigVersionState is an autogenerated conversion function.
func Convert_output_ComponentConfigVersionState_To_v1alpha1_ComponentConfigVersionState(in *output.ComponentConfigVersionState, out *ComponentConfigVersionState, s conversion.Scope) error {
return autoConvert_output_ComponentConfigVersionState_To_v1alpha1_ComponentConfigVersionState(in, out, s)
}
func autoConvert_v1alpha1_ComponentUpgradePlan_To_output_ComponentUpgradePlan(in *ComponentUpgradePlan, out *output.ComponentUpgradePlan, s conversion.Scope) error {
out.Name = in.Name
out.CurrentVersion = in.CurrentVersion
@@ -144,6 +180,7 @@ func Convert_output_Images_To_v1alpha1_Images(in *output.Images, out *Images, s
func autoConvert_v1alpha1_UpgradePlan_To_output_UpgradePlan(in *UpgradePlan, out *output.UpgradePlan, s conversion.Scope) error {
out.Components = *(*[]output.ComponentUpgradePlan)(unsafe.Pointer(&in.Components))
out.ConfigVersions = *(*[]output.ComponentConfigVersionState)(unsafe.Pointer(&in.ConfigVersions))
return nil
}
@@ -154,6 +191,7 @@ func Convert_v1alpha1_UpgradePlan_To_output_UpgradePlan(in *UpgradePlan, out *ou
func autoConvert_output_UpgradePlan_To_v1alpha1_UpgradePlan(in *output.UpgradePlan, out *UpgradePlan, s conversion.Scope) error {
out.Components = *(*[]ComponentUpgradePlan)(unsafe.Pointer(&in.Components))
out.ConfigVersions = *(*[]ComponentConfigVersionState)(unsafe.Pointer(&in.ConfigVersions))
return nil
}

View File

@@ -50,6 +50,22 @@ func (in *BootstrapToken) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComponentConfigVersionState) DeepCopyInto(out *ComponentConfigVersionState) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentConfigVersionState.
func (in *ComponentConfigVersionState) DeepCopy() *ComponentConfigVersionState {
if in == nil {
return nil
}
out := new(ComponentConfigVersionState)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComponentUpgradePlan) DeepCopyInto(out *ComponentUpgradePlan) {
*out = *in
@@ -105,6 +121,11 @@ func (in *UpgradePlan) DeepCopyInto(out *UpgradePlan) {
*out = make([]ComponentUpgradePlan, len(*in))
copy(*out, *in)
}
if in.ConfigVersions != nil {
in, out := &in.ConfigVersions, &out.ConfigVersions
*out = make([]ComponentConfigVersionState, len(*in))
copy(*out, *in)
}
return
}

View File

@@ -50,6 +50,22 @@ func (in *BootstrapToken) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComponentConfigVersionState) DeepCopyInto(out *ComponentConfigVersionState) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentConfigVersionState.
func (in *ComponentConfigVersionState) DeepCopy() *ComponentConfigVersionState {
if in == nil {
return nil
}
out := new(ComponentConfigVersionState)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComponentUpgradePlan) DeepCopyInto(out *ComponentUpgradePlan) {
*out = *in
@@ -105,6 +121,11 @@ func (in *UpgradePlan) DeepCopyInto(out *UpgradePlan) {
*out = make([]ComponentUpgradePlan, len(*in))
copy(*out, *in)
}
if in.ConfigVersions != nil {
in, out := &in.ConfigVersions, &out.ConfigVersions
*out = make([]ComponentConfigVersionState, len(*in))
copy(*out, *in)
}
return
}