fix(ksonnet): don't depend on specific k8s version (#2525)

* fix(ksonnet): don't depend on specific k8s version

* docs(tanka): remove k8s-alpha refs

* fix(ksonnet): backwards compatibility with ksonnet
pull/2527/head
Jeroen Op 't Eynde 5 years ago committed by GitHub
parent 6b6b33f9eb
commit b29bc19d7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      docs/sources/installation/tanka.md
  2. 7
      production/ksonnet/loki-canary/loki-canary.libsonnet
  3. 9
      production/ksonnet/loki/jsonnetfile.json
  4. 10
      production/ksonnet/loki/jsonnetfile.lock.json
  5. 5
      production/ksonnet/promtail/promtail.libsonnet

@ -30,18 +30,11 @@ Download and install the Loki and Promtail module using `jb`:
```bash
go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
jb init
jb init # not required if you already ran `tk init`
jb install github.com/grafana/loki/production/ksonnet/loki
jb install github.com/grafana/loki/production/ksonnet/promtail
```
Note: As of 2020-08-13 we use some as of yet non GA features, please override the `lib/k.libsonnet` with the following. This step will likely not be necessary in future tanka releases.
```jsonnet
(import 'github.com/jsonnet-libs/k8s-alpha/1.14/main.libsonnet')
+ (import 'github.com/jsonnet-libs/k8s-alpha/1.14/extensions/kausal-shim.libsonnet')
```
Be sure to replace the username, password and the relevant `htpasswd` contents.
Making sure to set the value for username, password, and `htpasswd` properly,
replace the contents of `environments/loki/main.jsonnet` with:
@ -89,4 +82,5 @@ loki + promtail + gateway {
Notice that `container_root_path` is your own data root for the Docker Daemon.
Run `docker info | grep "Root Dir"` to get the root path.
Run `tk show environments/loki` to see the manifests that will be deployed to the cluster. Run `tk apply environments/loki` to deploy the manifests.
Run `tk show environments/loki` to see the manifests that will be deployed to
the cluster. Run `tk apply environments/loki` to deploy the manifests.

@ -1,6 +1,9 @@
local config = import 'config.libsonnet';
local k = import 'ksonnet-util/kausal.libsonnet';
// backwards compatibility with ksonnet
local envVar = if std.objectHasAll(k.core.v1, 'envVar') then k.core.v1.envVar else k.core.v1.container.envType;
k + config {
namespace: $.core.v1.namespace.new($._config.namespace),
@ -16,8 +19,8 @@ k + config {
container.withPorts($.core.v1.containerPort.new(name='http-metrics', port=80)) +
container.withArgsMixin($.util.mapToFlags($.loki_canary_args)) +
container.withEnv([
$.core.v1.envVar.fromFieldPath('HOSTNAME', 'spec.nodeName'),
$.core.v1.envVar.fromFieldPath('POD_NAME', 'metadata.name'),
envVar.fromFieldPath('HOSTNAME', 'spec.nodeName'),
envVar.fromFieldPath('POD_NAME', 'metadata.name'),
]),
local daemonSet = $.apps.v1.daemonSet,

@ -36,15 +36,6 @@
}
},
"version": "master"
},
{
"source": {
"git": {
"remote": "https://github.com/jsonnet-libs/k8s-alpha.git",
"subdir": "1.14"
}
},
"version": "master"
}
],
"legacyImports": true

@ -40,16 +40,6 @@
},
"version": "8629e32d04a0eefdce41224540f0d31de7d40deb",
"sum": "AIspZ151p0qkxVc9tuoAEYNrkazV6QncWWsIsarK9GE="
},
{
"source": {
"git": {
"remote": "https://github.com/jsonnet-libs/k8s-alpha.git",
"subdir": "1.14"
}
},
"version": "4423ca26d1762943b9975fd4f5cc229e814fe8b6",
"sum": "00qOXX9Ddf0r2AR3NX7d9A/9MFaAesdGxCs6sXUobok="
}
],
"legacyImports": false

@ -2,6 +2,9 @@ local scrape_config = import './scrape_config.libsonnet';
local config = import 'config.libsonnet';
local k = import 'ksonnet-util/kausal.libsonnet';
// backwards compatibility with ksonnet
local envVar = if std.objectHasAll(k.core.v1, 'envVar') then k.core.v1.envVar else k.core.v1.container.envType;
k + config + scrape_config {
namespace:
$.core.v1.namespace.new($._config.namespace),
@ -49,7 +52,7 @@ k + config + scrape_config {
container.withPorts($.core.v1.containerPort.new(name='http-metrics', port=80)) +
container.withArgsMixin($.util.mapToFlags($.promtail_args)) +
container.withEnv([
$.core.v1.envVar.fromFieldPath('HOSTNAME', 'spec.nodeName'),
envVar.fromFieldPath('HOSTNAME', 'spec.nodeName'),
]) +
container.mixin.readinessProbe.httpGet.withPath('/ready') +
container.mixin.readinessProbe.httpGet.withPort(80) +

Loading…
Cancel
Save