-
Notifications
You must be signed in to change notification settings - Fork 38.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kubeadm: fix conversion macros and add kubeadm to round trip testing #34555
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
Copyright 2016 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 install | ||
|
||
import ( | ||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" | ||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" | ||
"k8s.io/kubernetes/pkg/apimachinery/announced" | ||
) | ||
|
||
func init() { | ||
if err := announced.NewGroupMetaFactory( | ||
&announced.GroupMetaFactoryArgs{ | ||
GroupName: kubeadm.GroupName, | ||
VersionPreferenceOrder: []string{v1alpha1.SchemeGroupVersion.Version}, | ||
ImportPrefix: "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm", | ||
AddInternalObjectsToScheme: kubeadm.AddToScheme, | ||
}, | ||
announced.VersionToSchemeFunc{ | ||
v1alpha1.SchemeGroupVersion.Version: v1alpha1.AddToScheme, | ||
}, | ||
).Announce().RegisterAndEnable(); err != nil { | ||
panic(err) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ type MasterConfiguration struct { | |
|
||
Secrets Secrets `json:"secrets"` | ||
API API `json:"api"` | ||
Etcd Etcd `json:"etcd"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering why these were missing 👍 |
||
Networking Networking `json:"networking"` | ||
KubernetesVersion string `json:"kubernetesVersion"` | ||
CloudProvider string `json:"cloudProvider"` | ||
|
@@ -57,6 +58,7 @@ type NodeConfiguration struct { | |
unversioned.TypeMeta | ||
|
||
MasterAddresses []string `json:"masterAddresses"` | ||
Secrets Secrets `json:"secrets"` | ||
} | ||
|
||
// ClusterInfo TODO add description | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ import ( | |
"reflect" | ||
"strings" | ||
|
||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" | ||
"k8s.io/kubernetes/federation/apis/federation" | ||
"k8s.io/kubernetes/pkg/api" | ||
"k8s.io/kubernetes/pkg/api/meta" | ||
|
@@ -47,6 +48,7 @@ import ( | |
"k8s.io/kubernetes/pkg/runtime" | ||
"k8s.io/kubernetes/pkg/runtime/serializer/recognizer" | ||
|
||
_ "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/install" | ||
_ "k8s.io/kubernetes/federation/apis/federation/install" | ||
_ "k8s.io/kubernetes/pkg/api/install" | ||
_ "k8s.io/kubernetes/pkg/apis/apps/install" | ||
|
@@ -247,7 +249,6 @@ func init() { | |
externalTypes: api.Scheme.KnownTypes(externalGroupVersion), | ||
} | ||
} | ||
|
||
if _, ok := Groups[imagepolicy.GroupName]; !ok { | ||
externalGroupVersion := unversioned.GroupVersion{Group: imagepolicy.GroupName, Version: registered.GroupOrDie(imagepolicy.GroupName).GroupVersion.Version} | ||
Groups[imagepolicy.GroupName] = TestGroup{ | ||
|
@@ -257,6 +258,15 @@ func init() { | |
externalTypes: api.Scheme.KnownTypes(externalGroupVersion), | ||
} | ||
} | ||
if _, ok := Groups[kubeadm.GroupName]; !ok { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is ugly. I would prefer this and/or other packages providing APIs to use to do the testing without having to modify this package and register it globally. Way out of scope though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole package should not exist, we should reuse the manager in apimachinery/registered. It's a big change though. @mml This is one of the refactoring changes I want to make. |
||
externalGroupVersion := unversioned.GroupVersion{Group: kubeadm.GroupName, Version: registered.GroupOrDie(kubeadm.GroupName).GroupVersion.Version} | ||
Groups[kubeadm.GroupName] = TestGroup{ | ||
externalGroupVersion: externalGroupVersion, | ||
internalGroupVersion: kubeadm.SchemeGroupVersion, | ||
internalTypes: api.Scheme.KnownTypes(kubeadm.SchemeGroupVersion), | ||
externalTypes: api.Scheme.KnownTypes(externalGroupVersion), | ||
} | ||
} | ||
|
||
Default = Groups[api.GroupName] | ||
Autoscaling = Groups[autoscaling.GroupName] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This machinery is much different than what I remember. What is the difference between announce, register, and enable? And why to we need each?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea. Maybe @lavalamp or @caesarxuchao can say. I need this apigroup to be available from
registered.GroupOrDie
so I can add it to the testapi package and thus round trip testing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Announce and register are really the same concept, but my refactoring work is half done.