Skip to content

Commit

Permalink
Merge branch 'master' into createttr
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrancisc authored Jan 17, 2025
2 parents d1487d0 + 57551c2 commit a68e63f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 18 deletions.
2 changes: 1 addition & 1 deletion dev_install.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Clone this repository +

This repository provides you multiple Makefile targets that you can use - it depends on which version of Dev Sandbox operators you want to install.

NOTE: If the cluster is an OSD cluster, then set the variable `IS_OSD=true` when running any of the Makefile targets (for example: `make appstudio-dev-deploy-latest IS_OSD=true`).
NOTE: If the connection to the cluster requires you to manually set the `--insecure-skip-tls-verify=true`, you can do so when running any of the Makefile targets by setting the DISABLE_KUBE_CLIENT_TLS_VERIFY variable to true (for example: `make appstudio-dev-deploy-latest DISABLE_KUBE_CLIENT_TLS_VERIFY=true`).

IMPORTANT: Make note of the Registration Service URL that is printed at the end of the target execution.

Expand Down
14 changes: 7 additions & 7 deletions make/dev.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ dev-deploy-e2e-two-members: deploy-e2e-to-dev-namespaces-two-members print-reg-s

.PHONY: deploy-e2e-to-dev-namespaces
deploy-e2e-to-dev-namespaces:
$(MAKE) deploy-e2e MEMBER_NS=${DEFAULT_MEMBER_NS} SECOND_MEMBER_MODE=false HOST_NS=${DEFAULT_HOST_NS} REGISTRATION_SERVICE_NS=${DEFAULT_HOST_NS} ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false IS_OSD=${IS_OSD} DEPLOY_LATEST=${DEPLOY_LATEST}
$(MAKE) deploy-e2e MEMBER_NS=${DEFAULT_MEMBER_NS} SECOND_MEMBER_MODE=false HOST_NS=${DEFAULT_HOST_NS} REGISTRATION_SERVICE_NS=${DEFAULT_HOST_NS} ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false DEPLOY_LATEST=${DEPLOY_LATEST}
$(MAKE) setup-dev-sso DEV_SSO=${DEV_SSO}

.PHONY: deploy-e2e-to-dev-namespaces-two-members
deploy-e2e-to-dev-namespaces-two-members:
$(MAKE) deploy-e2e MEMBER_NS=${DEFAULT_MEMBER_NS} MEMBER_NS_2=${DEFAULT_MEMBER_NS_2} HOST_NS=${DEFAULT_HOST_NS} REGISTRATION_SERVICE_NS=${DEFAULT_HOST_NS} ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false IS_OSD=${IS_OSD}
$(MAKE) deploy-e2e MEMBER_NS=${DEFAULT_MEMBER_NS} MEMBER_NS_2=${DEFAULT_MEMBER_NS_2} HOST_NS=${DEFAULT_HOST_NS} REGISTRATION_SERVICE_NS=${DEFAULT_HOST_NS} ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false
$(MAKE) setup-dev-sso DEV_SSO=${DEV_SSO}

setup-dev-sso:
Expand All @@ -44,12 +44,12 @@ dev-deploy-e2e-local-two-members: deploy-e2e-local-to-dev-namespaces-two-members

.PHONY: deploy-e2e-local-to-dev-namespaces
deploy-e2e-local-to-dev-namespaces:
$(MAKE) deploy-e2e-local MEMBER_NS=${DEFAULT_MEMBER_NS} SECOND_MEMBER_MODE=false HOST_NS=${DEFAULT_HOST_NS} REGISTRATION_SERVICE_NS=${DEFAULT_HOST_NS} ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false IS_OSD=${IS_OSD}
$(MAKE) deploy-e2e-local MEMBER_NS=${DEFAULT_MEMBER_NS} SECOND_MEMBER_MODE=false HOST_NS=${DEFAULT_HOST_NS} REGISTRATION_SERVICE_NS=${DEFAULT_HOST_NS} ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false
$(MAKE) setup-dev-sso DEV_SSO=${DEV_SSO}

.PHONY: deploy-e2e-local-to-dev-namespaces-two-members
deploy-e2e-local-to-dev-namespaces-two-members:
$(MAKE) deploy-e2e-local MEMBER_NS=${DEFAULT_MEMBER_NS} MEMBER_NS_2=${DEFAULT_MEMBER_NS_2} HOST_NS=${DEFAULT_HOST_NS} REGISTRATION_SERVICE_NS=${DEFAULT_HOST_NS} ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false IS_OSD=${IS_OSD}
$(MAKE) deploy-e2e-local MEMBER_NS=${DEFAULT_MEMBER_NS} MEMBER_NS_2=${DEFAULT_MEMBER_NS_2} HOST_NS=${DEFAULT_HOST_NS} REGISTRATION_SERVICE_NS=${DEFAULT_HOST_NS} ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false
$(MAKE) setup-dev-sso DEV_SSO=${DEV_SSO}


Expand Down Expand Up @@ -93,14 +93,14 @@ print-reg-service-link:
.PHONY: dev-deploy-e2e-member-local
## Deploy the e2e resources with the local 'member-operator' repository only
dev-deploy-e2e-member-local:
$(MAKE) dev-deploy-e2e MEMBER_REPO_PATH=${PWD}/../member-operator ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false IS_OSD=${IS_OSD}
$(MAKE) dev-deploy-e2e MEMBER_REPO_PATH=${PWD}/../member-operator ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false

.PHONY: dev-deploy-e2e-host-local
## Deploy the e2e resource with the local 'host-operator' repository only
dev-deploy-e2e-host-local:
$(MAKE) dev-deploy-e2e HOST_REPO_PATH=${PWD}/../host-operator ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false IS_OSD=${IS_OSD}
$(MAKE) dev-deploy-e2e HOST_REPO_PATH=${PWD}/../host-operator ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false

.PHONY: dev-deploy-e2e-registration-local
## Deploy the e2e resources with the local 'registration-service' repository only
dev-deploy-e2e-registration-local:
$(MAKE) dev-deploy-e2e REG_REPO_PATH=${PWD}/../registration-service ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false IS_OSD=${IS_OSD}
$(MAKE) dev-deploy-e2e REG_REPO_PATH=${PWD}/../registration-service ENVIRONMENT=${DEV_ENVIRONMENT} E2E_TEST_EXECUTION=false
12 changes: 6 additions & 6 deletions make/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ endif

E2E_TEST_EXECUTION ?= true

ifneq ($(IS_OSD),true)
LETS_ENCRYPT_PARAM := --lets-encrypt=false
ifeq ($(DISABLE_KUBE_CLIENT_TLS_VERIFY),true)
KSCTL_TLS_VERIFY_PARAM := --insecure-skip-tls-verify=true
endif

TESTS_RUN_FILTER_REGEXP ?= ""
Expand Down Expand Up @@ -78,7 +78,7 @@ e2e-migration-verify:

.PHONY: e2e-deploy-latest
e2e-deploy-latest:
$(MAKE) get-publish-install-and-register-operators MEMBER_NS=${MEMBER_NS} MEMBER_NS_2=${MEMBER_NS_2} HOST_NS=${HOST_NS} REGISTRATION_SERVICE_NS=${REGISTRATION_SERVICE_NS} ENVIRONMENT=${ENVIRONMENT} INSTALL_OPERATOR=${INSTALL_OPERATOR} DEPLOY_LATEST=true LETS_ENCRYPT_PARAM=${LETS_ENCRYPT_PARAM}
$(MAKE) get-publish-install-and-register-operators MEMBER_NS=${MEMBER_NS} MEMBER_NS_2=${MEMBER_NS_2} HOST_NS=${HOST_NS} REGISTRATION_SERVICE_NS=${REGISTRATION_SERVICE_NS} ENVIRONMENT=${ENVIRONMENT} INSTALL_OPERATOR=${INSTALL_OPERATOR} DEPLOY_LATEST=true KSCTL_TLS_VERIFY_PARAM=${KSCTL_TLS_VERIFY_PARAM}

.PHONY: prepare-e2e
prepare-e2e: build clean-e2e-files
Expand Down Expand Up @@ -263,8 +263,8 @@ print-operator-logs:

.PHONY: setup-toolchainclusters
setup-toolchainclusters: ksctl
${KSCTL_BIN_DIR}ksctl adm register-member --host-ns="$(HOST_NS)" --member-ns="$(MEMBER_NS)" --host-kubeconfig="$(or ${KUBECONFIG}, ${HOME}/.kube/config)" --member-kubeconfig="$(or ${KUBECONFIG}, ${HOME}/.kube/config)" ${LETS_ENCRYPT_PARAM} -y
if [[ ${SECOND_MEMBER_MODE} == true ]]; then ${KSCTL_BIN_DIR}ksctl adm register-member --host-ns="$(HOST_NS)" --member-ns="$(MEMBER_NS_2)" --host-kubeconfig="$(or ${KUBECONFIG}, ${HOME}/.kube/config)" --member-kubeconfig="$(or ${KUBECONFIG}, ${HOME}/.kube/config)" ${LETS_ENCRYPT_PARAM} --name-suffix="2" -y ; fi
${KSCTL_BIN_DIR}ksctl adm register-member --host-ns="$(HOST_NS)" --member-ns="$(MEMBER_NS)" --host-kubeconfig="$(or ${KUBECONFIG}, ${HOME}/.kube/config)" --member-kubeconfig="$(or ${KUBECONFIG}, ${HOME}/.kube/config)" ${KSCTL_TLS_VERIFY_PARAM} -y
if [[ ${SECOND_MEMBER_MODE} == true ]]; then ${KSCTL_BIN_DIR}ksctl adm register-member --host-ns="$(HOST_NS)" --member-ns="$(MEMBER_NS_2)" --host-kubeconfig="$(or ${KUBECONFIG}, ${HOME}/.kube/config)" --member-kubeconfig="$(or ${KUBECONFIG}, ${HOME}/.kube/config)" ${KSCTL_TLS_VERIFY_PARAM} --name-suffix="2" -y ; fi


.PHONY: deploy-single-member-e2e
Expand Down Expand Up @@ -468,4 +468,4 @@ test-support:

.PHONY: test-setup
test-setup:
@go test github.com/codeready-toolchain/toolchain-e2e/setup/... -failfast
@go test github.com/codeready-toolchain/toolchain-e2e/setup/... -failfast
26 changes: 22 additions & 4 deletions test/e2e/parallel/user_workloads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
)

Expand Down Expand Up @@ -117,15 +118,22 @@ func prepareWorkloads(t *testing.T, memberAwait *wait.MemberAwaitility, namespac
createJob(t, memberAwait, namespace)
n++

dc := createDeploymentConfig(t, memberAwait, namespace)
dc := createDeploymentConfig(t, memberAwait, types.NamespacedName{Namespace: namespace, Name: "idler-test-dc"})
n = n + int(dc.Spec.Replicas)

// create another DeploymentConfig that will be paused to test that the idler will unpause it when scaling it down
dcPaused := createDeploymentConfig(t, memberAwait, types.NamespacedName{Namespace: namespace, Name: "idler-test-dc-paused"})
n = n + int(dcPaused.Spec.Replicas)

rc := createReplicationController(t, memberAwait, namespace)
n = n + int(*rc.Spec.Replicas)

pods, err := memberAwait.WaitForPods(t, namespace, n, append(additionalPodCriteria, wait.PodRunning(),
wait.WithPodLabel("idler", "idler"))...)
require.NoError(t, err)

// pause the dcPaused DeploymentConfig now that its pods are running
pauseDeploymentConfig(t, memberAwait, types.NamespacedName{Namespace: dcPaused.Namespace, Name: dcPaused.Name})
return pods
}

Expand Down Expand Up @@ -193,12 +201,12 @@ func createJob(t *testing.T, memberAwait *wait.MemberAwaitility, namespace strin
return job
}

func createDeploymentConfig(t *testing.T, memberAwait *wait.MemberAwaitility, namespace string) *openshiftappsv1.DeploymentConfig {
// Create a Deployment with two pods
func createDeploymentConfig(t *testing.T, memberAwait *wait.MemberAwaitility, namespacedName types.NamespacedName) *openshiftappsv1.DeploymentConfig {
// Create a DeploymentConfig with two pods
spec := podTemplateSpec("idler-dc")
replicas := int32(2)
dc := &openshiftappsv1.DeploymentConfig{
ObjectMeta: metav1.ObjectMeta{Name: "idler-test-dc", Namespace: namespace},
ObjectMeta: metav1.ObjectMeta{Name: namespacedName.Name, Namespace: namespacedName.Namespace},
Spec: openshiftappsv1.DeploymentConfigSpec{
Selector: selectorLabels("idler-dc"),
Replicas: replicas,
Expand All @@ -211,6 +219,16 @@ func createDeploymentConfig(t *testing.T, memberAwait *wait.MemberAwaitility, na
return dc
}

func pauseDeploymentConfig(t *testing.T, memberAwait *wait.MemberAwaitility, namespacedName types.NamespacedName) *openshiftappsv1.DeploymentConfig {
dc, err := wait.For(t, memberAwait.Awaitility, &openshiftappsv1.DeploymentConfig{}).
Update(namespacedName.Name, namespacedName.Namespace,
func(dc *openshiftappsv1.DeploymentConfig) {
dc.Spec.Paused = true
})
require.NoError(t, err)
return dc
}

func createReplicationController(t *testing.T, memberAwait *wait.MemberAwaitility, namespace string) *corev1.ReplicationController {
// Standalone ReplicationController
spec := podTemplateSpec("idler-rc")
Expand Down

0 comments on commit a68e63f

Please sign in to comment.