mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Rename NodeConfiguration to JoinConfiguration in v1alpha3, but support both names for this release of kubeadm
This commit is contained in:
parent
a6b0410f83
commit
54b16cbd9e
@ -57,10 +57,8 @@ func Resource(resource string) schema.GroupResource {
|
||||
}
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&JoinConfiguration{},
|
||||
)
|
||||
scheme.AddKnownTypeWithName(SchemeGroupVersion.WithKind("MasterConfiguration"), &InitConfiguration{})
|
||||
scheme.AddKnownTypeWithName(SchemeGroupVersion.WithKind("NodeConfiguration"), &JoinConfiguration{})
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ func getDefaultAPIObjectBytes(apiObject string) ([]byte, error) {
|
||||
case constants.InitConfigurationKind, constants.MasterConfigurationKind:
|
||||
return getDefaultInitConfigBytes()
|
||||
|
||||
case constants.JoinConfigurationKind:
|
||||
case constants.JoinConfigurationKind, constants.NodeConfigurationKind:
|
||||
return getDefaultNodeConfigBytes()
|
||||
|
||||
default:
|
||||
|
@ -293,9 +293,13 @@ const (
|
||||
// In v1alpha3 and higher, this struct is now named InitConfiguration
|
||||
MasterConfigurationKind = "MasterConfiguration"
|
||||
|
||||
// JoinConfigurationKind is the string kind value for the InitConfiguration struct
|
||||
// JoinConfigurationKind is the string kind value for the JoinConfiguration struct
|
||||
JoinConfigurationKind = "JoinConfiguration"
|
||||
|
||||
// NodeConfigurationKind is the string kind value for the v1alpha2-named NodeConfiguration struct
|
||||
// In v1alpha3 and higher, this struct is now named JoinConfiguration
|
||||
NodeConfigurationKind = "NodeConfiguration"
|
||||
|
||||
// YAMLDocumentSeparator is the separator for YAML documents
|
||||
// TODO: Find a better place for this constant
|
||||
YAMLDocumentSeparator = "---\n"
|
||||
|
@ -48,7 +48,7 @@ func AnyConfigFileAndDefaultsToInternal(cfgPath string) (runtime.Object, error)
|
||||
if kubeadmutil.GroupVersionKindsHasInitConfiguration(gvks...) {
|
||||
return ConfigFileAndDefaultsToInternalConfig(cfgPath, &kubeadmapiv1alpha3.InitConfiguration{})
|
||||
}
|
||||
if kubeadmutil.GroupVersionKindsHasJoinConfiguration(gvks) {
|
||||
if kubeadmutil.GroupVersionKindsHasJoinConfiguration(gvks...) {
|
||||
return NodeConfigFileAndDefaultsToInternalConfig(cfgPath, &kubeadmapiv1alpha3.JoinConfiguration{})
|
||||
}
|
||||
return nil, fmt.Errorf("didn't recognize types with GroupVersionKind: %v", gvks)
|
||||
|
@ -7,7 +7,7 @@ discoveryToken: abcdef.0123456789abcdef
|
||||
discoveryTokenAPIServers:
|
||||
- kube-apiserver:6443
|
||||
discoveryTokenUnsafeSkipCAVerification: true
|
||||
kind: NodeConfiguration
|
||||
kind: JoinConfiguration
|
||||
nodeRegistration:
|
||||
criSocket: /var/run/dockershim.sock
|
||||
name: master-1
|
||||
|
@ -7,7 +7,7 @@ discoveryToken: abcdef.0123456789abcdef
|
||||
discoveryTokenAPIServers:
|
||||
- kube-apiserver:6443
|
||||
discoveryTokenUnsafeSkipCAVerification: true
|
||||
kind: NodeConfiguration
|
||||
kind: JoinConfiguration
|
||||
nodeRegistration:
|
||||
criSocket: /var/run/dockershim.sock
|
||||
name: thegopher
|
||||
|
@ -155,6 +155,6 @@ func GroupVersionKindsHasInitConfiguration(gvks ...schema.GroupVersionKind) bool
|
||||
}
|
||||
|
||||
// GroupVersionKindsHasJoinConfiguration returns whether the following gvk slice contains a JoinConfiguration object
|
||||
func GroupVersionKindsHasJoinConfiguration(gvks []schema.GroupVersionKind) bool {
|
||||
return GroupVersionKindsHasKind(gvks, constants.JoinConfigurationKind)
|
||||
func GroupVersionKindsHasJoinConfiguration(gvks ...schema.GroupVersionKind) bool {
|
||||
return GroupVersionKindsHasKind(gvks, constants.JoinConfigurationKind) || GroupVersionKindsHasKind(gvks, constants.NodeConfigurationKind)
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ func TestGroupVersionKindsHasJoinConfiguration(t *testing.T) {
|
||||
for _, rt := range tests {
|
||||
t.Run(rt.name, func(t2 *testing.T) {
|
||||
|
||||
actual := GroupVersionKindsHasJoinConfiguration(rt.gvks)
|
||||
actual := GroupVersionKindsHasJoinConfiguration(rt.gvks...)
|
||||
if rt.expected != actual {
|
||||
t2.Errorf("expected gvks has JoinConfiguration: %t\n\tactual: %t\n", rt.expected, actual)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user