Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #740 from JoshVanL/718-grafana-heapster-influxdb-t…
Browse files Browse the repository at this point in the history
…oggle

Add config toggle for heapster, influxdb, grafana
  • Loading branch information
jetstack-bot authored Feb 12, 2019
2 parents 6a24497 + 17186d3 commit 8b526d4
Show file tree
Hide file tree
Showing 13 changed files with 298 additions and 19 deletions.
128 changes: 127 additions & 1 deletion docs/generated/reference/output/api-docs.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/generated/reference/output/navData.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Golang
Grafana
gz
Hashicorp
heapster
heptio
hostname
iam
Expand Down
13 changes: 13 additions & 0 deletions docs/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,19 @@ Enabling Typha, along with setting the number of replicas is shown above.
Cluster Services
----------------

Deploying Grafana, InfluxDB and Heapster can be toggled in the Tarmak
configuration like follows:

.. code-block:: yaml
kubernetes:
grafana:
enabled: true
heapster:
enabled: false
influxDB:
enabled: true
Grafana
~~~~~~~

Expand Down
15 changes: 15 additions & 0 deletions pkg/apis/cluster/v1alpha1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ type ClusterKubernetes struct {
Dashboard *ClusterKubernetesDashboard `json:"dashboard,omitempty"`
PodSecurityPolicy *ClusterPodSecurityPolicy `json:"podSecurityPolicy,omitempty"`
Prometheus *ClusterKubernetesPrometheus `json:"prometheus,omitempty"`
Grafana *ClusterKubernetesGrafana `json:"grafana,omiempty"`
Heapster *ClusterKubernetesHeapster `json:"heapster,omiempty"`
InfluxDB *ClusterKubernetesInfluxDB `json:"influxDB,omiempty"`

APIServer *ClusterKubernetesAPIServer `json:"apiServer,omitempty"`
Kubelet *ClusterKubernetesKubelet `json:"kubelet,omitempty"`
Expand Down Expand Up @@ -214,6 +217,18 @@ type ClusterKubernetesPrometheus struct {
Mode string `json:"mode,omitempty"`
}

type ClusterKubernetesGrafana struct {
Enabled bool `json:"enabled,omitempty"`
}

type ClusterKubernetesHeapster struct {
Enabled bool `json:"enabled,omitempty"`
}

type ClusterKubernetesInfluxDB struct {
Enabled bool `json:"enabled,omitempty"`
}

type ClusterVaultHelper struct {
URL string `json:"url,omitempty"`
}
Expand Down
18 changes: 18 additions & 0 deletions pkg/apis/cluster/v1alpha1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,24 @@ func SetDefaults_Cluster(obj *Cluster) {
obj.Kubernetes.Calico.TyphaReplicas = intPointer(1)
}

if obj.Kubernetes.Heapster == nil {
obj.Kubernetes.Heapster = &ClusterKubernetesHeapster{
Enabled: true,
}
}

if obj.Kubernetes.Grafana == nil {
obj.Kubernetes.Grafana = &ClusterKubernetesGrafana{
Enabled: true,
}
}

if obj.Kubernetes.InfluxDB == nil {
obj.Kubernetes.InfluxDB = &ClusterKubernetesInfluxDB{
Enabled: true,
}
}

// EBS encryption off if Amazon interface used
// but EBSEncrypted not specified
if obj.Amazon == nil {
Expand Down
63 changes: 63 additions & 0 deletions pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions pkg/puppet/puppet.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,18 @@ func kubernetesClusterConfigPerRole(conf *clusterv1alpha1.ClusterKubernetes, rol
}
}

if g := conf.Grafana; g != nil {
hieraData.variables = append(hieraData.variables, fmt.Sprintf(`kubernetes_addons::grafana::enabled: %t`, conf.Grafana.Enabled))
}

if h := conf.Heapster; h != nil {
hieraData.variables = append(hieraData.variables, fmt.Sprintf(`kubernetes_addons::heapster::enabled: %t`, conf.Heapster.Enabled))
}

if i := conf.Heapster; i != nil {
hieraData.variables = append(hieraData.variables, fmt.Sprintf(`kubernetes_addons::influxdb::enabled: %t`, conf.InfluxDB.Enabled))
}

return
}

Expand Down
16 changes: 16 additions & 0 deletions pkg/tarmak/initialize/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,22 @@ creationLoop:
return nil, err
}

if clusterConf.Kubernetes == nil {
clusterConf.Kubernetes = new(clusterv1alpha1.ClusterKubernetes)
}

clusterConf.Kubernetes.Heapster = &clusterv1alpha1.ClusterKubernetesHeapster{
Enabled: false,
}

clusterConf.Kubernetes.Grafana = &clusterv1alpha1.ClusterKubernetesGrafana{
Enabled: false,
}

clusterConf.Kubernetes.InfluxDB = &clusterv1alpha1.ClusterKubernetesInfluxDB{
Enabled: false,
}

clusterObj, err = i.newCluster(clusterConf)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion puppet/hieradata/role/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ classes:
- tarmak::master
- tarmak::worker
- tarmak::overlay_calico
- kubernetes_addons::heapster
- kubernetes_addons::metrics_server
- kubernetes_addons::heapster
- kubernetes_addons::influxdb
- kubernetes_addons::grafana

Expand Down
15 changes: 10 additions & 5 deletions puppet/modules/kubernetes_addons/manifests/grafana.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
class kubernetes_addons::grafana(
$image=$::kubernetes_addons::params::grafana_image,
$version=$::kubernetes_addons::params::grafana_version,
$enabled = true,
) inherits ::kubernetes_addons::params {
require ::kubernetes

kubernetes::apply{'heapster-grafana':
manifests => [
template('kubernetes_addons/grafana-svc.yaml.erb'),
template('kubernetes_addons/grafana-deployment.yaml.erb'),
],
if $enabled {
kubernetes::apply{'heapster-grafana':
manifests => [
template('kubernetes_addons/grafana-svc.yaml.erb'),
template('kubernetes_addons/grafana-deployment.yaml.erb'),
],
}
} else {
kubernetes::delete{'heapster-grafana':}
}
}
17 changes: 11 additions & 6 deletions puppet/modules/kubernetes_addons/manifests/heapster.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
$nanny_request_mem=$::kubernetes_addons::params::heapster_nanny_request_mem,
$nanny_limit_cpu=$::kubernetes_addons::params::heapster_nanny_limit_cpu,
$nanny_limit_mem=$::kubernetes_addons::params::heapster_nanny_limit_mem,
$enabled = true,
$sink=undef,
) inherits ::kubernetes_addons::params {
require ::kubernetes
Expand Down Expand Up @@ -40,11 +41,15 @@
$version_before_1_9 = true
}

kubernetes::apply{'heapster':
manifests => [
template('kubernetes_addons/heapster-svc.yaml.erb'),
template('kubernetes_addons/heapster-deployment.yaml.erb'),
template('kubernetes_addons/heapster-rbac.yaml.erb'),
],
if $enabled {
kubernetes::apply{'heapster':
manifests => [
template('kubernetes_addons/heapster-svc.yaml.erb'),
template('kubernetes_addons/heapster-deployment.yaml.erb'),
template('kubernetes_addons/heapster-rbac.yaml.erb'),
],
}
} else {
kubernetes::delete{'heapster':}
}
}
15 changes: 10 additions & 5 deletions puppet/modules/kubernetes_addons/manifests/influxdb.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
class kubernetes_addons::influxdb(
$image=$::kubernetes_addons::params::influxdb_image,
$version=$::kubernetes_addons::params::influxdb_version,
$enabled = true,
) inherits ::kubernetes_addons::params {
require ::kubernetes

kubernetes::apply{'heapster-influxdb':
manifests => [
template('kubernetes_addons/influxdb-svc.yaml.erb'),
template('kubernetes_addons/influxdb-deployment.yaml.erb'),
],
if $enabled {
kubernetes::apply{'heapster-influxdb':
manifests => [
template('kubernetes_addons/influxdb-svc.yaml.erb'),
template('kubernetes_addons/influxdb-deployment.yaml.erb'),
],
}
} else {
kubernetes::delete{'heapster-influxdb':}
}
}

0 comments on commit 8b526d4

Please sign in to comment.