Skip to content

Commit

Permalink
feat(inCluster): set serviceaccount root for inCluster (#383)
Browse files Browse the repository at this point in the history
Closes #382
  • Loading branch information
Oleg Sucharevich authored and silasbw committed Dec 29, 2018
1 parent 4b61fa4 commit 623453d
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 623453d

Please sign in to comment.