Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing relative root when running inCluster #383

Merged
merged 5 commits into from
Dec 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ const path = require('path')
const yaml = require('js-yaml')
const merge = require('deepmerge')

const caPath = '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'
const tokenPath = '/var/run/secrets/kubernetes.io/serviceaccount/token'
const namespacePath = '/var/run/secrets/kubernetes.io/serviceaccount/namespace'
const root = process.env.KUBERNETES_CLIENT_SERVICEACCOUNT_ROOT || '/var/run/secrets/kubernetes.io/serviceaccount/'
const caPath = path.join(root, 'ca.crt')
const tokenPath = path.join(root, 'token')
const namespacePath = path.join(root, 'namespace')

function defaultConfigPaths () {
if (process.env.KUBECONFIG) {
Expand All @@ -32,7 +33,6 @@ function defaultConfigPaths () {
function getInCluster () {
const host = process.env.KUBERNETES_SERVICE_HOST
const port = process.env.KUBERNETES_SERVICE_PORT

if (!host || !port) {
throw new TypeError(
'Unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST' +
Expand Down