Skip to content

Commit c6fc8ad

Browse files
authored
Updated the go version in go.mod (#316)
* Updated the go version in go.mod Ran `go mod tidy` Updated travis.yml Deleted staled code, disabled the quota manager in the controller. * Added travis changes. * Removed linter install Ported changes to .travis.yml from quota-management-branch * Removed linter install Ported changes to .travis.yml from quota-management-branch * Downgraded go to version 1.18 to allow for use of ubi images. * Added use of docker builder using ubi8 images Makefile updates * Cleaned up the obsolete build scripts Updated documentation Minor changes to makefile * Small fix to the docker file. * More updates to go.mod to fix vulnerabilities * Removed text files. * Yet another text file removal * Small fix to address PR review comments.
1 parent bc8fca0 commit c6fc8ad

23 files changed

+304
-2774
lines changed

.travis.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ services:
99
- docker
1010

1111
go:
12-
- "1.16.3"
12+
- "1.18.10"
1313

1414
go_import_path: github.com/project-codeflare/multi-cluster-app-dispatcher
1515

16-
install:
17-
- go get -u golang.org/x/lint/golint
16+
install: []
17+
1818

1919
before_script:
2020
- export TEST_LOG_LEVEL=4
2121

2222
script:
23-
# - make
23+
- BLUE='\033[34m'
2424
- make mcad-controller
2525
- make run-test
2626
# Process 'make images' when NOT a pull request
@@ -29,4 +29,11 @@ script:
2929
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then unset quay_repository && make images; fi'
3030
# Process 'make push-images' when NOT a pull request
3131
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make push-images; fi'
32-
- travis_wait 80 make run-e2e
32+
# Run the e2e and handle Travis condition where Travis fails on no output for 10 minutes. No output for 10 minutes
33+
# is fine for our test cases that waits for 10 minutes before requeuing a job. The other workaround was to
34+
# use 'travis_wait n' which unfortunately does not stream output until the very end so monitoring the Travis log
35+
# during runtime is not possible.
36+
- make run-e2e &
37+
- PID=$! && echo -e "${BLUE}make run e2e pid=${PID}"
38+
- while [ -e /proc/${PID} ]; do echo -n "." && sleep 30; done
39+
- wait ${PID}

deployment/Dockerfile.both renamed to Dockerfile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1+
FROM registry.access.redhat.com/ubi8/go-toolset:1.18.10-1 AS BUILDER
2+
USER root
3+
WORKDIR /workdir
4+
5+
COPY Makefile Makefile
6+
COPY go.mod go.mod
7+
COPY go.sum go.sum
8+
COPY cmd cmd
9+
COPY pkg pkg
10+
COPY hack hack
11+
12+
RUN make mcad-controller
13+
114
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
215

3-
ADD mcad-controller /usr/local/bin
16+
COPY --from=BUILDER /workdir/_output/bin/mcad-controller /usr/local/bin
417

518
RUN true \
619
&& microdnf update \

Makefile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TAG:=${TAG}${RELEASE_VER}
2727
# Build the controler executalbe for use in docker image build
2828
mcad-controller: init generate-code
2929
$(info Compiling controller)
30-
CGO_ENABLED=0 GOOS="linux" go build -o ${BIN_DIR}/mcad-controller ./cmd/kar-controllers/
30+
CGO_ENABLED=0 go build -o ${BIN_DIR}/mcad-controller ./cmd/kar-controllers/
3131

3232
print-global-variables:
3333
$(info "---")
@@ -56,21 +56,20 @@ generate-code:
5656
$(info Generating deepcopy...)
5757
${BIN_DIR}/deepcopy-gen -i ./pkg/apis/controller/v1beta1/ -O zz_generated.deepcopy
5858

59-
images: verify-tag-name mcad-controller
59+
images: verify-tag-name
6060
$(info List executable directory)
6161
$(info repo id: ${git_repository_id})
6262
$(info branch: ${GIT_BRANCH})
63-
ls -l ${CURRENT_DIR}/_output/bin
6463
$(info Build the docker image)
65-
docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/deployment/Dockerfile.both ${CURRENT_DIR}/_output/bin
64+
docker build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
6665

67-
images-podman: verify-tag-name mcad-controller
66+
images-podman: verify-tag-name
6867
$(info List executable directory)
6968
$(info repo id: ${git_repository_id})
7069
$(info branch: ${GIT_BRANCH})
7170
ls -l ${CURRENT_DIR}/_output/bin
7271
$(info Build the docker image)
73-
podman build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/deployment/Dockerfile.both ${CURRENT_DIR}/_output/bin
72+
podman build --quiet --no-cache --tag mcad-controller:${TAG} -f ${CURRENT_DIR}/Dockerfile ${CURRENT_DIR}
7473

7574
push-images: verify-tag-name
7675
ifeq ($(strip $(quay_repository)),)
@@ -95,7 +94,7 @@ run-test:
9594
$(info Running unit tests...)
9695
hack/make-rules/test.sh $(WHAT) $(TESTS)
9796

98-
run-e2e: mcad-controller verify-tag-name
97+
run-e2e: verify-tag-name
9998
ifeq ($(strip $(quay_repository)),)
10099
echo "Running e2e with MCAD local image: mcad-controller ${TAG} IfNotPresent."
101100
hack/run-e2e-kind.sh mcad-controller ${TAG} IfNotPresent
@@ -104,12 +103,10 @@ else
104103
hack/run-e2e-kind.sh ${quay_repository}/mcad-controller ${TAG}
105104
endif
106105

107-
mcad-controller-private: init generate-code
108-
$(info Compiling controller)
109-
CGO_ENABLED=0 GOARCH=amd64 GOPRIVATE=github.ibm.com/* go build -tags private -modfile ./private.mod -o ${BIN_DIR}/mcad-controller ./cmd/kar-controllers/
110106

111107
# Build the controller executable for use on the local host and using local build args
112-
# the default for local build args is `-race` to turn race detection
108+
# the default for local build args is `-race` to turn race detection, this is not to be used
109+
# inside the docker containers.
113110
mcad-controller-local: init generate-code
114111
$(info Compiling controller)
115112
go build ${LOCAL_BUILD_ARGS} -o ${BIN_DIR}/mcad-controller-local ./cmd/kar-controllers/
@@ -119,4 +116,3 @@ coverage:
119116

120117
clean:
121118
rm -rf _output/
122-
rm -f mcad-controllers

deployment/build-inside-container-private.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

deployment/build-inside-container.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

deployment/build-podman.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

deployment/build-private.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

deployment/build.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

deployment/image-podman.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

deployment/image.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

doc/build/build.md

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -91,69 +91,47 @@ From the root directory of the repository:
9191
```bash
9292
# With docker daemon running
9393
multi-cluster-app-dispatcher % make images
94-
9594
....
96-
97-
# output from a local branch, MacOS build, local file names replaced with XXXXXXXXXX
95+
# output from main branch, MacOS build, local file names replaced with XXXXXXXXXX
9896
"---"
9997
"MAKE GLOBAL VARIABLES:"
10098
" "BIN_DIR="_output/bin"
101-
" "GIT_BRANCH="local_e2e_test"
99+
" "GIT_BRANCH="main"
102100
" "RELEASE_VER="v1.29.55"
103-
" "TAG="local_e2e_test-v1.29.55"
101+
" "TAG="main-v1.29.55"
104102
"---"
105103
# Check for invalid tag name
106-
t=local_e2e_test-v1.29.55 && [ ${#t} -le 128 ] || { echo "Target name $t has 128 or more chars"; false; }
107-
mkdir -p _output/bin
108-
Compiling deepcopy-gen...
109-
Generating deepcopy...
110-
go build -o _output/bin/deepcopy-gen ./cmd/deepcopy-gen/
111-
_output/bin/deepcopy-gen -i ./pkg/apis/controller/v1beta1/ -O zz_generated.deepcopy
112-
Compiling controller
113-
CGO_ENABLED=0 GOOS="linux" go build -o _output/bin/mcad-controller ./cmd/kar-controllers/
104+
t=main-v1.29.55 && [ ${#t} -le 128 ] || { echo "Target name $t has 128 or more chars"; false; }
114105
List executable directory
115106
repo id:
116-
branch: local_e2e_test
107+
branch: main
117108
Build the docker image
118-
ls -l XXXXXXXXXXXX/multi-cluster-app-dispatcher/_output/bin
119-
total 268768
120-
-rwxr-xr-x 1 XXXXX staff 8238498 Apr 4 12:46 deepcopy-gen
121-
-rwxr-xr-x 1 XXXXX staff 57584808 Apr 4 12:47 mcad-controller
122-
docker build --quiet --no-cache --tag mcad-controller:local_e2e_test-v1.29.55 -f XXXXXXXX/multi-cluster-app-dispatcher/deployment/Dockerfile.both XXXXXX/multi-cluster-app-dispatcher/_output/bin
123-
sha256:3b4f314b06674f6b52d6a5d77ad1d3d9cebf8fa94a9f80026b02813689c3289d
109+
docker build --quiet --no-cache --tag mcad-controller:main-v1.29.55 -f XXXXXXXXXX/multi-cluster-app-dispatcher/Dockerfile XXXXXXXXXX/multi-cluster-app-dispatcher
110+
sha256:6871c150701280abc29baa14aa639791cefb9ba4b61177ab4faf5a43bdfcc4e4
124111

125112
#Using podman
126113
make images-podman
127-
128114
....
129-
130-
# output from a local branch, MacOS build, local file names replaced with XXXXXXXXXX
115+
# output from a main branch, MacOS build, local file names replaced with XXXXXXXXXX
131116
"---"
132117
"MAKE GLOBAL VARIABLES:"
133118
" "BIN_DIR="_output/bin"
134-
" "GIT_BRANCH="local_e2e_test"
119+
" "GIT_BRANCH="main"
135120
" "RELEASE_VER="v1.29.55"
136-
" "TAG="local_e2e_test-v1.29.55"
121+
" "TAG="main-v1.29.55"
137122
"---"
138123
# Check for invalid tag name
139-
t=local_e2e_test-v1.29.55 && [ ${#t} -le 128 ] || { echo "Target name $t has 128 or more chars"; false; }
140-
mkdir -p _output/bin
141-
Compiling deepcopy-gen...
142-
Generating deepcopy...
143-
go build -o _output/bin/deepcopy-gen ./cmd/deepcopy-gen/
144-
_output/bin/deepcopy-gen -i ./pkg/apis/controller/v1beta1/ -O zz_generated.deepcopy
145-
Compiling controller
146-
CGO_ENABLED=0 GOOS="linux" go build -o _output/bin/mcad-controller ./cmd/kar-controllers/
124+
t=main-v1.29.55 && [ ${#t} -le 128 ] || { echo "Target name $t has 128 or more chars"; false; }
147125
List executable directory
148126
repo id:
149-
branch: local_e2e_test
127+
branch: main
150128
Build the docker image
151129
ls -l XXXXXXXXXX/multi-cluster-app-dispatcher/_output/bin
152-
total 128568
153-
-rwxr-xr-x 1 XXXXXXXX staff 8238498 Apr 4 12:53 deepcopy-gen
154-
-rwxr-xr-x 1 XXXXXXXX staff 57584808 Apr 4 12:53 mcad-controller
155-
podman build --quiet --no-cache --tag mcad-controller:local_e2e_test-v1.29.55 -f XXXXXXXXXX/multi-cluster-app-dispatcher/deployment/Dockerfile.both XXXXXXXXXX/multi-cluster-app-dispatcher/_output/bin
156-
7553c702e5238920f44cba7303d1ff111aca1722e7e3ed4d49afbafa165fc3e3
130+
total 130144
131+
-rwxr-xr-x 1 laurentiu.bradin staff 8238498 Apr 6 15:19 deepcopy-gen
132+
-rwxr-xr-x 1 laurentiu.bradin staff 58391090 Apr 6 15:19 mcad-controller
133+
podman build --quiet --no-cache --tag mcad-controller:issue_315_small_changes-v1.29.55 -f XXXXXXXXXX/multi-cluster-app-dispatcher/Dockerfile XXXXXXXXXX/multi-cluster-app-dispatcher
134+
f784707e8982399ef7ef66e3d8a09b669e6deb17990d174400338813fb13c505
157135
```
158136
159137
### Push the Multi-Cluster-App-Dispatcher Image to an Image Repository
@@ -176,7 +154,7 @@ Refer to [deployment](../deploy/deployment.md) on how to deploy the `multi-clust
176154
177155
## 3. Running e2e tests locally
178156
179-
When running e2e tests, is recommended you restrict the `docker` daemon [cpu and memory resources](https://docs.docker.com/config/containers/resource_constraints/). The recomended settings are:
157+
When running e2e tests, is recommended you restrict the `docker` daemon [cpu and memory resources](https://docs.docker.com/config/containers/resource_constraints/). The recommended settings are:
180158
181159
* CPU: 2
182160
* Memory: 8 GB
@@ -185,5 +163,5 @@ From the root directory of the repository:
185163
186164
```bash
187165
# With docker daemon running
188-
multi-cluster-app-dispatcher % make run-e2e:
166+
multi-cluster-app-dispatcher % make run-e2e
189167
```

0 commit comments

Comments
 (0)