Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6090091
fix upgrade
foot Nov 19, 2021
9203c47
lint
foot Nov 19, 2021
7a3d5e1
linting
foot Nov 19, 2021
223a59e
missing helper
foot Nov 19, 2021
75aafc7
fix
foot Nov 19, 2021
c7bbe80
build and accept
foot Nov 22, 2021
b72966d
Merge remote-tracking branch 'origin/main' into fix-upgrade
foot Nov 22, 2021
06dee16
build
foot Nov 22, 2021
2af39ca
rm helper
foot Nov 22, 2021
0307a54
Maybemaybemaybe
foot Nov 22, 2021
f4b8ea6
diy
foot Nov 22, 2021
adbfadc
try and try again
foot Nov 22, 2021
3581c7e
mkdirp
foot Nov 22, 2021
68440ff
wkp-agent ns please
foot Nov 22, 2021
98ae64c
correct port
foot Nov 23, 2021
6512598
use release bin
foot Nov 23, 2021
3c79a6b
fix
foot Nov 23, 2021
ca48b90
just do it
foot Nov 23, 2021
6608065
add the action
foot Nov 23, 2021
46febfa
hope thats not re-using kind..
foot Nov 23, 2021
d989677
missing an env var
foot Nov 23, 2021
5a22aed
check other waitforpods thing
foot Nov 23, 2021
e31ed90
trim deployment name properly
foot Nov 23, 2021
dce9318
disable check for now
foot Nov 23, 2021
bef3ac3
bring kind back
foot Nov 23, 2021
f8c2193
try and make everyone happy
foot Nov 23, 2021
70e8c08
faster check
foot Nov 23, 2021
d434cbf
more prefix work
foot Nov 23, 2021
b7f5509
restore most of test
foot Nov 23, 2021
ae8f182
fix up test
foot Nov 23, 2021
ea643fd
use consitent bin getting
foot Nov 23, 2021
cb296dc
Merge remote-tracking branch 'origin/main' into fix-upgrade
foot Nov 23, 2021
d5a1322
fix up prefix again
foot Nov 23, 2021
28fb18b
Merge branch 'main' into fix-upgrade
foot Nov 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/gitops-binary/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Get gitops binary'
description: 'Get or build the gitops binary'
inputs:
path:
description: 'where shall it go?'
required: true
default: /tmp/gitops
os:
description: "`macOS-latest` or `ubuntu-latest`"
required: false
default: "ubuntu-latest"
runs:
using: "composite"
steps:
- shell: bash
name: Download gitops binary from s3
run: |
# Not working right now
# wget https://weave-gitops.s3.us-east-2.amazonaws.com/gitops-${{ inputs.os }}
# mv gitops-${{ inputs.os }} ${{ inputs.path }}

curl -LO https://github.com/weaveworks/weave-gitops/releases/download/v0.5.0-rc2/gitops-linux-x86_64.tar.gz
tar -xf gitops-linux-x86_64.tar.gz
mv gitops ${{ inputs.path }}

# Print out Version
${{ inputs.path }} version
13 changes: 6 additions & 7 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
GITHUB_PASSWORD: ${{ secrets.WGE_GITHUB_PASSWORD }}
DOCKER_IO_USER: ${{ secrets.WGE_DOCKER_IO_USER }}
DOCKER_IO_PASSWORD: ${{ secrets.WGE_DOCKER_IO_PASSWORD }}
GITOPS_BIN_PATH: ${{ github.workspace }}/cmd/gitops/gitops-${{ matrix.os_name }}-x86_64
GITOPS_BIN_PATH: /tmp/gitops
PCTL_BIN_PATH: ${{ github.workspace }}/cmd/pctl/pctl_${{ matrix.os_name }}_amd64
WKP_BIN_PATH: ${{ github.workspace }}/cmd/wk/wk-v2.5.0-${{ matrix.os_name }}-amd64
SELENIUM_DEBUG: true
Expand Down Expand Up @@ -160,11 +160,11 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "test-user"
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
- name: Download gitops binary from s3
run: |
mkdir -p cmd/gitops/
wget https://weave-gitops.s3.us-east-2.amazonaws.com/gitops-${{ matrix.os }}
mv gitops-${{ matrix.os }} $GITOPS_BIN_PATH
- name: Get a gitops-binary
uses: ./.github/actions/gitops-binary
with:
os: ${{ matrix.os }}
path: ${{ env.GITOPS_BIN_PATH }}
- name: Download pctl binary from GH
run: |
mkdir -p cmd/pctl/
Expand All @@ -177,7 +177,6 @@ jobs:
curl -o $WKP_BIN_PATH https://s3.amazonaws.com/weaveworks-wkp/wk-v2.5.0-${{ matrix.os_name }}-amd64
- name: Change bin permissions
run: |
sudo chmod +x ${{ env.GITOPS_BIN_PATH }}
sudo chmod +x ${{ env.WKP_BIN_PATH }}
- name: Setup selenium server
if: ${{ runner.os == 'Linux' }}
Expand Down
27 changes: 12 additions & 15 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
GITHUB_PASSWORD: ${{ secrets.WGE_GITHUB_PASSWORD }}
DOCKER_IO_USER: ${{ secrets.WGE_DOCKER_IO_USER }}
DOCKER_IO_PASSWORD: ${{ secrets.WGE_DOCKER_IO_PASSWORD }}
GITOPS_BIN_PATH: ${{ github.workspace }}/cmd/gitops/gitops-${{ matrix.os_name }}-x86_64
GITOPS_BIN_PATH: /tmp/gitops
PCTL_BIN_PATH: ${{ github.workspace }}/cmd/pctl/pctl_${{ matrix.os_name }}_amd64
WKP_BIN_PATH: ${{ github.workspace }}/cmd/wk/wk-v2.5.0-${{ matrix.os_name }}-amd64
WGE_ACCEPTANCE_EKS_KUBECONFIG: ${{ secrets.WGE_ACCEPTANCE_EKS_KUBECONFIG }}
Expand Down Expand Up @@ -112,12 +112,11 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "test-user"
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
- name: Download gitops binary from s3
run: |
mkdir -p cmd/gitops/

wget https://weave-gitops.s3.us-east-2.amazonaws.com/gitops-${{ matrix.os }}
mv gitops-${{ matrix.os }} $GITOPS_BIN_PATH
- name: Get a gitops-binary
uses: ./.github/actions/gitops-binary
with:
os: ${{ matrix.os }}
path: ${{ env.GITOPS_BIN_PATH }}
- name: Download pctl binary from GH
run: |
mkdir -p cmd/pctl/
Expand All @@ -130,7 +129,6 @@ jobs:
curl -o $WKP_BIN_PATH https://s3.amazonaws.com/weaveworks-wkp/wk-v2.5.0-${{ matrix.os_name }}-amd64
- name: Change bin permissions
run: |
sudo chmod +x ${{ env.GITOPS_BIN_PATH }}
sudo chmod +x ${{ env.WKP_BIN_PATH }}
- name: Setup selenium server
if: ${{ runner.os == 'Linux' }}
Expand Down Expand Up @@ -226,7 +224,7 @@ jobs:
GITHUB_PASSWORD: ${{ secrets.WGE_GITHUB_PASSWORD }}
DOCKER_IO_USER: ${{ secrets.WGE_DOCKER_IO_USER }}
DOCKER_IO_PASSWORD: ${{ secrets.WGE_DOCKER_IO_PASSWORD }}
GITOPS_BIN_PATH: ${{ github.workspace }}/cmd/gitops/gitops-${{ matrix.os_name }}-x86_64
GITOPS_BIN_PATH: /tmp/gitops
PCTL_BIN_PATH: ${{ github.workspace }}/cmd/pctl/pctl_${{ matrix.os_name }}_amd64
WKP_BIN_PATH: ${{ github.workspace }}/cmd/wk/wk-v2.5.0-${{ matrix.os_name }}-amd64
WGE_ACCEPTANCE_GCE_KUBECONFIG: ${{ secrets.WGE_ACCEPTANCE_GCE_KUBECONFIG }}
Expand Down Expand Up @@ -294,11 +292,11 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "test-user"
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
- name: Download gitops binary from s3
run: |
mkdir -p cmd/gitops/
wget https://weave-gitops.s3.us-east-2.amazonaws.com/gitops-${{ matrix.os }}
mv gitops-${{ matrix.os }} $GITOPS_BIN_PATH
- name: Get a gitops-binary
uses: ./.github/actions/gitops-binary
with:
os: ${{ matrix.os }}
path: ${{ env.GITOPS_BIN_PATH }}
- name: Download pctl binary from GH
run: |
mkdir -p cmd/pctl/
Expand All @@ -311,7 +309,6 @@ jobs:
curl -o $WKP_BIN_PATH https://s3.amazonaws.com/weaveworks-wkp/wk-v2.5.0-${{ matrix.os_name }}-amd64
- name: Change bin permissions
run: |
sudo chmod +x ${{ env.GITOPS_BIN_PATH }}
sudo chmod +x ${{ env.WKP_BIN_PATH }}
- name: Setup selenium server
if: ${{ runner.os == 'Linux' }}
Expand Down
40 changes: 16 additions & 24 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ jobs:
GITHUB_ORG: ${{ secrets.WGE_GITHUB_ORG }}
GITHUB_USER: ${{ secrets.WGE_GITHUB_USER }}
GITHUB_PASSWORD: ${{ secrets.WGE_GITHUB_PASSWORD }}
GITOPS_BIN_PATH: ${{ github.workspace }}/cmd/gitops/gitops-linux-x86_64
GITOPS_BIN_PATH: /tmp/gitops
SELENIUM_DEBUG: true
ACCEPTANCE_TESTS_DATABASE_TYPE: sqlite
WGE_ACCEPTANCE: true
Expand Down Expand Up @@ -277,14 +277,10 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "test-user"
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
- name: Download gitops binary from s3
run: |
mkdir -p cmd/gitops/
wget https://weave-gitops.s3.us-east-2.amazonaws.com/gitops-ubuntu-latest
mv gitops-ubuntu-latest $GITOPS_BIN_PATH
- name: Change bin permissions
run: |
sudo chmod +x ${{ env.GITOPS_BIN_PATH }}
- name: Get a gitops-binary
uses: ./.github/actions/gitops-binary
with:
path: ${{ env.GITOPS_BIN_PATH }}
- name: Setup selenium server
run: |
wget https://selenium-release.storage.googleapis.com/3.14/selenium-server-standalone-3.14.0.jar
Expand Down Expand Up @@ -330,14 +326,18 @@ jobs:
GITHUB_ORG: ${{ secrets.WGE_GITHUB_ORG }}
GITHUB_USER: ${{ secrets.WGE_GITHUB_USER }}
GITHUB_PASSWORD: ${{ secrets.WGE_GITHUB_PASSWORD }}
GITOPS_BIN_PATH: ${{ github.workspace }}/cmd/gitops/gitops-linux-x86_64
GITOPS_BIN_PATH: /tmp/gitops
WKP_BIN_PATH: ${{ github.workspace }}/cmd/wk/wk-v2.5.0-linux-amd64
SELENIUM_DEBUG: true
ACCEPTANCE_TESTS_DATABASE_TYPE: sqlite
WGE_ACCEPTANCE: true
CONNECT_KIND_WKP_LEAF_TEST: true
ARTEFACTS_BASE_DIR: /tmp/workspace/test/
steps:
- name: "Setup dynamic env vars"
run: |
export CLUSTER_REPOSITORY=gitops-capi-template-${{ github.run_id }}-$(openssl rand -hex 8)
echo "CLUSTER_REPOSITORY=$CLUSTER_REPOSITORY" >> $GITHUB_ENV
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
Expand Down Expand Up @@ -380,14 +380,10 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "test-user"
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
- name: Download gitops binary from s3
run: |
mkdir -p cmd/gitops/
wget https://weave-gitops.s3.us-east-2.amazonaws.com/gitops-ubuntu-latest
mv gitops-ubuntu-latest $GITOPS_BIN_PATH
- name: Change bin permissions
run: |
sudo chmod +x ${{ env.GITOPS_BIN_PATH }}
- name: Get a gitops-binary
uses: ./.github/actions/gitops-binary
with:
path: ${{ env.GITOPS_BIN_PATH }}
- name: Setup selenium server
run: |
wget https://selenium-release.storage.googleapis.com/3.14/selenium-server-standalone-3.14.0.jar
Expand All @@ -403,14 +399,10 @@ jobs:
config: "./test/utils/data/local-kind-config.yaml"
- name: Kind-check
run: |
kubectl get pods -A
kubectl get pods -A
- name: Install wego enterprise components on management cluster
run: |
export CLUSTER_REPOSITORY=gitops-capi-template-${{ github.run_id }}-$(openssl rand -hex 8)
# Set the CLUSTER_REPOSITORY as environment variable for subsequent steps
echo "CLUSTER_REPOSITORY=$CLUSTER_REPOSITORY" >> $GITHUB_ENV

./test/utils/scripts/wego-enterprise.sh setup ${{ github.workspace }}
./test/utils/scripts/wego-enterprise.sh setup ${{ github.workspace }}
- name: Run acceptance tests
run: |
cd test/acceptance/test/
Expand Down
4 changes: 4 additions & 0 deletions test/acceptance/test/cli_add_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,10 @@ func DescribeCliAddDelete(gitopsTestRunner GitopsTestRunner) {

It("@capd Verify leaf CAPD cluster can be provisioned and kubeconfig is available for cluster operations", func() {

By("Check wge is all running", func() {
gitopsTestRunner.VerifyWegoPodsRunning()
})

var repoAbsolutePath string
By("When I create a private repository for cluster configs", func() {
repoAbsolutePath = gitopsTestRunner.InitAndCreateEmptyRepo(CLUSTER_REPOSITORY, true)
Expand Down
102 changes: 11 additions & 91 deletions test/acceptance/test/cli_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package acceptance

import (
"fmt"
"io/ioutil"
"log"
"os/exec"
"path"
Expand All @@ -14,39 +13,6 @@ import (
"github.com/onsi/gomega/gexec"
)

func configureConfigMapvalues(repoAbsolutePath string, uiNodePort string, natsNodeport string, natsURL string, repositoryURL string) {
pullGitRepo(repoAbsolutePath)

configMapYaml := path.Join(repoAbsolutePath, "upgrade", "weave-gitops-enterprise", "artifacts", "mccp-chart", "helm-chart", "ConfigMap.yaml")

input, err := ioutil.ReadFile(configMapYaml)
Expect(err).ShouldNot(HaveOccurred())

lines := strings.Split(string(input), "\n")

for i, line := range lines {
if uiNodePort != "" && strings.Contains(line, "nginx-ingress-controller") {
lines = append(lines[:i+2], lines[i+1:]...)
lines[i+2] = " type: NodePort"
lines[i+5] = " " + uiNodePort
}
if natsNodeport != "" && strings.Contains(line, "nodePort: 31490") {
lines[i] = " nodePort: " + natsNodeport
}
if natsURL != "" && strings.Contains(line, "natsURL: ") {
lines[i] = " natsURL: " + natsURL
}
if repositoryURL != "" && strings.Contains(line, "repositoryURL: ") {
lines[i] = " repositoryURL: " + repositoryURL
}
}

output := strings.Join(lines, "\n")
err = ioutil.WriteFile(configMapYaml, []byte(output), 0644)
Expect(err).ShouldNot(HaveOccurred())

}

func DescribeCliUpgrade(gitopsTestRunner GitopsTestRunner) {
var _ = Describe("Gitops upgrade Tests", func() {

Expand Down Expand Up @@ -76,8 +42,6 @@ func DescribeCliUpgrade(gitopsTestRunner GitopsTestRunner) {
var public_ip string
kind_upgrade_cluster_name := "test-upgrade"

appName := "wego-upgrade"
appPath := "upgrade"
templateFiles := []string{}

JustBeforeEach(func() {
Expand Down Expand Up @@ -113,26 +77,12 @@ func DescribeCliUpgrade(gitopsTestRunner GitopsTestRunner) {

By("When I create a private repository for cluster configs", func() {
repoAbsolutePath = gitopsTestRunner.InitAndCreateEmptyRepo(CLUSTER_REPOSITORY, true)
testFile := createTestFile("README.md", "# gitops-capi-template")

gitopsTestRunner.GitAddCommitPush(repoAbsolutePath, testFile)
})

By("When I install gitops/wego to my active cluster", func() {
InstallAndVerifyGitops(GITOPS_DEFAULT_NAMESPACE, GetGitRepositoryURL(repoAbsolutePath))
})

By("And I install profile controllers to my active cluster", func() {
InstallAndVerifyPctl(GITOPS_DEFAULT_NAMESPACE)
})

addCommand := fmt.Sprintf("add app . --path=./%s --name=%s --auto-merge=true", appPath, appName)
By(fmt.Sprintf("And I run gitops add app command ' %s 'in namespace %s from dir %s", addCommand, GITOPS_DEFAULT_NAMESPACE, repoAbsolutePath), func() {
cmd := fmt.Sprintf("cd %s && %s %s", repoAbsolutePath, GITOPS_BIN_PATH, addCommand)
_, err := runCommandAndReturnStringOutput(cmd)
Expect(err).Should(BeEmpty())
})

By("And I install the entitlement for cluster upgrade", func() {
Expect(gitopsTestRunner.KubectlApply([]string{}, "../../utils/scripts/entitlement-secret.yaml"), "Failed to create/configure entitlement")
})
Expand All @@ -143,19 +93,16 @@ func DescribeCliUpgrade(gitopsTestRunner GitopsTestRunner) {
Expect(err).Should(BeEmpty(), "Failed to create git repository secret for cluster service")
})

By("And I install the docker registry secret for wego enteprise components", func() {
cmd := fmt.Sprintf(`kubectl create secret docker-registry docker-io-pull-secret --namespace=%s --docker-username=%s --docker-password=%s`, GITOPS_DEFAULT_NAMESPACE, DOCKER_IO_USER, DOCKER_IO_PASSWORD)
_, err := runCommandAndReturnStringOutput(cmd)
Expect(err).Should(BeEmpty(), "Failed to create git repository secret for cluster service")
})

By("Then I should see gitops add command linked the repo to the cluster", func() {
verifyWegoAddCommand(appName, GITOPS_DEFAULT_NAMESPACE)
By("And I should update/modify the default upgrade manifest ", func() {
public_ip = ClusterWorkloadNonePublicIP("KIND")
})

prBranch := "wego-upgrade-enterprise"
upgradeCommand := fmt.Sprintf("upgrade --git-repository %s/%s --branch %s --out %s", GITOPS_DEFAULT_NAMESPACE, appName, prBranch, appPath)
By(fmt.Sprintf("And I run gitops upgrade command ' %s ' form firectory %s", upgradeCommand, repoAbsolutePath), func() {
profileVersion := "0.0.15"
By(fmt.Sprintf("And I run gitops upgrade command from directory %s", repoAbsolutePath), func() {
natsURL := public_ip + ":" + NATS_NODEPORT
repositoryURL := fmt.Sprintf(`https://github.com/%s/%s`, GITHUB_ORG, CLUSTER_REPOSITORY)
upgradeCommand := fmt.Sprintf("upgrade --profile-version %s --app-config-url %s --branch %s --set 'agentTemplate.natsURL=%s' --set 'nats.client.service.nodePort=%s'", profileVersion, repositoryURL, prBranch, natsURL, NATS_NODEPORT)
command := exec.Command("sh", "-c", fmt.Sprintf("cd %s && %s %s", repoAbsolutePath, GITOPS_BIN_PATH, upgradeCommand))
session, err = gexec.Start(command, GinkgoWriter, GinkgoWriter)
Expect(err).ShouldNot(HaveOccurred())
Expand All @@ -166,53 +113,26 @@ func DescribeCliUpgrade(gitopsTestRunner GitopsTestRunner) {
By("Then I should see pull request created to management cluster", func() {
output := session.Wait().Out.Contents()

re := regexp.MustCompile(`PR created.*:[\s\w\d]+(?P<URL>https.*\/\d+)`)
re := regexp.MustCompile(`Pull Request created.*:[\s\w\d]+(?P<URL>https.*\/\d+)`)
match := re.FindSubmatch([]byte(output))
Eventually(match[1]).ShouldNot(BeNil(), "Failed to Create pull request")
})

By("And I should update/modify the default upgrade manifest ", func() {
public_ip = ClusterWorkloadNonePublicIP("KIND")
natsURL := public_ip + ":" + NATS_NODEPORT
repositoryURL := fmt.Sprintf(`https://github.com/%s/%s`, GITHUB_ORG, CLUSTER_REPOSITORY)
gitopsTestRunner.PullBranch(repoAbsolutePath, prBranch)
configureConfigMapvalues(repoAbsolutePath, UI_NODEPORT, NATS_NODEPORT, natsURL, repositoryURL)
GitSetUpstream(repoAbsolutePath, prBranch)
GitUpdateCommitPush(repoAbsolutePath, "")
})

By("Then I should merge the pull request to start weave gitops enterprise upgrade", func() {
gitopsTestRunner.MergePullRequest(repoAbsolutePath, prBranch)
})

By("And I should see cluster upgraded from 'wego core' to 'wego enterprise'", func() {
VerifyEnterpriseControllers("mccp-chart", GITOPS_DEFAULT_NAMESPACE)
})

By("And I can change the config map values for the upgrade profile", func() {
repositoryURL := fmt.Sprintf(`https://github.com/%s/%s`, GITHUB_ORG, CLUSTER_REPOSITORY)
configureConfigMapvalues(repoAbsolutePath, "", "", "", repositoryURL)
GitUpdateCommitPush(repoAbsolutePath, "")
})

By("Then I restart the cluster service pod for capi config to take effect", func() {
configmapValuesUpdated := func() bool {
data, _ := runCommandAndReturnStringOutput(fmt.Sprintf(`kubectl get configmap -n %s weave-gitops-enterprise-mccp-chart-defaultvalues -o jsonpath="{.data}"`, GITOPS_DEFAULT_NAMESPACE))
re := regexp.MustCompile(fmt.Sprintf(`repositoryURL:\s*(?P<url>https:.*%s)`, CLUSTER_REPOSITORY))
return len(re.FindSubmatch([]byte(data))) > 0
}

Eventually(configmapValuesUpdated, ASSERTION_2MINUTE_TIME_OUT, POLL_INTERVAL_5SECONDS).Should(BeTrue(), "ConfigMap values failed to reconcile")
Expect(gitopsTestRunner.RestartDeploymentPods([]string{}, "mccp-chart-cluster-service", GITOPS_DEFAULT_NAMESPACE), "Failed restart deployment successfully")
VerifyEnterpriseControllers("weave-gitops-enterprise", "mccp-", GITOPS_DEFAULT_NAMESPACE)
})

By("And I can also use upgraded enterprise UI/CLI after port forwarding (for loadbalancer ingress controller)", func() {
serviceType, _ := runCommandAndReturnStringOutput(fmt.Sprintf(`kubectl get service mccp-chart-nginx-ingress-controller -n %s -o jsonpath="{.spec.type}"`, GITOPS_DEFAULT_NAMESPACE))
serviceType, _ := runCommandAndReturnStringOutput(fmt.Sprintf(`kubectl get service weave-gitops-enterprise-nginx-ingress-controller -n %s -o jsonpath="{.spec.type}"`, GITOPS_DEFAULT_NAMESPACE))
if strings.Trim(serviceType, "\n") == "NodePort" {
capi_endpoint_url = "http://" + public_ip + ":" + UI_NODEPORT
test_ui_url = "http://" + public_ip + ":" + UI_NODEPORT
} else {
commandToRun := fmt.Sprintf("kubectl port-forward --namespace %s deployments.apps/mccp-chart-nginx-ingress-controller 8000:80", GITOPS_DEFAULT_NAMESPACE)
commandToRun := fmt.Sprintf("kubectl port-forward --namespace %s deployments.apps/weave-gitops-enterprise-nginx-ingress-controller 8000:80", GITOPS_DEFAULT_NAMESPACE)

cmd := exec.Command("sh", "-c", commandToRun)
session, _ := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
Expand Down
Loading