diff --git a/Makefile b/Makefile index 526c47de6047..b02ef80ebb3d 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,10 @@ generate-go: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go related generate tar --input-dirs=./api/v1alpha2 \ --output-file-base=zz_generated.conversion \ --go-header-file=./hack/boilerplate/boilerplate.generatego.txt + $(CONVERSION_GEN) \ + --input-dirs=./bootstrap/kubeadm/api/v1alpha2 \ + --output-file-base=zz_generated.conversion \ + --go-header-file=./hack/boilerplate/boilerplate.generatego.txt .PHONY: generate-bindata generate-bindata: $(KUSTOMIZE) $(GOBINDATA) clean-bindata ## Generate code for embedding the clusterctl api manifest @@ -170,6 +174,7 @@ generate-bindata: $(KUSTOMIZE) $(GOBINDATA) clean-bindata ## Generate code for e generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc. $(CONTROLLER_GEN) \ paths=./api/... \ + paths=./bootstrap/kubeadm/api/... \ paths=./controllers/... \ paths=./bootstrap/kubeadm/controllers/... \ crd:preserveUnknownFields=false \ @@ -177,10 +182,6 @@ generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc. output:crd:dir=./config/crd/bases \ output:webhook:dir=./config/webhook \ webhook - $(CONTROLLER_GEN) \ - paths=./bootstrap/kubeadm/api/... \ - crd:trivialVersions=true,preserveUnknownFields=false \ - output:crd:dir=./config/crd/bases $(CONTROLLER_GEN) \ paths=./cmd/clusterctl/api/... \ crd:trivialVersions=true,preserveUnknownFields=false \ diff --git a/api/v1alpha3/kubeadm_control_plane_types.go b/api/v1alpha3/kubeadm_control_plane_types.go index d17d3965cd4f..97c2ab2f70a7 100644 --- a/api/v1alpha3/kubeadm_control_plane_types.go +++ b/api/v1alpha3/kubeadm_control_plane_types.go @@ -19,7 +19,7 @@ package v1alpha3 import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" "sigs.k8s.io/cluster-api/errors" ) @@ -90,7 +90,7 @@ type KubeadmControlPlaneStatus struct { // state, and will be set to a token value suitable for // programmatic interpretation. // +optional - Failurereason errors.KubeadmControlPlaneStatusError `json:"failureReason,omitempty"` + FailureReason errors.KubeadmControlPlaneStatusError `json:"failureReason,omitempty"` // ErrorMessage indicates that there is a terminal problem reconciling the // state, and will be set to a descriptive error message. diff --git a/bootstrap/kubeadm/PROJECT b/bootstrap/kubeadm/PROJECT index 92ca92d58f9c..10e59ac978dd 100644 --- a/bootstrap/kubeadm/PROJECT +++ b/bootstrap/kubeadm/PROJECT @@ -8,3 +8,9 @@ resources: - group: bootstrap version: v1alpha2 kind: KubeadmConfigTemplate +- group: bootstrap + version: v1alpha3 + kind: KubeadmConfig +- group: bootstrap + version: v1alpha3 + kind: KubeadmConfigTemplate diff --git a/bootstrap/kubeadm/api/v1alpha2/conversion.go b/bootstrap/kubeadm/api/v1alpha2/conversion.go new file mode 100644 index 000000000000..c13f4cb3921b --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha2/conversion.go @@ -0,0 +1,97 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha2 + +import ( + apiconversion "k8s.io/apimachinery/pkg/conversion" + kubeadmbootstrapv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts this KubeadmConfig to the Hub version (v1alpha3). +func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error { // nolint + dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfig) + return Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(src, dst, nil) +} + +// ConvertFrom converts from the KubeadmConfig Hub version (v1alpha3) to this version. +func (dst *KubeadmConfig) ConvertFrom(srcRaw conversion.Hub) error { // nolint + src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfig) + return Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(src, dst, nil) +} + +// ConvertTo converts this KubeadmConfigList to the Hub version (v1alpha3). +func (src *KubeadmConfigList) ConvertTo(dstRaw conversion.Hub) error { // nolint + dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigList) + return Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(src, dst, nil) +} + +// ConvertFrom converts from the KubeadmConfigList Hub version (v1alpha3) to this version. +func (dst *KubeadmConfigList) ConvertFrom(srcRaw conversion.Hub) error { // nolint + src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigList) + return Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(src, dst, nil) +} + +// ConvertTo converts this KubeadmConfigTemplate to the Hub version (v1alpha3). +func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error { // nolint + dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplate) + return Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(src, dst, nil) +} + +// ConvertFrom converts from the KubeadmConfigTemplate Hub version (v1alpha3) to this version. +func (dst *KubeadmConfigTemplate) ConvertFrom(srcRaw conversion.Hub) error { // nolint + src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplate) + return Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(src, dst, nil) +} + +// ConvertTo converts this KubeadmConfigTemplateList to the Hub version (v1alpha3). +func (src *KubeadmConfigTemplateList) ConvertTo(dstRaw conversion.Hub) error { // nolint + dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList) + return Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(src, dst, nil) +} + +// ConvertFrom converts from the KubeadmConfigTemplateList Hub version (v1alpha3) to this version. +func (dst *KubeadmConfigTemplateList) ConvertFrom(srcRaw conversion.Hub) error { // nolint + src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList) + return Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(src, dst, nil) +} + +// Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus converts this KubeadmConfigStatus to the Hub version (v1alpha3). +func Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *KubeadmConfigStatus, out *kubeadmbootstrapv1alpha3.KubeadmConfigStatus, s apiconversion.Scope) error { // nolint + if err := autoConvert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in, out, s); err != nil { + return err + } + + // Manually convert the Error fields to the Failure fields + out.FailureMessage = in.ErrorMessage + out.FailureReason = in.ErrorReason + + return nil +} + +// Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus converts from the Hub version (v1alpha3) of the KubeadmConfigStatus to this version. +func Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in *kubeadmbootstrapv1alpha3.KubeadmConfigStatus, out *KubeadmConfigStatus, s apiconversion.Scope) error { // nolint + if err := autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in, out, s); err != nil { + return err + } + + // Manually convert the Failure fields to the Error fields + out.ErrorMessage = in.FailureMessage + out.ErrorReason = in.FailureReason + + return nil +} diff --git a/bootstrap/kubeadm/api/v1alpha2/doc.go b/bootstrap/kubeadm/api/v1alpha2/doc.go new file mode 100644 index 000000000000..7fee63494946 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha2/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3 +package v1alpha2 diff --git a/bootstrap/kubeadm/api/v1alpha2/groupversion_info.go b/bootstrap/kubeadm/api/v1alpha2/groupversion_info.go index 8f00b8c75b34..2b042f0ed460 100644 --- a/bootstrap/kubeadm/api/v1alpha2/groupversion_info.go +++ b/bootstrap/kubeadm/api/v1alpha2/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/bootstrap/kubeadm/api/v1alpha2/kubeadmbootstrapconfig_types.go b/bootstrap/kubeadm/api/v1alpha2/kubeadmbootstrapconfig_types.go index 9c998db1afde..ac270090e4ea 100644 --- a/bootstrap/kubeadm/api/v1alpha2/kubeadmbootstrapconfig_types.go +++ b/bootstrap/kubeadm/api/v1alpha2/kubeadmbootstrapconfig_types.go @@ -82,7 +82,6 @@ type KubeadmConfigStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=kubeadmconfigs,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // +kubebuilder:subresource:status // KubeadmConfig is the Schema for the kubeadmconfigs API diff --git a/bootstrap/kubeadm/api/v1alpha2/kubeadmconfigtemplate_types.go b/bootstrap/kubeadm/api/v1alpha2/kubeadmconfigtemplate_types.go index 1bf5aac34a65..6d3f798f6707 100644 --- a/bootstrap/kubeadm/api/v1alpha2/kubeadmconfigtemplate_types.go +++ b/bootstrap/kubeadm/api/v1alpha2/kubeadmconfigtemplate_types.go @@ -27,7 +27,6 @@ type KubeadmConfigTemplateSpec struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=kubeadmconfigtemplates,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // KubeadmConfigTemplate is the Schema for the kubeadmconfigtemplates API type KubeadmConfigTemplate struct { diff --git a/bootstrap/kubeadm/api/v1alpha2/zz_generated.conversion.go b/bootstrap/kubeadm/api/v1alpha2/zz_generated.conversion.go new file mode 100644 index 000000000000..4cfd804b458f --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha2/zz_generated.conversion.go @@ -0,0 +1,472 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + unsafe "unsafe" + + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + v1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + v1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*File)(nil), (*v1alpha3.File)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_File_To_v1alpha3_File(a.(*File), b.(*v1alpha3.File), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.File)(nil), (*File)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_File_To_v1alpha2_File(a.(*v1alpha3.File), b.(*File), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfig)(nil), (*v1alpha3.KubeadmConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(a.(*KubeadmConfig), b.(*v1alpha3.KubeadmConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfig)(nil), (*KubeadmConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(a.(*v1alpha3.KubeadmConfig), b.(*KubeadmConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigList)(nil), (*v1alpha3.KubeadmConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(a.(*KubeadmConfigList), b.(*v1alpha3.KubeadmConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigList)(nil), (*KubeadmConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(a.(*v1alpha3.KubeadmConfigList), b.(*KubeadmConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigSpec)(nil), (*v1alpha3.KubeadmConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(a.(*KubeadmConfigSpec), b.(*v1alpha3.KubeadmConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigSpec)(nil), (*KubeadmConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(a.(*v1alpha3.KubeadmConfigSpec), b.(*KubeadmConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigStatus)(nil), (*v1alpha3.KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(a.(*KubeadmConfigStatus), b.(*v1alpha3.KubeadmConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigStatus)(nil), (*KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(a.(*v1alpha3.KubeadmConfigStatus), b.(*KubeadmConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplate)(nil), (*v1alpha3.KubeadmConfigTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(a.(*KubeadmConfigTemplate), b.(*v1alpha3.KubeadmConfigTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigTemplate)(nil), (*KubeadmConfigTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(a.(*v1alpha3.KubeadmConfigTemplate), b.(*KubeadmConfigTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplateList)(nil), (*v1alpha3.KubeadmConfigTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(a.(*KubeadmConfigTemplateList), b.(*v1alpha3.KubeadmConfigTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigTemplateList)(nil), (*KubeadmConfigTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(a.(*v1alpha3.KubeadmConfigTemplateList), b.(*KubeadmConfigTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplateResource)(nil), (*v1alpha3.KubeadmConfigTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(a.(*KubeadmConfigTemplateResource), b.(*v1alpha3.KubeadmConfigTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigTemplateResource)(nil), (*KubeadmConfigTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(a.(*v1alpha3.KubeadmConfigTemplateResource), b.(*KubeadmConfigTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplateSpec)(nil), (*v1alpha3.KubeadmConfigTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(a.(*KubeadmConfigTemplateSpec), b.(*v1alpha3.KubeadmConfigTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigTemplateSpec)(nil), (*KubeadmConfigTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(a.(*v1alpha3.KubeadmConfigTemplateSpec), b.(*KubeadmConfigTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NTP)(nil), (*v1alpha3.NTP)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_NTP_To_v1alpha3_NTP(a.(*NTP), b.(*v1alpha3.NTP), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.NTP)(nil), (*NTP)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_NTP_To_v1alpha2_NTP(a.(*v1alpha3.NTP), b.(*NTP), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*User)(nil), (*v1alpha3.User)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_User_To_v1alpha3_User(a.(*User), b.(*v1alpha3.User), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.User)(nil), (*User)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_User_To_v1alpha2_User(a.(*v1alpha3.User), b.(*User), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*KubeadmConfigStatus)(nil), (*v1alpha3.KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(a.(*KubeadmConfigStatus), b.(*v1alpha3.KubeadmConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha3.KubeadmConfigStatus)(nil), (*KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(a.(*v1alpha3.KubeadmConfigStatus), b.(*KubeadmConfigStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha2_File_To_v1alpha3_File(in *File, out *v1alpha3.File, s conversion.Scope) error { + out.Path = in.Path + out.Owner = in.Owner + out.Permissions = in.Permissions + out.Encoding = v1alpha3.Encoding(in.Encoding) + out.Content = in.Content + return nil +} + +// Convert_v1alpha2_File_To_v1alpha3_File is an autogenerated conversion function. +func Convert_v1alpha2_File_To_v1alpha3_File(in *File, out *v1alpha3.File, s conversion.Scope) error { + return autoConvert_v1alpha2_File_To_v1alpha3_File(in, out, s) +} + +func autoConvert_v1alpha3_File_To_v1alpha2_File(in *v1alpha3.File, out *File, s conversion.Scope) error { + out.Path = in.Path + out.Owner = in.Owner + out.Permissions = in.Permissions + out.Encoding = Encoding(in.Encoding) + out.Content = in.Content + return nil +} + +// Convert_v1alpha3_File_To_v1alpha2_File is an autogenerated conversion function. +func Convert_v1alpha3_File_To_v1alpha2_File(in *v1alpha3.File, out *File, s conversion.Scope) error { + return autoConvert_v1alpha3_File_To_v1alpha2_File(in, out, s) +} + +func autoConvert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(in *KubeadmConfig, out *v1alpha3.KubeadmConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig is an autogenerated conversion function. +func Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(in *KubeadmConfig, out *v1alpha3.KubeadmConfig, s conversion.Scope) error { + return autoConvert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(in *v1alpha3.KubeadmConfig, out *KubeadmConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(in *v1alpha3.KubeadmConfig, out *KubeadmConfig, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(in, out, s) +} + +func autoConvert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(in *KubeadmConfigList, out *v1alpha3.KubeadmConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha3.KubeadmConfig, len(*in)) + for i := range *in { + if err := Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList is an autogenerated conversion function. +func Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(in *KubeadmConfigList, out *v1alpha3.KubeadmConfigList, s conversion.Scope) error { + return autoConvert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(in *v1alpha3.KubeadmConfigList, out *KubeadmConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KubeadmConfig, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(in *v1alpha3.KubeadmConfigList, out *KubeadmConfigList, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(in, out, s) +} + +func autoConvert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *KubeadmConfigSpec, out *v1alpha3.KubeadmConfigSpec, s conversion.Scope) error { + out.ClusterConfiguration = (*v1beta1.ClusterConfiguration)(unsafe.Pointer(in.ClusterConfiguration)) + out.InitConfiguration = (*v1beta1.InitConfiguration)(unsafe.Pointer(in.InitConfiguration)) + out.JoinConfiguration = (*v1beta1.JoinConfiguration)(unsafe.Pointer(in.JoinConfiguration)) + out.Files = *(*[]v1alpha3.File)(unsafe.Pointer(&in.Files)) + out.PreKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PreKubeadmCommands)) + out.PostKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PostKubeadmCommands)) + out.Users = *(*[]v1alpha3.User)(unsafe.Pointer(&in.Users)) + out.NTP = (*v1alpha3.NTP)(unsafe.Pointer(in.NTP)) + out.Format = v1alpha3.Format(in.Format) + return nil +} + +// Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec is an autogenerated conversion function. +func Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *KubeadmConfigSpec, out *v1alpha3.KubeadmConfigSpec, s conversion.Scope) error { + return autoConvert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(in *v1alpha3.KubeadmConfigSpec, out *KubeadmConfigSpec, s conversion.Scope) error { + out.ClusterConfiguration = (*v1beta1.ClusterConfiguration)(unsafe.Pointer(in.ClusterConfiguration)) + out.InitConfiguration = (*v1beta1.InitConfiguration)(unsafe.Pointer(in.InitConfiguration)) + out.JoinConfiguration = (*v1beta1.JoinConfiguration)(unsafe.Pointer(in.JoinConfiguration)) + out.Files = *(*[]File)(unsafe.Pointer(&in.Files)) + out.PreKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PreKubeadmCommands)) + out.PostKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PostKubeadmCommands)) + out.Users = *(*[]User)(unsafe.Pointer(&in.Users)) + out.NTP = (*NTP)(unsafe.Pointer(in.NTP)) + out.Format = Format(in.Format) + return nil +} + +// Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(in *v1alpha3.KubeadmConfigSpec, out *KubeadmConfigSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(in, out, s) +} + +func autoConvert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *KubeadmConfigStatus, out *v1alpha3.KubeadmConfigStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.BootstrapData = *(*[]byte)(unsafe.Pointer(&in.BootstrapData)) + // WARNING: in.ErrorReason requires manual conversion: does not exist in peer-type + // WARNING: in.ErrorMessage requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in *v1alpha3.KubeadmConfigStatus, out *KubeadmConfigStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.BootstrapData = *(*[]byte)(unsafe.Pointer(&in.BootstrapData)) + // WARNING: in.FailureReason requires manual conversion: does not exist in peer-type + // WARNING: in.FailureMessage requires manual conversion: does not exist in peer-type + return nil +} + +func autoConvert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(in *KubeadmConfigTemplate, out *v1alpha3.KubeadmConfigTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate is an autogenerated conversion function. +func Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(in *KubeadmConfigTemplate, out *v1alpha3.KubeadmConfigTemplate, s conversion.Scope) error { + return autoConvert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(in *v1alpha3.KubeadmConfigTemplate, out *KubeadmConfigTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(in *v1alpha3.KubeadmConfigTemplate, out *KubeadmConfigTemplate, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(in, out, s) +} + +func autoConvert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(in *KubeadmConfigTemplateList, out *v1alpha3.KubeadmConfigTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha3.KubeadmConfigTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList is an autogenerated conversion function. +func Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(in *KubeadmConfigTemplateList, out *v1alpha3.KubeadmConfigTemplateList, s conversion.Scope) error { + return autoConvert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(in *v1alpha3.KubeadmConfigTemplateList, out *KubeadmConfigTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]KubeadmConfigTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(in *v1alpha3.KubeadmConfigTemplateList, out *KubeadmConfigTemplateList, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(in, out, s) +} + +func autoConvert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in *KubeadmConfigTemplateResource, out *v1alpha3.KubeadmConfigTemplateResource, s conversion.Scope) error { + if err := Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource is an autogenerated conversion function. +func Convert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in *KubeadmConfigTemplateResource, out *v1alpha3.KubeadmConfigTemplateResource, s conversion.Scope) error { + return autoConvert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(in *v1alpha3.KubeadmConfigTemplateResource, out *KubeadmConfigTemplateResource, s conversion.Scope) error { + if err := Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(in *v1alpha3.KubeadmConfigTemplateResource, out *KubeadmConfigTemplateResource, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(in, out, s) +} + +func autoConvert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(in *KubeadmConfigTemplateSpec, out *v1alpha3.KubeadmConfigTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(in *KubeadmConfigTemplateSpec, out *v1alpha3.KubeadmConfigTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(in *v1alpha3.KubeadmConfigTemplateSpec, out *KubeadmConfigTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(in *v1alpha3.KubeadmConfigTemplateSpec, out *KubeadmConfigTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha2_NTP_To_v1alpha3_NTP(in *NTP, out *v1alpha3.NTP, s conversion.Scope) error { + out.Servers = *(*[]string)(unsafe.Pointer(&in.Servers)) + out.Enabled = (*bool)(unsafe.Pointer(in.Enabled)) + return nil +} + +// Convert_v1alpha2_NTP_To_v1alpha3_NTP is an autogenerated conversion function. +func Convert_v1alpha2_NTP_To_v1alpha3_NTP(in *NTP, out *v1alpha3.NTP, s conversion.Scope) error { + return autoConvert_v1alpha2_NTP_To_v1alpha3_NTP(in, out, s) +} + +func autoConvert_v1alpha3_NTP_To_v1alpha2_NTP(in *v1alpha3.NTP, out *NTP, s conversion.Scope) error { + out.Servers = *(*[]string)(unsafe.Pointer(&in.Servers)) + out.Enabled = (*bool)(unsafe.Pointer(in.Enabled)) + return nil +} + +// Convert_v1alpha3_NTP_To_v1alpha2_NTP is an autogenerated conversion function. +func Convert_v1alpha3_NTP_To_v1alpha2_NTP(in *v1alpha3.NTP, out *NTP, s conversion.Scope) error { + return autoConvert_v1alpha3_NTP_To_v1alpha2_NTP(in, out, s) +} + +func autoConvert_v1alpha2_User_To_v1alpha3_User(in *User, out *v1alpha3.User, s conversion.Scope) error { + out.Name = in.Name + out.Gecos = (*string)(unsafe.Pointer(in.Gecos)) + out.Groups = (*string)(unsafe.Pointer(in.Groups)) + out.HomeDir = (*string)(unsafe.Pointer(in.HomeDir)) + out.Inactive = (*bool)(unsafe.Pointer(in.Inactive)) + out.Shell = (*string)(unsafe.Pointer(in.Shell)) + out.Passwd = (*string)(unsafe.Pointer(in.Passwd)) + out.PrimaryGroup = (*string)(unsafe.Pointer(in.PrimaryGroup)) + out.LockPassword = (*bool)(unsafe.Pointer(in.LockPassword)) + out.Sudo = (*string)(unsafe.Pointer(in.Sudo)) + out.SSHAuthorizedKeys = *(*[]string)(unsafe.Pointer(&in.SSHAuthorizedKeys)) + return nil +} + +// Convert_v1alpha2_User_To_v1alpha3_User is an autogenerated conversion function. +func Convert_v1alpha2_User_To_v1alpha3_User(in *User, out *v1alpha3.User, s conversion.Scope) error { + return autoConvert_v1alpha2_User_To_v1alpha3_User(in, out, s) +} + +func autoConvert_v1alpha3_User_To_v1alpha2_User(in *v1alpha3.User, out *User, s conversion.Scope) error { + out.Name = in.Name + out.Gecos = (*string)(unsafe.Pointer(in.Gecos)) + out.Groups = (*string)(unsafe.Pointer(in.Groups)) + out.HomeDir = (*string)(unsafe.Pointer(in.HomeDir)) + out.Inactive = (*bool)(unsafe.Pointer(in.Inactive)) + out.Shell = (*string)(unsafe.Pointer(in.Shell)) + out.Passwd = (*string)(unsafe.Pointer(in.Passwd)) + out.PrimaryGroup = (*string)(unsafe.Pointer(in.PrimaryGroup)) + out.LockPassword = (*bool)(unsafe.Pointer(in.LockPassword)) + out.Sudo = (*string)(unsafe.Pointer(in.Sudo)) + out.SSHAuthorizedKeys = *(*[]string)(unsafe.Pointer(&in.SSHAuthorizedKeys)) + return nil +} + +// Convert_v1alpha3_User_To_v1alpha2_User is an autogenerated conversion function. +func Convert_v1alpha3_User_To_v1alpha2_User(in *v1alpha3.User, out *User, s conversion.Scope) error { + return autoConvert_v1alpha3_User_To_v1alpha2_User(in, out, s) +} diff --git a/bootstrap/kubeadm/api/v1alpha3/conversion.go b/bootstrap/kubeadm/api/v1alpha3/conversion.go new file mode 100644 index 000000000000..13a5d47ca7d0 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/conversion.go @@ -0,0 +1,22 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +func (*KubeadmConfig) Hub() {} +func (*KubeadmConfigList) Hub() {} +func (*KubeadmConfigTemplate) Hub() {} +func (*KubeadmConfigTemplateList) Hub() {} diff --git a/bootstrap/kubeadm/api/v1alpha3/doc.go b/bootstrap/kubeadm/api/v1alpha3/doc.go new file mode 100644 index 000000000000..999cec2ac553 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/doc.go @@ -0,0 +1,17 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 diff --git a/bootstrap/kubeadm/api/v1alpha3/groupversion_info.go b/bootstrap/kubeadm/api/v1alpha3/groupversion_info.go new file mode 100644 index 000000000000..c16eb4210d7c --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha3 contains API Schema definitions for the kubeadm v1alpha3 API group +// +kubebuilder:object:generate=true +// +groupName=bootstrap.cluster.x-k8s.io +package v1alpha3 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "bootstrap.cluster.x-k8s.io", Version: "v1alpha3"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types.go new file mode 100644 index 000000000000..c66dc81e2f80 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types.go @@ -0,0 +1,199 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" +) + +// Format specifies the output format of the bootstrap data +// +kubebuilder:validation:Enum=cloud-config +type Format string + +const ( + // CloudConfig make the bootstrap data to be of cloud-config format + CloudConfig Format = "cloud-config" +) + +// KubeadmConfigSpec defines the desired state of KubeadmConfig. +// Either ClusterConfiguration and InitConfiguration should be defined or the JoinConfiguration should be defined. +type KubeadmConfigSpec struct { + // ClusterConfiguration along with InitConfiguration are the configurations necessary for the init command + // +optional + ClusterConfiguration *kubeadmv1beta1.ClusterConfiguration `json:"clusterConfiguration,omitempty"` + // InitConfiguration along with ClusterConfiguration are the configurations necessary for the init command + // +optional + InitConfiguration *kubeadmv1beta1.InitConfiguration `json:"initConfiguration,omitempty"` + // JoinConfiguration is the kubeadm configuration for the join command + // +optional + JoinConfiguration *kubeadmv1beta1.JoinConfiguration `json:"joinConfiguration,omitempty"` + // Files specifies extra files to be passed to user_data upon creation. + // +optional + Files []File `json:"files,omitempty"` + // PreKubeadmCommands specifies extra commands to run before kubeadm runs + // +optional + PreKubeadmCommands []string `json:"preKubeadmCommands,omitempty"` + // PostKubeadmCommands specifies extra commands to run after kubeadm runs + // +optional + PostKubeadmCommands []string `json:"postKubeadmCommands,omitempty"` + // Users specifies extra users to add + // +optional + Users []User `json:"users,omitempty"` + // NTP specifies NTP configuration + // +optional + NTP *NTP `json:"ntp,omitempty"` + // Format specifies the output format of the bootstrap data + // +optional + Format Format `json:"format,omitempty"` +} + +// KubeadmConfigStatus defines the observed state of KubeadmConfig +type KubeadmConfigStatus struct { + // Ready indicates the BootstrapData field is ready to be consumed + Ready bool `json:"ready,omitempty"` + + // BootstrapData will be a cloud-init script for now + // +optional + BootstrapData []byte `json:"bootstrapData,omitempty"` + + // FailureReason will be set on non-retryable errors + // +optional + FailureReason string `json:"failureReason,omitempty"` + + // FailureMessage will be set on non-retryable errors + // +optional + FailureMessage string `json:"failureMessage,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=kubeadmconfigs,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +// KubeadmConfig is the Schema for the kubeadmconfigs API +type KubeadmConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec KubeadmConfigSpec `json:"spec,omitempty"` + Status KubeadmConfigStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// KubeadmConfigList contains a list of KubeadmConfig +type KubeadmConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []KubeadmConfig `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KubeadmConfig{}, &KubeadmConfigList{}) +} + +// Encoding specifies the cloud-init file encoding. +// +kubebuilder:validation:Enum=base64;gzip;gzip+base64 +type Encoding string + +const ( + // Base64 implies the contents of the file are encoded as base64. + Base64 Encoding = "base64" + // Gzip implies the contents of the file are encoded with gzip. + Gzip Encoding = "gzip" + // GzipBase64 implies the contents of the file are first base64 encoded and then gzip encoded. + GzipBase64 Encoding = "gzip+base64" +) + +// File defines the input for generating write_files in cloud-init. +type File struct { + // Path specifies the full path on disk where to store the file. + Path string `json:"path"` + + // Owner specifies the ownership of the file, e.g. "root:root". + // +optional + Owner string `json:"owner,omitempty"` + + // Permissions specifies the permissions to assign to the file, e.g. "0640". + // +optional + Permissions string `json:"permissions,omitempty"` + + // Encoding specifies the encoding of the file contents. + // +optional + Encoding Encoding `json:"encoding,omitempty"` + + // Content is the actual content of the file. + Content string `json:"content"` +} + +// User defines the input for a generated user in cloud-init. +type User struct { + // Name specifies the user name + Name string `json:"name"` + + // Gecos specifies the gecos to use for the user + // +optional + Gecos *string `json:"gecos,omitempty"` + + // Groups specifies the additional groups for the user + // +optional + Groups *string `json:"groups,omitempty"` + + // HomeDir specifies the home directory to use for the user + // +optional + HomeDir *string `json:"homeDir,omitempty"` + + // Inactive specifies whether to mark the user as inactive + // +optional + Inactive *bool `json:"inactive,omitempty"` + + // Shell specifies the user's shell + // +optional + Shell *string `json:"shell,omitempty"` + + // Passwd specifies a hashed password for the user + // +optional + Passwd *string `json:"passwd"` + + // PrimaryGroup specifies the primary group for the user + // +optional + PrimaryGroup *string `json:"primaryGroup,omitempty"` + + // LockPassword specifies if password login should be disabled + // +optional + LockPassword *bool `json:"lockPassword,omitempty"` + + // Sudo specifies a sudo role for the user + // +optional + Sudo *string `json:"sudo,omitempty"` + + // SSHAuthorizedKeys specifies a list of ssh authorized keys for the user + // +optional + SSHAuthorizedKeys []string `json:"sshAuthorizedKeys,omitempty"` +} + +// NTP defines input for generated ntp in cloud-init +type NTP struct { + // Servers specifies which NTP servers to use + // +optional + Servers []string `json:"servers,omitempty"` + + // Enabled specifies whether NTP should be enabled + // +optional + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types_test.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types_test.go new file mode 100644 index 000000000000..637556172205 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types_test.go @@ -0,0 +1,77 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "golang.org/x/net/context" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// These tests are written in BDD-style using Ginkgo framework. Refer to +// http://onsi.github.io/ginkgo to learn more. + +var _ = Describe("KubeadmConfig", func() { + var ( + key types.NamespacedName + created, fetched *KubeadmConfig + ) + + BeforeEach(func() { + // Add any setup steps that needs to be executed before each test + }) + + AfterEach(func() { + // Add any teardown steps that needs to be executed after each test + }) + + // Add Tests for OpenAPI validation (or additional CRD features) specified in + // your API definition. + // Avoid adding tests for vanilla CRUD operations because they would + // test Kubernetes API server, which isn't the goal here. + Context("Create API", func() { + + It("should create an object successfully", func() { + + key = types.NamespacedName{ + Name: "foo", + Namespace: "default", + } + created = &KubeadmConfig{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: "default", + }, + } + + By("creating an API obj") + Expect(k8sClient.Create(context.TODO(), created)).To(Succeed()) + + fetched = &KubeadmConfig{} + Expect(k8sClient.Get(context.TODO(), key, fetched)).To(Succeed()) + Expect(fetched).To(Equal(created)) + + By("deleting the created object") + Expect(k8sClient.Delete(context.TODO(), created)).To(Succeed()) + Expect(k8sClient.Get(context.TODO(), key, created)).ToNot(Succeed()) + }) + + }) + +}) diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_webhook.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_webhook.go new file mode 100644 index 000000000000..d08b3e1598d8 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_webhook.go @@ -0,0 +1,27 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +func (r *KubeadmConfig) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfiglist_webhook.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfiglist_webhook.go new file mode 100644 index 000000000000..5d7d3850705c --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfiglist_webhook.go @@ -0,0 +1,27 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +func (r *KubeadmConfigList) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_types.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_types.go new file mode 100644 index 000000000000..672673965ea1 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_types.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// KubeadmConfigTemplateSpec defines the desired state of KubeadmConfigTemplate +type KubeadmConfigTemplateSpec struct { + Template KubeadmConfigTemplateResource `json:"template"` +} + +// KubeadmConfigTemplateResource defines the Template structure +type KubeadmConfigTemplateResource struct { + Spec KubeadmConfigSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=kubeadmconfigtemplates,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion + +// KubeadmConfigTemplate is the Schema for the kubeadmconfigtemplates API +type KubeadmConfigTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec KubeadmConfigTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// KubeadmConfigTemplateList contains a list of KubeadmConfigTemplate +type KubeadmConfigTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []KubeadmConfigTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KubeadmConfigTemplate{}, &KubeadmConfigTemplateList{}) +} diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_webhook.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_webhook.go new file mode 100644 index 000000000000..7e7ef6bd6f79 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_webhook.go @@ -0,0 +1,27 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +func (r *KubeadmConfigTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplatelist_webhook.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplatelist_webhook.go new file mode 100644 index 000000000000..f1e9b8084e37 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplatelist_webhook.go @@ -0,0 +1,27 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +func (r *KubeadmConfigTemplateList) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/bootstrap/kubeadm/api/v1alpha3/suite_test.go b/bootstrap/kubeadm/api/v1alpha3/suite_test.go new file mode 100644 index 000000000000..5ae7a79e3a2c --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/suite_test.go @@ -0,0 +1,80 @@ +/* +Copyright 2019 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + "path/filepath" + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" + "k8s.io/klog" + "k8s.io/klog/klogr" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" + logf "sigs.k8s.io/controller-runtime/pkg/log" +) + +// These tests use Ginkgo (BDD-style Go testing framework). Refer to +// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. + +var cfg *rest.Config +var k8sClient client.Client +var testEnv *envtest.Environment + +func init() { + klog.InitFlags(nil) + klog.SetOutput(GinkgoWriter) + logf.SetLogger(klogr.New()) +} + +func TestAPIs(t *testing.T) { + RegisterFailHandler(Fail) + + RunSpecsWithDefaultAndCustomReporters(t, + "v1alpha3 Suite", + []Reporter{envtest.NewlineReporter{}}) +} + +var _ = BeforeSuite(func(done Done) { + By("bootstrapping test environment") + testEnv = &envtest.Environment{ + CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "..", "config", "crd", "bases")}, + } + + err := SchemeBuilder.AddToScheme(scheme.Scheme) + Expect(err).NotTo(HaveOccurred()) + + cfg, err = testEnv.Start() + Expect(err).ToNot(HaveOccurred()) + Expect(cfg).ToNot(BeNil()) + + k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) + Expect(err).ToNot(HaveOccurred()) + Expect(k8sClient).ToNot(BeNil()) + + close(done) +}, 60) + +var _ = AfterSuite(func() { + By("tearing down the test environment") + err := testEnv.Stop() + Expect(err).ToNot(HaveOccurred()) +}) diff --git a/bootstrap/kubeadm/api/v1alpha3/zz_generated.deepcopy.go b/bootstrap/kubeadm/api/v1alpha3/zz_generated.deepcopy.go new file mode 100644 index 000000000000..59a9cdf4806e --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/zz_generated.deepcopy.go @@ -0,0 +1,357 @@ +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *File) DeepCopyInto(out *File) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new File. +func (in *File) DeepCopy() *File { + if in == nil { + return nil + } + out := new(File) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmConfig) DeepCopyInto(out *KubeadmConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfig. +func (in *KubeadmConfig) DeepCopy() *KubeadmConfig { + if in == nil { + return nil + } + out := new(KubeadmConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubeadmConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmConfigList) DeepCopyInto(out *KubeadmConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KubeadmConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigList. +func (in *KubeadmConfigList) DeepCopy() *KubeadmConfigList { + if in == nil { + return nil + } + out := new(KubeadmConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubeadmConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmConfigSpec) DeepCopyInto(out *KubeadmConfigSpec) { + *out = *in + if in.ClusterConfiguration != nil { + in, out := &in.ClusterConfiguration, &out.ClusterConfiguration + *out = new(v1beta1.ClusterConfiguration) + (*in).DeepCopyInto(*out) + } + if in.InitConfiguration != nil { + in, out := &in.InitConfiguration, &out.InitConfiguration + *out = new(v1beta1.InitConfiguration) + (*in).DeepCopyInto(*out) + } + if in.JoinConfiguration != nil { + in, out := &in.JoinConfiguration, &out.JoinConfiguration + *out = new(v1beta1.JoinConfiguration) + (*in).DeepCopyInto(*out) + } + if in.Files != nil { + in, out := &in.Files, &out.Files + *out = make([]File, len(*in)) + copy(*out, *in) + } + if in.PreKubeadmCommands != nil { + in, out := &in.PreKubeadmCommands, &out.PreKubeadmCommands + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PostKubeadmCommands != nil { + in, out := &in.PostKubeadmCommands, &out.PostKubeadmCommands + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Users != nil { + in, out := &in.Users, &out.Users + *out = make([]User, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.NTP != nil { + in, out := &in.NTP, &out.NTP + *out = new(NTP) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigSpec. +func (in *KubeadmConfigSpec) DeepCopy() *KubeadmConfigSpec { + if in == nil { + return nil + } + out := new(KubeadmConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmConfigStatus) DeepCopyInto(out *KubeadmConfigStatus) { + *out = *in + if in.BootstrapData != nil { + in, out := &in.BootstrapData, &out.BootstrapData + *out = make([]byte, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigStatus. +func (in *KubeadmConfigStatus) DeepCopy() *KubeadmConfigStatus { + if in == nil { + return nil + } + out := new(KubeadmConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmConfigTemplate) DeepCopyInto(out *KubeadmConfigTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigTemplate. +func (in *KubeadmConfigTemplate) DeepCopy() *KubeadmConfigTemplate { + if in == nil { + return nil + } + out := new(KubeadmConfigTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubeadmConfigTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmConfigTemplateList) DeepCopyInto(out *KubeadmConfigTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KubeadmConfigTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigTemplateList. +func (in *KubeadmConfigTemplateList) DeepCopy() *KubeadmConfigTemplateList { + if in == nil { + return nil + } + out := new(KubeadmConfigTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubeadmConfigTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmConfigTemplateResource) DeepCopyInto(out *KubeadmConfigTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigTemplateResource. +func (in *KubeadmConfigTemplateResource) DeepCopy() *KubeadmConfigTemplateResource { + if in == nil { + return nil + } + out := new(KubeadmConfigTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmConfigTemplateSpec) DeepCopyInto(out *KubeadmConfigTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigTemplateSpec. +func (in *KubeadmConfigTemplateSpec) DeepCopy() *KubeadmConfigTemplateSpec { + if in == nil { + return nil + } + out := new(KubeadmConfigTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NTP) DeepCopyInto(out *NTP) { + *out = *in + if in.Servers != nil { + in, out := &in.Servers, &out.Servers + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NTP. +func (in *NTP) DeepCopy() *NTP { + if in == nil { + return nil + } + out := new(NTP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *User) DeepCopyInto(out *User) { + *out = *in + if in.Gecos != nil { + in, out := &in.Gecos, &out.Gecos + *out = new(string) + **out = **in + } + if in.Groups != nil { + in, out := &in.Groups, &out.Groups + *out = new(string) + **out = **in + } + if in.HomeDir != nil { + in, out := &in.HomeDir, &out.HomeDir + *out = new(string) + **out = **in + } + if in.Inactive != nil { + in, out := &in.Inactive, &out.Inactive + *out = new(bool) + **out = **in + } + if in.Shell != nil { + in, out := &in.Shell, &out.Shell + *out = new(string) + **out = **in + } + if in.Passwd != nil { + in, out := &in.Passwd, &out.Passwd + *out = new(string) + **out = **in + } + if in.PrimaryGroup != nil { + in, out := &in.PrimaryGroup, &out.PrimaryGroup + *out = new(string) + **out = **in + } + if in.LockPassword != nil { + in, out := &in.LockPassword, &out.LockPassword + *out = new(bool) + **out = **in + } + if in.Sudo != nil { + in, out := &in.Sudo, &out.Sudo + *out = new(string) + **out = **in + } + if in.SSHAuthorizedKeys != nil { + in, out := &in.SSHAuthorizedKeys, &out.SSHAuthorizedKeys + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new User. +func (in *User) DeepCopy() *User { + if in == nil { + return nil + } + out := new(User) + in.DeepCopyInto(out) + return out +} diff --git a/bootstrap/kubeadm/cloudinit/cloudinit.go b/bootstrap/kubeadm/cloudinit/cloudinit.go index 6ff6b3f6d9a1..73ccfff1f0ce 100644 --- a/bootstrap/kubeadm/cloudinit/cloudinit.go +++ b/bootstrap/kubeadm/cloudinit/cloudinit.go @@ -21,7 +21,7 @@ import ( "text/template" "github.com/pkg/errors" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" ) const ( diff --git a/bootstrap/kubeadm/cloudinit/cloudinit_test.go b/bootstrap/kubeadm/cloudinit/cloudinit_test.go index 54f2821a976e..4514a4868b88 100644 --- a/bootstrap/kubeadm/cloudinit/cloudinit_test.go +++ b/bootstrap/kubeadm/cloudinit/cloudinit_test.go @@ -20,7 +20,7 @@ import ( "bytes" "testing" - infrav1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + infrav1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/internal/cluster" "sigs.k8s.io/cluster-api/util/certs" ) diff --git a/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go b/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go index 37c00b4902c9..f2b44f3e465c 100644 --- a/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go +++ b/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go @@ -28,7 +28,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/cloudinit" internalcluster "sigs.k8s.io/cluster-api/bootstrap/kubeadm/internal/cluster" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/internal/locking" diff --git a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_reconciler_test.go b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_reconciler_test.go index 50641570faeb..5c6819536883 100644 --- a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_reconciler_test.go +++ b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_reconciler_test.go @@ -26,7 +26,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/log" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" ) var _ = Describe("KubeadmConfigReconciler", func() { diff --git a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go index a94f5279f70a..c5d412a3e082 100644 --- a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go +++ b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go @@ -32,7 +32,7 @@ import ( bootstrapapi "k8s.io/cluster-bootstrap/token/api" "k8s.io/klog/klogr" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" internalcluster "sigs.k8s.io/cluster-api/bootstrap/kubeadm/internal/cluster" kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" "sigs.k8s.io/cluster-api/util/secret" diff --git a/bootstrap/kubeadm/controllers/suite_test.go b/bootstrap/kubeadm/controllers/suite_test.go index f0346f9007be..9e62fc4f08a1 100644 --- a/bootstrap/kubeadm/controllers/suite_test.go +++ b/bootstrap/kubeadm/controllers/suite_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/klog" "k8s.io/klog/klogr" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/envtest" logf "sigs.k8s.io/controller-runtime/pkg/log" diff --git a/bootstrap/kubeadm/internal/cluster/certificates.go b/bootstrap/kubeadm/internal/cluster/certificates.go index 5824a2fea383..a1c135aca40f 100644 --- a/bootstrap/kubeadm/internal/cluster/certificates.go +++ b/bootstrap/kubeadm/internal/cluster/certificates.go @@ -35,7 +35,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/util/cert" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" "sigs.k8s.io/cluster-api/util/certs" "sigs.k8s.io/cluster-api/util/secret" diff --git a/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml b/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml index 70e312336c07..8bb758504895 100644 --- a/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml +++ b/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml @@ -20,801 +20,1620 @@ spec: scope: Namespaced subresources: status: {} - validation: - openAPIV3Schema: - description: KubeadmConfig is the Schema for the kubeadmconfigs API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: KubeadmConfigSpec defines the desired state of KubeadmConfig. - Either ClusterConfiguration and InitConfiguration should be defined or - the JoinConfiguration should be defined. - properties: - clusterConfiguration: - description: ClusterConfiguration along with InitConfiguration are the - configurations necessary for the init command - properties: - apiServer: - description: APIServer contains extra settings for the API server - control plane component - properties: - certSANs: - description: CertSANs sets extra Subject Alternative Names for - the API Server signing cert. - items: + version: v1alpha2 + versions: + - name: v1alpha2 + schema: + openAPIV3Schema: + description: KubeadmConfig is the Schema for the kubeadmconfigs API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: KubeadmConfigSpec defines the desired state of KubeadmConfig. + Either ClusterConfiguration and InitConfiguration should be defined + or the JoinConfiguration should be defined. + properties: + clusterConfiguration: + description: ClusterConfiguration along with InitConfiguration are + the configurations necessary for the init command + properties: + apiServer: + description: APIServer contains extra settings for the API server + control plane component + properties: + certSANs: + description: CertSANs sets extra Subject Alternative Names + for the API Server signing cert. + items: + type: string + type: array + extraArgs: + additionalProperties: + type: string + description: 'ExtraArgs is an extra set of flags to pass to + the control plane component. TODO: This is temporary and + ideally we would like to switch all components to use ComponentConfig + + ConfigMaps.' + type: object + extraVolumes: + description: ExtraVolumes is an extra set of host volumes, + mounted to the control plane component. + items: + description: HostPathMount contains elements describing + volumes that are mounted from the host. + properties: + hostPath: + description: HostPath is the path in the host that will + be mounted inside the pod. + type: string + mountPath: + description: MountPath is the path inside the pod where + hostPath will be mounted. + type: string + name: + description: Name of the volume inside the pod template. + type: string + pathType: + description: PathType is the type of the HostPath. + type: string + readOnly: + description: ReadOnly controls write access to the volume + type: boolean + required: + - hostPath + - mountPath + - name + type: object + type: array + timeoutForControlPlane: + description: TimeoutForControlPlane controls the timeout that + we use for API server to appear type: string - type: array - extraArgs: - additionalProperties: + type: object + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + certificatesDir: + description: CertificatesDir specifies where to store or look + for all required certificates. + type: string + clusterName: + description: The cluster name + type: string + controlPlaneEndpoint: + description: 'ControlPlaneEndpoint sets a stable IP address or + DNS name for the control plane; it can be a valid IP address + or a RFC-1123 DNS subdomain, both with optional TCP port. In + case the ControlPlaneEndpoint is not specified, the AdvertiseAddress + + BindPort are used; in case the ControlPlaneEndpoint is specified + but without a TCP port, the BindPort is used. Possible usages + are: e.g. In a cluster with more than one control plane instances, + this field should be assigned the address of the external load + balancer in front of the control plane instances. e.g. in environments + with enforced node recycling, the ControlPlaneEndpoint could + be used for assigning a stable DNS to the control plane. NB: + This value defaults to the first value in the Cluster object + status.apiEndpoints array.' + type: string + controllerManager: + description: ControllerManager contains extra settings for the + controller manager control plane component + properties: + extraArgs: + additionalProperties: + type: string + description: 'ExtraArgs is an extra set of flags to pass to + the control plane component. TODO: This is temporary and + ideally we would like to switch all components to use ComponentConfig + + ConfigMaps.' + type: object + extraVolumes: + description: ExtraVolumes is an extra set of host volumes, + mounted to the control plane component. + items: + description: HostPathMount contains elements describing + volumes that are mounted from the host. + properties: + hostPath: + description: HostPath is the path in the host that will + be mounted inside the pod. + type: string + mountPath: + description: MountPath is the path inside the pod where + hostPath will be mounted. + type: string + name: + description: Name of the volume inside the pod template. + type: string + pathType: + description: PathType is the type of the HostPath. + type: string + readOnly: + description: ReadOnly controls write access to the volume + type: boolean + required: + - hostPath + - mountPath + - name + type: object + type: array + type: object + dns: + description: DNS defines the options for the DNS add-on installed + in the cluster. + properties: + imageRepository: + description: ImageRepository sets the container registry to + pull images from. if not set, the ImageRepository defined + in ClusterConfiguration will be used instead. type: string - description: 'ExtraArgs is an extra set of flags to pass to - the control plane component. TODO: This is temporary and ideally - we would like to switch all components to use ComponentConfig - + ConfigMaps.' - type: object - extraVolumes: - description: ExtraVolumes is an extra set of host volumes, mounted - to the control plane component. - items: - description: HostPathMount contains elements describing volumes - that are mounted from the host. + imageTag: + description: ImageTag allows to specify a tag for the image. + In case this value is set, kubeadm does not change automatically + the version of the above components during upgrades. + type: string + type: + description: Type defines the DNS add-on to be used + type: string + required: + - type + type: object + etcd: + description: Etcd holds configuration for etcd. + properties: + external: + description: External describes how to connect to an external + etcd cluster Local and External are mutually exclusive properties: - hostPath: - description: HostPath is the path in the host that will - be mounted inside the pod. + caFile: + description: CAFile is an SSL Certificate Authority file + used to secure etcd communication. Required if using + a TLS connection. type: string - mountPath: - description: MountPath is the path inside the pod where - hostPath will be mounted. + certFile: + description: CertFile is an SSL certification file used + to secure etcd communication. Required if using a TLS + connection. type: string - name: - description: Name of the volume inside the pod template. + endpoints: + description: Endpoints of etcd members. Required for ExternalEtcd. + items: + type: string + type: array + keyFile: + description: KeyFile is an SSL key file used to secure + etcd communication. Required if using a TLS connection. type: string - pathType: - description: PathType is the type of the HostPath. - type: string - readOnly: - description: ReadOnly controls write access to the volume - type: boolean required: - - hostPath - - mountPath - - name + - caFile + - certFile + - endpoints + - keyFile type: object - type: array - timeoutForControlPlane: - description: TimeoutForControlPlane controls the timeout that - we use for API server to appear - type: string - type: object - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the - latest internal value, and may reject unrecognized values. More - info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - certificatesDir: - description: CertificatesDir specifies where to store or look for - all required certificates. - type: string - clusterName: - description: The cluster name - type: string - controlPlaneEndpoint: - description: 'ControlPlaneEndpoint sets a stable IP address or DNS - name for the control plane; it can be a valid IP address or a - RFC-1123 DNS subdomain, both with optional TCP port. In case the - ControlPlaneEndpoint is not specified, the AdvertiseAddress + - BindPort are used; in case the ControlPlaneEndpoint is specified - but without a TCP port, the BindPort is used. Possible usages - are: e.g. In a cluster with more than one control plane instances, - this field should be assigned the address of the external load - balancer in front of the control plane instances. e.g. in environments - with enforced node recycling, the ControlPlaneEndpoint could be - used for assigning a stable DNS to the control plane. NB: This - value defaults to the first value in the Cluster object status.apiEndpoints - array.' - type: string - controllerManager: - description: ControllerManager contains extra settings for the controller - manager control plane component - properties: - extraArgs: - additionalProperties: - type: string - description: 'ExtraArgs is an extra set of flags to pass to - the control plane component. TODO: This is temporary and ideally - we would like to switch all components to use ComponentConfig - + ConfigMaps.' - type: object - extraVolumes: - description: ExtraVolumes is an extra set of host volumes, mounted - to the control plane component. - items: - description: HostPathMount contains elements describing volumes - that are mounted from the host. + local: + description: Local provides configuration knobs for configuring + the local etcd instance Local and External are mutually + exclusive properties: - hostPath: - description: HostPath is the path in the host that will - be mounted inside the pod. - type: string - mountPath: - description: MountPath is the path inside the pod where - hostPath will be mounted. + dataDir: + description: DataDir is the directory etcd will place + its data. Defaults to "/var/lib/etcd". type: string - name: - description: Name of the volume inside the pod template. + extraArgs: + additionalProperties: + type: string + description: ExtraArgs are extra arguments provided to + the etcd binary when run inside a static pod. + type: object + imageRepository: + description: ImageRepository sets the container registry + to pull images from. if not set, the ImageRepository + defined in ClusterConfiguration will be used instead. type: string - pathType: - description: PathType is the type of the HostPath. + imageTag: + description: ImageTag allows to specify a tag for the + image. In case this value is set, kubeadm does not change + automatically the version of the above components during + upgrades. type: string - readOnly: - description: ReadOnly controls write access to the volume - type: boolean + peerCertSANs: + description: PeerCertSANs sets extra Subject Alternative + Names for the etcd peer signing cert. + items: + type: string + type: array + serverCertSANs: + description: ServerCertSANs sets extra Subject Alternative + Names for the etcd server signing cert. + items: + type: string + type: array required: - - hostPath - - mountPath - - name + - dataDir type: object - type: array - type: object - dns: - description: DNS defines the options for the DNS add-on installed - in the cluster. + type: object + featureGates: + additionalProperties: + type: boolean + description: FeatureGates enabled by the user. + type: object + imageRepository: + description: ImageRepository sets the container registry to pull + images from. If empty, `k8s.gcr.io` will be used by default; + in case of kubernetes version is a CI build (kubernetes version + starts with `ci/` or `ci-cross/`) `gcr.io/kubernetes-ci-images` + will be used as a default for control plane components and for + kube-proxy, while `k8s.gcr.io` will be used for all the other + images. + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + kubernetesVersion: + description: 'KubernetesVersion is the target version of the control + plane. NB: This value defaults to the Machine object spec.kuberentesVersion' + type: string + networking: + description: 'Networking holds configuration for the networking + topology of the cluster. NB: This value defaults to the Cluster + object spec.clusterNetwork.' + properties: + dnsDomain: + description: DNSDomain is the dns domain used by k8s services. + Defaults to "cluster.local". + type: string + podSubnet: + description: PodSubnet is the subnet used by pods. + type: string + serviceSubnet: + description: ServiceSubnet is the subnet used by k8s services. + Defaults to "10.96.0.0/12". + type: string + required: + - dnsDomain + - podSubnet + - serviceSubnet + type: object + scheduler: + description: Scheduler contains extra settings for the scheduler + control plane component + properties: + extraArgs: + additionalProperties: + type: string + description: 'ExtraArgs is an extra set of flags to pass to + the control plane component. TODO: This is temporary and + ideally we would like to switch all components to use ComponentConfig + + ConfigMaps.' + type: object + extraVolumes: + description: ExtraVolumes is an extra set of host volumes, + mounted to the control plane component. + items: + description: HostPathMount contains elements describing + volumes that are mounted from the host. + properties: + hostPath: + description: HostPath is the path in the host that will + be mounted inside the pod. + type: string + mountPath: + description: MountPath is the path inside the pod where + hostPath will be mounted. + type: string + name: + description: Name of the volume inside the pod template. + type: string + pathType: + description: PathType is the type of the HostPath. + type: string + readOnly: + description: ReadOnly controls write access to the volume + type: boolean + required: + - hostPath + - mountPath + - name + type: object + type: array + type: object + useHyperKubeImage: + description: UseHyperKubeImage controls if hyperkube should be + used for Kubernetes components instead of their respective separate + images + type: boolean + type: object + files: + description: Files specifies extra files to be passed to user_data + upon creation. + items: + description: File defines the input for generating write_files in + cloud-init. properties: - imageRepository: - description: ImageRepository sets the container registry to - pull images from. if not set, the ImageRepository defined - in ClusterConfiguration will be used instead. + content: + description: Content is the actual content of the file. + type: string + encoding: + description: Encoding specifies the encoding of the file contents. + enum: + - base64 + - gzip + - gzip+base64 + type: string + owner: + description: Owner specifies the ownership of the file, e.g. + "root:root". type: string - imageTag: - description: ImageTag allows to specify a tag for the image. - In case this value is set, kubeadm does not change automatically - the version of the above components during upgrades. + path: + description: Path specifies the full path on disk where to store + the file. type: string - type: - description: Type defines the DNS add-on to be used + permissions: + description: Permissions specifies the permissions to assign + to the file, e.g. "0640". type: string required: - - type + - content + - path type: object - etcd: - description: Etcd holds configuration for etcd. - properties: - external: - description: External describes how to connect to an external - etcd cluster Local and External are mutually exclusive + type: array + format: + description: Format specifies the output format of the bootstrap data + enum: + - cloud-config + type: string + initConfiguration: + description: InitConfiguration along with ClusterConfiguration are + the configurations necessary for the init command + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + bootstrapTokens: + description: BootstrapTokens is respected at `kubeadm init` time + and describes a set of Bootstrap Tokens to create. This information + IS NOT uploaded to the kubeadm cluster configmap, partly because + of its sensitive nature + items: + description: BootstrapToken describes one bootstrap token, stored + as a Secret in the cluster properties: - caFile: - description: CAFile is an SSL Certificate Authority file - used to secure etcd communication. Required if using a - TLS connection. + description: + description: Description sets a human-friendly message why + this token exists and what it's used for, so other administrators + can know its purpose. type: string - certFile: - description: CertFile is an SSL certification file used - to secure etcd communication. Required if using a TLS - connection. + expires: + description: Expires specifies the timestamp when this token + expires. Defaults to being set dynamically at runtime + based on the TTL. Expires and TTL are mutually exclusive. + format: date-time type: string - endpoints: - description: Endpoints of etcd members. Required for ExternalEtcd. + groups: + description: Groups specifies the extra groups that this + token will authenticate as when/if used for authentication items: type: string type: array - keyFile: - description: KeyFile is an SSL key file used to secure etcd - communication. Required if using a TLS connection. - type: string - required: - - caFile - - certFile - - endpoints - - keyFile - type: object - local: - description: Local provides configuration knobs for configuring - the local etcd instance Local and External are mutually exclusive - properties: - dataDir: - description: DataDir is the directory etcd will place its - data. Defaults to "/var/lib/etcd". - type: string - extraArgs: - additionalProperties: - type: string - description: ExtraArgs are extra arguments provided to the - etcd binary when run inside a static pod. + token: + description: Token is used for establishing bidirectional + trust between nodes and control-planes. Used for joining + nodes in the cluster. type: object - imageRepository: - description: ImageRepository sets the container registry - to pull images from. if not set, the ImageRepository defined - in ClusterConfiguration will be used instead. - type: string - imageTag: - description: ImageTag allows to specify a tag for the image. - In case this value is set, kubeadm does not change automatically - the version of the above components during upgrades. + ttl: + description: TTL defines the time to live for this token. + Defaults to 24h. Expires and TTL are mutually exclusive. type: string - peerCertSANs: - description: PeerCertSANs sets extra Subject Alternative - Names for the etcd peer signing cert. - items: - type: string - type: array - serverCertSANs: - description: ServerCertSANs sets extra Subject Alternative - Names for the etcd server signing cert. + usages: + description: Usages describes the ways in which this token + can be used. Can by default be used for establishing bidirectional + trust, but that can be changed here. items: type: string type: array required: - - dataDir + - token type: object - type: object - featureGates: - additionalProperties: + type: array + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + localAPIEndpoint: + description: LocalAPIEndpoint represents the endpoint of the API + server instance that's deployed on this control plane node In + HA setups, this differs from ClusterConfiguration.ControlPlaneEndpoint + in the sense that ControlPlaneEndpoint is the global endpoint + for the cluster, which then loadbalances the requests to each + individual API server. This configuration object lets you customize + what IP/DNS name and port the local API server advertises it's + accessible on. By default, kubeadm tries to auto-detect the + IP of the default interface and use that, but in case that process + fails you may set the desired value here. + properties: + advertiseAddress: + description: AdvertiseAddress sets the IP address for the + API server to advertise. + type: string + bindPort: + description: BindPort sets the secure port for the API Server + to bind to. Defaults to 6443. + format: int32 + type: integer + required: + - advertiseAddress + - bindPort + type: object + nodeRegistration: + description: NodeRegistration holds fields that relate to registering + the new control-plane node to the cluster + properties: + criSocket: + description: CRISocket is used to retrieve container runtime + info. This information will be annotated to the Node API + object, for later re-use + type: string + kubeletExtraArgs: + additionalProperties: + type: string + description: KubeletExtraArgs passes through extra arguments + to the kubelet. The arguments here are passed to the kubelet + command line via the environment file kubeadm writes at + runtime for the kubelet to source. This overrides the generic + base-level configuration in the kubelet-config-1.X ConfigMap + Flags have higher priority when parsing. These values are + local and specific to the node kubeadm is executing on. + type: object + name: + description: Name is the `.Metadata.Name` field of the Node + API object that will be created in this `kubeadm init` or + `kubeadm join` operation. This field is also used in the + CommonName field of the kubelet's client certificate to + the API server. Defaults to the hostname of the node if + not provided. + type: string + taints: + description: 'Taints specifies the taints the Node API object + should be registered with. If this field is unset, i.e. + nil, in the `kubeadm init` process it will be defaulted + to []v1.Taint{''node-role.kubernetes.io/master=""''}. If + you don''t want to taint your control-plane node, set this + field to an empty slice, i.e. `taints: {}` in the YAML file. + This field is solely used for Node registration.' + items: + description: The node this Taint is attached to has the + "effect" on any pod that does not tolerate the Taint. + properties: + effect: + description: Required. The effect of the taint on pods + that do not tolerate the taint. Valid effects are + NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Required. The taint key to be applied to + a node. + type: string + timeAdded: + description: TimeAdded represents the time at which + the taint was added. It is only written for NoExecute + taints. + format: date-time + type: string + value: + description: Required. The taint value corresponding + to the taint key. + type: string + required: + - effect + - key + type: object + type: array + type: object + type: object + joinConfiguration: + description: JoinConfiguration is the kubeadm configuration for the + join command + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + caCertPath: + description: 'CACertPath is the path to the SSL certificate authority + used to secure comunications between node and control-plane. + Defaults to "/etc/kubernetes/pki/ca.crt". TODO: revisit when + there is defaulting from k/k' + type: string + controlPlane: + description: ControlPlane defines the additional control plane + instance to be deployed on the joining node. If nil, no additional + control plane instance will be deployed. + properties: + localAPIEndpoint: + description: LocalAPIEndpoint represents the endpoint of the + API server instance to be deployed on this node. + properties: + advertiseAddress: + description: AdvertiseAddress sets the IP address for + the API server to advertise. + type: string + bindPort: + description: BindPort sets the secure port for the API + Server to bind to. Defaults to 6443. + format: int32 + type: integer + required: + - advertiseAddress + - bindPort + type: object + type: object + discovery: + description: 'Discovery specifies the options for the kubelet + to use during the TLS Bootstrap process TODO: revisit when there + is defaulting from k/k' + properties: + bootstrapToken: + description: BootstrapToken is used to set the options for + bootstrap token based discovery BootstrapToken and File + are mutually exclusive + properties: + apiServerEndpoint: + description: APIServerEndpoint is an IP or domain name + to the API server from which info will be fetched. + type: string + caCertHashes: + description: 'CACertHashes specifies a set of public key + pins to verify when token-based discovery is used. The + root CA found during discovery must match one of these + values. Specifying an empty set disables root CA pinning, + which can be unsafe. Each hash is specified as ":", + where the only currently supported type is "sha256". + This is a hex-encoded SHA-256 hash of the Subject Public + Key Info (SPKI) object in DER-encoded ASN.1. These hashes + can be calculated using, for example, OpenSSL: openssl + x509 -pubkey -in ca.crt openssl rsa -pubin -outform + der 2>&/dev/null | openssl dgst -sha256 -hex' + items: + type: string + type: array + token: + description: Token is a token used to validate cluster + information fetched from the control-plane. + type: string + unsafeSkipCAVerification: + description: UnsafeSkipCAVerification allows token-based + discovery without CA verification via CACertHashes. + This can weaken the security of kubeadm since other + nodes can impersonate the control-plane. + type: boolean + required: + - token + - unsafeSkipCAVerification + type: object + file: + description: File is used to specify a file or URL to a kubeconfig + file from which to load cluster information BootstrapToken + and File are mutually exclusive + properties: + kubeConfigPath: + description: KubeConfigPath is used to specify the actual + file path or URL to the kubeconfig file from which to + load cluster information + type: string + required: + - kubeConfigPath + type: object + timeout: + description: Timeout modifies the discovery timeout + type: string + tlsBootstrapToken: + description: 'TLSBootstrapToken is a token used for TLS bootstrapping. + If .BootstrapToken is set, this field is defaulted to .BootstrapToken.Token, + but can be overridden. If .File is set, this field **must + be set** in case the KubeConfigFile does not contain any + other authentication information TODO: revisit when there + is defaulting from k/k' + type: string + type: object + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + nodeRegistration: + description: NodeRegistration holds fields that relate to registering + the new control-plane node to the cluster + properties: + criSocket: + description: CRISocket is used to retrieve container runtime + info. This information will be annotated to the Node API + object, for later re-use + type: string + kubeletExtraArgs: + additionalProperties: + type: string + description: KubeletExtraArgs passes through extra arguments + to the kubelet. The arguments here are passed to the kubelet + command line via the environment file kubeadm writes at + runtime for the kubelet to source. This overrides the generic + base-level configuration in the kubelet-config-1.X ConfigMap + Flags have higher priority when parsing. These values are + local and specific to the node kubeadm is executing on. + type: object + name: + description: Name is the `.Metadata.Name` field of the Node + API object that will be created in this `kubeadm init` or + `kubeadm join` operation. This field is also used in the + CommonName field of the kubelet's client certificate to + the API server. Defaults to the hostname of the node if + not provided. + type: string + taints: + description: 'Taints specifies the taints the Node API object + should be registered with. If this field is unset, i.e. + nil, in the `kubeadm init` process it will be defaulted + to []v1.Taint{''node-role.kubernetes.io/master=""''}. If + you don''t want to taint your control-plane node, set this + field to an empty slice, i.e. `taints: {}` in the YAML file. + This field is solely used for Node registration.' + items: + description: The node this Taint is attached to has the + "effect" on any pod that does not tolerate the Taint. + properties: + effect: + description: Required. The effect of the taint on pods + that do not tolerate the taint. Valid effects are + NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Required. The taint key to be applied to + a node. + type: string + timeAdded: + description: TimeAdded represents the time at which + the taint was added. It is only written for NoExecute + taints. + format: date-time + type: string + value: + description: Required. The taint value corresponding + to the taint key. + type: string + required: + - effect + - key + type: object + type: array + type: object + required: + - nodeRegistration + type: object + ntp: + description: NTP specifies NTP configuration + properties: + enabled: + description: Enabled specifies whether NTP should be enabled type: boolean - description: FeatureGates enabled by the user. - type: object - imageRepository: - description: ImageRepository sets the container registry to pull - images from. If empty, `k8s.gcr.io` will be used by default; in - case of kubernetes version is a CI build (kubernetes version starts - with `ci/` or `ci-cross/`) `gcr.io/kubernetes-ci-images` will - be used as a default for control plane components and for kube-proxy, - while `k8s.gcr.io` will be used for all the other images. - type: string - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + servers: + description: Servers specifies which NTP servers to use + items: + type: string + type: array + type: object + postKubeadmCommands: + description: PostKubeadmCommands specifies extra commands to run after + kubeadm runs + items: type: string - kubernetesVersion: - description: 'KubernetesVersion is the target version of the control - plane. NB: This value defaults to the Machine object spec.kuberentesVersion' + type: array + preKubeadmCommands: + description: PreKubeadmCommands specifies extra commands to run before + kubeadm runs + items: type: string - networking: - description: 'Networking holds configuration for the networking - topology of the cluster. NB: This value defaults to the Cluster - object spec.clusterNetwork.' + type: array + users: + description: Users specifies extra users to add + items: + description: User defines the input for a generated user in cloud-init. properties: - dnsDomain: - description: DNSDomain is the dns domain used by k8s services. - Defaults to "cluster.local". + gecos: + description: Gecos specifies the gecos to use for the user + type: string + groups: + description: Groups specifies the additional groups for the + user type: string - podSubnet: - description: PodSubnet is the subnet used by pods. + homeDir: + description: HomeDir specifies the home directory to use for + the user + type: string + inactive: + description: Inactive specifies whether to mark the user as + inactive + type: boolean + lockPassword: + description: LockPassword specifies if password login should + be disabled + type: boolean + name: + description: Name specifies the user name type: string - serviceSubnet: - description: ServiceSubnet is the subnet used by k8s services. - Defaults to "10.96.0.0/12". + passwd: + description: Passwd specifies a hashed password for the user + type: string + primaryGroup: + description: PrimaryGroup specifies the primary group for the + user + type: string + shell: + description: Shell specifies the user's shell + type: string + sshAuthorizedKeys: + description: SSHAuthorizedKeys specifies a list of ssh authorized + keys for the user + items: + type: string + type: array + sudo: + description: Sudo specifies a sudo role for the user type: string required: - - dnsDomain - - podSubnet - - serviceSubnet + - name type: object - scheduler: - description: Scheduler contains extra settings for the scheduler - control plane component - properties: - extraArgs: - additionalProperties: + type: array + type: object + status: + description: KubeadmConfigStatus defines the observed state of KubeadmConfig + properties: + bootstrapData: + description: BootstrapData will be a cloud-init script for now + format: byte + type: string + errorMessage: + description: ErrorMessage will be set on non-retryable errors + type: string + errorReason: + description: ErrorReason will be set on non-retryable errors + type: string + ready: + description: Ready indicates the BootstrapData field is ready to be + consumed + type: boolean + type: object + type: object + served: true + storage: false + - name: v1alpha3 + schema: + openAPIV3Schema: + description: KubeadmConfig is the Schema for the kubeadmconfigs API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: KubeadmConfigSpec defines the desired state of KubeadmConfig. + Either ClusterConfiguration and InitConfiguration should be defined + or the JoinConfiguration should be defined. + properties: + clusterConfiguration: + description: ClusterConfiguration along with InitConfiguration are + the configurations necessary for the init command + properties: + apiServer: + description: APIServer contains extra settings for the API server + control plane component + properties: + certSANs: + description: CertSANs sets extra Subject Alternative Names + for the API Server signing cert. + items: + type: string + type: array + extraArgs: + additionalProperties: + type: string + description: 'ExtraArgs is an extra set of flags to pass to + the control plane component. TODO: This is temporary and + ideally we would like to switch all components to use ComponentConfig + + ConfigMaps.' + type: object + extraVolumes: + description: ExtraVolumes is an extra set of host volumes, + mounted to the control plane component. + items: + description: HostPathMount contains elements describing + volumes that are mounted from the host. + properties: + hostPath: + description: HostPath is the path in the host that will + be mounted inside the pod. + type: string + mountPath: + description: MountPath is the path inside the pod where + hostPath will be mounted. + type: string + name: + description: Name of the volume inside the pod template. + type: string + pathType: + description: PathType is the type of the HostPath. + type: string + readOnly: + description: ReadOnly controls write access to the volume + type: boolean + required: + - hostPath + - mountPath + - name + type: object + type: array + timeoutForControlPlane: + description: TimeoutForControlPlane controls the timeout that + we use for API server to appear type: string - description: 'ExtraArgs is an extra set of flags to pass to - the control plane component. TODO: This is temporary and ideally - we would like to switch all components to use ComponentConfig - + ConfigMaps.' - type: object - extraVolumes: - description: ExtraVolumes is an extra set of host volumes, mounted - to the control plane component. - items: - description: HostPathMount contains elements describing volumes - that are mounted from the host. + type: object + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + certificatesDir: + description: CertificatesDir specifies where to store or look + for all required certificates. + type: string + clusterName: + description: The cluster name + type: string + controlPlaneEndpoint: + description: 'ControlPlaneEndpoint sets a stable IP address or + DNS name for the control plane; it can be a valid IP address + or a RFC-1123 DNS subdomain, both with optional TCP port. In + case the ControlPlaneEndpoint is not specified, the AdvertiseAddress + + BindPort are used; in case the ControlPlaneEndpoint is specified + but without a TCP port, the BindPort is used. Possible usages + are: e.g. In a cluster with more than one control plane instances, + this field should be assigned the address of the external load + balancer in front of the control plane instances. e.g. in environments + with enforced node recycling, the ControlPlaneEndpoint could + be used for assigning a stable DNS to the control plane. NB: + This value defaults to the first value in the Cluster object + status.apiEndpoints array.' + type: string + controllerManager: + description: ControllerManager contains extra settings for the + controller manager control plane component + properties: + extraArgs: + additionalProperties: + type: string + description: 'ExtraArgs is an extra set of flags to pass to + the control plane component. TODO: This is temporary and + ideally we would like to switch all components to use ComponentConfig + + ConfigMaps.' + type: object + extraVolumes: + description: ExtraVolumes is an extra set of host volumes, + mounted to the control plane component. + items: + description: HostPathMount contains elements describing + volumes that are mounted from the host. + properties: + hostPath: + description: HostPath is the path in the host that will + be mounted inside the pod. + type: string + mountPath: + description: MountPath is the path inside the pod where + hostPath will be mounted. + type: string + name: + description: Name of the volume inside the pod template. + type: string + pathType: + description: PathType is the type of the HostPath. + type: string + readOnly: + description: ReadOnly controls write access to the volume + type: boolean + required: + - hostPath + - mountPath + - name + type: object + type: array + type: object + dns: + description: DNS defines the options for the DNS add-on installed + in the cluster. + properties: + imageRepository: + description: ImageRepository sets the container registry to + pull images from. if not set, the ImageRepository defined + in ClusterConfiguration will be used instead. + type: string + imageTag: + description: ImageTag allows to specify a tag for the image. + In case this value is set, kubeadm does not change automatically + the version of the above components during upgrades. + type: string + type: + description: Type defines the DNS add-on to be used + type: string + required: + - type + type: object + etcd: + description: Etcd holds configuration for etcd. + properties: + external: + description: External describes how to connect to an external + etcd cluster Local and External are mutually exclusive properties: - hostPath: - description: HostPath is the path in the host that will - be mounted inside the pod. + caFile: + description: CAFile is an SSL Certificate Authority file + used to secure etcd communication. Required if using + a TLS connection. + type: string + certFile: + description: CertFile is an SSL certification file used + to secure etcd communication. Required if using a TLS + connection. type: string - mountPath: - description: MountPath is the path inside the pod where - hostPath will be mounted. + endpoints: + description: Endpoints of etcd members. Required for ExternalEtcd. + items: + type: string + type: array + keyFile: + description: KeyFile is an SSL key file used to secure + etcd communication. Required if using a TLS connection. type: string - name: - description: Name of the volume inside the pod template. + required: + - caFile + - certFile + - endpoints + - keyFile + type: object + local: + description: Local provides configuration knobs for configuring + the local etcd instance Local and External are mutually + exclusive + properties: + dataDir: + description: DataDir is the directory etcd will place + its data. Defaults to "/var/lib/etcd". type: string - pathType: - description: PathType is the type of the HostPath. + extraArgs: + additionalProperties: + type: string + description: ExtraArgs are extra arguments provided to + the etcd binary when run inside a static pod. + type: object + imageRepository: + description: ImageRepository sets the container registry + to pull images from. if not set, the ImageRepository + defined in ClusterConfiguration will be used instead. type: string - readOnly: - description: ReadOnly controls write access to the volume - type: boolean + imageTag: + description: ImageTag allows to specify a tag for the + image. In case this value is set, kubeadm does not change + automatically the version of the above components during + upgrades. + type: string + peerCertSANs: + description: PeerCertSANs sets extra Subject Alternative + Names for the etcd peer signing cert. + items: + type: string + type: array + serverCertSANs: + description: ServerCertSANs sets extra Subject Alternative + Names for the etcd server signing cert. + items: + type: string + type: array required: - - hostPath - - mountPath - - name + - dataDir type: object - type: array - type: object - useHyperKubeImage: - description: UseHyperKubeImage controls if hyperkube should be used - for Kubernetes components instead of their respective separate - images - type: boolean - type: object - files: - description: Files specifies extra files to be passed to user_data upon - creation. - items: - description: File defines the input for generating write_files in - cloud-init. - properties: - content: - description: Content is the actual content of the file. - type: string - encoding: - description: Encoding specifies the encoding of the file contents. - enum: - - base64 - - gzip - - gzip+base64 - type: string - owner: - description: Owner specifies the ownership of the file, e.g. "root:root". + type: object + featureGates: + additionalProperties: + type: boolean + description: FeatureGates enabled by the user. + type: object + imageRepository: + description: ImageRepository sets the container registry to pull + images from. If empty, `k8s.gcr.io` will be used by default; + in case of kubernetes version is a CI build (kubernetes version + starts with `ci/` or `ci-cross/`) `gcr.io/kubernetes-ci-images` + will be used as a default for control plane components and for + kube-proxy, while `k8s.gcr.io` will be used for all the other + images. type: string - path: - description: Path specifies the full path on disk where to store - the file. + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' type: string - permissions: - description: Permissions specifies the permissions to assign to - the file, e.g. "0640". + kubernetesVersion: + description: 'KubernetesVersion is the target version of the control + plane. NB: This value defaults to the Machine object spec.kuberentesVersion' type: string - required: - - content - - path - type: object - type: array - format: - description: Format specifies the output format of the bootstrap data - enum: - - cloud-config - type: string - initConfiguration: - description: InitConfiguration along with ClusterConfiguration are the - configurations necessary for the init command - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the - latest internal value, and may reject unrecognized values. More - info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - bootstrapTokens: - description: BootstrapTokens is respected at `kubeadm init` time - and describes a set of Bootstrap Tokens to create. This information - IS NOT uploaded to the kubeadm cluster configmap, partly because - of its sensitive nature - items: - description: BootstrapToken describes one bootstrap token, stored - as a Secret in the cluster + networking: + description: 'Networking holds configuration for the networking + topology of the cluster. NB: This value defaults to the Cluster + object spec.clusterNetwork.' properties: - description: - description: Description sets a human-friendly message why - this token exists and what it's used for, so other administrators - can know its purpose. + dnsDomain: + description: DNSDomain is the dns domain used by k8s services. + Defaults to "cluster.local". type: string - expires: - description: Expires specifies the timestamp when this token - expires. Defaults to being set dynamically at runtime based - on the TTL. Expires and TTL are mutually exclusive. - format: date-time + podSubnet: + description: PodSubnet is the subnet used by pods. type: string - groups: - description: Groups specifies the extra groups that this token - will authenticate as when/if used for authentication - items: + serviceSubnet: + description: ServiceSubnet is the subnet used by k8s services. + Defaults to "10.96.0.0/12". + type: string + required: + - dnsDomain + - podSubnet + - serviceSubnet + type: object + scheduler: + description: Scheduler contains extra settings for the scheduler + control plane component + properties: + extraArgs: + additionalProperties: type: string - type: array - token: - description: Token is used for establishing bidirectional - trust between nodes and control-planes. Used for joining - nodes in the cluster. + description: 'ExtraArgs is an extra set of flags to pass to + the control plane component. TODO: This is temporary and + ideally we would like to switch all components to use ComponentConfig + + ConfigMaps.' type: object - ttl: - description: TTL defines the time to live for this token. - Defaults to 24h. Expires and TTL are mutually exclusive. - type: string - usages: - description: Usages describes the ways in which this token - can be used. Can by default be used for establishing bidirectional - trust, but that can be changed here. + extraVolumes: + description: ExtraVolumes is an extra set of host volumes, + mounted to the control plane component. items: - type: string + description: HostPathMount contains elements describing + volumes that are mounted from the host. + properties: + hostPath: + description: HostPath is the path in the host that will + be mounted inside the pod. + type: string + mountPath: + description: MountPath is the path inside the pod where + hostPath will be mounted. + type: string + name: + description: Name of the volume inside the pod template. + type: string + pathType: + description: PathType is the type of the HostPath. + type: string + readOnly: + description: ReadOnly controls write access to the volume + type: boolean + required: + - hostPath + - mountPath + - name + type: object type: array - required: - - token type: object - type: array - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - localAPIEndpoint: - description: LocalAPIEndpoint represents the endpoint of the API - server instance that's deployed on this control plane node In - HA setups, this differs from ClusterConfiguration.ControlPlaneEndpoint - in the sense that ControlPlaneEndpoint is the global endpoint - for the cluster, which then loadbalances the requests to each - individual API server. This configuration object lets you customize - what IP/DNS name and port the local API server advertises it's - accessible on. By default, kubeadm tries to auto-detect the IP - of the default interface and use that, but in case that process - fails you may set the desired value here. + useHyperKubeImage: + description: UseHyperKubeImage controls if hyperkube should be + used for Kubernetes components instead of their respective separate + images + type: boolean + type: object + files: + description: Files specifies extra files to be passed to user_data + upon creation. + items: + description: File defines the input for generating write_files in + cloud-init. properties: - advertiseAddress: - description: AdvertiseAddress sets the IP address for the API - server to advertise. + content: + description: Content is the actual content of the file. type: string - bindPort: - description: BindPort sets the secure port for the API Server - to bind to. Defaults to 6443. - format: int32 - type: integer - required: - - advertiseAddress - - bindPort - type: object - nodeRegistration: - description: NodeRegistration holds fields that relate to registering - the new control-plane node to the cluster - properties: - criSocket: - description: CRISocket is used to retrieve container runtime - info. This information will be annotated to the Node API object, - for later re-use + encoding: + description: Encoding specifies the encoding of the file contents. + enum: + - base64 + - gzip + - gzip+base64 type: string - kubeletExtraArgs: - additionalProperties: - type: string - description: KubeletExtraArgs passes through extra arguments - to the kubelet. The arguments here are passed to the kubelet - command line via the environment file kubeadm writes at runtime - for the kubelet to source. This overrides the generic base-level - configuration in the kubelet-config-1.X ConfigMap Flags have - higher priority when parsing. These values are local and specific - to the node kubeadm is executing on. - type: object - name: - description: Name is the `.Metadata.Name` field of the Node - API object that will be created in this `kubeadm init` or - `kubeadm join` operation. This field is also used in the CommonName - field of the kubelet's client certificate to the API server. - Defaults to the hostname of the node if not provided. + owner: + description: Owner specifies the ownership of the file, e.g. + "root:root". type: string - taints: - description: 'Taints specifies the taints the Node API object - should be registered with. If this field is unset, i.e. nil, - in the `kubeadm init` process it will be defaulted to []v1.Taint{''node-role.kubernetes.io/master=""''}. - If you don''t want to taint your control-plane node, set this - field to an empty slice, i.e. `taints: {}` in the YAML file. - This field is solely used for Node registration.' - items: - description: The node this Taint is attached to has the "effect" - on any pod that does not tolerate the Taint. - properties: - effect: - description: Required. The effect of the taint on pods - that do not tolerate the taint. Valid effects are NoSchedule, - PreferNoSchedule and NoExecute. - type: string - key: - description: Required. The taint key to be applied to - a node. - type: string - timeAdded: - description: TimeAdded represents the time at which the - taint was added. It is only written for NoExecute taints. - format: date-time - type: string - value: - description: Required. The taint value corresponding to - the taint key. - type: string - required: - - effect - - key - type: object - type: array + path: + description: Path specifies the full path on disk where to store + the file. + type: string + permissions: + description: Permissions specifies the permissions to assign + to the file, e.g. "0640". + type: string + required: + - content + - path type: object - type: object - joinConfiguration: - description: JoinConfiguration is the kubeadm configuration for the - join command - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the - latest internal value, and may reject unrecognized values. More - info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - caCertPath: - description: 'CACertPath is the path to the SSL certificate authority - used to secure comunications between node and control-plane. Defaults - to "/etc/kubernetes/pki/ca.crt". TODO: revisit when there is defaulting - from k/k' - type: string - controlPlane: - description: ControlPlane defines the additional control plane instance - to be deployed on the joining node. If nil, no additional control - plane instance will be deployed. - properties: - localAPIEndpoint: - description: LocalAPIEndpoint represents the endpoint of the - API server instance to be deployed on this node. + type: array + format: + description: Format specifies the output format of the bootstrap data + enum: + - cloud-config + type: string + initConfiguration: + description: InitConfiguration along with ClusterConfiguration are + the configurations necessary for the init command + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + bootstrapTokens: + description: BootstrapTokens is respected at `kubeadm init` time + and describes a set of Bootstrap Tokens to create. This information + IS NOT uploaded to the kubeadm cluster configmap, partly because + of its sensitive nature + items: + description: BootstrapToken describes one bootstrap token, stored + as a Secret in the cluster properties: - advertiseAddress: - description: AdvertiseAddress sets the IP address for the - API server to advertise. + description: + description: Description sets a human-friendly message why + this token exists and what it's used for, so other administrators + can know its purpose. type: string - bindPort: - description: BindPort sets the secure port for the API Server - to bind to. Defaults to 6443. - format: int32 - type: integer - required: - - advertiseAddress - - bindPort - type: object - type: object - discovery: - description: 'Discovery specifies the options for the kubelet to - use during the TLS Bootstrap process TODO: revisit when there - is defaulting from k/k' - properties: - bootstrapToken: - description: BootstrapToken is used to set the options for bootstrap - token based discovery BootstrapToken and File are mutually - exclusive - properties: - apiServerEndpoint: - description: APIServerEndpoint is an IP or domain name to - the API server from which info will be fetched. + expires: + description: Expires specifies the timestamp when this token + expires. Defaults to being set dynamically at runtime + based on the TTL. Expires and TTL are mutually exclusive. + format: date-time type: string - caCertHashes: - description: 'CACertHashes specifies a set of public key - pins to verify when token-based discovery is used. The - root CA found during discovery must match one of these - values. Specifying an empty set disables root CA pinning, - which can be unsafe. Each hash is specified as ":", - where the only currently supported type is "sha256". This - is a hex-encoded SHA-256 hash of the Subject Public Key - Info (SPKI) object in DER-encoded ASN.1. These hashes - can be calculated using, for example, OpenSSL: openssl - x509 -pubkey -in ca.crt openssl rsa -pubin -outform der - 2>&/dev/null | openssl dgst -sha256 -hex' + groups: + description: Groups specifies the extra groups that this + token will authenticate as when/if used for authentication items: type: string type: array token: - description: Token is a token used to validate cluster information - fetched from the control-plane. + description: Token is used for establishing bidirectional + trust between nodes and control-planes. Used for joining + nodes in the cluster. + type: object + ttl: + description: TTL defines the time to live for this token. + Defaults to 24h. Expires and TTL are mutually exclusive. type: string - unsafeSkipCAVerification: - description: UnsafeSkipCAVerification allows token-based - discovery without CA verification via CACertHashes. This - can weaken the security of kubeadm since other nodes can - impersonate the control-plane. - type: boolean + usages: + description: Usages describes the ways in which this token + can be used. Can by default be used for establishing bidirectional + trust, but that can be changed here. + items: + type: string + type: array required: - token - - unsafeSkipCAVerification type: object - file: - description: File is used to specify a file or URL to a kubeconfig - file from which to load cluster information BootstrapToken - and File are mutually exclusive - properties: - kubeConfigPath: - description: KubeConfigPath is used to specify the actual - file path or URL to the kubeconfig file from which to - load cluster information + type: array + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + localAPIEndpoint: + description: LocalAPIEndpoint represents the endpoint of the API + server instance that's deployed on this control plane node In + HA setups, this differs from ClusterConfiguration.ControlPlaneEndpoint + in the sense that ControlPlaneEndpoint is the global endpoint + for the cluster, which then loadbalances the requests to each + individual API server. This configuration object lets you customize + what IP/DNS name and port the local API server advertises it's + accessible on. By default, kubeadm tries to auto-detect the + IP of the default interface and use that, but in case that process + fails you may set the desired value here. + properties: + advertiseAddress: + description: AdvertiseAddress sets the IP address for the + API server to advertise. + type: string + bindPort: + description: BindPort sets the secure port for the API Server + to bind to. Defaults to 6443. + format: int32 + type: integer + required: + - advertiseAddress + - bindPort + type: object + nodeRegistration: + description: NodeRegistration holds fields that relate to registering + the new control-plane node to the cluster + properties: + criSocket: + description: CRISocket is used to retrieve container runtime + info. This information will be annotated to the Node API + object, for later re-use + type: string + kubeletExtraArgs: + additionalProperties: type: string - required: - - kubeConfigPath - type: object - timeout: - description: Timeout modifies the discovery timeout - type: string - tlsBootstrapToken: - description: 'TLSBootstrapToken is a token used for TLS bootstrapping. - If .BootstrapToken is set, this field is defaulted to .BootstrapToken.Token, - but can be overridden. If .File is set, this field **must - be set** in case the KubeConfigFile does not contain any other - authentication information TODO: revisit when there is defaulting - from k/k' - type: string - type: object - kind: - description: 'Kind is a string value representing the REST resource - this object represents. Servers may infer this from the endpoint - the client submits requests to. Cannot be updated. In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - nodeRegistration: - description: NodeRegistration holds fields that relate to registering - the new control-plane node to the cluster - properties: - criSocket: - description: CRISocket is used to retrieve container runtime - info. This information will be annotated to the Node API object, - for later re-use - type: string - kubeletExtraArgs: - additionalProperties: + description: KubeletExtraArgs passes through extra arguments + to the kubelet. The arguments here are passed to the kubelet + command line via the environment file kubeadm writes at + runtime for the kubelet to source. This overrides the generic + base-level configuration in the kubelet-config-1.X ConfigMap + Flags have higher priority when parsing. These values are + local and specific to the node kubeadm is executing on. + type: object + name: + description: Name is the `.Metadata.Name` field of the Node + API object that will be created in this `kubeadm init` or + `kubeadm join` operation. This field is also used in the + CommonName field of the kubelet's client certificate to + the API server. Defaults to the hostname of the node if + not provided. type: string - description: KubeletExtraArgs passes through extra arguments - to the kubelet. The arguments here are passed to the kubelet - command line via the environment file kubeadm writes at runtime - for the kubelet to source. This overrides the generic base-level - configuration in the kubelet-config-1.X ConfigMap Flags have - higher priority when parsing. These values are local and specific - to the node kubeadm is executing on. - type: object - name: - description: Name is the `.Metadata.Name` field of the Node - API object that will be created in this `kubeadm init` or - `kubeadm join` operation. This field is also used in the CommonName - field of the kubelet's client certificate to the API server. - Defaults to the hostname of the node if not provided. - type: string - taints: - description: 'Taints specifies the taints the Node API object - should be registered with. If this field is unset, i.e. nil, - in the `kubeadm init` process it will be defaulted to []v1.Taint{''node-role.kubernetes.io/master=""''}. - If you don''t want to taint your control-plane node, set this - field to an empty slice, i.e. `taints: {}` in the YAML file. - This field is solely used for Node registration.' - items: - description: The node this Taint is attached to has the "effect" - on any pod that does not tolerate the Taint. + taints: + description: 'Taints specifies the taints the Node API object + should be registered with. If this field is unset, i.e. + nil, in the `kubeadm init` process it will be defaulted + to []v1.Taint{''node-role.kubernetes.io/master=""''}. If + you don''t want to taint your control-plane node, set this + field to an empty slice, i.e. `taints: {}` in the YAML file. + This field is solely used for Node registration.' + items: + description: The node this Taint is attached to has the + "effect" on any pod that does not tolerate the Taint. + properties: + effect: + description: Required. The effect of the taint on pods + that do not tolerate the taint. Valid effects are + NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Required. The taint key to be applied to + a node. + type: string + timeAdded: + description: TimeAdded represents the time at which + the taint was added. It is only written for NoExecute + taints. + format: date-time + type: string + value: + description: Required. The taint value corresponding + to the taint key. + type: string + required: + - effect + - key + type: object + type: array + type: object + type: object + joinConfiguration: + description: JoinConfiguration is the kubeadm configuration for the + join command + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this + representation of an object. Servers should convert recognized + schemas to the latest internal value, and may reject unrecognized + values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + caCertPath: + description: 'CACertPath is the path to the SSL certificate authority + used to secure comunications between node and control-plane. + Defaults to "/etc/kubernetes/pki/ca.crt". TODO: revisit when + there is defaulting from k/k' + type: string + controlPlane: + description: ControlPlane defines the additional control plane + instance to be deployed on the joining node. If nil, no additional + control plane instance will be deployed. + properties: + localAPIEndpoint: + description: LocalAPIEndpoint represents the endpoint of the + API server instance to be deployed on this node. properties: - effect: - description: Required. The effect of the taint on pods - that do not tolerate the taint. Valid effects are NoSchedule, - PreferNoSchedule and NoExecute. + advertiseAddress: + description: AdvertiseAddress sets the IP address for + the API server to advertise. type: string - key: - description: Required. The taint key to be applied to - a node. + bindPort: + description: BindPort sets the secure port for the API + Server to bind to. Defaults to 6443. + format: int32 + type: integer + required: + - advertiseAddress + - bindPort + type: object + type: object + discovery: + description: 'Discovery specifies the options for the kubelet + to use during the TLS Bootstrap process TODO: revisit when there + is defaulting from k/k' + properties: + bootstrapToken: + description: BootstrapToken is used to set the options for + bootstrap token based discovery BootstrapToken and File + are mutually exclusive + properties: + apiServerEndpoint: + description: APIServerEndpoint is an IP or domain name + to the API server from which info will be fetched. type: string - timeAdded: - description: TimeAdded represents the time at which the - taint was added. It is only written for NoExecute taints. - format: date-time + caCertHashes: + description: 'CACertHashes specifies a set of public key + pins to verify when token-based discovery is used. The + root CA found during discovery must match one of these + values. Specifying an empty set disables root CA pinning, + which can be unsafe. Each hash is specified as ":", + where the only currently supported type is "sha256". + This is a hex-encoded SHA-256 hash of the Subject Public + Key Info (SPKI) object in DER-encoded ASN.1. These hashes + can be calculated using, for example, OpenSSL: openssl + x509 -pubkey -in ca.crt openssl rsa -pubin -outform + der 2>&/dev/null | openssl dgst -sha256 -hex' + items: + type: string + type: array + token: + description: Token is a token used to validate cluster + information fetched from the control-plane. type: string - value: - description: Required. The taint value corresponding to - the taint key. + unsafeSkipCAVerification: + description: UnsafeSkipCAVerification allows token-based + discovery without CA verification via CACertHashes. + This can weaken the security of kubeadm since other + nodes can impersonate the control-plane. + type: boolean + required: + - token + - unsafeSkipCAVerification + type: object + file: + description: File is used to specify a file or URL to a kubeconfig + file from which to load cluster information BootstrapToken + and File are mutually exclusive + properties: + kubeConfigPath: + description: KubeConfigPath is used to specify the actual + file path or URL to the kubeconfig file from which to + load cluster information type: string required: - - effect - - key + - kubeConfigPath type: object - type: array - type: object - required: - - nodeRegistration - type: object - ntp: - description: NTP specifies NTP configuration - properties: - enabled: - description: Enabled specifies whether NTP should be enabled - type: boolean - servers: - description: Servers specifies which NTP servers to use - items: + timeout: + description: Timeout modifies the discovery timeout + type: string + tlsBootstrapToken: + description: 'TLSBootstrapToken is a token used for TLS bootstrapping. + If .BootstrapToken is set, this field is defaulted to .BootstrapToken.Token, + but can be overridden. If .File is set, this field **must + be set** in case the KubeConfigFile does not contain any + other authentication information TODO: revisit when there + is defaulting from k/k' + type: string + type: object + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint + the client submits requests to. Cannot be updated. In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' type: string - type: array - type: object - postKubeadmCommands: - description: PostKubeadmCommands specifies extra commands to run after - kubeadm runs - items: - type: string - type: array - preKubeadmCommands: - description: PreKubeadmCommands specifies extra commands to run before - kubeadm runs - items: - type: string - type: array - users: - description: Users specifies extra users to add - items: - description: User defines the input for a generated user in cloud-init. + nodeRegistration: + description: NodeRegistration holds fields that relate to registering + the new control-plane node to the cluster + properties: + criSocket: + description: CRISocket is used to retrieve container runtime + info. This information will be annotated to the Node API + object, for later re-use + type: string + kubeletExtraArgs: + additionalProperties: + type: string + description: KubeletExtraArgs passes through extra arguments + to the kubelet. The arguments here are passed to the kubelet + command line via the environment file kubeadm writes at + runtime for the kubelet to source. This overrides the generic + base-level configuration in the kubelet-config-1.X ConfigMap + Flags have higher priority when parsing. These values are + local and specific to the node kubeadm is executing on. + type: object + name: + description: Name is the `.Metadata.Name` field of the Node + API object that will be created in this `kubeadm init` or + `kubeadm join` operation. This field is also used in the + CommonName field of the kubelet's client certificate to + the API server. Defaults to the hostname of the node if + not provided. + type: string + taints: + description: 'Taints specifies the taints the Node API object + should be registered with. If this field is unset, i.e. + nil, in the `kubeadm init` process it will be defaulted + to []v1.Taint{''node-role.kubernetes.io/master=""''}. If + you don''t want to taint your control-plane node, set this + field to an empty slice, i.e. `taints: {}` in the YAML file. + This field is solely used for Node registration.' + items: + description: The node this Taint is attached to has the + "effect" on any pod that does not tolerate the Taint. + properties: + effect: + description: Required. The effect of the taint on pods + that do not tolerate the taint. Valid effects are + NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Required. The taint key to be applied to + a node. + type: string + timeAdded: + description: TimeAdded represents the time at which + the taint was added. It is only written for NoExecute + taints. + format: date-time + type: string + value: + description: Required. The taint value corresponding + to the taint key. + type: string + required: + - effect + - key + type: object + type: array + type: object + required: + - nodeRegistration + type: object + ntp: + description: NTP specifies NTP configuration properties: - gecos: - description: Gecos specifies the gecos to use for the user - type: string - groups: - description: Groups specifies the additional groups for the user - type: string - homeDir: - description: HomeDir specifies the home directory to use for the - user - type: string - inactive: - description: Inactive specifies whether to mark the user as inactive - type: boolean - lockPassword: - description: LockPassword specifies if password login should be - disabled + enabled: + description: Enabled specifies whether NTP should be enabled type: boolean - name: - description: Name specifies the user name - type: string - passwd: - description: Passwd specifies a hashed password for the user - type: string - primaryGroup: - description: PrimaryGroup specifies the primary group for the - user - type: string - shell: - description: Shell specifies the user's shell - type: string - sshAuthorizedKeys: - description: SSHAuthorizedKeys specifies a list of ssh authorized - keys for the user + servers: + description: Servers specifies which NTP servers to use items: type: string type: array - sudo: - description: Sudo specifies a sudo role for the user - type: string - required: - - name type: object - type: array - type: object - status: - description: KubeadmConfigStatus defines the observed state of KubeadmConfig - properties: - bootstrapData: - description: BootstrapData will be a cloud-init script for now - format: byte - type: string - errorMessage: - description: ErrorMessage will be set on non-retryable errors - type: string - errorReason: - description: ErrorReason will be set on non-retryable errors - type: string - ready: - description: Ready indicates the BootstrapData field is ready to be - consumed - type: boolean - type: object - type: object - version: v1alpha2 - versions: - - name: v1alpha2 + postKubeadmCommands: + description: PostKubeadmCommands specifies extra commands to run after + kubeadm runs + items: + type: string + type: array + preKubeadmCommands: + description: PreKubeadmCommands specifies extra commands to run before + kubeadm runs + items: + type: string + type: array + users: + description: Users specifies extra users to add + items: + description: User defines the input for a generated user in cloud-init. + properties: + gecos: + description: Gecos specifies the gecos to use for the user + type: string + groups: + description: Groups specifies the additional groups for the + user + type: string + homeDir: + description: HomeDir specifies the home directory to use for + the user + type: string + inactive: + description: Inactive specifies whether to mark the user as + inactive + type: boolean + lockPassword: + description: LockPassword specifies if password login should + be disabled + type: boolean + name: + description: Name specifies the user name + type: string + passwd: + description: Passwd specifies a hashed password for the user + type: string + primaryGroup: + description: PrimaryGroup specifies the primary group for the + user + type: string + shell: + description: Shell specifies the user's shell + type: string + sshAuthorizedKeys: + description: SSHAuthorizedKeys specifies a list of ssh authorized + keys for the user + items: + type: string + type: array + sudo: + description: Sudo specifies a sudo role for the user + type: string + required: + - name + type: object + type: array + type: object + status: + description: KubeadmConfigStatus defines the observed state of KubeadmConfig + properties: + bootstrapData: + description: BootstrapData will be a cloud-init script for now + format: byte + type: string + failureMessage: + description: FailureMessage will be set on non-retryable errors + type: string + failureReason: + description: FailureReason will be set on non-retryable errors + type: string + ready: + description: Ready indicates the BootstrapData field is ready to be + consumed + type: boolean + type: object + type: object served: true storage: true status: diff --git a/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml b/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml index a06ea28634d8..ed20e318dcdd 100644 --- a/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml +++ b/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml @@ -853,6 +853,9 @@ spec: version: v1alpha2 versions: - name: v1alpha2 + served: true + storage: false + - name: v1alpha3 served: true storage: true status: diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index ead9e32d0bc3..a2c553d1d217 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -18,6 +18,8 @@ patchesStrategicMerge: #- patches/webhook_in_machines.yaml #- patches/webhook_in_machinesets.yaml #- patches/webhook_in_machinedeployments.yaml +- patches/webhook_in_kubeadmconfigs.yaml +- patches/webhook_in_kubeadmconfigtemplates.yaml # +kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix. @@ -26,6 +28,8 @@ patchesStrategicMerge: #- patches/cainjection_in_machines.yaml #- patches/cainjection_in_machinesets.yaml #- patches/cainjection_in_machinedeployments.yaml +- patches/cainjection_in_kubeadmconfigs.yaml +- patches/cainjection_in_kubeadmconfigtemplates.yaml # +kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/config/crd/patches/cainjection_in_kubeadmconfigs.yaml b/config/crd/patches/cainjection_in_kubeadmconfigs.yaml new file mode 100644 index 000000000000..4586b59f4dea --- /dev/null +++ b/config/crd/patches/cainjection_in_kubeadmconfigs.yaml @@ -0,0 +1,8 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +# CRD conversion requires k8s 1.13 or later. +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: kubeadmconfigs.bootstrap.cluster.x-k8s.io diff --git a/config/crd/patches/cainjection_in_kubeadmconfigtemplates.yaml b/config/crd/patches/cainjection_in_kubeadmconfigtemplates.yaml new file mode 100644 index 000000000000..ac54f554f157 --- /dev/null +++ b/config/crd/patches/cainjection_in_kubeadmconfigtemplates.yaml @@ -0,0 +1,8 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +# CRD conversion requires k8s 1.13 or later. +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: kubeadmconfigtemplates.bootstrap.cluster.x-k8s.io diff --git a/config/crd/patches/webhook_in_kubeadmconfigs.yaml b/config/crd/patches/webhook_in_kubeadmconfigs.yaml new file mode 100644 index 000000000000..473c63500adf --- /dev/null +++ b/config/crd/patches/webhook_in_kubeadmconfigs.yaml @@ -0,0 +1,17 @@ +# The following patch enables conversion webhook for CRD +# CRD conversion requires k8s 1.13 or later. +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: kubeadmconfigs.bootstrap.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhookClientConfig: + # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, + # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) + caBundle: Cg== + service: + namespace: system + name: webhook-service + path: /convert diff --git a/config/crd/patches/webhook_in_kubeadmconfigtemplates.yaml b/config/crd/patches/webhook_in_kubeadmconfigtemplates.yaml new file mode 100644 index 000000000000..20c651947580 --- /dev/null +++ b/config/crd/patches/webhook_in_kubeadmconfigtemplates.yaml @@ -0,0 +1,17 @@ +# The following patch enables conversion webhook for CRD +# CRD conversion requires k8s 1.13 or later. +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: kubeadmconfigtemplates.bootstrap.cluster.x-k8s.io +spec: + conversion: + strategy: Webhook + webhookClientConfig: + # this is "\n" used as a placeholder, otherwise it will be rejected by the apiserver for being blank, + # but we're going to set it later using the cert-manager (or potentially a patch if not using cert-manager) + caBundle: Cg== + service: + namespace: system + name: webhook-service + path: /convert diff --git a/main.go b/main.go index 74ebebcfdbdf..8f113dbb31e5 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,8 @@ import ( "k8s.io/klog/klogr" clusterv1alpha2 "sigs.k8s.io/cluster-api/api/v1alpha2" clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - kubeadmbootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + kubeadmbootstrapv1alpha2 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + kubeadmbootstrapv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" kubeadmcontrollers "sigs.k8s.io/cluster-api/bootstrap/kubeadm/controllers" "sigs.k8s.io/cluster-api/controllers" ctrl "sigs.k8s.io/controller-runtime" @@ -49,7 +50,8 @@ func init() { _ = clientgoscheme.AddToScheme(scheme) _ = clusterv1alpha2.AddToScheme(scheme) _ = clusterv1alpha3.AddToScheme(scheme) - _ = kubeadmbootstrapv1.AddToScheme(scheme) + _ = kubeadmbootstrapv1alpha2.AddToScheme(scheme) + _ = kubeadmbootstrapv1alpha3.AddToScheme(scheme) // +kubebuilder:scaffold:scheme } @@ -225,6 +227,23 @@ func main() { setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmControlPlane") os.Exit(1) } + + if err = (&kubeadmbootstrapv1alpha3.KubeadmConfig{}).SetupWebhookWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfig") + os.Exit(1) + } + if err = (&kubeadmbootstrapv1alpha3.KubeadmConfigList{}).SetupWebhookWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfigList") + os.Exit(1) + } + if err = (&kubeadmbootstrapv1alpha3.KubeadmConfigTemplate{}).SetupWebhookWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfigTemplate") + os.Exit(1) + } + if err = (&kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList{}).SetupWebhookWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfigTemplateList") + os.Exit(1) + } } // +kubebuilder:scaffold:builder diff --git a/test/infrastructure/docker/e2e/docker_suite_test.go b/test/infrastructure/docker/e2e/docker_suite_test.go index d8acd8d1e2c0..71d6d76ab15e 100644 --- a/test/infrastructure/docker/e2e/docker_suite_test.go +++ b/test/infrastructure/docker/e2e/docker_suite_test.go @@ -29,7 +29,7 @@ import ( "sigs.k8s.io/cluster-api/test/framework/generators" capiv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha2" ) diff --git a/test/infrastructure/docker/e2e/docker_test.go b/test/infrastructure/docker/e2e/docker_test.go index ea0f3eee36fd..90e5ddb2ee6a 100644 --- a/test/infrastructure/docker/e2e/docker_test.go +++ b/test/infrastructure/docker/e2e/docker_test.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/cluster-api/test/framework" capiv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha2" )