@@ -31,6 +31,7 @@ public extension KubeConfig {
3131 return try from ( config: contents)
3232 }
3333
34+ #if os(Linux) || os(macOS)
3435 static func fromEnvironment( envVar: String = " KUBECONFIG " , logger: Logger ? = nil ) throws -> KubeConfig ? {
3536 guard let varContent = ProcessInfo . processInfo. environment [ envVar] else {
3637 logger? . info ( " Skipping kubeconfig because environment variable \( envVar) is not set " )
@@ -43,7 +44,9 @@ public extension KubeConfig {
4344
4445 return try from ( url: kubeConfigURL)
4546 }
47+ #endif
4648
49+ #if os(Linux) || os(macOS)
4750 static func fromDefaultLocalConfig( logger: Logger ? = nil ) throws -> KubeConfig ? {
4851 guard let homePath = ProcessInfo . processInfo. environment [ " HOME " ] else {
4952 logger? . info ( " Skipping kubeconfig in $HOME/.kube/config because HOME env variable is not set. " )
@@ -55,7 +58,9 @@ public extension KubeConfig {
5558
5659 return try from ( url: kubeConfigURL)
5760 }
61+ #endif
5862
63+ #if os(Linux) || os(macOS)
5964 static func fromServiceAccount( logger: Logger ? = nil ) throws -> KubeConfig ? {
6065 guard
6166 let host = ProcessInfo . processInfo. environment [ " KUBERNETES_SERVICE_HOST " ] ,
@@ -120,8 +125,10 @@ public extension KubeConfig {
120125 currentContext: " service-account-context "
121126 )
122127 }
128+ #endif
123129}
124130
131+ #if os(Linux) || os(macOS)
125132internal extension String {
126133
127134 func stringByExpandingTildePath( ) -> String {
@@ -143,3 +150,4 @@ internal extension String {
143150 return FileManager . default. homeDirectoryForCurrentUser. path + " / " + relativePath
144151 }
145152}
153+ #endif
0 commit comments