Refactor kube package to use controller-runtime golang client to interact with cluster

This commit is contained in:
Volodymyr Zotov
2025-08-26 15:11:04 -05:00
parent cd03a651ad
commit b40f27b052
6 changed files with 249 additions and 210 deletions

View File

@@ -1,8 +1,6 @@
package operator
import (
"time"
//nolint:staticcheck // ST1001
. "github.com/onsi/ginkgo/v2"
//nolint:staticcheck // ST1001
@@ -27,27 +25,3 @@ func DeployOperator() {
_, err := system.Run("make", "deploy")
Expect(err).NotTo(HaveOccurred())
}
// WaitingForOperatorPod waits for the Operator pod to be in 'Running' state
func WaitingForOperatorPod() {
By("Waiting for the Operator pod to be 'Running'")
Eventually(func(g Gomega) {
output, err := system.Run("kubectl", "get", "pods",
"-l", "name=onepassword-connect-operator",
"-o", "jsonpath={.items[0].status.phase}")
g.Expect(err).NotTo(HaveOccurred())
g.Expect(output).To(ContainSubstring("Running"))
}, 30*time.Second, 1*time.Second).Should(Succeed())
}
// WaitingForConnectPod waits for the Connect pod to be in 'Running' state
func WaitingForConnectPod() {
By("Waiting for the Connect pod to be 'Running'")
Eventually(func(g Gomega) {
output, err := system.Run("kubectl", "get", "pods",
"-l", "app=onepassword-connect",
"-o", "jsonpath={.items[0].status.phase}")
g.Expect(err).NotTo(HaveOccurred())
g.Expect(output).To(ContainSubstring("Running"))
}, 30*time.Second, 1*time.Second).Should(Succeed())
}