@@ -18,16 +18,16 @@ This is a mostly straightforward translation into Haskell, with 'FromJSON' and '
18
18
-}
19
19
module Kubernetes.KubeConfig where
20
20
21
- import Data.Aeson (FromJSON (.. ), Options , ToJSON (.. ),
22
- Value (.. ), camelTo2 , defaultOptions ,
23
- fieldLabelModifier , genericParseJSON ,
24
- genericToJSON , object , omitNothingFields ,
25
- withObject , (.:) , (.=) )
26
- import qualified Data.Map as Map
21
+ import Data.Aeson (FromJSON (.. ), Options , ToJSON (.. ),
22
+ Value (.. ), camelTo2 , defaultOptions ,
23
+ fieldLabelModifier , genericParseJSON ,
24
+ genericToJSON , object , omitNothingFields ,
25
+ withObject , (.:) , (.=) )
26
+ import qualified Data.Map as Map
27
27
import Data.Proxy
28
- import Data.Semigroup ((<>) )
29
- import Data.Text (Text )
30
- import qualified Data.Text as T
28
+ import Data.Semigroup ((<>) )
29
+ import Data.Text (Text )
30
+ import qualified Data.Text as T
31
31
import Data.Typeable
32
32
import GHC.Generics
33
33
import GHC.TypeLits
@@ -176,9 +176,9 @@ getAuthInfo cfg@Config {..} = do
176
176
177
177
-- | Returns the currently active cluster.
178
178
getCluster :: Config -> Either String Cluster
179
- getCluster cfg@ Config {.. } = do
180
- Context {.. } <- getContext cfg
181
- let maybeCluster = Map. lookup cluster (toMap clusters)
179
+ getCluster cfg@ Config {clusters = clusters } = do
180
+ Context {cluster = clusterName } <- getContext cfg
181
+ let maybeCluster = Map. lookup clusterName (toMap clusters)
182
182
case maybeCluster of
183
183
Just cluster -> Right cluster
184
184
Nothing -> Left (" No cluster named " <> T. unpack cluster)
0 commit comments