@@ -57,8 +57,7 @@ var _ = Describe("Manager", Ordered, func() {
5757 var controllerPodName string
5858
5959 // Before running the tests, set up the environment by creating the namespace,
60- // enforce the restricted security policy to the namespace, installing CRDs,
61- // and deploying the controller.
60+ // enforce the restricted security policy to the namespace, and deploying the controller using Helm.
6261 BeforeAll (func () {
6362 By ("creating manager namespace" )
6463 cmd := exec .Command ("kubectl" , "create" , "ns" , namespace )
@@ -71,30 +70,25 @@ var _ = Describe("Manager", Ordered, func() {
7170 _ , err = utils .Run (cmd )
7271 Expect (err ).NotTo (HaveOccurred (), "Failed to label namespace with restricted policy" )
7372
74- By ("installing CRDs" )
75- cmd = exec .Command ("make" , "install" )
73+ By ("deploying the controller-manager using Helm" )
74+ cmd = exec .Command ("helm" , "install" , "kmcp" , "helm/kmcp" ,
75+ "--namespace" , namespace ,
76+ "--wait" , "--timeout=5m" ,
77+ "--set" , fmt .Sprintf ("image.repository=%s" , getImageRepository (projectImage )),
78+ "--set" , fmt .Sprintf ("image.tag=%s" , getImageTag (projectImage )))
7679 _ , err = utils .Run (cmd )
77- Expect (err ).NotTo (HaveOccurred (), "Failed to install CRDs" )
78-
79- By ("deploying the controller-manager" )
80- cmd = exec .Command ("make" , "deploy" , fmt .Sprintf ("IMG=%s" , projectImage ))
81- _ , err = utils .Run (cmd )
82- Expect (err ).NotTo (HaveOccurred (), "Failed to deploy the controller-manager" )
80+ Expect (err ).NotTo (HaveOccurred (), "Failed to deploy the controller-manager using Helm" )
8381 })
8482
85- // After all tests have been executed, clean up by undeploying the controller, uninstalling CRDs,
83+ // After all tests have been executed, clean up by undeploying the controller using Helm
8684 // and deleting the namespace.
8785 AfterAll (func () {
8886 By ("cleaning up the curl pod for metrics" )
8987 cmd := exec .Command ("kubectl" , "delete" , "pod" , "curl-metrics" , "-n" , namespace )
9088 _ , _ = utils .Run (cmd )
9189
92- By ("undeploying the controller-manager" )
93- cmd = exec .Command ("make" , "undeploy" )
94- _ , _ = utils .Run (cmd )
95-
96- By ("uninstalling CRDs" )
97- cmd = exec .Command ("make" , "uninstall" )
90+ By ("undeploying the controller-manager using Helm" )
91+ cmd = exec .Command ("helm" , "uninstall" , "kmcp" , "--namespace" , namespace )
9892 _ , _ = utils .Run (cmd )
9993
10094 By ("removing manager namespace" )
@@ -195,10 +189,8 @@ var _ = Describe("Manager", Ordered, func() {
195189 _ , err = utils .Run (cmd )
196190 Expect (err ).NotTo (HaveOccurred (), "Metrics service should exist" )
197191
198- By ("validating that the ServiceMonitor for Prometheus is applied in the namespace" )
199- cmd = exec .Command ("kubectl" , "get" , "ServiceMonitor" , "-n" , namespace )
200- _ , err = utils .Run (cmd )
201- Expect (err ).NotTo (HaveOccurred (), "ServiceMonitor should exist" )
192+ // Note: ServiceMonitor is not included in the basic Helm chart deployment
193+ // Skip ServiceMonitor validation for now
202194
203195 By ("getting the service account token" )
204196 token , err := serviceAccountToken ()
@@ -489,3 +481,21 @@ func mcpServerToYAML(mcpServer interface{}) string {
489481 }
490482 return string (yamlBytes )
491483}
484+
485+ // getImageRepository extracts the repository part from a full image name
486+ // e.g., "example.com/kmcp:v0.0.1" -> "example.com/kmcp"
487+ func getImageRepository (image string ) string {
488+ if idx := strings .LastIndex (image , ":" ); idx != - 1 {
489+ return image [:idx ]
490+ }
491+ return image
492+ }
493+
494+ // getImageTag extracts the tag part from a full image name
495+ // e.g., "example.com/kmcp:v0.0.1" -> "v0.0.1"
496+ func getImageTag (image string ) string {
497+ if idx := strings .LastIndex (image , ":" ); idx != - 1 {
498+ return image [idx + 1 :]
499+ }
500+ return "latest"
501+ }
0 commit comments