Skip to content

Commit

Permalink
Merge pull request #65945 from luxas/kubeadm_initconfig
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Rename `MasterConfiguration` to `InitConfiguration` in the kubeadm v1alpha3 Config API

**What this PR does / why we need it**:
In v1alpha3, we have made the design decision that `MasterConfiguration` will be renamed `InitConfiguration`. This PR implements that change.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
ref: kubernetes/kubeadm#911
Depends on:
 - [x] #65776
 - [x] #65628
 - [x] #65629
 - [x] #65631
 - [x] #65940
 - [x] #65787

**Special notes for your reviewer**:
Most of the code is autogenerated, using just find and replace.
Please only review commits:
 - `Automated rename from MasterConfiguration to InitConfiguration`
 - `Rename MasterConfiguration to InitConfiguration in v1alpha3, but support both names for this release of kubeadm`

**Release note**:

```release-note
[action required] The `MasterConfiguration` kind in the kubeadm v1alpha2 API has been renamed `InitConfiguration` in v1alpha3
```
@kubernetes/sig-cluster-lifecycle-pr-reviews
  • Loading branch information
Kubernetes Submit Queue committed Jul 9, 2018
2 parents 4bb3a2a + 23ac814 commit 32dc6cc
Show file tree
Hide file tree
Showing 97 changed files with 699 additions and 692 deletions.
2 changes: 1 addition & 1 deletion cmd/kubeadm/app/apis/kubeadm/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
// Funcs returns the fuzzer functions for the kubeadm apis.
func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
return []interface{}{
func(obj *kubeadm.MasterConfiguration, c fuzz.Continue) {
func(obj *kubeadm.InitConfiguration, c fuzz.Continue) {
c.FuzzNoCustom(obj)
obj.KubernetesVersion = "v10"
obj.API.BindPort = 20
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubeadm/app/apis/kubeadm/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Resource(resource string) schema.GroupResource {

func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&MasterConfiguration{},
&InitConfiguration{},
&NodeConfiguration{},
)
return nil
Expand Down
20 changes: 10 additions & 10 deletions cmd/kubeadm/app/apis/kubeadm/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MasterConfiguration contains a list of elements which make up master's
// InitConfiguration contains a list of elements which make up master's
// configuration object.
type MasterConfiguration struct {
type InitConfiguration struct {
metav1.TypeMeta

// `kubeadm init`-only information. These fields are solely used the first time `kubeadm init` runs.
Expand Down Expand Up @@ -309,7 +309,7 @@ type NodeConfiguration struct {
// It will override location with CI registry name in case user requests special
// Kubernetes version from CI build area.
// (See: kubeadmconstants.DefaultCIImageRepository)
func (cfg *MasterConfiguration) GetControlPlaneImageRepository() string {
func (cfg *InitConfiguration) GetControlPlaneImageRepository() string {
if cfg.CIImageRepository != "" {
return cfg.CIImageRepository
}
Expand Down Expand Up @@ -344,29 +344,29 @@ type AuditPolicyConfiguration struct {
}

// CommonConfiguration defines the list of common configuration elements and the getter
// methods that must exist for both the MasterConfiguration and NodeConfiguration objects.
// methods that must exist for both the InitConfiguration and NodeConfiguration objects.
// This is used internally to deduplicate the kubeadm preflight checks.
type CommonConfiguration interface {
GetCRISocket() string
GetNodeName() string
GetKubernetesVersion() string
}

// GetCRISocket will return the CRISocket that is defined for the MasterConfiguration.
// GetCRISocket will return the CRISocket that is defined for the InitConfiguration.
// This is used internally to deduplicate the kubeadm preflight checks.
func (cfg *MasterConfiguration) GetCRISocket() string {
func (cfg *InitConfiguration) GetCRISocket() string {
return cfg.NodeRegistration.CRISocket
}

// GetNodeName will return the NodeName that is defined for the MasterConfiguration.
// GetNodeName will return the NodeName that is defined for the InitConfiguration.
// This is used internally to deduplicate the kubeadm preflight checks.
func (cfg *MasterConfiguration) GetNodeName() string {
func (cfg *InitConfiguration) GetNodeName() string {
return cfg.NodeRegistration.Name
}

// GetKubernetesVersion will return the KubernetesVersion that is defined for the MasterConfiguration.
// GetKubernetesVersion will return the KubernetesVersion that is defined for the InitConfiguration.
// This is used internally to deduplicate the kubeadm preflight checks.
func (cfg *MasterConfiguration) GetKubernetesVersion() string {
func (cfg *InitConfiguration) GetKubernetesVersion() string {
return cfg.KubernetesVersion
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/kubeadm/app/apis/kubeadm/v1alpha2/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
kubeproxyconfigv1alpha1 "k8s.io/kubernetes/pkg/proxy/apis/kubeproxyconfig/v1alpha1"
)

func Convert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration(in *MasterConfiguration, out *kubeadm.MasterConfiguration, s conversion.Scope) error {
if err := autoConvert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration(in, out, s); err != nil {
func Convert_v1alpha2_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error {
if err := autoConvert_v1alpha2_InitConfiguration_To_kubeadm_InitConfiguration(in, out, s); err != nil {
return err
}

Expand All @@ -53,8 +53,8 @@ func Convert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration(in *Mas
return nil
}

func Convert_kubeadm_MasterConfiguration_To_v1alpha2_MasterConfiguration(in *kubeadm.MasterConfiguration, out *MasterConfiguration, s conversion.Scope) error {
if err := autoConvert_kubeadm_MasterConfiguration_To_v1alpha2_MasterConfiguration(in, out, s); err != nil {
func Convert_kubeadm_InitConfiguration_To_v1alpha2_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error {
if err := autoConvert_kubeadm_InitConfiguration_To_v1alpha2_InitConfiguration(in, out, s); err != nil {
return err
}

Expand Down
14 changes: 7 additions & 7 deletions cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}

// SetDefaults_MasterConfiguration assigns default values to Master node
func SetDefaults_MasterConfiguration(obj *MasterConfiguration) {
// SetDefaults_InitConfiguration assigns default values to Master node
func SetDefaults_InitConfiguration(obj *InitConfiguration) {
if obj.KubernetesVersion == "" {
obj.KubernetesVersion = DefaultKubernetesVersion
}
Expand Down Expand Up @@ -114,7 +114,7 @@ func SetDefaults_MasterConfiguration(obj *MasterConfiguration) {
}

// SetDefaults_Etcd assigns default values for the Proxy
func SetDefaults_Etcd(obj *MasterConfiguration) {
func SetDefaults_Etcd(obj *InitConfiguration) {
if obj.Etcd.External == nil && obj.Etcd.Local == nil {
obj.Etcd.Local = &LocalEtcd{}
}
Expand All @@ -126,7 +126,7 @@ func SetDefaults_Etcd(obj *MasterConfiguration) {
}

// SetDefaults_ProxyConfiguration assigns default values for the Proxy
func SetDefaults_ProxyConfiguration(obj *MasterConfiguration) {
func SetDefaults_ProxyConfiguration(obj *InitConfiguration) {
// IMPORTANT NOTE: If you're changing this code you should mirror it to cmd/kubeadm/app/componentconfig/defaults.go
// and cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go.
if obj.KubeProxy.Config == nil {
Expand Down Expand Up @@ -174,7 +174,7 @@ func SetDefaults_NodeConfiguration(obj *NodeConfiguration) {
}

// SetDefaults_KubeletConfiguration assigns default values to kubelet
func SetDefaults_KubeletConfiguration(obj *MasterConfiguration) {
func SetDefaults_KubeletConfiguration(obj *InitConfiguration) {
// IMPORTANT NOTE: If you're changing this code you should mirror it to cmd/kubeadm/app/componentconfig/defaults.go
// and cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion.go.
if obj.KubeletConfiguration.BaseConfig == nil {
Expand Down Expand Up @@ -231,7 +231,7 @@ func SetDefaults_NodeRegistrationOptions(obj *NodeRegistrationOptions) {
}

// SetDefaults_AuditPolicyConfiguration sets default values for the AuditPolicyConfiguration
func SetDefaults_AuditPolicyConfiguration(obj *MasterConfiguration) {
func SetDefaults_AuditPolicyConfiguration(obj *InitConfiguration) {
if obj.AuditPolicyConfiguration.LogDir == "" {
obj.AuditPolicyConfiguration.LogDir = constants.StaticPodAuditPolicyLogDir
}
Expand All @@ -245,7 +245,7 @@ func SetDefaults_AuditPolicyConfiguration(obj *MasterConfiguration) {
// through the slice and sets the defaults for the omitempty fields that are TTL,
// Usages and Groups. Token is NOT defaulted with a random one in the API defaulting
// layer, but set to a random value later at runtime if not set before.
func SetDefaults_BootstrapTokens(obj *MasterConfiguration) {
func SetDefaults_BootstrapTokens(obj *InitConfiguration) {

if obj.BootstrapTokens == nil || len(obj.BootstrapTokens) == 0 {
obj.BootstrapTokens = []BootstrapToken{{}}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubeadm/app/apis/kubeadm/v1alpha2/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func Resource(resource string) schema.GroupResource {

func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&MasterConfiguration{},
&NodeConfiguration{},
)
scheme.AddKnownTypeWithName(SchemeGroupVersion.WithKind("MasterConfiguration"), &InitConfiguration{})
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
4 changes: 2 additions & 2 deletions cmd/kubeadm/app/apis/kubeadm/v1alpha2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MasterConfiguration contains a list of elements which make up master's
// InitConfiguration contains a list of elements which make up master's
// configuration object.
type MasterConfiguration struct {
type InitConfiguration struct {
metav1.TypeMeta `json:",inline"`

// `kubeadm init`-only information. These fields are solely used the first time `kubeadm init` runs.
Expand Down
64 changes: 32 additions & 32 deletions cmd/kubeadm/app/apis/kubeadm/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 32dc6cc

Please sign in to comment.