diff --git a/pkg/apis/kops/networking.go b/pkg/apis/kops/networking.go index 781b650626..fc079d5948 100644 --- a/pkg/apis/kops/networking.go +++ b/pkg/apis/kops/networking.go @@ -70,6 +70,16 @@ type FlannelNetworkingSpec struct { // CalicoNetworkingSpec declares that we want Calico networking type CalicoNetworkingSpec struct { CrossSubnet bool `json:"crossSubnet,omitempty"` // Enables Calico's cross-subnet mode when set to true + // PrometheusMetricsEnabled can be set to enable the experimental Prometheus + // metrics server (default: false) + PrometheusMetricsEnabled bool `json:"prometheusMetricsEnabled,omitempty"` + // PrometheusMetricsPort is the TCP port that the experimental Prometheus + // metrics server should bind to (default: 9091) + PrometheusMetricsPort int32 `json:"prometheusMetricsPort,omitempty"` + // PrometheusGoMetricsEnabled enables Prometheus Go runtime metrics collection + PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"` + // PrometheusProcessMetricsEnabled enables Prometheus process metrics collection + PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"` } // CanalNetworkingSpec declares that we want Canal networking diff --git a/pkg/apis/kops/v1alpha1/networking.go b/pkg/apis/kops/v1alpha1/networking.go index f66bc63029..07f32a7af7 100644 --- a/pkg/apis/kops/v1alpha1/networking.go +++ b/pkg/apis/kops/v1alpha1/networking.go @@ -70,6 +70,16 @@ type FlannelNetworkingSpec struct { // CalicoNetworkingSpec declares that we want Calico networking type CalicoNetworkingSpec struct { CrossSubnet bool `json:"crossSubnet,omitempty"` // Enables Calico's cross-subnet mode when set to true + // PrometheusMetricsEnabled can be set to enable the experimental Prometheus + // metrics server (default: false) + PrometheusMetricsEnabled bool `json:"prometheusMetricsEnabled,omitempty"` + // PrometheusMetricsPort is the TCP port that the experimental Prometheus + // metrics server should bind to (default: 9091) + PrometheusMetricsPort int32 `json:"prometheusMetricsPort,omitempty"` + // PrometheusGoMetricsEnabled enables Prometheus Go runtime metrics collection + PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"` + // PrometheusProcessMetricsEnabled enables Prometheus process metrics collection + PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"` } // CanalNetworkingSpec declares that we want Canal networking diff --git a/pkg/apis/kops/v1alpha1/zz_generated.conversion.go b/pkg/apis/kops/v1alpha1/zz_generated.conversion.go index 1eac0c00d0..15d0c0da76 100644 --- a/pkg/apis/kops/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/kops/v1alpha1/zz_generated.conversion.go @@ -380,6 +380,10 @@ func Convert_v1alpha1_CalicoNetworkingSpec_To_kops_CalicoNetworkingSpec(in *Cali func autoConvert_kops_CalicoNetworkingSpec_To_v1alpha1_CalicoNetworkingSpec(in *kops.CalicoNetworkingSpec, out *CalicoNetworkingSpec, s conversion.Scope) error { out.CrossSubnet = in.CrossSubnet + out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled + out.PrometheusMetricsPort = in.PrometheusMetricsPort + out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled + out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled return nil } diff --git a/pkg/apis/kops/v1alpha2/networking.go b/pkg/apis/kops/v1alpha2/networking.go index fc3f32be26..5d7341d05f 100644 --- a/pkg/apis/kops/v1alpha2/networking.go +++ b/pkg/apis/kops/v1alpha2/networking.go @@ -70,6 +70,16 @@ type FlannelNetworkingSpec struct { // CalicoNetworkingSpec declares that we want Calico networking type CalicoNetworkingSpec struct { CrossSubnet bool `json:"crossSubnet,omitempty"` // Enables Calico's cross-subnet mode when set to true + // PrometheusMetricsEnabled can be set to enable the experimental Prometheus + // metrics server (default: false) + PrometheusMetricsEnabled bool `json:"prometheusMetricsEnabled,omitempty"` + // PrometheusMetricsPort is the TCP port that the experimental Prometheus + // metrics server should bind to (default: 9091) + PrometheusMetricsPort int32 `json:"prometheusMetricsPort,omitempty"` + // PrometheusGoMetricsEnabled enables Prometheus Go runtime metrics collection + PrometheusGoMetricsEnabled bool `json:"prometheusGoMetricsEnabled,omitempty"` + // PrometheusProcessMetricsEnabled enables Prometheus process metrics collection + PrometheusProcessMetricsEnabled bool `json:"prometheusProcessMetricsEnabled,omitempty"` } // CanalNetworkingSpec declares that we want Canal networking diff --git a/pkg/apis/kops/v1alpha2/zz_generated.conversion.go b/pkg/apis/kops/v1alpha2/zz_generated.conversion.go index 6fd092225d..f2f5e0aa07 100644 --- a/pkg/apis/kops/v1alpha2/zz_generated.conversion.go +++ b/pkg/apis/kops/v1alpha2/zz_generated.conversion.go @@ -416,6 +416,10 @@ 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 { out.CrossSubnet = in.CrossSubnet + out.PrometheusMetricsEnabled = in.PrometheusMetricsEnabled + out.PrometheusMetricsPort = in.PrometheusMetricsPort + out.PrometheusGoMetricsEnabled = in.PrometheusGoMetricsEnabled + out.PrometheusProcessMetricsEnabled = in.PrometheusProcessMetricsEnabled return nil } diff --git a/upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.6.yaml.template b/upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.6.yaml.template index f1c9b30f79..c35689e7ae 100644 --- a/upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.6.yaml.template +++ b/upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.6.yaml.template @@ -182,6 +182,18 @@ spec: # Set Felix logging to "info" - name: FELIX_LOGSEVERITYSCREEN value: "info" + # Set to enable the experimental Prometheus metrics server + - name: FELIX_PROMETHEUSMETRICSENABLED + value: "{{- or .Networking.Calico.PrometheusMetricsEnabled "false" }}" + # TCP port that the Prometheus metrics server should bind to + - name: FELIX_PROMETHEUSMETRICSPORT + value: "{{- or .Networking.Calico.PrometheusMetricsPort "9091" }}" + # Enable Prometheus Go runtime metrics collection + - name: FELIX_PROMETHEUSGOMETRICSENABLED + value: "{{- or .Networking.Calico.PrometheusGoMetricsEnabled "true" }}" + # Enable Prometheus process metrics collection + - name: FELIX_PROMETHEUSPROCESSMETRICSENABLED + value: "{{- or .Networking.Calico.PrometheusProcessMetricsEnabled "true" }}" - name: FELIX_HEALTHENABLED value: "true" securityContext: diff --git a/upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.7.yaml.template b/upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.7.yaml.template index 9bccd75d72..8129935c94 100644 --- a/upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.7.yaml.template +++ b/upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.7.yaml.template @@ -193,6 +193,18 @@ spec: # Set Felix logging to "info" - name: FELIX_LOGSEVERITYSCREEN value: "info" + # Set to enable the experimental Prometheus metrics server + - name: FELIX_PROMETHEUSMETRICSENABLED + value: "{{- or .Networking.Calico.PrometheusMetricsEnabled "false" }}" + # TCP port that the Prometheus metrics server should bind to + - name: FELIX_PROMETHEUSMETRICSPORT + value: "{{- or .Networking.Calico.PrometheusMetricsPort "9091" }}" + # Enable Prometheus Go runtime metrics collection + - name: FELIX_PROMETHEUSGOMETRICSENABLED + value: "{{- or .Networking.Calico.PrometheusGoMetricsEnabled "true" }}" + # Enable Prometheus process metrics collection + - name: FELIX_PROMETHEUSPROCESSMETRICSENABLED + value: "{{- or .Networking.Calico.PrometheusProcessMetricsEnabled "true" }}" - name: FELIX_HEALTHENABLED value: "true" securityContext: diff --git a/upup/models/cloudup/resources/addons/networking.projectcalico.org/pre-k8s-1.6.yaml.template b/upup/models/cloudup/resources/addons/networking.projectcalico.org/pre-k8s-1.6.yaml.template index 56a4db810c..afff9eead1 100644 --- a/upup/models/cloudup/resources/addons/networking.projectcalico.org/pre-k8s-1.6.yaml.template +++ b/upup/models/cloudup/resources/addons/networking.projectcalico.org/pre-k8s-1.6.yaml.template @@ -100,6 +100,18 @@ spec: # Auto-detect the BGP IP address. - name: IP value: "" + # Set to enable the experimental Prometheus metrics server + - name: FELIX_PROMETHEUSMETRICSENABLED + value: "{{- or .Networking.Calico.PrometheusMetricsEnabled "false" }}" + # TCP port that the Prometheus metrics server should bind to + - name: FELIX_PROMETHEUSMETRICSPORT + value: "{{- or .Networking.Calico.PrometheusMetricsPort "9091" }}" + # Enable Prometheus Go runtime metrics collection + - name: FELIX_PROMETHEUSGOMETRICSENABLED + value: "{{- or .Networking.Calico.PrometheusGoMetricsEnabled "true" }}" + # Enable Prometheus process metrics collection + - name: FELIX_PROMETHEUSPROCESSMETRICSENABLED + value: "{{- or .Networking.Calico.PrometheusProcessMetricsEnabled "true" }}" securityContext: privileged: true volumeMounts: