Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 4 additions & 17 deletions .github/actions/setup-ssh/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,7 @@ runs:
touch ~/.ssh/known_hosts
ssh-keygen -R github.com
ssh-keygen -R gitlab.com
cat > ~/.ssh/known_hosts <<- EOM
# github.com:22 SSH-2.0-babeld-a73e1397
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
# github.com:22 SSH-2.0-babeld-a73e1397
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
# github.com:22 SSH-2.0-babeld-a73e1397
github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
# gitlab.com:22 SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
gitlab.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bNKTBSpIYDEGk9KxsGh3mySTRgMtXL583qmBpzeQ+jqCMRgBqB98u3z++J1sKlXHWfM9dyhSevkMwSbhoR8XIq/U0tCNyokEi/ueaBMCvbcTHhO7FcwzY92WK4Yt0aGROY5qX2UKSeOvuP4D6TPqKF1onrSzH9bx9XUf2lEdWT/ia1NEKjunUqu1xOB/StKDHMoX4/OKyIzuS0q/T1zOATthvasJFoPrAjkohTyaDUz2LN5JoH839hViyEG82yB+MjcFV5MU3N1l1QL3cVUCh93xSaua1N85qivl+siMkPGbO5xR/En4iEY6K2XPASUEMaieWVNTRCtJ4S8H+9
# gitlab.com:22 SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
gitlab.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY=
# gitlab.com:22 SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
gitlab.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf
gitlab.git.dev.wkp.weave.works ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBeP3Ucl8fV9dQK3cuN8A8z1t5ah9Xwq/oVGG/MOyiE4DyCP/m+XIBJ07dW7rl5cCpGivmzURslQuSQWLM7oSMVddzKMeMA+A2Xqf+c5jEpCDx08TarBInInqjgO3Yt9NmptQ0JsQgNYLugclQVcuk832/2Ge7M9kw8Dp9SeYsIG/8oBl8DeSXp7AR21zsnH0uKRil7a8I6Nmo8wC3s8iAj1KP/dYTn0S7M+8ZYM0ubrUyKULqAWMAH2KXG4fs2Z3yaK4yWugCre8KTSF2YJYsnNkfNy2NHyb/nGgIDLP3Or0ER5mRPqUgu1vgvXIk0nVKmYfGnWvByg5e2sn4QjE/
gitlab.git.dev.wkp.weave.works ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBB7Mqp5balgSUzdzgveNGarJatOw6elpMtKzawdtY+ugxWFNLskxoEydYqZFHDaS8D/bH1XvZYUemRZBd7vntbk=
gitlab.git.dev.wkp.weave.works ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPUuEL+yd8UwVnrP2PLSNslqfOt7o6WGDdEcD2f8SwRB
EOM
ssh-keygen -R gitlab.git.dev.weave.works

# Append fresh new keys
ssh-keyscan github.com gitlab.com gitlab.git.dev.weave.works >> ~/.ssh/known_hosts
4 changes: 2 additions & 2 deletions .github/workflows/acceptance-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ env:
UI_NODEPORT: 30080
NATS_NODEPORT: 31490
MANAGEMENT_CLUSTER_CNAME: weave.gitops.enterprise.com
UPGRADE_MANAGEMENT_CLUSTER_CNAME: weave.gitops.upgrade.enterprise.com
MANAGEMENT_CLUSTER_KIND: ${{ inputs.management-cluster-kind }}
GITOPS_BIN_PATH: ${{ inputs.gitops-bin-path }}
ACCEPTANCE_TESTS_DATABASE_TYPE: ${{ inputs.database-type }}
Expand Down Expand Up @@ -275,7 +276,7 @@ jobs:
git config --global user.name $USERNAME
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
git config --global [email protected]:.insteadOf https://gitlab.com/
git config --global [email protected].wkp.weave.works:.insteadOf https://gitlab.git.dev.wkp.weave.works/
git config --global [email protected]:.insteadOf https://gitlab.git.dev.weave.works/
- name: Download totp-cli from GH
run: |
wget https://github.com/yitsushi/totp-cli/releases/download/v1.1.17/totp-cli-v1.1.17-${{ inputs.os-name }}-amd64.tar.gz
Expand All @@ -291,7 +292,6 @@ jobs:
chmod +x /tmp/gitops-${{ inputs.runs-on }}
ls -la /tmp/gitops-${{ inputs.runs-on }}
sudo mv /tmp/gitops-${{ inputs.runs-on }} ${{ env.GITOPS_BIN_PATH }}
ls -la ${{ env.GITOPS_BIN_PATH }}
gitops version
- name: Setup selenium server
if: ${{ runner.os == 'Linux' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
focus-or-skip: "-ginkgo.focus='@git'"
kubectl-version: "v1.22.0"
git-provider: gitlab
git-provider_hostname: gitlab.git.dev.wkp.weave.works
git-provider_hostname: gitlab.git.dev.weave.works
cluster_resource_set: true
management-cluster-kind: kind
gitops-bin-path: /usr/local/bin/gitops
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
focus-or-skip: "-ginkgo.skip='@gce|@eks|@capd|@upgrade'"
kubectl-version: "v1.22.0"
git-provider: gitlab
git-provider_hostname: gitlab.git.dev.wkp.weave.works
git-provider_hostname: gitlab.git.dev.weave.works
cluster_resource_set: false
management-cluster-kind: gke
gitops-bin-path: /usr/local/bin/gitops
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
GITHUB_ORG: ${{ secrets.WGE_GITHUB_ORG }}
GITHUB_USER: ${{ secrets.WGE_GITHUB_USER }}
GITLAB_TOKEN: ${{ secrets.WGE_ON_PREM_GITLAB_TOKEN }}
GIT_PROVIDER_HOSTNAME: gitlab.git.dev.wkp.weave.works
GIT_PROVIDER_HOSTNAME: gitlab.git.dev.weave.works
steps:
- id: cache-paths
run: |
Expand Down Expand Up @@ -297,7 +297,7 @@ jobs:
focus-or-skip: "-ginkgo.focus='@smoke'"
kubectl-version: "v1.22.0"
git-provider: gitlab
git-provider_hostname: gitlab.git.dev.wkp.weave.works
git-provider_hostname: gitlab.git.dev.weave.works
cluster_resource_set: true
management-cluster-kind: kind
gitops-bin-path: /usr/local/bin/gitops
Expand Down
14 changes: 7 additions & 7 deletions docs/acceptance_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Configure git with the following global settings. It will elevates the manual in
git config --global user.name <your user name>
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
git config --global [email protected]:.insteadOf https://gitlab.com/
git config --global [email protected].wkp.weave.works:.insteadOf https://gitlab.git.dev.wkp.weave.works/
git config --global [email protected]:.insteadOf https://gitlab.git.dev.weave.works/


<font size="5">**Git provider(s) key fingerprints**</font>
Expand All @@ -50,10 +50,10 @@ Add git providers i.e. (GitHub, gitlab and gitlab-on-prm) key fingerprints to th
# Clean up potentially old keys
ssh-keygen -R github.com
ssh-keygen -R gitlab.com
ssh-keygen -R gitlab.git.dev.wkp.weave.works
ssh-keygen -R gitlab.git.dev.weave.works

# Append fresh new keys
ssh-keyscan gitlab.git.dev.wkp.weave.works github.com gitlab.com >> ~/.ssh/known_hosts
ssh-keyscan gitlab.git.dev.weave.works github.com gitlab.com >> ~/.ssh/known_hosts
```

<font size="5">**Environment variables**</font>
Expand Down Expand Up @@ -101,17 +101,17 @@ export GITLAB_CLIENT_SECRET=<gitlab oath app secret>
**Gitlab on-prem**
```
export GIT_PROVIDER=gitlab
export GIT_PROVIDER_HOSTNAME=gitlab.git.dev.wkp.weave.works
export GIT_PROVIDER_HOSTNAME=gitlab.git.dev.weave.works
export GITHUB_ORG=<gitlab group name>
export GITHUB_TOKEN=<gitlab account token>
export GITHUB_USER=<gitlab account user name>
export GITHUB_PASSWORD=<gitlab account password>
export GITLAB_CLIENT_ID=<gitlab oath app id>
export GITLAB_CLIENT_SECRET=<gitlab oath app secret>
export GITOPS_GIT_HOST_TYPES="gitlab.git.dev.wkp.weave.works=gitlab"
export GITLAB_HOSTNAME=“gitlab.git.dev.wkp.weave.works"
export GITOPS_GIT_HOST_TYPES="gitlab.git.dev.weave.works=gitlab"
export GITLAB_HOSTNAME=“gitlab.git.dev.weave.works"
```
You can use any gitlab on-prem instance to run tests. However, `gitlab.git.dev.wkp.weave.works` instance is already setup and ready to use for development and testing purposes.
You can use any gitlab on-prem instance to run tests. However, `gitlab.git.dev.weave.works` instance is already setup and ready to use for development and testing purposes.
You must configure the gitlab oath application with redirect url as below. It is required for automated gitlab authentication flows (applicabel to both gilab sas and gitlab on-prem).
http://weave.gitops.enterprise.com:30080/oauth/gitlab

Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/test/cli_add_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func DescribeCliAddDelete(gitopsTestRunner GitopsTestRunner) {
cmd := fmt.Sprintf(`%s add cluster --from-template cluster-template-development-observability-0 --set CLUSTER_NAME=%s --set NAMESPACE=%s --set KUBERNETES_VERSION=%s --set CONTROL_PLANE_MACHINE_COUNT=1 --set WORKER_MACHINE_COUNT=1 `, gitops_bin_path, clusterName, namespace, k8version) +
fmt.Sprintf(`--profile 'name=podinfo,version=6.0.1' --branch "%s" --title "%s" --url %s --commit-message "%s" --description "%s" --endpoint %s %s`, prBranch, prTitle, git_repository_url, prCommit, prDescription, capi_endpoint_url, insecureFlag)
By(fmt.Sprintf("And I run '%s'", cmd), func() {
stdOut, stdErr = runCommandAndReturnStringOutput(cmd)
stdOut, stdErr = runCommandAndReturnStringOutput(cmd, ASSERTION_30SECONDS_TIME_OUT)
})

By("Then I should see pull request created to management cluster", func() {
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/test/cli_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ func DescribeCliUpgrade(gitopsTestRunner GitopsTestRunner) {
serviceType, _ := runCommandAndReturnStringOutput(fmt.Sprintf(`kubectl get service weave-gitops-enterprise-nginx-ingress-controller -n %s -o jsonpath="{.spec.type}"`, GITOPS_DEFAULT_NAMESPACE))
// serviceType, _ := runCommandAndReturnStringOutput(fmt.Sprintf(`kubectl get service clusters-service -n %s -o jsonpath="{.spec.type}"`, GITOPS_DEFAULT_NAMESPACE))
if serviceType == "NodePort" {
capi_endpoint_url = fmt.Sprintf(`http://%s:%s`, GetEnv("MANAGEMENT_CLUSTER_CNAME", "localhost"), UI_NODEPORT)
test_ui_url = fmt.Sprintf(`http://%s:%s`, GetEnv("MANAGEMENT_CLUSTER_CNAME", "localhost"), UI_NODEPORT)
capi_endpoint_url = fmt.Sprintf(`http://%s:%s`, GetEnv("UPGRADE_MANAGEMENT_CLUSTER_CNAME", "localhost"), UI_NODEPORT)
test_ui_url = fmt.Sprintf(`http://%s:%s`, GetEnv("UPGRADE_MANAGEMENT_CLUSTER_CNAME", "localhost"), UI_NODEPORT)
} else {
commandToRun := fmt.Sprintf("kubectl port-forward --namespace %s svc/clusters-service 8000:80", GITOPS_DEFAULT_NAMESPACE)

Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/test/ui_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -1215,9 +1215,9 @@ func DescribeTemplates(gitopsTestRunner GitopsTestRunner) {

Expect(webDriver.Refresh()).ShouldNot(HaveOccurred())
if beFound {
Eventually(checkOutput, ASSERTION_DEFAULT_TIME_OUT, POLL_INTERVAL_5SECONDS).Should(BeTrue())
Eventually(checkOutput, ASSERTION_30SECONDS_TIME_OUT, POLL_INTERVAL_5SECONDS).Should(BeTrue())
} else {
Eventually(checkOutput, ASSERTION_DEFAULT_TIME_OUT, POLL_INTERVAL_5SECONDS).Should(BeFalse())
Eventually(checkOutput, ASSERTION_30SECONDS_TIME_OUT, POLL_INTERVAL_5SECONDS).Should(BeFalse())
}

}
Expand Down
30 changes: 18 additions & 12 deletions test/utils/scripts/wego-enterprise.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ function setup {
exit 1
fi

if [ "$(uname -s)" == "Linux" ]; then
LOCALHOST_IP=$(ifconfig eth0 | grep -i MASK | awk '{print $2}' | cut -f2 -d:)
elif [ "$(uname -s)" == "Darwin" ]; then
LOCALHOST_IP=$(ifconfig en0 | grep -i MASK | awk '{print $2}' | cut -f2 -d:)
fi

if [ "$MANAGEMENT_CLUSTER_KIND" == "eks" ] || [ "$MANAGEMENT_CLUSTER_KIND" == "gke" ]; then
WORKER_NAME=$(kubectl get node --selector='!node-role.kubernetes.io/master' -o name | head -n 1 | cut -d '/' -f2-)
WORKER_NODE_EXTERNAL_IP=$(kubectl get nodes -o jsonpath="{.items[?(@.metadata.name=='${WORKER_NAME}')].status.addresses[?(@.type=='ExternalIP')].address}")
Expand All @@ -30,19 +36,17 @@ function setup {
gcloud compute firewall-rules create nats-node-port --allow tcp:${NATS_NODEPORT}
gcloud compute firewall-rules create ui-node-port --allow tcp:${UI_NODEPORT}
fi
elif [ -z ${WORKER_NODE_EXTERNAL_IP} ]; then
# MANAGEMENT_CLUSTER_KIND is a KIND cluster
if [ "$(uname -s)" == "Linux" ]; then
WORKER_NODE_EXTERNAL_IP=$(ifconfig eth0 | grep -i MASK | awk '{print $2}' | cut -f2 -d:)
elif [ "$(uname -s)" == "Darwin" ]; then
WORKER_NODE_EXTERNAL_IP=$(ifconfig en0 | grep -i MASK | awk '{print $2}' | cut -f2 -d:)
elif [ -z ${WORKER_NODE_EXTERNAL_IP} ]; then
# MANAGEMENT_CLUSTER_KIND is a KIND cluster
WORKER_NODE_EXTERNAL_IP=${LOCALHOST_IP}
fi
fi

# Sets enterprise CNAME host entry in the hosts file
# Set enterprise cluster CNAME host entry in the hosts file
hostEntry=$(cat /etc/hosts | grep "${WORKER_NODE_EXTERNAL_IP} ${MANAGEMENT_CLUSTER_CNAME}")
if [ -z $hostEntry ]; then
upgradeHostEntry=$(cat /etc/hosts | grep "${LOCALHOST_IP} ${UPGRADE_MANAGEMENT_CLUSTER_CNAME}")
if [ -z "${hostEntry}" ] || [ -z "${upgradeHostEntry}" ]; then
echo "${WORKER_NODE_EXTERNAL_IP} ${MANAGEMENT_CLUSTER_CNAME}" | sudo tee -a /etc/hosts
echo "${LOCALHOST_IP} ${UPGRADE_MANAGEMENT_CLUSTER_CNAME}" | sudo tee -a /etc/hosts
fi

kubectl create namespace prom
Expand Down Expand Up @@ -91,9 +95,8 @@ function setup {

# Install weave gitops core controllers
$GITOPS_BIN_PATH install --config-repo ${GIT_REPOSITORY_URL} ${gitopsArgs[@]} --auto-merge

kubectl apply -f ${args[1]}/test/utils/scripts/entitlement-secret.yaml
kubectl apply -f ${args[1]}/test/utils/data/gitlab-on-prem-ssh-config.yaml

kubectl apply -f ${args[1]}/test/utils/scripts/entitlement-secret.yaml

# Choosing weave-gitops-enterprise chart version to install
if [ -z ${ENTERPRISE_CHART_VERSION} ]; then
Expand Down Expand Up @@ -132,6 +135,9 @@ function setup {
helmArgs+=( --set "config.extraVolumes[0].configMap.name=ssh-config" )
helmArgs+=( --set "config.extraVolumeMounts[0].name=ssh-config" )
helmArgs+=( --set "config.extraVolumeMounts[0].mountPath=/root/.ssh" )

ssh-keyscan ${GIT_PROVIDER_HOSTNAME} > known_hosts
kubectl create configmap ssh-config --namespace wego-system --from-file=./known_hosts
fi

helm install my-mccp wkpv3/mccp --version "${CHART_VERSION}" --namespace wego-system ${helmArgs[@]}
Expand Down