From 6748b8d4480a7254c50cee79f2f062e7700a7271 Mon Sep 17 00:00:00 2001 From: Martin Lau Date: Mon, 18 Sep 2023 15:45:59 +0800 Subject: [PATCH] Let the insecureSkipTLSVerify property work --- Sources/SwiftkubeClient/Client/KubernetesClient.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Sources/SwiftkubeClient/Client/KubernetesClient.swift b/Sources/SwiftkubeClient/Client/KubernetesClient.swift index 167ff4c..f14394d 100644 --- a/Sources/SwiftkubeClient/Client/KubernetesClient.swift +++ b/Sources/SwiftkubeClient/Client/KubernetesClient.swift @@ -142,8 +142,13 @@ public class KubernetesClient { self.logger = logger ?? SwiftkubeClient.loggingDisabled var tlsConfiguration = TLSConfiguration.makeClientConfiguration() - tlsConfiguration.minimumTLSVersion = .tlsv12 - tlsConfiguration.trustRoots = config.trustRoots + + if config.insecureSkipTLSVerify { + tlsConfiguration.certificateVerification = .none + } else { + tlsConfiguration.minimumTLSVersion = .tlsv12 + tlsConfiguration.trustRoots = config.trustRoots + } if case let KubernetesClientAuthentication.x509(clientCertificate, clientKey) = config.authentication { tlsConfiguration.certificateChain = [.certificate(clientCertificate)]