@@ -44,6 +44,7 @@ public static function setTempFolder(string $tempFolder)
44
44
*/
45
45
public static function fromKubeConfigVariable (string $ context = null )
46
46
{
47
+ /** @var \RenokiCo\PhpK8s\KubernetesCluster $this */
47
48
$ cluster = new static ;
48
49
49
50
if (! isset ($ _SERVER ['KUBECONFIG ' ])) {
@@ -81,6 +82,7 @@ public static function fromKubeConfigVariable(string $context = null)
81
82
*/
82
83
public static function fromKubeConfigYaml (string $ yaml , string $ context = null )
83
84
{
85
+ /** @var \RenokiCo\PhpK8s\KubernetesCluster $this */
84
86
$ cluster = new static ;
85
87
86
88
return $ cluster ->loadKubeConfigFromArray (yaml_parse ($ yaml ), $ context );
@@ -126,6 +128,8 @@ public static function fromKubeConfigArray(array $kubeConfigArray, string $conte
126
128
*/
127
129
protected function loadKubeConfigFromArray (array $ kubeconfig , string $ context = null )
128
130
{
131
+ /** @var \RenokiCo\PhpK8s\KubernetesCluster $this */
132
+
129
133
// Compute the context from the method, or in case it is passed as null
130
134
// try to find it from the current kubeconfig's "current-context" field.
131
135
$ context = $ context ?: ($ kubeconfig ['current-context ' ] ?? null );
@@ -186,6 +190,10 @@ protected function loadKubeConfigFromArray(array $kubeconfig, string $context =
186
190
$ this ->withToken ($ userConfig ['user ' ]['token ' ]);
187
191
}
188
192
193
+ if (isset ($ clusterConfig ['cluster ' ]['insecure-skip-tls-verify ' ]) && $ clusterConfig ['cluster ' ]['insecure-skip-tls-verify ' ]) {
194
+ $ this ->withoutSslChecks ();
195
+ }
196
+
189
197
return $ this ;
190
198
}
191
199
@@ -202,6 +210,7 @@ protected function loadKubeConfigFromArray(array $kubeconfig, string $context =
202
210
*/
203
211
protected function writeTempFileForContext (string $ context , string $ fileName , string $ contents )
204
212
{
213
+ /** @var \RenokiCo\PhpK8s\KubernetesCluster $this */
205
214
$ tempFolder = static ::$ tempFolder ?: sys_get_temp_dir ();
206
215
207
216
$ tempFilePath = $ tempFolder .DIRECTORY_SEPARATOR ."ctx- {$ context }- {$ fileName }" ;
@@ -226,6 +235,7 @@ protected function writeTempFileForContext(string $context, string $fileName, st
226
235
*/
227
236
protected static function mergeKubeconfigContents (array $ kubeconfig1 , array $ kubeconfig2 ): array
228
237
{
238
+ /** @var \RenokiCo\PhpK8s\KubernetesCluster $this */
229
239
$ kubeconfig1 += $ kubeconfig2 ;
230
240
231
241
foreach ($ kubeconfig1 as $ key => $ value ) {
0 commit comments