github.com/redhat-appstudio/e2e-tests@v0.0.0-20230619105049-9a422b2094d7/pkg/utils/common/controller.go (about) 1 package common 2 3 import ( 4 "github.com/redhat-appstudio/e2e-tests/pkg/apis/github" 5 kubeCl "github.com/redhat-appstudio/e2e-tests/pkg/apis/kubernetes" 6 "github.com/redhat-appstudio/e2e-tests/pkg/constants" 7 "github.com/redhat-appstudio/e2e-tests/pkg/utils" 8 ) 9 10 // Create the struct for kubernetes and github clients. 11 type SuiteController struct { 12 // Wrap K8S client go to interact with Kube cluster 13 *kubeCl.CustomClient 14 15 // Github client to interact with GH apis 16 Github *github.Github 17 } 18 19 /* 20 Create controller for the common kubernetes API crud operations. This controller should be used only to interact with non RHTAP/AppStudio APIS like routes, deployment, pods etc... 21 Check if a github organization env var is set, if not use by default the redhat-appstudio-qe org. See: https://github.com/redhat-appstudio-qe 22 */ 23 func NewSuiteController(kubeC *kubeCl.CustomClient) (*SuiteController, error) { 24 gh, err := github.NewGithubClient(utils.GetEnv(constants.GITHUB_TOKEN_ENV, ""), utils.GetEnv(constants.GITHUB_E2E_ORGANIZATION_ENV, "redhat-appstudio-qe")) 25 if err != nil { 26 return nil, err 27 } 28 return &SuiteController{ 29 kubeC, 30 gh, 31 }, nil 32 }