mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-30 23:57:46 +00:00
add component config api group
This commit is contained in:
parent
7b8bf758f3
commit
82111a7cb5
@ -32,12 +32,13 @@ var RegisteredVersions []string
|
||||
func init() {
|
||||
// TODO: caesarxuchao: rename this variable to validGroupVersions
|
||||
validAPIVersions := map[string]bool{
|
||||
"v1": true,
|
||||
"extensions/v1beta1": true,
|
||||
"v1": true,
|
||||
"extensions/v1beta1": true,
|
||||
"componentconfig/v1alpha1": true,
|
||||
}
|
||||
|
||||
// The default list of supported api versions, in order of most preferred to the least.
|
||||
defaultSupportedVersions := "v1,extensions/v1beta1"
|
||||
defaultSupportedVersions := "v1,extensions/v1beta1,componentconfig/v1alpha1"
|
||||
// Env var KUBE_API_VERSIONS is a comma separated list of API versions that should be registered in the scheme.
|
||||
// The versions should be in the order of most preferred to the least.
|
||||
supportedVersions := os.Getenv("KUBE_API_VERSIONS")
|
||||
|
33
pkg/apis/componentconfig/decode.go
Normal file
33
pkg/apis/componentconfig/decode.go
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 componentconfig
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
)
|
||||
|
||||
func DecodeFromPathInto(obj runtime.Object, c runtime.Codec, filename string) error {
|
||||
b, err := ioutil.ReadFile(filename)
|
||||
c = runtime.YAMLDecoder(c)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.DecodeInto(b, obj)
|
||||
}
|
33
pkg/apis/componentconfig/register.go
Normal file
33
pkg/apis/componentconfig/register.go
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 componentconfig
|
||||
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
)
|
||||
|
||||
func init() {
|
||||
addKnownTypes()
|
||||
}
|
||||
|
||||
func addKnownTypes() {
|
||||
api.Scheme.AddKnownTypes("",
|
||||
&KubeProxyConfiguration{},
|
||||
)
|
||||
}
|
||||
|
||||
func (_ *KubeProxyConfiguration) IsAnAPIObject() {}
|
64
pkg/apis/componentconfig/types.go
Normal file
64
pkg/apis/componentconfig/types.go
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 componentconfig
|
||||
|
||||
import "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
|
||||
type KubeProxyConfiguration struct {
|
||||
unversioned.TypeMeta
|
||||
|
||||
// bindAddress is the IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)
|
||||
BindAddress string `json:"bindAddress"`
|
||||
// cleanupIPTables
|
||||
CleanupIPTables bool `json:"cleanupIPTables"`
|
||||
// healthzBindAddress is the IP address for the health check server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)
|
||||
HealthzBindAddress string `json:"healthzBindAddress"`
|
||||
// healthzPort is the port to bind the health check server. Use 0 to disable.
|
||||
HealthzPort int `json:"healthzPort"`
|
||||
// hostnameOverride, if non-empty, will be used as the identity instead of the actual hostname.
|
||||
HostnameOverride string `json:"hostnameOverride"`
|
||||
// iptablesSyncPeriodSeconds is the period that iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.
|
||||
IPTablesSyncePeriodSeconds int `json:"iptablesSyncPeriodSeconds"`
|
||||
// kubeAPIBurst is the burst to use while talking with kubernetes apiserver
|
||||
KubeAPIBurst int `json:"kubeAPIBurst"`
|
||||
// kubeAPIQPS is the max QPS to use while talking with kubernetes apiserver
|
||||
KubeAPIQPS int `json:"kubeAPIQPS"`
|
||||
// kubeconfigPath is the path to the kubeconfig file with authorization information (the master location is set by the master flag).
|
||||
KubeconfigPath string `json:"kubeconfigPath"`
|
||||
// masqueradeAll tells kube-proxy to SNAT everything if using the pure iptables proxy mode.
|
||||
MasqueradeAll bool `json:"masqueradeAll"`
|
||||
// master is the address of the Kubernetes API server (overrides any value in kubeconfig)
|
||||
Master string `json:"master"`
|
||||
// oomScoreAdj is the oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]
|
||||
OOMScoreAdj *int `json:"oomScoreAdj"`
|
||||
// mode specifies which proxy mode to use.
|
||||
Mode ProxyMode `json:"mode"`
|
||||
// portRange is the range of host ports (beginPort-endPort, inclusive) that may be consumed in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen.
|
||||
PortRange string `json:"portRange"`
|
||||
// resourceContainer is the bsolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).
|
||||
ResourceContainer string `json:"resourceContainer"`
|
||||
// udpTimeoutMilliseconds is how long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxyMode=userspace.
|
||||
UDPTimeoutMilliseconds int `json:"udpTimeoutMilliseconds"`
|
||||
}
|
||||
|
||||
// Currently two modes of proxying are available: 'userspace' (older, stable) or 'iptables' (experimental). If blank, look at the Node object on the Kubernetes API and respect the 'net.experimental.kubernetes.io/proxy-mode' annotation if provided. Otherwise use the best-available proxy (currently userspace, but may change in future versions). If the iptables proxy is selected, regardless of how, but the system's kernel or iptables versions are insufficient, this always falls back to the userspace proxy.
|
||||
type ProxyMode string
|
||||
|
||||
const (
|
||||
ProxyModeUserspace ProxyMode = "userspace"
|
||||
ProxyModeIPTables ProxyMode = "iptables"
|
||||
)
|
48
pkg/apis/componentconfig/v1alpha1/defaults.go
Normal file
48
pkg/apis/componentconfig/v1alpha1/defaults.go
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/kubelet/qos"
|
||||
)
|
||||
|
||||
func addDefaultingFuncs() {
|
||||
api.Scheme.AddDefaultingFuncs(
|
||||
func(obj *KubeProxyConfiguration) {
|
||||
if obj.BindAddress == "" {
|
||||
obj.BindAddress = "0.0.0.0"
|
||||
}
|
||||
if obj.HealthzPort == 0 {
|
||||
obj.HealthzPort = 10249
|
||||
}
|
||||
if obj.HealthzBindAddress == "" {
|
||||
obj.HealthzBindAddress = "127.0.0.1"
|
||||
}
|
||||
if obj.OOMScoreAdj == nil {
|
||||
temp := qos.KubeProxyOOMScoreAdj
|
||||
obj.OOMScoreAdj = &temp
|
||||
}
|
||||
if obj.ResourceContainer == "" {
|
||||
obj.ResourceContainer = "/kube-proxy"
|
||||
}
|
||||
if obj.IPTablesSyncePeriodSeconds == 0 {
|
||||
obj.IPTablesSyncePeriodSeconds = 5
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
37
pkg/apis/componentconfig/v1alpha1/register.go
Normal file
37
pkg/apis/componentconfig/v1alpha1/register.go
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
)
|
||||
|
||||
var Codec = runtime.CodecFor(api.Scheme, "componentconfig/v1alpha1")
|
||||
|
||||
func init() {
|
||||
addKnownTypes()
|
||||
addDefaultingFuncs()
|
||||
}
|
||||
|
||||
func addKnownTypes() {
|
||||
api.Scheme.AddKnownTypes("componentconfig/v1alpha1",
|
||||
&KubeProxyConfiguration{},
|
||||
)
|
||||
}
|
||||
|
||||
func (_ *KubeProxyConfiguration) IsAnAPIObject() {}
|
64
pkg/apis/componentconfig/v1alpha1/types.go
Normal file
64
pkg/apis/componentconfig/v1alpha1/types.go
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 "k8s.io/kubernetes/pkg/api/unversioned"
|
||||
|
||||
type KubeProxyConfiguration struct {
|
||||
unversioned.TypeMeta
|
||||
|
||||
// bindAddress is the IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)
|
||||
BindAddress string `json:"bindAddress"`
|
||||
// cleanupIPTables
|
||||
CleanupIPTables bool `json:"cleanupIPTables"`
|
||||
// healthzBindAddress is the IP address for the health check server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)
|
||||
HealthzBindAddress string `json:"healthzBindAddress"`
|
||||
// healthzPort is the port to bind the health check server. Use 0 to disable.
|
||||
HealthzPort int `json:"healthzPort"`
|
||||
// hostnameOverride, if non-empty, will be used as the identity instead of the actual hostname.
|
||||
HostnameOverride string `json:"hostnameOverride"`
|
||||
// iptablesSyncPeriodSeconds is the period that iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.
|
||||
IPTablesSyncePeriodSeconds int `json:"iptablesSyncPeriodSeconds"`
|
||||
// kubeAPIBurst is the burst to use while talking with kubernetes apiserver
|
||||
KubeAPIBurst int `json:"kubeAPIBurst"`
|
||||
// kubeAPIQPS is the max QPS to use while talking with kubernetes apiserver
|
||||
KubeAPIQPS int `json:"kubeAPIQPS"`
|
||||
// kubeconfigPath is the path to the kubeconfig file with authorization information (the master location is set by the master flag).
|
||||
KubeconfigPath string `json:"kubeconfigPath"`
|
||||
// masqueradeAll tells kube-proxy to SNAT everything if using the pure iptables proxy mode.
|
||||
MasqueradeAll bool `json:"masqueradeAll"`
|
||||
// master is the address of the Kubernetes API server (overrides any value in kubeconfig)
|
||||
Master string `json:"master"`
|
||||
// oomScoreAdj is the oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]
|
||||
OOMScoreAdj *int `json:"oomScoreAdj"`
|
||||
// mode specifies which proxy mode to use.
|
||||
Mode ProxyMode `json:"mode"`
|
||||
// portRange is the range of host ports (beginPort-endPort, inclusive) that may be consumed in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen.
|
||||
PortRange string `json:"portRange"`
|
||||
// resourceContainer is the bsolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).
|
||||
ResourceContainer string `json:"resourceContainer"`
|
||||
// udpTimeoutMilliseconds is how long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxyMode=userspace.
|
||||
UDPTimeoutMilliseconds int `json:"udpTimeoutMilliseconds"`
|
||||
}
|
||||
|
||||
// Currently two modes of proxying are available: 'userspace' (older, stable) or 'iptables' (experimental). If blank, look at the Node object on the Kubernetes API and respect the 'net.experimental.kubernetes.io/proxy-mode' annotation if provided. Otherwise use the best-available proxy (currently userspace, but may change in future versions). If the iptables proxy is selected, regardless of how, but the system's kernel or iptables versions are insufficient, this always falls back to the userspace proxy.
|
||||
type ProxyMode string
|
||||
|
||||
const (
|
||||
ProxyModeUserspace ProxyMode = "userspace"
|
||||
ProxyModeIPTables ProxyMode = "iptables"
|
||||
)
|
Loading…
Reference in New Issue
Block a user