Skip to content

Commit 8a2f52d

Browse files
Merge pull request #19186 from deads2k/server-16-kube
remove illegal and dead kubemasterconfig fields
2 parents 668dff6 + 2dcc2b2 commit 8a2f52d

File tree

12 files changed

+28
-225
lines changed

12 files changed

+28
-225
lines changed

pkg/cmd/server/apis/config/helpers.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ func GetMasterFileReferences(config *MasterConfig) []*string {
154154
refs = appendFlagsWithFileExtensions(refs, config.KubernetesMasterConfig.APIServerArguments)
155155
refs = appendFlagsWithFileExtensions(refs, config.KubernetesMasterConfig.SchedulerArguments)
156156
refs = appendFlagsWithFileExtensions(refs, config.KubernetesMasterConfig.ControllerArguments)
157-
158-
for k := range config.KubernetesMasterConfig.AdmissionConfig.PluginConfig {
159-
refs = append(refs, &config.KubernetesMasterConfig.AdmissionConfig.PluginConfig[k].Location)
160-
}
161157
}
162158

163159
if config.AuthConfig.RequestHeader != nil {

pkg/cmd/server/apis/config/serialization_test.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -191,25 +191,7 @@ func fuzzInternalObject(t *testing.T, forVersion schema.GroupVersion, item runti
191191
obj.AdmissionConfig.PluginConfig[pluginName] = &configapi.AdmissionPluginConfig{}
192192
}
193193
}
194-
if obj.KubernetesMasterConfig != nil {
195-
for pluginName := range obj.KubernetesMasterConfig.AdmissionConfig.PluginConfig {
196-
if obj.KubernetesMasterConfig.AdmissionConfig.PluginConfig[pluginName] == nil {
197-
obj.KubernetesMasterConfig.AdmissionConfig.PluginConfig[pluginName] = &configapi.AdmissionPluginConfig{}
198-
}
199-
}
200-
}
201194

202-
// test a Kubernetes admission plugin nested for round tripping
203-
if obj.KubernetesMasterConfig != nil && c.RandBool() {
204-
obj.KubernetesMasterConfig.AdmissionConfig.PluginConfig = map[string]*configapi.AdmissionPluginConfig{
205-
"abc": {
206-
Location: "test",
207-
Configuration: &configapi.LDAPSyncConfig{
208-
URL: "ldap://some:other@server:8080/test",
209-
},
210-
},
211-
}
212-
}
213195
if obj.OAuthConfig != nil && c.RandBool() {
214196
obj.OAuthConfig.IdentityProviders = []configapi.IdentityProvider{
215197
{
@@ -234,9 +216,6 @@ func fuzzInternalObject(t *testing.T, forVersion schema.GroupVersion, item runti
234216
},
235217
func(obj *configapi.KubernetesMasterConfig, c fuzz.Continue) {
236218
c.FuzzNoCustom(obj)
237-
if obj.MasterCount == 0 {
238-
obj.MasterCount = 1
239-
}
240219
if len(obj.ServicesNodePortRange) == 0 {
241220
obj.ServicesNodePortRange = "30000-32767"
242221
}

pkg/cmd/server/apis/config/types.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,9 +1220,6 @@ type KubernetesMasterConfig struct {
12201220

12211221
// MasterIP is the public IP address of kubernetes stuff. If empty, the first result from net.InterfaceAddrs will be used.
12221222
MasterIP string
1223-
// MasterCount is the number of expected masters that should be running. This value defaults to 1 and may be set to a positive integer,
1224-
// or if set to -1, indicates this is part of a cluster.
1225-
MasterCount int
12261223
// MasterEndpointReconcileTTL sets the time to live in seconds of an endpoint record recorded by each master. The endpoints are checked
12271224
// at an interval that is 2/3 of this value and this value defaults to 15s if unset. In very large clusters, this value may be increased to
12281225
// reduce the possibility that the master endpoint record expires (due to other load on the etcd server) and causes masters to drop in and
@@ -1232,8 +1229,6 @@ type KubernetesMasterConfig struct {
12321229
ServicesSubnet string
12331230
// ServicesNodePortRange is the range to use for assigning service public ports on a host.
12341231
ServicesNodePortRange string
1235-
// StaticNodeNames is the list of nodes that are statically known
1236-
StaticNodeNames []string
12371232

12381233
// SchedulerConfigFile points to a file that describes how to set up the scheduler. If empty, you get the default scheduling rules.
12391234
SchedulerConfigFile string
@@ -1245,9 +1240,6 @@ type KubernetesMasterConfig struct {
12451240
// ProxyClientInfo specifies the client cert/key to use when proxying to pods
12461241
ProxyClientInfo CertInfo
12471242

1248-
// AdmissionConfig contains admission control plugin configuration.
1249-
AdmissionConfig AdmissionConfig
1250-
12511243
// APIServerArguments are key value pairs that will be passed directly to the Kube apiserver that match the apiservers's
12521244
// command line arguments. These are not migrated, but if you reference a value that does not exist the server will not
12531245
// start. These values may override other settings in KubernetesMasterConfig which may cause invalid configurations.

pkg/cmd/server/apis/config/v1/conversions.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ func SetDefaults_MasterConfig(obj *MasterConfig) {
146146
}
147147

148148
func SetDefaults_KubernetesMasterConfig(obj *KubernetesMasterConfig) {
149-
if obj.MasterCount == 0 {
150-
obj.MasterCount = 1
151-
}
152149
if obj.MasterEndpointReconcileTTL == 0 {
153150
obj.MasterEndpointReconcileTTL = 15
154151
}
@@ -161,12 +158,6 @@ func SetDefaults_KubernetesMasterConfig(obj *KubernetesMasterConfig) {
161158
if len(obj.PodEvictionTimeout) == 0 {
162159
obj.PodEvictionTimeout = "5m"
163160
}
164-
// Ensure no nil plugin config stanzas
165-
for pluginName := range obj.AdmissionConfig.PluginConfig {
166-
if obj.AdmissionConfig.PluginConfig[pluginName] == nil {
167-
obj.AdmissionConfig.PluginConfig[pluginName] = &AdmissionPluginConfig{}
168-
}
169-
}
170161
}
171162
func SetDefaults_NodeConfig(obj *NodeConfig) {
172163
if obj.MasterClientConnectionOverrides == nil {
@@ -465,12 +456,6 @@ func (c *MasterConfig) DecodeNestedObjects(d runtime.Decoder) error {
465456
apihelpers.DecodeNestedRawExtensionOrUnknown(d, &v.Configuration)
466457
c.AdmissionConfig.PluginConfig[k] = v
467458
}
468-
if c.KubernetesMasterConfig != nil {
469-
for k, v := range c.KubernetesMasterConfig.AdmissionConfig.PluginConfig {
470-
apihelpers.DecodeNestedRawExtensionOrUnknown(d, &v.Configuration)
471-
c.KubernetesMasterConfig.AdmissionConfig.PluginConfig[k] = v
472-
}
473-
}
474459
if c.OAuthConfig != nil {
475460
for i := range c.OAuthConfig.IdentityProviders {
476461
apihelpers.DecodeNestedRawExtensionOrUnknown(d, &c.OAuthConfig.IdentityProviders[i].Provider)
@@ -491,14 +476,6 @@ func (c *MasterConfig) EncodeNestedObjects(e runtime.Encoder) error {
491476
}
492477
c.AdmissionConfig.PluginConfig[k] = v
493478
}
494-
if c.KubernetesMasterConfig != nil {
495-
for k, v := range c.KubernetesMasterConfig.AdmissionConfig.PluginConfig {
496-
if err := apihelpers.EncodeNestedRawExtension(e, &v.Configuration); err != nil {
497-
return err
498-
}
499-
c.KubernetesMasterConfig.AdmissionConfig.PluginConfig[k] = v
500-
}
501-
}
502479
if c.OAuthConfig != nil {
503480
for i := range c.OAuthConfig.IdentityProviders {
504481
if err := apihelpers.EncodeNestedRawExtension(e, &c.OAuthConfig.IdentityProviders[i].Provider); err != nil {

pkg/cmd/server/apis/config/v1/testdata/master-config.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,10 @@ kubeletClientInfo:
9292
keyFile: ""
9393
port: 0
9494
kubernetesMasterConfig:
95-
admissionConfig:
96-
pluginConfig:
97-
plugin:
98-
configuration:
99-
apiVersion: v1
100-
data: ""
101-
kind: AdmissionPluginTestConfig
102-
location: ""
103-
pluginOrderOverride:
104-
- plugin
10595
apiLevels: null
10696
apiServerArguments: null
10797
controllerArguments: null
10898
disabledAPIGroupVersions: {}
109-
masterCount: 1
11099
masterEndpointReconcileTTL: 15
111100
masterIP: ""
112101
podEvictionTimeout: 5m
@@ -117,7 +106,6 @@ kubernetesMasterConfig:
117106
schedulerConfigFile: ""
118107
servicesNodePortRange: 30000-32767
119108
servicesSubnet: ""
120-
staticNodeNames: null
121109
masterClients:
122110
externalKubernetesClientConnectionOverrides:
123111
acceptContentTypes: application/json

pkg/cmd/server/apis/config/v1/types.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,9 +1145,6 @@ type KubernetesMasterConfig struct {
11451145

11461146
// MasterIP is the public IP address of kubernetes stuff. If empty, the first result from net.InterfaceAddrs will be used.
11471147
MasterIP string `json:"masterIP"`
1148-
// MasterCount is the number of expected masters that should be running. This value defaults to 1 and may be set to a positive integer,
1149-
// or if set to -1, indicates this is part of a cluster.
1150-
MasterCount int `json:"masterCount"`
11511148
// MasterEndpointReconcileTTL sets the time to live in seconds of an endpoint record recorded by each master. The endpoints are checked
11521149
// at an interval that is 2/3 of this value and this value defaults to 15s if unset. In very large clusters, this value may be increased to
11531150
// reduce the possibility that the master endpoint record expires (due to other load on the etcd server) and causes masters to drop in and
@@ -1157,8 +1154,6 @@ type KubernetesMasterConfig struct {
11571154
ServicesSubnet string `json:"servicesSubnet"`
11581155
// ServicesNodePortRange is the range to use for assigning service public ports on a host.
11591156
ServicesNodePortRange string `json:"servicesNodePortRange"`
1160-
// StaticNodeNames is the list of nodes that are statically known
1161-
StaticNodeNames []string `json:"staticNodeNames"`
11621157

11631158
// SchedulerConfigFile points to a file that describes how to set up the scheduler. If empty, you get the default scheduling rules.
11641159
SchedulerConfigFile string `json:"schedulerConfigFile"`
@@ -1169,9 +1164,6 @@ type KubernetesMasterConfig struct {
11691164
// ProxyClientInfo specifies the client cert/key to use when proxying to pods
11701165
ProxyClientInfo CertInfo `json:"proxyClientInfo"`
11711166

1172-
// AdmissionConfig contains admission control plugin configuration.
1173-
AdmissionConfig AdmissionConfig `json:"admissionConfig"`
1174-
11751167
// APIServerArguments are key value pairs that will be passed directly to the Kube apiserver that match the apiservers's
11761168
// command line arguments. These are not migrated, but if you reference a value that does not exist the server will not
11771169
// start. These values may override other settings in KubernetesMasterConfig which may cause invalid configurations.

pkg/cmd/server/apis/config/v1/types_test.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,8 @@ func TestMasterConfig(t *testing.T) {
191191
NamedCertificates: []internal.NamedCertificate{{}},
192192
},
193193
},
194-
KubernetesMasterConfig: &internal.KubernetesMasterConfig{
195-
AdmissionConfig: internal.AdmissionConfig{
196-
PluginConfig: map[string]*internal.AdmissionPluginConfig{ // test config as an embedded object
197-
"plugin": {
198-
Configuration: &testtypes.AdmissionPluginTestConfig{},
199-
},
200-
},
201-
PluginOrderOverride: []string{"plugin"}, // explicitly set this field because it's omitempty
202-
},
203-
},
204-
EtcdConfig: &internal.EtcdConfig{},
194+
KubernetesMasterConfig: &internal.KubernetesMasterConfig{},
195+
EtcdConfig: &internal.EtcdConfig{},
205196
OAuthConfig: &internal.OAuthConfig{
206197
IdentityProviders: []internal.IdentityProvider{
207198
{Provider: &internal.BasicAuthPasswordIdentityProvider{}},

pkg/cmd/server/apis/config/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cmd/server/apis/config/validation/master.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,6 @@ func ValidateKubernetesMasterConfig(config *configapi.KubernetesMasterConfig, fl
527527
validationResults.AddErrors(ValidateSpecifiedIP(config.MasterIP, fldPath.Child("masterIP"))...)
528528
}
529529

530-
if config.MasterCount == 0 || config.MasterCount < -1 {
531-
validationResults.AddErrors(field.Invalid(fldPath.Child("masterCount"), config.MasterCount, "must be a positive integer or -1"))
532-
}
533-
534530
validationResults.AddErrors(ValidateCertInfo(config.ProxyClientInfo, false, fldPath.Child("proxyClientInfo"))...)
535531
if len(config.ProxyClientInfo.CertFile) == 0 && len(config.ProxyClientInfo.KeyFile) == 0 {
536532
validationResults.AddWarnings(field.Invalid(fldPath.Child("proxyClientInfo"), "", "if no client certificate is specified, TLS pods and services cannot validate requests came from the proxy"))
@@ -552,14 +548,6 @@ func ValidateKubernetesMasterConfig(config *configapi.KubernetesMasterConfig, fl
552548
validationResults.AddErrors(ValidateFile(config.SchedulerConfigFile, fldPath.Child("schedulerConfigFile"))...)
553549
}
554550

555-
for i, nodeName := range config.StaticNodeNames {
556-
if len(nodeName) == 0 {
557-
validationResults.AddErrors(field.Invalid(fldPath.Child("staticNodeName").Index(i), nodeName, "may not be empty"))
558-
} else {
559-
validationResults.AddWarnings(field.Invalid(fldPath.Child("staticNodeName").Index(i), nodeName, "static nodes are not supported"))
560-
}
561-
}
562-
563551
if len(config.PodEvictionTimeout) > 0 {
564552
if _, err := time.ParseDuration(config.PodEvictionTimeout); err != nil {
565553
validationResults.AddErrors(field.Invalid(fldPath.Child("podEvictionTimeout"), config.PodEvictionTimeout, "must be a valid time duration string (e.g. '300ms' or '2m30s'). Valid time units are 'ns', 'us', 'ms', 's', 'm', 'h'"))
@@ -585,13 +573,6 @@ func ValidateKubernetesMasterConfig(config *configapi.KubernetesMasterConfig, fl
585573
}
586574
}
587575

588-
if config.AdmissionConfig.PluginConfig != nil {
589-
validationResults.AddErrors(field.Invalid(fldPath.Child("admissionConfig", "pluginConfig"), config.AdmissionConfig.PluginConfig, "separate admission chains are no longer allowed. Convert to admissionConfig.pluginConfig."))
590-
}
591-
if len(config.AdmissionConfig.PluginOrderOverride) != 0 {
592-
validationResults.AddErrors(field.Invalid(fldPath.Child("admissionConfig", "pluginOrderOverride"), config.AdmissionConfig.PluginOrderOverride, "separate admission chains are no longer allowed. Convert to DefaultAdmissionConfig in admissionConfig.pluginConfig."))
593-
}
594-
595576
validationResults.Append(ValidateAPIServerExtendedArguments(config.APIServerArguments, fldPath.Child("apiServerArguments")))
596577
validationResults.AddErrors(ValidateControllerExtendedArguments(config.ControllerArguments, fldPath.Child("controllerArguments"))...)
597578

pkg/cmd/server/apis/config/validation/master_test.go

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,6 @@ func TestValidateAdmissionPluginConfigConflicts(t *testing.T) {
282282
{
283283
name: "stock everything",
284284
},
285-
{
286-
name: "specified kube admission order 01",
287-
options: configapi.MasterConfig{
288-
KubernetesMasterConfig: &configapi.KubernetesMasterConfig{
289-
AdmissionConfig: configapi.AdmissionConfig{
290-
PluginOrderOverride: []string{"foo"},
291-
},
292-
},
293-
},
294-
errorFields: []string{"kubernetesMasterConfig.admissionConfig.pluginOrderOverride"},
295-
},
296285
{
297286
name: "specified kube admission order 02",
298287
options: configapi.MasterConfig{
@@ -336,69 +325,6 @@ func TestValidateAdmissionPluginConfigConflicts(t *testing.T) {
336325
},
337326
},
338327
},
339-
{
340-
name: "specified, non-conflicting plugin configs 02",
341-
options: configapi.MasterConfig{
342-
KubernetesMasterConfig: &configapi.KubernetesMasterConfig{
343-
AdmissionConfig: configapi.AdmissionConfig{
344-
PluginConfig: map[string]*configapi.AdmissionPluginConfig{
345-
"foo": {
346-
Location: "bar",
347-
},
348-
"third": {
349-
Location: "bar",
350-
},
351-
},
352-
},
353-
},
354-
AdmissionConfig: configapi.AdmissionConfig{
355-
PluginConfig: map[string]*configapi.AdmissionPluginConfig{
356-
"foo": {
357-
Location: "bar",
358-
},
359-
},
360-
},
361-
},
362-
},
363-
{
364-
name: "specified, non-conflicting plugin configs 03",
365-
options: configapi.MasterConfig{
366-
KubernetesMasterConfig: &configapi.KubernetesMasterConfig{
367-
AdmissionConfig: configapi.AdmissionConfig{
368-
PluginConfig: map[string]*configapi.AdmissionPluginConfig{
369-
"foo": {
370-
Location: "bar",
371-
},
372-
"third": {
373-
Location: "bar",
374-
},
375-
},
376-
},
377-
},
378-
},
379-
},
380-
{
381-
name: "specified conflicting plugin configs 01",
382-
options: configapi.MasterConfig{
383-
KubernetesMasterConfig: &configapi.KubernetesMasterConfig{
384-
AdmissionConfig: configapi.AdmissionConfig{
385-
PluginConfig: map[string]*configapi.AdmissionPluginConfig{
386-
"foo": {
387-
Location: "different",
388-
},
389-
},
390-
},
391-
},
392-
AdmissionConfig: configapi.AdmissionConfig{
393-
PluginConfig: map[string]*configapi.AdmissionPluginConfig{
394-
"foo": {
395-
Location: "bar",
396-
},
397-
},
398-
},
399-
},
400-
errorFields: []string{"kubernetesMasterConfig.admissionConfig.pluginConfig"},
401-
},
402328
}
403329

404330
// these fields have warnings in the empty case

pkg/cmd/server/apis/config/zz_generated.deepcopy.go

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)