Skip to content

Commit

Permalink
Merge pull request wildfly#310 from yersan/issue-309
Browse files Browse the repository at this point in the history
[wildfly#309] Fix default JBOSS_HOME directory
  • Loading branch information
yersan authored Aug 20, 2024
2 parents 6ec9f22 + 81bab76 commit 20bc416
Show file tree
Hide file tree
Showing 133 changed files with 1,372 additions and 2,417 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21.3 as builder
FROM golang:1.21.13 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -23,7 +23,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager

FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
ENV OPERATOR=/usr/local/bin/wildfly-operator \
JBOSS_HOME=/wildfly \
JBOSS_HOME=/opt/wildfly \
JBOSS_BOOTABLE_HOME=/opt/jboss/container/wildfly-bootable-jar-server \
JBOSS_BOOTABLE_DATA_DIR=/opt/jboss/container/wildfly-bootable-jar-data \
USER_UID=1001 \
Expand Down
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ endif

# Set the Operator SDK version to use. By default, what is installed on the system is used.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.25.0
OPERATOR_SDK_VERSION ?= v1.25.4

# Image URL to use all building/pushing image targets
IMG ?= quay.io/wildfly/wildfly-operator:latest
Expand Down Expand Up @@ -118,14 +118,18 @@ vet: ## Run go vet against code.

.PHONY: unit-test
unit-test: generate openapi fmt vet ## Run unit-tests.
go test -v $(shell go list ./... | grep -v /test/)
go test -v $(shell go list ./... | grep -v /test/) -coverprofile cover.out

.PHONY: test
test: manifests generate fmt vet controller-gen envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v ./test/e2e/... -coverprofile cover.out
.PHONY: test # Needs a cluster running and with a admin user logged in
test: clean manifests generate fmt vet controller-gen ## Run tests.
go test -v ./test/e2e/... -v -ginkgo.v

.PHONY: debug-test # Needs a cluster running and with a admin user logged in
debug-test: clean manifests generate fmt vet controller-gen dlv ## Run tests.
./bin/dlv test --listen=:2345 --headless=true --api-version=2 --accept-multiclient ./test/e2e/...

.PHONY: test-e2e
test-e2e: prepare-test-e2e run-test-e2e ## Run E2E tests running the Operator as a Deployment inside the cluster.
test-e2e: prepare-test-e2e run-test-e2e ## Used By CI.

## Run E2E tests running the Operator as a Deployment inside a local minikube cluster installation.
.PHONY: test-e2e-minikube
Expand All @@ -134,15 +138,15 @@ test-e2e-minikube: prepare-test-e2e
IMG="localhost:5000/wildfly-operator:latest" make docker-build docker-push run-test-e2e

.PHONY: prepare-test-e2e
prepare-test-e2e: manifests generate fmt vet envtest kustomize
prepare-test-e2e: manifests generate fmt vet kustomize

.PHONY: run-test-e2e
run-test-e2e:
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/rbac | kubectl apply -f -
mkdir -p dry-run
$(KUSTOMIZE) build config/tests > dry-run/test-resources.yaml
LOCAL_MANAGER=0 go test -timeout 20m -v ./test/e2e/... -coverprofile cover.out
LOCAL_MANAGER=0 go test -timeout 20m ./test/e2e/... -v -ginkgo.v
$(KUSTOMIZE) build config/rbac | kubectl delete --ignore-not-found=true -f -

.PHONY: clean
Expand All @@ -163,7 +167,7 @@ build: manifests generate openapi fmt vet ## Build manager binary.

.PHONY: run
run: manifests generate openapi fmt vet ## Run a controller from your host.
JBOSS_HOME=/wildfly \
JBOSS_HOME=/opt/wildfly \
JBOSS_BOOTABLE_DATA_DIR=/opt/jboss/container/wildfly-bootable-jar-data \
OPERATOR_NAME=wildfly-operator \
JBOSS_BOOTABLE_HOME=/opt/jboss/container/wildfly-bootable-jar-server \
Expand All @@ -183,7 +187,7 @@ vendor: tidy ## Add missing and remove unused modules and make vendored copy of

# Run the manager with debug enabled
debug: dlv build
JBOSS_HOME=/wildfly JBOSS_BOOTABLE_DATA_DIR=/opt/jboss/container/wildfly-bootable-jar-data \
JBOSS_HOME=/opt/wildfly JBOSS_BOOTABLE_DATA_DIR=/opt/jboss/container/wildfly-bootable-jar-data \
JBOSS_BOOTABLE_HOME=/opt/jboss/container/wildfly-bootable-jar-server OPERATOR_NAME=wildfly-operator \
./bin/dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec bin/manager

Expand Down
16 changes: 1 addition & 15 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ as a local application:

[source,shell]
----
$ make local-test
$ make test
----

The test suite creates the resources for each test under the `wildfly-op-test-ns` namespace.
Expand All @@ -371,13 +371,6 @@ You can monitor the resources created by the test suite in a different terminal
$ kubectl get pods -w -n wildfly-op-test-ns
----

If you stop the execution or if a test fails, you have to clean any resource left in your cluster before running the tests again:

[source,shell]
----
$ make clean
----

Note: Transaction recovery tests will be skipped under this mode since they cannot run outside the cluster.

#### Run end-to-end (e2e) tests in Deploy Mode
Expand Down Expand Up @@ -407,13 +400,6 @@ You can monitor the resources created by the test suite in a different terminal
$ oc get pods -w -n wildfly-op-test-ns
----

If a test fails or if you stop the testsuite before it finish normally, clean up the resources before starting it again

[source,shell]
----
$ make clean
----

### OLM installation

You can also install the Operator by using OLM. This could be useful to verify how changes in the CSV will be
Expand Down
12 changes: 9 additions & 3 deletions config/crd/bases/wildfly.org_wildflyservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ spec:
used in HTTP probes
properties:
name:
description: The header field name
description: The header field name. This will be canonicalized
upon output, so case-variant names will be understood
as the same header.
type: string
value:
description: The header field value
Expand Down Expand Up @@ -360,7 +362,9 @@ spec:
used in HTTP probes
properties:
name:
description: The header field name
description: The header field name. This will be canonicalized
upon output, so case-variant names will be understood
as the same header.
type: string
value:
description: The header field value
Expand Down Expand Up @@ -683,7 +687,9 @@ spec:
used in HTTP probes
properties:
name:
description: The header field name
description: The header field name. This will be canonicalized
upon output, so case-variant names will be understood
as the same header.
type: string
value:
description: The header field value
Expand Down
23 changes: 11 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ go 1.20
require (
github.com/RHsyseng/operator-utils v1.4.13
github.com/go-logr/logr v1.2.4
github.com/onsi/ginkgo/v2 v2.1.4
github.com/onsi/gomega v1.19.0
github.com/onsi/ginkgo/v2 v2.1.6
github.com/onsi/gomega v1.20.1
github.com/openshift/api v0.0.0-20211209135129-c58d9f695577
github.com/operator-framework/operator-lib v0.11.0
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.67.1
github.com/stretchr/testify v1.8.2
github.com/tevino/abool v1.2.0
Expand All @@ -19,6 +18,7 @@ require (
k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/controller-runtime v0.15.0
sigs.k8s.io/yaml v1.3.0
)

require (
Expand Down Expand Up @@ -67,11 +67,11 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
Expand All @@ -85,12 +85,11 @@ require (
k8s.io/klog/v2 v2.100.1 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace (
k8s.io/api => k8s.io/api v0.25.0
k8s.io/apimachinery => k8s.io/apimachinery v0.25.0
k8s.io/client-go => k8s.io/client-go v0.25.0
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.13.0
k8s.io/api => k8s.io/api v0.25.15
k8s.io/apimachinery => k8s.io/apimachinery v0.25.15
k8s.io/client-go => k8s.io/client-go v0.25.15
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.13.2
)
Loading

0 comments on commit 20bc416

Please sign in to comment.