Skip to content

Commit 9147d9a

Browse files
committed
Fixed host for in-cluster config
1 parent 043e664 commit 9147d9a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

config/k8s.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393

9494
'cluster' => [
9595
'driver' => 'cluster',
96+
'host' => env('KUBE_HOST', 'https://kubernetes.default.svc.cluster.local'),
9697
],
9798

9899
],

src/KubernetesCluster.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function loadFromConfig(array $config)
5353
case 'kubeconfig': $this->configureWithKubeConfigFile($config); break;
5454
case 'http': $this->configureWithHttpAuth($config); break;
5555
case 'token': $this->configureWithToken($config); break;
56-
case 'cluster': $this->configureInCluster(); break;
56+
case 'cluster': $this->configureInCluster($config); break;
5757
default: break;
5858
}
5959
}
@@ -135,10 +135,13 @@ protected function configureWithToken(array $config)
135135
/**
136136
* Load the In-Cluster configuration.
137137
*
138+
* @param array $config
138139
* @return void
139140
*/
140-
protected function configureInCluster()
141+
protected function configureInCluster(array $config)
141142
{
143+
$this->cluster = new PhpK8sCluster($config['host'] ?? 'https://kubernetes.default.svc.cluster.local');
144+
142145
$this->cluster->inClusterConfiguration();
143146
}
144147

0 commit comments

Comments
 (0)