Skip to content

Commit

Permalink
Cherrypick support for experimental manager build (#743)
Browse files Browse the repository at this point in the history
* Extend workflows to support experimental manager (#731)

* Add build arg for go build tags to Dockerfile

* Add make target and job for testing experimental tag

* Extend publish_assets.sh to publish yaml for experimental istio manager

* Add docs about building and installing experimental image

* Add section for experimental features in the release notes template

* Add new jobs to CI/CD documentation

* Add job to wait for experimental build on release

* Rename job and add missing job to CI/CD docs

* Fix UI test workflow name

(cherry picked from commit 3523851)

* Add permalinks for newly added CI/CD jobs (#740)

* Add permalinks for newly added CI/CD jobs

* Update docs/contributor/04-30-ci-cd.md

Co-authored-by: Natalia Sitko <[email protected]>

---------

Co-authored-by: Natalia Sitko <[email protected]>
(cherry picked from commit ff06cc7)

* Improve UI tests (#723)

* Change UI tests to Typescript. Restructure and simplify tests to make them more reliable and easier to adapt.

* Add wait after namespace creation to avoid flakiness in tests

* Simplify validation for AP action

(cherry picked from commit 5411fcb)
  • Loading branch information
triffer authored Apr 16, 2024
1 parent 9c54ce5 commit 170471f
Show file tree
Hide file tree
Showing 74 changed files with 1,803 additions and 1,411 deletions.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@ updates:
directory: "/"
schedule:
interval: "weekly"
# We only use npm for UI tests, therefore running it weekly and on main only is enough.
- package-ecosystem: "npm"
directory: "/tests/ui/"
schedule:
interval: "weekly"
13 changes: 13 additions & 0 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,24 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
statusName: "rel-istio-build"
intervalSeconds: "30"
timeoutSeconds: "1800"
- name: Check that module build status is success
if: steps.wait-for-build.outputs.state != 'success'
run: exit 1

- uses: autotelic/action-wait-for-status-check@6556cf50c8fb6608412945382eae73581f56cbb4
name: Verify build of experimental image
id: wait-for-experimental-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
statusName: "rel-istio-experimental-build"
intervalSeconds: "30"
timeoutSeconds: "300"
- name: Check that experimental module build status is success
if: steps.wait-for-experimental-build.outputs.state != 'success'
run: exit 1

- name: Publish release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,15 @@ jobs:
PULL_BASE_SHA=${{ github.event.pull_request.base.sha}} \
PULL_NUMBER=${{ github.event.number }} \
./tests/integration/scripts/code-coverage-guard.sh
run-unit-tests-experimental:
name: Run unit tests with experimental build tag
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run tests
run: make test-experimental-tag
2 changes: 1 addition & 1 deletion .github/workflows/ui-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Jobs defined in this file are responsible for things that do not require container image
# but still relevant to the codebase such as unit tests, linting etc

name: Pull Request
name: UI Tests

on:
pull_request:
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
FROM europe-docker.pkg.dev/kyma-project/prod/external/golang:1.22.2-alpine3.19 as builder
ARG TARGETOS
ARG TARGETARCH
ARG GO_BUILD_TAGS
ARG VERSION=dev

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -23,8 +25,7 @@ COPY pkg/ pkg/
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
ARG VERSION=dev
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} go build -a -ldflags="-X github.com/kyma-project/istio/operator/internal/resources.version=${VERSION}" -o manager main.go
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} go build -tags ${GO_BUILD_TAGS} -a -ldflags="-X github.com/kyma-project/istio/operator/internal/resources.version=${VERSION}" -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ vet: ## Run go vet against code.
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_CONTROLPLANE_START_TIMEOUT=2m KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT=2m KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test $(shell go list ./... | grep -v /tests/integration) -coverprofile cover.out

.PHONY: test-experimental-tag
test-experimental-tag: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_CONTROLPLANE_START_TIMEOUT=2m KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT=2m KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test -tags experimental $(shell go list ./... | grep -v /tests/integration) -coverprofile cover.out

##@ Build

.PHONY: build
Expand All @@ -99,6 +103,10 @@ run: manifests install create-kyma-system-ns build ## Run a controller from your
docker-build: ## Build docker image with the manager.
IMG=$(IMG) docker build -t ${IMG} --build-arg TARGETOS=${TARGETOS} --build-arg TARGETARCH=${TARGETARCH} .

.PHONY: docker-build-experimental
docker-build-experimental: ## Build docker image with the experimental manager
IMG=$(IMG) docker build -t ${IMG} --build-arg GO_BUILD_TAGS=experimental --build-arg TARGETOS=${TARGETOS} --build-arg TARGETARCH=${TARGETARCH} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
docker push ${IMG}
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ Kyma Istio Operator is a component of the Kyma runtime that handles the manageme
kubectl label namespace kyma-system istio-injection=enabled --overwrite
```

2. To install Istio, you must install the latest version of Kyma Istio Operator and Istio CRD first. Run:

2. To install Istio, you must install the latest version of Kyma Istio Operator and Istio CRD first.
In order to install the standard version, run :
```bash
kubectl apply -f https://github.com/kyma-project/istio/releases/latest/download/istio-manager.yaml
```

In order to install the experimental version, run :
```bash
kubectl apply -f https://github.com/kyma-project/istio/releases/latest/download/istio-manager-experimental.yaml
```

3. To get Istio installed, apply the default Istio CR:

```bash
Expand Down
8 changes: 7 additions & 1 deletion docs/contributor/01-00-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
git clone https://github.com/kyma-project/istio.git && cd istio
```

1. Set the Istio Operator image name.
2. Set the Istio Operator image name.

```bash
export IMG=istio-operator:0.0.1
Expand All @@ -32,10 +32,16 @@ kyma provision k3d
4. Build the image.

Run:
```bash
make docker-build
```

To build the experimental image, run:
```bash
make docker-build-experimental
```

5. Push the image to the registry.

<div tabs name="Push image" group="istio-operator-installation">
Expand Down
Loading

0 comments on commit 170471f

Please sign in to comment.