Make LogSeveritySys configurable for Canal Networking

This commit is contained in:
Kashif Saadat 2018-04-26 15:47:29 +01:00
parent a8172fd292
commit 0057405d3b
10 changed files with 54 additions and 34 deletions

View File

@ -87,22 +87,25 @@ type CalicoNetworkingSpec struct {
// CanalNetworkingSpec declares that we want Canal networking // CanalNetworkingSpec declares that we want Canal networking
type CanalNetworkingSpec struct { type CanalNetworkingSpec struct {
// DefaultEndpointToHostAction allows users to configure the default behaviour
// for traffic between pod to host after calico rules have been processed.
// Default: ACCEPT (other options: DROP, RETURN)
DefaultEndpointToHostAction string `json:"defaultEndpointToHostAction,omitempty"`
// ChainInsertMode controls whether Felix inserts rules to the top of iptables chains, or // ChainInsertMode controls whether Felix inserts rules to the top of iptables chains, or
// 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"`
// DefaultEndpointToHostAction allows users to configure the default behaviour
// for traffic between pod to host after calico rules have been processed.
// Default: ACCEPT (other options: DROP, RETURN)
DefaultEndpointToHostAction string `json:"defaultEndpointToHostAction,omitempty"`
// LogSeveritySys the severity to set for logs which are sent to syslog
// Default: INFO (other options: DEBUG, WARNING, ERROR, CRITICAL, NONE)
LogSeveritySys string `json:"logSeveritySys,omitempty"`
// PrometheusGoMetricsEnabled enables Prometheus Go runtime metrics collection
PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"`
// PrometheusMetricsEnabled can be set to enable the experimental Prometheus // PrometheusMetricsEnabled can be set to enable the experimental Prometheus
// metrics server (default: false) // metrics server (default: false)
PrometheusMetricsEnabled bool `json:"prometheusMetricsEnabled,omitempty"` PrometheusMetricsEnabled bool `json:"prometheusMetricsEnabled,omitempty"`
// PrometheusMetricsPort is the TCP port that the experimental Prometheus // PrometheusMetricsPort is the TCP port that the experimental Prometheus
// metrics server should bind to (default: 9091) // metrics server should bind to (default: 9091)
PrometheusMetricsPort int32 `json:"prometheusMetricsPort,omitempty"` PrometheusMetricsPort int32 `json:"prometheusMetricsPort,omitempty"`
// PrometheusGoMetricsEnabled enables Prometheus Go runtime metrics collection
PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"`
// PrometheusProcessMetricsEnabled enables Prometheus process metrics collection // PrometheusProcessMetricsEnabled enables Prometheus process metrics collection
PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"` PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"`
} }

View File

@ -87,22 +87,25 @@ type CalicoNetworkingSpec struct {
// CanalNetworkingSpec declares that we want Canal networking // CanalNetworkingSpec declares that we want Canal networking
type CanalNetworkingSpec struct { type CanalNetworkingSpec struct {
// DefaultEndpointToHostAction allows users to configure the default behaviour
// for traffic between pod to host after calico rules have been processed.
// Default: ACCEPT (other options: DROP, RETURN)
DefaultEndpointToHostAction string `json:"defaultEndpointToHostAction,omitempty"`
// ChainInsertMode controls whether Felix inserts rules to the top of iptables chains, or // ChainInsertMode controls whether Felix inserts rules to the top of iptables chains, or
// 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"`
// DefaultEndpointToHostAction allows users to configure the default behaviour
// for traffic between pod to host after calico rules have been processed.
// Default: ACCEPT (other options: DROP, RETURN)
DefaultEndpointToHostAction string `json:"defaultEndpointToHostAction,omitempty"`
// LogSeveritySys the severity to set for logs which are sent to syslog
// Default: INFO (other options: DEBUG, WARNING, ERROR, CRITICAL, NONE)
LogSeveritySys string `json:"logSeveritySys,omitempty"`
// PrometheusGoMetricsEnabled enables Prometheus Go runtime metrics collection
PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"`
// PrometheusMetricsEnabled can be set to enable the experimental Prometheus // PrometheusMetricsEnabled can be set to enable the experimental Prometheus
// metrics server (default: false) // metrics server (default: false)
PrometheusMetricsEnabled bool `json:"prometheusMetricsEnabled,omitempty"` PrometheusMetricsEnabled bool `json:"prometheusMetricsEnabled,omitempty"`
// PrometheusMetricsPort is the TCP port that the experimental Prometheus // PrometheusMetricsPort is the TCP port that the experimental Prometheus
// metrics server should bind to (default: 9091) // metrics server should bind to (default: 9091)
PrometheusMetricsPort int32 `json:"prometheusMetricsPort,omitempty"` PrometheusMetricsPort int32 `json:"prometheusMetricsPort,omitempty"`
// PrometheusGoMetricsEnabled enables Prometheus Go runtime metrics collection
PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"`
// PrometheusProcessMetricsEnabled enables Prometheus process metrics collection // PrometheusProcessMetricsEnabled enables Prometheus process metrics collection
PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"` PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"`
} }

View File

@ -423,11 +423,12 @@ func Convert_kops_CalicoNetworkingSpec_To_v1alpha1_CalicoNetworkingSpec(in *kops
} }
func autoConvert_v1alpha1_CanalNetworkingSpec_To_kops_CanalNetworkingSpec(in *CanalNetworkingSpec, out *kops.CanalNetworkingSpec, s conversion.Scope) error { func autoConvert_v1alpha1_CanalNetworkingSpec_To_kops_CanalNetworkingSpec(in *CanalNetworkingSpec, out *kops.CanalNetworkingSpec, s conversion.Scope) error {
out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.ChainInsertMode = in.ChainInsertMode out.ChainInsertMode = in.ChainInsertMode
out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.LogSeveritySys = in.LogSeveritySys
out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled
out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled
out.PrometheusMetricsPort = in.PrometheusMetricsPort out.PrometheusMetricsPort = in.PrometheusMetricsPort
out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled
out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled
return nil return nil
} }
@ -438,11 +439,12 @@ func Convert_v1alpha1_CanalNetworkingSpec_To_kops_CanalNetworkingSpec(in *CanalN
} }
func autoConvert_kops_CanalNetworkingSpec_To_v1alpha1_CanalNetworkingSpec(in *kops.CanalNetworkingSpec, out *CanalNetworkingSpec, s conversion.Scope) error { func autoConvert_kops_CanalNetworkingSpec_To_v1alpha1_CanalNetworkingSpec(in *kops.CanalNetworkingSpec, out *CanalNetworkingSpec, s conversion.Scope) error {
out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.ChainInsertMode = in.ChainInsertMode out.ChainInsertMode = in.ChainInsertMode
out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.LogSeveritySys = in.LogSeveritySys
out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled
out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled
out.PrometheusMetricsPort = in.PrometheusMetricsPort out.PrometheusMetricsPort = in.PrometheusMetricsPort
out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled
out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled
return nil return nil
} }

View File

@ -87,22 +87,25 @@ type CalicoNetworkingSpec struct {
// CanalNetworkingSpec declares that we want Canal networking // CanalNetworkingSpec declares that we want Canal networking
type CanalNetworkingSpec struct { type CanalNetworkingSpec struct {
// DefaultEndpointToHostAction allows users to configure the default behaviour
// for traffic between pod to host after calico rules have been processed.
// Default: ACCEPT (other options: DROP, RETURN)
DefaultEndpointToHostAction string `json:"defaultEndpointToHostAction,omitempty"`
// ChainInsertMode controls whether Felix inserts rules to the top of iptables chains, or // ChainInsertMode controls whether Felix inserts rules to the top of iptables chains, or
// 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"`
// DefaultEndpointToHostAction allows users to configure the default behaviour
// for traffic between pod to host after calico rules have been processed.
// Default: ACCEPT (other options: DROP, RETURN)
DefaultEndpointToHostAction string `json:"defaultEndpointToHostAction,omitempty"`
// LogSeveritySys the severity to set for logs which are sent to syslog
// Default: INFO (other options: DEBUG, WARNING, ERROR, CRITICAL, NONE)
LogSeveritySys string `json:"logSeveritySys,omitempty"`
// PrometheusGoMetricsEnabled enables Prometheus Go runtime metrics collection
PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"`
// PrometheusMetricsEnabled can be set to enable the experimental Prometheus // PrometheusMetricsEnabled can be set to enable the experimental Prometheus
// metrics server (default: false) // metrics server (default: false)
PrometheusMetricsEnabled bool `json:"prometheusMetricsEnabled,omitempty"` PrometheusMetricsEnabled bool `json:"prometheusMetricsEnabled,omitempty"`
// PrometheusMetricsPort is the TCP port that the experimental Prometheus // PrometheusMetricsPort is the TCP port that the experimental Prometheus
// metrics server should bind to (default: 9091) // metrics server should bind to (default: 9091)
PrometheusMetricsPort int32 `json:"prometheusMetricsPort,omitempty"` PrometheusMetricsPort int32 `json:"prometheusMetricsPort,omitempty"`
// PrometheusGoMetricsEnabled enables Prometheus Go runtime metrics collection
PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"`
// PrometheusProcessMetricsEnabled enables Prometheus process metrics collection // PrometheusProcessMetricsEnabled enables Prometheus process metrics collection
PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"` PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"`
} }

View File

@ -459,11 +459,12 @@ 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.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.ChainInsertMode = in.ChainInsertMode out.ChainInsertMode = in.ChainInsertMode
out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.LogSeveritySys = in.LogSeveritySys
out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled
out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled
out.PrometheusMetricsPort = in.PrometheusMetricsPort out.PrometheusMetricsPort = in.PrometheusMetricsPort
out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled
out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled
return nil return nil
} }
@ -474,11 +475,12 @@ 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.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.ChainInsertMode = in.ChainInsertMode out.ChainInsertMode = in.ChainInsertMode
out.DefaultEndpointToHostAction = in.DefaultEndpointToHostAction
out.LogSeveritySys = in.LogSeveritySys
out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled
out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled
out.PrometheusMetricsPort = in.PrometheusMetricsPort out.PrometheusMetricsPort = in.PrometheusMetricsPort
out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled
out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled
return nil return nil
} }

View File

@ -233,14 +233,21 @@ func ValidateCluster(c *kops.Cluster, strict bool) *field.Error {
switch action { switch action {
case "", "ACCEPT", "DROP", "RETURN": case "", "ACCEPT", "DROP", "RETURN":
default: default:
return field.Invalid(fieldSpec.Child("Networking", "Canal", "DefaultEndpointToHostAction"), action, fmt.Sprintf("Unsupported value: %s, supports ACCEPT, DROP or RETURN", action)) return field.Invalid(fieldSpec.Child("Networking", "Canal", "DefaultEndpointToHostAction"), action, fmt.Sprintf("Unsupported value: %s, supports 'ACCEPT', 'DROP' or 'RETURN'", action))
} }
chainInsertMode := c.Spec.Networking.Canal.ChainInsertMode chainInsertMode := c.Spec.Networking.Canal.ChainInsertMode
switch chainInsertMode { switch chainInsertMode {
case "", "insert", "append": case "", "insert", "append":
default: default:
return field.Invalid(fieldSpec.Child("Networking", "Canal", "ChainInsertMode"), action, fmt.Sprintf("Unsupported value: %s, supports 'insert' or 'append'", chainInsertMode)) return field.Invalid(fieldSpec.Child("Networking", "Canal", "ChainInsertMode"), chainInsertMode, fmt.Sprintf("Unsupported value: %s, supports 'insert' or 'append'", chainInsertMode))
}
logSeveritySys := c.Spec.Networking.Canal.LogSeveritySys
switch logSeveritySys {
case "", "INFO", "DEBUG", "WARNING", "ERROR", "CRITICAL", "NONE":
default:
return field.Invalid(fieldSpec.Child("Networking", "Canal", "LogSeveritySys"), logSeveritySys, fmt.Sprintf("Unsupported value: %s, supports 'INFO', 'DEBUG', 'WARNING', 'ERROR', 'CRITICAL' or 'NONE'", logSeveritySys))
} }
} }

View File

@ -92,7 +92,7 @@ spec:
value: "kubernetes" value: "kubernetes"
# Enable felix logging. # Enable felix logging.
- name: FELIX_LOGSEVERITYSYS - name: FELIX_LOGSEVERITYSYS
value: "info" value: "{{- or .Networking.Canal.LogSeveritySys "INFO" }}"
# Period, in seconds, at which felix re-applies all iptables state # Period, in seconds, at which felix re-applies all iptables state
- name: FELIX_IPTABLESREFRESHINTERVAL - name: FELIX_IPTABLESREFRESHINTERVAL
value: "60" value: "60"

View File

@ -113,7 +113,7 @@ spec:
value: "kubernetes" value: "kubernetes"
# Enable felix logging. # Enable felix logging.
- name: FELIX_LOGSEVERITYSYS - name: FELIX_LOGSEVERITYSYS
value: "info" value: "{{- or .Networking.Canal.LogSeveritySys "INFO" }}"
# Don't enable BGP. # Don't enable BGP.
- name: CALICO_NETWORKING_BACKEND - name: CALICO_NETWORKING_BACKEND
value: "none" value: "none"

View File

@ -84,7 +84,7 @@ spec:
value: "kubernetes" value: "kubernetes"
# Enable felix logging. # Enable felix logging.
- name: FELIX_LOGSEVERITYSYS - name: FELIX_LOGSEVERITYSYS
value: "info" value: "{{- or .Networking.Canal.LogSeveritySys "INFO" }}"
# Period, in seconds, at which felix re-applies all iptables state # Period, in seconds, at which felix re-applies all iptables state
- name: FELIX_IPTABLESREFRESHINTERVAL - name: FELIX_IPTABLESREFRESHINTERVAL
value: "60" value: "60"

View File

@ -564,9 +564,9 @@ func (b *BootstrapChannelBuilder) buildManifest() (*channelsapi.Addons, map[stri
key := "networking.projectcalico.org.canal" key := "networking.projectcalico.org.canal"
// 2.6.3-kops.1 = 2.6.2 with kops manifest tweaks. This should go away with the next version bump. // 2.6.3-kops.1 = 2.6.2 with kops manifest tweaks. This should go away with the next version bump.
versions := map[string]string{ versions := map[string]string{
"pre-k8s-1.6": "2.4.2-kops.1", "pre-k8s-1.6": "2.4.2-kops.2",
"k8s-1.6": "2.4.2-kops.1", "k8s-1.6": "2.4.2-kops.2",
"k8s-1.8": "2.6.7-kops.1", "k8s-1.8": "2.6.7-kops.2",
} }
{ {