Make CPU Requests for Calico configurable instead of hard-coded

Update bindata.go

Apply suggestions from code review

Applying suggested changes.

Co-Authored-By: Ciprian Hacman <ciprianhacman@gmail.com>

Applying changes after running `make gofmt`

Applying changes after running `make crds`

Apply suggestions from code review

Applying suggested changes.

Co-Authored-By: Ciprian Hacman <ciprianhacman@gmail.com>

Applying changes after running `make gofmt`

Fixing broken things

Typo fixes

Apply suggestions from code review

Co-Authored-By: Ciprian Hacman <ciprianhacman@gmail.com>

Apply suggested changes and run necessary `make` steps
This commit is contained in:
mosheshitrit 2020-04-26 01:17:47 -04:00
parent b0ed737899
commit 9fffc5f8e0
13 changed files with 69 additions and 17 deletions

View File

@ -2601,7 +2601,17 @@ spec:
description: CalicoNetworkingSpec declares that we want Calico description: CalicoNetworkingSpec declares that we want Calico
networking networking
properties: properties:
cpuRequest:
anyOf:
- type: integer
- type: string
description: 'CPURequest CPU request of Calico container.
Default: 100m'
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
crossSubnet: crossSubnet:
description: CrossSubnet enables Calico's cross-subnet mode
when set to true
type: boolean type: boolean
ipipMode: ipipMode:
description: IPIPMode is mode for CALICO_IPV4POOL_IPIP description: IPIPMode is mode for CALICO_IPV4POOL_IPIP
@ -2666,6 +2676,14 @@ spec:
breaking connectivity. Default: ''insert'' (other options: breaking connectivity. Default: ''insert'' (other options:
''append'')' ''append'')'
type: string type: string
cpuRequest:
anyOf:
- type: integer
- type: string
description: 'CPURequest CPU request of Canal container. Default:
100m'
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
defaultEndpointToHostAction: defaultEndpointToHostAction:
description: 'DefaultEndpointToHostAction allows users to description: 'DefaultEndpointToHostAction allows users to
configure the default behaviour for traffic between pod configure the default behaviour for traffic between pod

View File

@ -100,7 +100,10 @@ type FlannelNetworkingSpec struct {
// CalicoNetworkingSpec declares that we want Calico networking // CalicoNetworkingSpec declares that we want Calico networking
type CalicoNetworkingSpec struct { type CalicoNetworkingSpec struct {
CrossSubnet bool `json:"crossSubnet,omitempty"` // Enables Calico's cross-subnet mode when set to true // CPURequest CPU request of Calico container. Default: 100m
CPURequest *resource.Quantity `json:"cpuRequest,omitempty"`
// CrossSubnet enables Calico's cross-subnet mode when set to true
CrossSubnet bool `json:"crossSubnet,omitempty"`
// LogSeverityScreen lets us set the desired log level. (Default: info) // LogSeverityScreen lets us set the desired log level. (Default: info)
LogSeverityScreen string `json:"logSeverityScreen,omitempty"` LogSeverityScreen string `json:"logSeverityScreen,omitempty"`
// MTU to be set in the cni-network-config for calico. // MTU to be set in the cni-network-config for calico.
@ -138,6 +141,8 @@ type CanalNetworkingSpec struct {
// appends to the bottom. Leaving the default option is safest to prevent accidentally // appends to the bottom. Leaving the default option is safest to prevent accidentally
// breaking connectivity. Default: 'insert' (other options: 'append') // breaking connectivity. Default: 'insert' (other options: 'append')
ChainInsertMode string `json:"chainInsertMode,omitempty"` ChainInsertMode string `json:"chainInsertMode,omitempty"`
// CPURequest CPU request of Canal container. Default: 100m
CPURequest *resource.Quantity `json:"cpuRequest,omitempty"`
// DefaultEndpointToHostAction allows users to configure the default behaviour // DefaultEndpointToHostAction allows users to configure the default behaviour
// for traffic between pod to host after calico rules have been processed. // for traffic between pod to host after calico rules have been processed.
// Default: ACCEPT (other options: DROP, RETURN) // Default: ACCEPT (other options: DROP, RETURN)

View File

@ -100,7 +100,10 @@ type FlannelNetworkingSpec struct {
// CalicoNetworkingSpec declares that we want Calico networking // CalicoNetworkingSpec declares that we want Calico networking
type CalicoNetworkingSpec struct { type CalicoNetworkingSpec struct {
CrossSubnet bool `json:"crossSubnet,omitempty"` // Enables Calico's cross-subnet mode when set to true // CPURequest CPU request of Calico container. Default: 100m
CPURequest *resource.Quantity `json:"cpuRequest,omitempty"`
// CrossSubnet enables Calico's cross-subnet mode when set to true
CrossSubnet bool `json:"crossSubnet,omitempty"`
// LogSeverityScreen lets us set the desired log level. (Default: info) // LogSeverityScreen lets us set the desired log level. (Default: info)
LogSeverityScreen string `json:"logSeverityScreen,omitempty"` LogSeverityScreen string `json:"logSeverityScreen,omitempty"`
// MTU to be set in the cni-network-config for calico. // MTU to be set in the cni-network-config for calico.
@ -138,6 +141,8 @@ type CanalNetworkingSpec struct {
// appends to the bottom. Leaving the default option is safest to prevent accidentally // appends to the bottom. Leaving the default option is safest to prevent accidentally
// breaking connectivity. Default: 'insert' (other options: 'append') // breaking connectivity. Default: 'insert' (other options: 'append')
ChainInsertMode string `json:"chainInsertMode,omitempty"` ChainInsertMode string `json:"chainInsertMode,omitempty"`
// CPURequest CPU request of Canal container. Default: 100m
CPURequest *resource.Quantity `json:"cpuRequest,omitempty"`
// DefaultEndpointToHostAction allows users to configure the default behaviour // DefaultEndpointToHostAction allows users to configure the default behaviour
// for traffic between pod to host after calico rules have been processed. // for traffic between pod to host after calico rules have been processed.
// Default: ACCEPT (other options: DROP, RETURN) // Default: ACCEPT (other options: DROP, RETURN)

View File

@ -1281,6 +1281,7 @@ func Convert_kops_CNINetworkingSpec_To_v1alpha2_CNINetworkingSpec(in *kops.CNINe
} }
func autoConvert_v1alpha2_CalicoNetworkingSpec_To_kops_CalicoNetworkingSpec(in *CalicoNetworkingSpec, out *kops.CalicoNetworkingSpec, s conversion.Scope) error { func autoConvert_v1alpha2_CalicoNetworkingSpec_To_kops_CalicoNetworkingSpec(in *CalicoNetworkingSpec, out *kops.CalicoNetworkingSpec, s conversion.Scope) error {
out.CPURequest = in.CPURequest
out.CrossSubnet = in.CrossSubnet out.CrossSubnet = in.CrossSubnet
out.LogSeverityScreen = in.LogSeverityScreen out.LogSeverityScreen = in.LogSeverityScreen
out.MTU = in.MTU out.MTU = in.MTU
@ -1303,6 +1304,7 @@ func Convert_v1alpha2_CalicoNetworkingSpec_To_kops_CalicoNetworkingSpec(in *Cali
} }
func autoConvert_kops_CalicoNetworkingSpec_To_v1alpha2_CalicoNetworkingSpec(in *kops.CalicoNetworkingSpec, out *CalicoNetworkingSpec, s conversion.Scope) error { func autoConvert_kops_CalicoNetworkingSpec_To_v1alpha2_CalicoNetworkingSpec(in *kops.CalicoNetworkingSpec, out *CalicoNetworkingSpec, s conversion.Scope) error {
out.CPURequest = in.CPURequest
out.CrossSubnet = in.CrossSubnet out.CrossSubnet = in.CrossSubnet
out.LogSeverityScreen = in.LogSeverityScreen out.LogSeverityScreen = in.LogSeverityScreen
out.MTU = in.MTU out.MTU = in.MTU
@ -1326,6 +1328,7 @@ func Convert_kops_CalicoNetworkingSpec_To_v1alpha2_CalicoNetworkingSpec(in *kops
func autoConvert_v1alpha2_CanalNetworkingSpec_To_kops_CanalNetworkingSpec(in *CanalNetworkingSpec, out *kops.CanalNetworkingSpec, s conversion.Scope) error { func autoConvert_v1alpha2_CanalNetworkingSpec_To_kops_CanalNetworkingSpec(in *CanalNetworkingSpec, out *kops.CanalNetworkingSpec, s conversion.Scope) error {
out.ChainInsertMode = in.ChainInsertMode out.ChainInsertMode = in.ChainInsertMode
out.CPURequest = in.CPURequest
out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.DisableFlannelForwardRules = in.DisableFlannelForwardRules out.DisableFlannelForwardRules = in.DisableFlannelForwardRules
out.IptablesBackend = in.IptablesBackend out.IptablesBackend = in.IptablesBackend
@ -1348,6 +1351,7 @@ func Convert_v1alpha2_CanalNetworkingSpec_To_kops_CanalNetworkingSpec(in *CanalN
func autoConvert_kops_CanalNetworkingSpec_To_v1alpha2_CanalNetworkingSpec(in *kops.CanalNetworkingSpec, out *CanalNetworkingSpec, s conversion.Scope) error { func autoConvert_kops_CanalNetworkingSpec_To_v1alpha2_CanalNetworkingSpec(in *kops.CanalNetworkingSpec, out *CanalNetworkingSpec, s conversion.Scope) error {
out.ChainInsertMode = in.ChainInsertMode out.ChainInsertMode = in.ChainInsertMode
out.CPURequest = in.CPURequest
out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.DisableFlannelForwardRules = in.DisableFlannelForwardRules out.DisableFlannelForwardRules = in.DisableFlannelForwardRules
out.IptablesBackend = in.IptablesBackend out.IptablesBackend = in.IptablesBackend

View File

@ -290,6 +290,11 @@ func (in *CNINetworkingSpec) DeepCopy() *CNINetworkingSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CalicoNetworkingSpec) DeepCopyInto(out *CalicoNetworkingSpec) { func (in *CalicoNetworkingSpec) DeepCopyInto(out *CalicoNetworkingSpec) {
*out = *in *out = *in
if in.CPURequest != nil {
in, out := &in.CPURequest, &out.CPURequest
x := (*in).DeepCopy()
*out = &x
}
if in.MTU != nil { if in.MTU != nil {
in, out := &in.MTU, &out.MTU in, out := &in.MTU, &out.MTU
*out = new(int32) *out = new(int32)
@ -311,6 +316,11 @@ func (in *CalicoNetworkingSpec) DeepCopy() *CalicoNetworkingSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CanalNetworkingSpec) DeepCopyInto(out *CanalNetworkingSpec) { func (in *CanalNetworkingSpec) DeepCopyInto(out *CanalNetworkingSpec) {
*out = *in *out = *in
if in.CPURequest != nil {
in, out := &in.CPURequest, &out.CPURequest
x := (*in).DeepCopy()
*out = &x
}
if in.MTU != nil { if in.MTU != nil {
in, out := &in.MTU, &out.MTU in, out := &in.MTU, &out.MTU
*out = new(int32) *out = new(int32)

View File

@ -306,6 +306,11 @@ func (in *CNINetworkingSpec) DeepCopy() *CNINetworkingSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CalicoNetworkingSpec) DeepCopyInto(out *CalicoNetworkingSpec) { func (in *CalicoNetworkingSpec) DeepCopyInto(out *CalicoNetworkingSpec) {
*out = *in *out = *in
if in.CPURequest != nil {
in, out := &in.CPURequest, &out.CPURequest
x := (*in).DeepCopy()
*out = &x
}
if in.MTU != nil { if in.MTU != nil {
in, out := &in.MTU, &out.MTU in, out := &in.MTU, &out.MTU
*out = new(int32) *out = new(int32)
@ -327,6 +332,11 @@ func (in *CalicoNetworkingSpec) DeepCopy() *CalicoNetworkingSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CanalNetworkingSpec) DeepCopyInto(out *CanalNetworkingSpec) { func (in *CanalNetworkingSpec) DeepCopyInto(out *CanalNetworkingSpec) {
*out = *in *out = *in
if in.CPURequest != nil {
in, out := &in.CPURequest, &out.CPURequest
x := (*in).DeepCopy()
*out = &x
}
if in.MTU != nil { if in.MTU != nil {
in, out := &in.MTU, &out.MTU in, out := &in.MTU, &out.MTU
*out = new(int32) *out = new(int32)

View File

@ -7639,7 +7639,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 90m cpu: {{ or .Networking.Calico.CPURequest "100m" }}
livenessProbe: livenessProbe:
exec: exec:
command: command:
@ -8754,7 +8754,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 90m cpu: {{ or .Networking.Calico.CPURequest "100m" }}
livenessProbe: livenessProbe:
exec: exec:
command: command:
@ -10863,7 +10863,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 100m cpu: {{ or .Networking.Canal.CPURequest "100m" }}
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /liveness path: /liveness
@ -11776,7 +11776,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 250m cpu: {{ or .Networking.Canal.CPURequest "100m" }}
livenessProbe: livenessProbe:
exec: exec:
command: command:
@ -12693,7 +12693,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 90m cpu: {{ or .Networking.Canal.CPURequest "100m" }}
livenessProbe: livenessProbe:
exec: exec:
command: command:

View File

@ -509,7 +509,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 100m cpu: {{ or .Networking.Canal.CPURequest "100m" }}
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /liveness path: /liveness

View File

@ -797,7 +797,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 250m cpu: {{ or .Networking.Canal.CPURequest "100m" }}
livenessProbe: livenessProbe:
exec: exec:
command: command:

View File

@ -787,7 +787,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 90m cpu: {{ or .Networking.Canal.CPURequest "100m" }}
livenessProbe: livenessProbe:
exec: exec:
command: command:

View File

@ -838,7 +838,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 90m cpu: {{ or .Networking.Calico.CPURequest "100m" }}
livenessProbe: livenessProbe:
exec: exec:
command: command:

View File

@ -849,7 +849,7 @@ spec:
privileged: true privileged: true
resources: resources:
requests: requests:
cpu: 90m cpu: {{ or .Networking.Calico.CPURequest "100m" }}
livenessProbe: livenessProbe:
exec: exec:
command: command:

View File

@ -725,8 +725,8 @@ func (b *BootstrapChannelBuilder) buildAddons() *channelsapi.Addons {
versions := map[string]string{ versions := map[string]string{
"k8s-1.7": "2.6.12-kops.1", "k8s-1.7": "2.6.12-kops.1",
"k8s-1.7-v3": "3.8.0-kops.2", "k8s-1.7-v3": "3.8.0-kops.2",
"k8s-1.12": "3.9.5-kops.2", "k8s-1.12": "3.9.5-kops.3",
"k8s-1.16": "3.13.3-kops.1", "k8s-1.16": "3.13.3-kops.2",
} }
{ {
@ -792,9 +792,9 @@ func (b *BootstrapChannelBuilder) buildAddons() *channelsapi.Addons {
key := "networking.projectcalico.org.canal" key := "networking.projectcalico.org.canal"
versions := map[string]string{ versions := map[string]string{
"k8s-1.9": "3.2.3-kops.1", "k8s-1.9": "3.2.3-kops.1",
"k8s-1.12": "3.7.5-kops.1", "k8s-1.12": "3.7.5-kops.2",
"k8s-1.15": "3.12.1-kops.1", "k8s-1.15": "3.12.1-kops.2",
"k8s-1.16": "3.13.3-kops.1", "k8s-1.16": "3.13.3-kops.2",
} }
{ {
id := "k8s-1.9" id := "k8s-1.9"