Skip to content

Commit

Permalink
Merge branch 'master' into new-predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
MatousJobanek authored Jan 8, 2025
2 parents 9d62475 + d1ae3ba commit ad47f65
Show file tree
Hide file tree
Showing 64 changed files with 2,283 additions and 1,300 deletions.
10 changes: 7 additions & 3 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
approvers:
- alexeykazakov
- MatousJobanek
- sbryzak
- xcoulon
- rajivnathan
- ranakan19
- mfrancisc
- fbm3307
- metlos
- rsoaresd

reviewers:
- alexeykazakov
- MatousJobanek
- sbryzak
- xcoulon
- rajivnathan
- ranakan19
- mfrancisc
- mfrancisc
- fbm3307
- metlos
- rsoaresd
19 changes: 14 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ There are multiple Makefile targets that will execute the e2e tests, they just d
* `make test-e2e-host-local` - this target clones only the https://github.com/codeready-toolchain/member-operator[member-operator] repo and builds an image from it. For host-operator, it builds the image from `../host-operator` directory. These images deploys to OpenShift and runs e2e tests against them.

The e2e tests will take care of creating all needed namespaces with random names (or see below for enforcing some specific namespace names).
It will also create all required CRDs, role and role bindings for the service accounts, build the Docker images for both operators and push them to the OpenShift container registry. Finally, it will deploy the operators and run the tests using the operator-sdk.
It will also create all required CRDs, role and role bindings for the service accounts, build the container images for both operators and push them to the OpenShift container registry. Finally, it will deploy the operators and run the tests using the operator-sdk.


NOTE: you can override the default namespace names where the end-to-end tests are going to be executed - eg.: `make test-e2e HOST_NS=my-host MEMBER_NS=my-member` file.
Expand All @@ -70,13 +70,17 @@ NOTE: you can disable SSL/TLS certificate verification in tests setting the `DIS

NOTE: you can specify a regular expression to selectively run particular test cases by setting the `TESTS_RUN_FILTER_REGEXP` variable. eg.: `make test-e2e TESTS_RUN_FILTER_REGEXP="TestSetupMigration"`. For more information see the https://pkg.go.dev/cmd/go#hdr-Testing_flags[go test -run documentation].

NOTE: you should not override `SECOND_MEMBER_MODE` in test-e2e, since the e2e tests require a second member operator.

=== Running/Debugging e2e tests from your IDE

In order to run/debug tests from your IDE you'll need to export some required env variables, those will be used by the test framework to interact with the operator namespaces and the other toolchain resources in you cluster.
Following snippet of code should be TEMPORARILY added at the top of the test you want to run/debug from your IDE:

```
os.Setenv("MEMBER_NS","toolchain-member-18161051")
// `SECOND_MEMBER_MODE` should be set to true, since the e2e tests require a second member operator.
os.Setenv("SECOND_MEMBER_MODE","true")
os.Setenv("MEMBER_NS_2","toolchain-member2-18161051")
os.Setenv("HOST_NS","toolchain-host-18161051")
os.Setenv("REGISTRATION_SERVICE_NS","toolchain-host-18161051")
Expand All @@ -95,6 +99,7 @@ import (

func TestCreateSpaceRequest(t *testing.T) {
os.Setenv("MEMBER_NS","toolchain-member-18161051")
os.Setenv("SECOND_MEMBER_MODE","true")
os.Setenv("MEMBER_NS_2","toolchain-member2-18161051")
os.Setenv("HOST_NS","toolchain-host-18161051")
os.Setenv("REGISTRATION_SERVICE_NS","toolchain-host-18161051")
Expand Down Expand Up @@ -144,19 +149,23 @@ If you are still confused by the different e2e/operator location, execution and
All e2e resources (host operator, member operator, registration-service, CRDs, etc) can be deployed without running tests:
* `make dev-deploy-e2e-local` - deploys the same resources as `make test-e2e-local` but doesn't run tests.
* `make dev-deploy-e2e-local` - deploys the same resources as `make test-e2e-local` in dev environment but doesn't run tests.
* `make dev-deploy-e2e` - deploys the same resources as `make test-e2e` in dev environment but doesn't run tests.
* `make dev-deploy-e2e` - deploys the same resources as `make test-e2e` but doesn't run tests.
* `make deploy-toolchain-resources-e2e` - deploys the same resources as `make test-e2e` but doesn't run tests.
By default these targets deploy resources to `toolchain-host-operator` and `toolchain-member-operator` namespaces.
NOTE: By default these targets deploy resources to `toolchain-host-operator` and `toolchain-member-operator` namespaces.
NOTE: If running in CodeReady Containers `eval $(crc oc-env)` is required.
NOTE: By default, `SECOND_MEMBER_MODE` is set to false.
== How to Test Mailgun/Twilio Notifications in a Dev Environment
* Get a cluster and setup the following env vars
** `export QUAY_NAMESPACE=<your-quay-namespace>`
** `export KUBECONFIG=<location-to-kubeconfig>`
* Run `docker login quay.io`
* Run `podman login quay.io`
* Create https://github.com/codeready-toolchain/toolchain-infra/tree/master/config/oauth[IdP]
* If you need to change any of the default configuration, modify the ToolchainConfig in https://github.com/codeready-toolchain/toolchain-e2e/blob/master/deploy/host-operator/dev/toolchainconfig.yaml[deploy/host-operator/dev/toolchainconfig.yaml]
* To set working notification/verification secrets, modify them in https://github.com/codeready-toolchain/toolchain-e2e/blob/master/deploy/host-operator/dev/secrets.yaml[deploy/host-operator/dev/secrets.yaml]
Expand Down
3 changes: 2 additions & 1 deletion deploy/host-operator/e2e-tests/toolchainconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ spec:
segmentWriteKey: 'test devspaces segment write key'
segmentWriteKey: 'test sandbox segment write key'
environment: 'e2e-tests'
replicas: 2
# same number that is set in https://github.com/codeready-toolchain/host-operator/blob/master/deploy/registration-service/registration-service.yaml#L272-L273
replicas: 3
verification:
enabled: true
excludedEmailDomains: 'redhat.com,acme.com'
Expand Down
13 changes: 13 additions & 0 deletions deploy/nstemplatetiers/appstudio-env/ns_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,19 @@ objects:
podSelector: {}
policyTypes:
- Ingress
- apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-from-dev-sandbox-managed-ns
namespace: ${SPACE_NAME}-env
spec:
ingress:
- from:
- namespaceSelector:
matchLabels:
dev-sandbox/policy-group: ingress
policyTypes:
- Ingress
parameters:
- name: SPACE_NAME
required: true
Expand Down
13 changes: 13 additions & 0 deletions deploy/nstemplatetiers/appstudio/ns_tenant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,19 @@ objects:
podSelector: {}
policyTypes:
- Ingress
- apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-from-dev-sandbox-managed-ns
namespace: ${SPACE_NAME}-tenant
spec:
ingress:
- from:
- namespaceSelector:
matchLabels:
dev-sandbox/policy-group: ingress
policyTypes:
- Ingress
# ServiceAccount and RoleBindings for running Pipelines.
# appstudio-pipelines-runner-clusterrole is deployed by the pipeline-service component.
- apiVersion: v1
Expand Down
105 changes: 56 additions & 49 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/codeready-toolchain/toolchain-e2e

require (
github.com/codeready-toolchain/api v0.0.0-20240927104325-b5bfcb3cb1b0
github.com/codeready-toolchain/toolchain-common v0.0.0-20240905135929-d55d86fdd41e
github.com/codeready-toolchain/api v0.0.0-20241119094246-f6581d52dc80
github.com/codeready-toolchain/toolchain-common v0.0.0-20241114215157-a6a85252b2f5
github.com/davecgh/go-spew v1.1.1
github.com/fatih/color v1.12.0
github.com/fatih/color v1.15.0
github.com/ghodss/yaml v1.0.0
github.com/gofrs/uuid v3.3.0+incompatible
github.com/google/go-cmp v0.5.9
Expand All @@ -13,64 +13,65 @@ require (
github.com/gosuri/uitable v0.0.4
github.com/hashicorp/go-multierror v1.1.1
github.com/manifoldco/promptui v0.9.0
// using latest commit from 'github.com/openshift/api branch release-4.12'
github.com/openshift/api v0.0.0-20230213134911-7ba313770556
// using latest commit from 'github.com/openshift/api branch release-4.14'
github.com/openshift/api v0.0.0-20241031180523-b1c90a6cf9a3
github.com/operator-framework/api v0.13.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.12.2
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.32.1
github.com/redhat-cop/operator-utils v1.3.3-0.20220121120056-862ef22b8cdf
github.com/spf13/cobra v1.4.0
github.com/prometheus/client_golang v1.15.1
github.com/prometheus/client_model v0.4.0
github.com/prometheus/common v0.42.0
github.com/redhat-cop/operator-utils v1.3.6
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.9.0
k8s.io/api v0.25.0
k8s.io/apimachinery v0.25.0
k8s.io/client-go v0.25.0
k8s.io/kubectl v0.25.0
k8s.io/metrics v0.25.0
sigs.k8s.io/controller-runtime v0.13.0
k8s.io/api v0.27.7
k8s.io/apimachinery v0.27.7
k8s.io/client-go v0.27.3
k8s.io/kubectl v0.27.3
k8s.io/metrics v0.27.3
sigs.k8s.io/controller-runtime v0.15.0
)

require github.com/google/uuid v1.6.0

require (
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-github/v52 v52.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gosuri/uilive v0.0.4 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/huandu/xstrings v1.3.1 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
Expand All @@ -79,44 +80,50 @@ require (
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/jwx v1.2.29 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/migueleliasweb/go-github-mock v0.0.18 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/openshift/library-go v0.0.0-20230301092340-c13b89190a26 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.21.0 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/h2non/gock.v1 v1.0.14 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.25.0 // indirect
k8s.io/component-base v0.25.0 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
k8s.io/apiextensions-apiserver v0.27.2 // indirect
k8s.io/cli-runtime v0.27.3 // indirect
k8s.io/component-base v0.27.3 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.2 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Expand Down
Loading

0 comments on commit ad47f65

Please sign in to comment.