-
Notifications
You must be signed in to change notification settings - Fork 233
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
Add support for the PodNodeSelector admission controller #920
Changes from all commits
ce38d20
b4a4722
89a18d3
cb8ae61
960ed81
84f02eb
6106087
865df1b
d44fef5
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,50 @@ | ||
/* | ||
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 v1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// AdmissionConfiguration provides versioned configuration for admission controllers. | ||
type AdmissionConfiguration struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// Plugins allows specifying a configuration per admission control plugin. | ||
// +optional | ||
Plugins []AdmissionPluginConfiguration `json:"plugins"` | ||
} | ||
|
||
// AdmissionPluginConfiguration provides the configuration for a single plug-in. | ||
type AdmissionPluginConfiguration struct { | ||
// Name is the name of the admission controller. | ||
// It must match the registered admission plugin name. | ||
Name string `json:"name"` | ||
|
||
// Path is the path to a configuration file that contains the plugin's | ||
// configuration | ||
// +optional | ||
Path string `json:"path"` | ||
|
||
// Configuration is an embedded configuration object to be used as the plugin's | ||
// configuration. If present, it will be used instead of the path to the configuration file. | ||
// +optional | ||
Configuration *runtime.Unknown `json:"configuration"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
Copyright 2017 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 v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// AdmissionConfiguration provides versioned configuration for admission controllers. | ||
type AdmissionConfiguration struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// Plugins allows specifying a configuration per admission control plugin. | ||
// +optional | ||
Plugins []AdmissionPluginConfiguration `json:"plugins"` | ||
} | ||
|
||
// AdmissionPluginConfiguration provides the configuration for a single plug-in. | ||
type AdmissionPluginConfiguration struct { | ||
// Name is the name of the admission controller. | ||
// It must match the registered admission plugin name. | ||
Name string `json:"name"` | ||
|
||
// Path is the path to a configuration file that contains the plugin's | ||
// configuration | ||
// +optional | ||
Path string `json:"path"` | ||
|
||
// Configuration is an embedded configuration object to be used as the plugin's | ||
// configuration. If present, it will be used instead of the path to the configuration file. | ||
// +optional | ||
Configuration *runtime.Unknown `json:"configuration"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,6 +215,7 @@ type MachineControllerConfig struct { | |
|
||
// Features controls what features will be enabled on the cluster | ||
type Features struct { | ||
PodNodeSelector *PodNodeSelector `json:"podNodeSelector"` | ||
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. While there is no technical obstacle to add this new feature to v1alpha1, I think we should avoid doing this, as v1alpha1 should be "conserved" and not changed anymore. 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've thought about this as well, but I think we should keep both APIs in sync until we don't officially announce the deprecation with the 1.0 release. After that, only v1beta1 should be extended. |
||
PodPresets *PodPresets `json:"podPresets"` | ||
PodSecurityPolicy *PodSecurityPolicy `json:"podSecurityPolicy"` | ||
StaticAuditLog *StaticAuditLog `json:"staticAuditLog"` | ||
|
@@ -230,6 +231,21 @@ type SystemPackages struct { | |
ConfigureRepositories bool `json:"configureRepositories"` | ||
} | ||
|
||
// PodNodeSelector feature flag | ||
type PodNodeSelector struct { | ||
Enable bool `json:"enable"` | ||
Config PodNodeSelectorConfig `json:"config"` | ||
} | ||
|
||
// PodNodeSelectorConfig config | ||
type PodNodeSelectorConfig struct { | ||
// ConfigFilePath is a path on the local file system to the PodNodeSelector | ||
// configuration file. | ||
// ConfigFilePath is a required field. | ||
// More info: https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#podnodeselector | ||
ConfigFilePath string `json:"configFilePath"` | ||
} | ||
|
||
// PodPresets feature flag | ||
type PodPresets struct { | ||
Enable bool `json:"enable"` | ||
|
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.
Let's have it inline instead of file
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.
I've thought about this as well and I'm not sure this is a good approach. I think we should have the standardized API, even if it's a little bit redundant sometimes. A couple of things I have on mind:
Config
is a struct for all other features. Having it as a string here could introduce confusionConfigFilePath
like it's now, but then we come to another problem...In the long run, I think it's better as it is right now.