Skip to content

Commit

Permalink
sandwich-contexts-kubernetes: more haddocks
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Oct 12, 2024
1 parent e7d99bf commit e3b2171
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ module Test.Sandwich.Contexts.Kubernetes.Cluster (
, KubernetesClusterContext(..)
, KubernetesClusterType(..)
, HasKubernetesClusterContext

-- * Util
, Util.parseHostnameAndPort
) where

import Control.Monad.Catch
Expand All @@ -76,8 +73,6 @@ import qualified Test.Sandwich.Contexts.Kubernetes.KindCluster.ServiceForwardPor
import qualified Test.Sandwich.Contexts.Kubernetes.MinikubeCluster as Minikube
import qualified Test.Sandwich.Contexts.Kubernetes.MinikubeCluster.Forwards as Minikube

import qualified Test.Sandwich.Contexts.Kubernetes.Util as Util


-- | Forward a Kubernetes service, so that it can be reached at a local URI.
withForwardKubernetesService :: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module Test.Sandwich.Contexts.Kubernetes.KubectlPortForward (
import Control.Monad
import Control.Monad.Catch (MonadCatch)
import Control.Monad.IO.Unlift
import Control.Monad.Logger
import Control.Retry
import Data.String.Interpolate
import qualified Data.Text as T
Expand All @@ -20,6 +19,7 @@ import System.FilePath
import System.Process (getPid)
import Test.Sandwich
import Test.Sandwich.Contexts.Files
import Test.Sandwich.Contexts.Kubernetes.Types
import Test.Sandwich.Contexts.Kubernetes.Util.Ports
import Test.Sandwich.Contexts.Kubernetes.Util.SocketUtil
import Test.Sandwich.Util.Process (gracefullyStopProcess)
Expand All @@ -41,14 +41,17 @@ newtype KubectlPortForwardContext = KubectlPortForwardContext {
-- | Run a @kubectl port-forward@ process, making the port available in the 'KubectlPortForwardContext'.
--
-- Note that this will stop working if the pod you're talking to goes away (even if you do it against a service).
-- If this happens, a rerun of the command is needed to resume forwarding
-- If this happens, a rerun of the command is needed to resume forwarding.
withKubectlPortForward :: (
HasCallStack, MonadCatch m, MonadLogger m, MonadUnliftIO m
, HasBaseContextMonad ctx m, HasFile ctx "kubectl"
HasCallStack, MonadCatch m, KubectlBasic context m
)
-- | Path to kubeconfig file
=> FilePath
-- | Namespace
-> Text
-- | Target name (pod, service, etc.)
-> Text
-- | Target port number
-> PortNumber
-> (KubectlPortForwardContext -> m a)
-> m a
Expand All @@ -58,15 +61,19 @@ withKubectlPortForward kubeConfigFile namespace targetName targetPort action = d

-- | Same as 'withKubectlPortForward', but allows you to pass in the @kubectl@ binary path.
withKubectlPortForward' :: (
HasCallStack, MonadCatch m, MonadLogger m, MonadUnliftIO m
, HasBaseContextMonad ctx m
HasCallStack, MonadCatch m, KubernetesBasic context m
)
=> FilePath
-- | Path to kubeconfig file
-> FilePath
-- | Namespace
-> Text
-- | Callback to check if the proposed local port is acceptable
-> (PortNumber -> Bool)
-> Maybe PortNumber
-- | Target name (pod, service, etc.)
-> Text
-- | Target port number
-> PortNumber
-> (KubectlPortForwardContext -> m a)
-> m a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This module can be used to install MinIO S3 servers onto a Kubernetes cluster.
Such a server is provided as a generic 'TestS3Server', so that you can easily run the same tests against both Kubernetes environments and normal ones. See for example the @sandwich-contexts-minio@ package.
-}

module Test.Sandwich.Contexts.Kubernetes.MinioS3Server (
introduceK8SMinioS3Server
, introduceK8SMinioS3Server'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-}

{-|
This module can be used to install [SeaweedFS](https://github.com/seaweedfs/seaweedfs) deployments on a Kubernetes cluster.
-}

module Test.Sandwich.Contexts.Kubernetes.SeaweedFS (
introduceSeaweedFS
, withSeaweedFS
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion sandwich-contexts-kubernetes/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ library:
- sandwich-contexts-minio
- containers
- filepath
- hostname
- http-client
- kubernetes-client
- kubernetes-client-core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ library
Test.Sandwich.Contexts.Kubernetes.MinioS3Server.Parsing
Test.Sandwich.Contexts.Kubernetes.Run
Test.Sandwich.Contexts.Kubernetes.Types
Test.Sandwich.Contexts.Kubernetes.Util
Test.Sandwich.Contexts.Kubernetes.Util.Aeson
Test.Sandwich.Contexts.Kubernetes.Util.Container
Test.Sandwich.Contexts.Kubernetes.Util.Exception
Expand Down Expand Up @@ -75,7 +74,6 @@ library
, containers
, exceptions
, filepath
, hostname
, http-client
, kubernetes-client
, kubernetes-client-core
Expand Down

0 comments on commit e3b2171

Please sign in to comment.