Add basic helm client and tiller installation
diff --git a/helm/client.sls b/helm/client.sls
new file mode 100644
index 0000000..e77f8b7
--- /dev/null
+++ b/helm/client.sls
@@ -0,0 +1,48 @@
+{%- from "helm/map.jinja" import client with context %}
+{%- if client.enabled %}
+
+{%- set helm_tmp = "/tmp/helm-" + client.version %}
+{%- set helm_bin = "/usr/bin/helm-" + client.version %}
+
+{{ helm_tmp }}:
+ file.directory:
+ - user: root
+ - group: root
+ archive.extracted:
+ - source: {{ client.download_url }}
+ - source_hash: {{ client.download_hash }}
+ - archive_format: tar
+ - tar_options: v
+ - if_missing: {{ helm_tmp }}/linux-amd64/helm
+ - require:
+ - file: {{ helm_tmp }}
+
+{{ helm_bin }}:
+ file.managed:
+ - source: {{ helm_tmp }}/linux-amd64/helm
+ - mode: 555
+ - user: root
+ - group: root
+ - require:
+ - archive: {{ helm_tmp }}
+
+/usr/bin/helm:
+ file.symlink:
+ - target: helm-{{ client.version }}
+ - require:
+ - file: {{ helm_bin }}
+
+prepare_client:
+ cmd.run:
+ - name: helm init --client-only
+ - unless: test -d /root/.helm
+ - require:
+ - file: /usr/bin/helm
+
+install_tiller:
+ cmd.run:
+ - name: helm init --upgrade
+ - unless: "helm version --server --short | grep -E 'Server: v{{ client.version }}(\\+|$)'"
+ - require:
+ - cmd: prepare_client
+{%- endif %}
diff --git a/helm/init.sls b/helm/init.sls
new file mode 100644
index 0000000..28c9200
--- /dev/null
+++ b/helm/init.sls
@@ -0,0 +1,6 @@
+{%- if pillar.helm is defined %}
+include:
+{%- if pillar.helm.client is defined %}
+- helm.client
+{%- endif %}
+{%- endif %}
diff --git a/helm/map.jinja b/helm/map.jinja
new file mode 100644
index 0000000..5aa27e2
--- /dev/null
+++ b/helm/map.jinja
@@ -0,0 +1,29 @@
+
+{%- set source_engine = salt['pillar.get']('helm:client:source:engine') %}
+
+{%- load_yaml as base_defaults %}
+{%- if source_engine == 'git' %}
+Debian:
+ pkgs:
+ - python-psycopg2
+ dir:
+ base: /srv/helm/venv
+ home: /var/lib/helm
+ workspace: /srv/helm/workspace
+RedHat:
+ pkgs:
+ - python-psycopg2
+ dir:
+ base: /srv/helm/venv
+ home: /var/lib/helm
+ workspace: /srv/helm/workspace
+{%- else %}
+Debian:
+ pkgs:
+ - helm
+ dir:
+ base: /usr/lib/helm
+{%- endif %}
+{%- endload %}
+
+{%- set client = salt['grains.filter_by'](base_defaults, merge=salt['pillar.get']('helm:client')) %}
\ No newline at end of file
diff --git a/helm/meta/sensu.yml b/helm/meta/sensu.yml
new file mode 100644
index 0000000..8de9a94
--- /dev/null
+++ b/helm/meta/sensu.yml
@@ -0,0 +1,8 @@
+# Sample check
+check:
+ local_helm_proc:
+ command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_procs -C helm -u helm -c 1:1"
+ interval: 60
+ occurrences: 1
+ subscribers:
+ - local-helm-client
diff --git a/helm/meta/sphinx.yml b/helm/meta/sphinx.yml
new file mode 100644
index 0000000..a73339e
--- /dev/null
+++ b/helm/meta/sphinx.yml
@@ -0,0 +1,12 @@
+{%- from "helm/map.jinja" import client with context %}
+# Fill in documentation details
+doc:
+ name: helm
+ description: Some service info
+ role:
+ client:
+ name: client
+ param:
+ some_param:
+ name: "Some name"
+ value: "some value"
diff --git a/metadata/service/client.yml b/metadata/service/client.yml
new file mode 100644
index 0000000..b3eb2e0
--- /dev/null
+++ b/metadata/service/client.yml
@@ -0,0 +1,11 @@
+applications:
+- helm
+classes:
+- service.helm.support
+parameters:
+ helm:
+ client:
+ enabled: true
+ version: 2.4.2
+ download_url: https://storage.googleapis.com/kubernetes-helm/helm-v${helm:client:version}-linux-amd64.tar.gz
+ download_hash: sha256=96f74ff04ec7eb38e5f53aba73132bfe4d6b81168f20574dad25a9bcaceec81b
diff --git a/metadata/service/client/cluster.yml b/metadata/service/client/cluster.yml
deleted file mode 100644
index fce7fe0..0000000
--- a/metadata/service/client/cluster.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-applications:
-- helm
-classes:
-- service.helm.support
-parameters:
- helm:
- client:
- enabled: true
- bind:
- address: 0.0.0.0
diff --git a/metadata/service/client/single.yml b/metadata/service/client/single.yml
deleted file mode 100644
index fce7fe0..0000000
--- a/metadata/service/client/single.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-applications:
-- helm
-classes:
-- service.helm.support
-parameters:
- helm:
- client:
- enabled: true
- bind:
- address: 0.0.0.0