Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync main branch with Apache main branch #4

Merged
merged 21 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4d125c4
Fix #317 - Make namespace an optional parameter when generating manif…
ricardozanini Dec 13, 2023
c8bd143
kogito-serverless-operator-331: Operator service discovery is not act…
wmedvede Dec 19, 2023
5400ae4
[KOGITO-9940] Add Job Service to SonataFlowPlatform CRD (#311)
jordigilh Dec 20, 2023
6e9cc5e
Fix #333 - :lock: Bump crypto to 0.17.0 (#334)
ricardozanini Dec 20, 2023
171af7d
[KOGITO-8792] - Add events to build controllers and the ability to re…
ricardozanini Dec 20, 2023
70977e4
kie-issues-314: Operator driven service discovery API Phase3 (#316)
wmedvede Dec 21, 2023
df304a1
Fix #336 - Upgrade Knative Serving to 0.39.0 (#339)
ricardozanini Jan 8, 2024
c9b1782
kogito-serverless-operator-343: Move workflows execution JDK to java1…
wmedvede Jan 9, 2024
9b66f95
Set selector and label specific to platform service (#341)
masayag Jan 11, 2024
15c3ff8
kogito-serverless-operator-356: Temporary use of the nightly images (…
wmedvede Jan 11, 2024
0d29f8d
kie-issues#755 - Increase E2E tests timeouts (#349)
rodrigonull Jan 12, 2024
e24b963
Use constant for domain name (#351)
masayag Jan 16, 2024
094b6f8
[SRVLOGIC-196] Rollout operator's deployment when custom configuratio…
dmartinol Jan 17, 2024
711679d
[KOGITO-10013] Migrate from Minikube to Kind for E2E tests and export…
jordigilh Jan 18, 2024
a396205
kie-kogito-serverless-operator-335: Operator driven service discovery…
wmedvede Jan 19, 2024
1691e2f
[KIE-830] Make SonataFlow Operator build reproducible (#357)
ricardozanini Jan 19, 2024
7fe6188
kogito-serverless-operator-353: Enable the sending of the process def…
wmedvede Jan 23, 2024
db96a11
Fix #364 pipelines using an old Ubuntu version (#365)
ricardozanini Jan 24, 2024
820006e
[KOGITO-9940] Add E2E test cases for platform configured with Job Ser…
jordigilh Jan 24, 2024
7bbcc0e
[KOGITO-9982] Add Persistence field in SonataFlow CRD (#322)
jordigilh Jan 26, 2024
65f1c35
Fix #359 - Change pullpolicy conditionally based on image tag (#362)
ricardozanini Jan 26, 2024
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
9 changes: 5 additions & 4 deletions .github/workflows/check-container-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup golang
uses: actions/setup-go@v2
with:
go-version: 1.19
go-version: 1.21
- name: Checkout code
uses: actions/checkout@v2
with:
Expand All @@ -53,18 +53,19 @@ jobs:
cancel-in-progress: true
timeout-minutes: 120
name: Integration tests (${{ matrix.container-engine }})
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Install packages
run: |
sudo apt-get -y install \
sudo apt-get update &&\
sudo apt-get -y install --no-install-recommends \
libgpgme-dev \
libbtrfs-dev \
libdevmapper-dev
- name: Setup golang
uses: actions/setup-go@v2
with:
go-version: 1.19
go-version: 1.21
- name: Checkout code
uses: actions/checkout@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- ".ci/jenkins/**"

env:
GO_VERSION: 1.19
GO_VERSION: 1.21

jobs:
unit-tests:
Expand Down Expand Up @@ -87,10 +87,10 @@ jobs:
uses: actions/checkout@v3

# since we now have to download container-builder deps, we need these packages installed before generating our types.
# we should be able to remove this after https://issues.redhat.com/browse/KOGITO-9106
- name: Install packages
run: |
sudo apt-get -y install \
sudo apt-get update &&\
sudo apt-get -y install --no-install-recommends \
btrfs-progs \
libgpgme-dev \
libbtrfs-dev \
Expand Down
80 changes: 30 additions & 50 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ on:
- ".ci/jenkins/**"

env:
GO_VERSION: 1.19
# Kubernetes version should aligned with OCP LTS, aka OCP 4.10 (k8s 1.23) for now
# https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.23.md
# WARNING: kindest/node is not always existing with given version ...
KUBERNETES_VERSION: v1.26.3
DEBUG: true
GO_VERSION: 1.21
KIND_VERSION: v0.20.0

jobs:
e2e:
Expand All @@ -26,7 +22,7 @@ jobs:
cancel-in-progress: true
timeout-minutes: 120
runs-on: ubuntu-latest
name: End-to-end tests (Minikube)
name: End-to-end tests (Kind)
steps:
- name: Install package
run: |
Expand All @@ -48,64 +44,48 @@ jobs:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Setup Minikube cluster
# Should be set back with correct version once https://github.com/radtriste/setup-minikube/tree/issue_49 is done
uses: medyagh/[email protected]
with:
addons: registry,metrics-server
kubernetes-version: ${{ env.KUBERNETES_VERSION }}
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
cpus: max
memory: max
insecure-registry: localhost:5000,192.168.0.0/16

- name: Wait for Minikube up and running
- name: Setup Kind cluster
run: |
minikube ssh cat /lib/systemd/system/docker.service
kubectl get pods -A
set -x
MINIKUBE_COMPONENTS=(etcd kube-apiserver kube-controller-manager kube-scheduler)
for component in "${MINIKUBE_COMPONENTS[@]}"
do
echo "Check component '${component}' is in 'Running' state"
COMPONENT_NAME=${component} timeout 60s bash -c 'kubectl get pods -l tier=control-plane -l component=${COMPONENT_NAME} -n kube-system && while [[ "$(kubectl get pods -l tier=control-plane -l component=${COMPONENT_NAME} -n kube-system -o jsonpath={.items[0].status.phase})" != "Running" ]] ; do sleep 2 && kubectl get pods -l tier=control-plane -l component=${COMPONENT_NAME} -n kube-system -o jsonpath={.items[0].status.phase}; done'
done
make KIND_VERSION=${{ env.KIND_VERSION }} create-cluster


- name: Wait for Minikube registry
- name: Set OPERATOR_IMAGE_NAME to point to Kind's local registry
run: |
kubectl get pods -A
timeout 60s bash -c 'kubectl get pods -l kubernetes.io/minikube-addons=registry -l actual-registry=true -n kube-system && while [[ "$(kubectl get pods -l kubernetes.io/minikube-addons=registry -l actual-registry=true -n kube-system -o jsonpath={.items[0].status.phase})" != "Running" ]] ; do sleep 2 && kubectl get pods -l kubernetes.io/minikube-addons=registry -l actual-registry=true -n kube-system -o jsonpath={.items[0].status.phase}; done'


- name: Retrieve Minikube registry
run: |
minikube_registry="$(minikube ip):5000"
echo "MINIKUBE_REGISTRY=${minikube_registry}" >> $GITHUB_ENV
echo "OPERATOR_IMAGE_NAME=${minikube_registry}/kogito-serverless-operator:0.0.1" >> $GITHUB_ENV

- name: Setup Python for cekit
uses: actions/setup-python@v4
with:
python-version: '3.10'
echo "OPERATOR_IMAGE_NAME=127.0.0.1:5001/kogito-serverless-operator:0.0.1" >> $GITHUB_ENV

# TODO: cache this installation
- name: Build operator image
run: |
pip install cekit==4.5.0
pip install odcs podman behave lxml krb5
make container-build BUILDER=podman IMG=${{ env.OPERATOR_IMAGE_NAME }}
make docker-build IMG=${{ env.OPERATOR_IMAGE_NAME }}

- name: Load image in Minikube
- name: Load image in Kind
run: |
podman push --tls-verify=false ${{ env.OPERATOR_IMAGE_NAME }}
kind load docker-image 127.0.0.1:5001/kogito-serverless-operator:0.0.1

- name: Check pods
run: |
kubectl version
kubectl get pods -A

# TODO: install the operator-sdk first, then cache the installation

- name: Deploy operator
run: |
make deploy IMG=${{ env.OPERATOR_IMAGE_NAME }}
kubectl wait pod -A -l control-plane=controller-manager --for condition=Ready

- name: Run tests
run: |
make test-e2e

- name: Export kind logs
if: always()
run: |
mkdir -p /tmp/kind/logs
kind export logs --loglevel=debug /tmp/kind/logs

- name: Upload kind logs
if: always()
uses: actions/upload-artifact@v3
with:
name: kind-logs-${{ env.JOB_NAME }}-${{ github.run_id }}
path: /tmp/kind/logs
retention-days: 1
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
# under the License.

# Build the manager binary
FROM docker.io/library/golang:1.19.9 as builder
FROM docker.io/library/golang:1.21.6 as builder

ARG SOURCE_DATE_EPOCH

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -40,12 +42,18 @@ COPY version/ version/
COPY log/ log/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags=-buildid= -a -o manager main.go

FROM registry.access.redhat.com/ubi9/ubi-micro:9.3-9

ARG SOURCE_DATE_EPOCH

FROM registry.access.redhat.com/ubi8/ubi-micro:latest
WORKDIR /usr/local/bin

COPY --from=builder /workspace/manager /usr/local/bin/manager
# We force a timestamp to the output to guarantee a reproducible build, once we have BuildKit 0.12, this won't be needed anymore.
# The workaround to force the date format is because docker cli is expecting an int from this parameter (the timestamp).
RUN touch -d $(date '+%FT%H:%M:%S' -d @${SOURCE_DATE_EPOCH}) /usr/local/bin/manager

USER 65532:65532

Expand Down
32 changes: 23 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ test-workflowproj:

.PHONY: build
build: generate ## Build manager binary.
go build -o bin/manager main.go
CGO_ENABLED=0 go build -trimpath -ldflags=-buildid= -o bin/manager main.go

.PHONY: build-4-debug
build-4-debug: generate ## Build manager binary with debug options.
Expand All @@ -161,12 +161,12 @@ debug: build-4-debug ## Run a controller from your host from binary
./bin/manager -v=2

.PHONY: docker-build
docker-build: test ## Build docker image with the manager.
docker build -t ${IMG} .
docker-build: generate ## Build docker image with the manager.
docker build --build-arg SOURCE_DATE_EPOCH="$(shell git log -1 --pretty=%ct)" -t ${IMG} .

.PHONY: podman-build
podman-build: test ## Build container image with the manager.
podman build -t ${IMG} .
podman-build: generate ## Build container image with the manager.
podman build --build-arg SOURCE_DATE_EPOCH="$(shell git log -1 --pretty=%ct)" -t ${IMG} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
Expand All @@ -181,12 +181,12 @@ docker-push: ## Push docker image with the manager.
# To properly provided solutions that supports more than one platform you should use this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
docker-buildx: test ## Build and push docker image for the manager for cross-platform support
docker-buildx: generate ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- docker buildx create --name project-v3-builder
docker buildx use project-v3-builder
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross
- docker buildx build --build-arg SOURCE_DATE_EPOCH=$(shell git log -1 --pretty=%ct) --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross
- docker buildx rm project-v3-builder
rm Dockerfile.cross

Expand Down Expand Up @@ -248,6 +248,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
## Tool Versions
KUSTOMIZE_VERSION ?= v4.5.2
CONTROLLER_TOOLS_VERSION ?= v0.9.2
KIND_VERSION ?= v0.20.0

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down Expand Up @@ -346,7 +347,20 @@ generate-all: generate generate-deploy bundle addheaders vet fmt

.PHONY: test-e2e # You will need to have a Minikube/Kind cluster up in running to run this target, and run container-builder before the test
test-e2e: install-operator-sdk
go test ./test/e2e/* -v -ginkgo.v
go test ./test/e2e/* -v -ginkgo.v -timeout 30m

.PHONY: before-pr
before-pr: test generate-all
before-pr: test generate-all


.PHONY: install-kind
install-kind:
command -v kind >/dev/null || go install sigs.k8s.io/kind@$(KIND_VERSION)

.PHONY: create-cluster
create-cluster: install-kind
kind get clusters | grep kind >/dev/null || ./hack/ci/create-kind-cluster-with-registry.sh

.PHONY: delete-cluster
delete-cluster: install-kind
kind delete cluster && docker rm -f kind-registry
4 changes: 3 additions & 1 deletion api/condition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ const (
BuildFailedReason = "BuildFailedReason"
WaitingForBuildReason = "WaitingForBuild"
BuildIsRunningReason = "BuildIsRunning"
BuildSkipped = "BuildSkipped"
BuildSkippedReason = "BuildSkipped"
BuildSuccessfulReason = "BuildSuccessful"
BuildMarkedToRestartReason = "BuildMarkedToRestart"
)

// Condition describes the common structure for conditions in our types
Expand Down
Loading
Loading