Skip to content

Commit

Permalink
install command
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Nov 8, 2023
1 parent 8887a89 commit a2f1c88
Show file tree
Hide file tree
Showing 50 changed files with 461 additions and 16,294 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/commands.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
---
name: Command Testing

on: pull_request
on:
push:
branches: [ 'main' ]

pull_request:
branches: [ '*' ]

jobs:
install:
name: Run kuadrantctl install
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
uses: actions/setup-go@v2
- name: Set up Go 1.20.x
uses: actions/setup-go@v4
with:
go-version: 1.16.x
go-version: 1.20.x
id: go
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.1.0
uses: helm/kind-action@v1.2.0
with:
version: v0.11.1
config: utils/kind/cluster.yaml
cluster_name: kuadrant-local
version: v0.20.0
config: utils/kind-cluster.yaml
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
wait: 120s
- name: Check cluster info
run: |
kubectl cluster-info dump
- name: Run make env-setup
run: |
make env-setup
- name: build
run: |
make install
Expand Down
87 changes: 14 additions & 73 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [ 'main' ]

pull_request:
branches: [ 'main' ]
branches: [ '*' ]

jobs:
build:
Expand All @@ -27,92 +27,33 @@ jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
env:
KIND_CLUSTER_NAME: kuadrant-local
steps:
- name: Set up Go 1.16.x
uses: actions/setup-go@v2
- name: Set up Go 1.20.x
uses: actions/setup-go@v4
with:
go-version: 1.16.x
go-version: 1.20.x
id: go
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.1.0
uses: helm/kind-action@v1.2.0
with:
version: v0.11.1
config: utils/kind/cluster.yaml
cluster_name: kuadrant-local
version: v0.20.0
config: utils/kind-cluster.yaml
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
wait: 120s
- name: Check cluster info
run: |
kubectl cluster-info dump
- name: Run make env-setup
run: |
make env-setup
- name: Run tests
run: |
make test
- name: Report to CodeCov
uses: codecov/codecov-action@v2
with:
files: "*.coverprofile"

verify-istio-manifest:
name: Verify istio manifests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
id: go
- name: Check out code
uses: actions/checkout@v2
- name: run test
run: |
make istio-manifest-update-test
verify-kuadrant-manifest:
name: Verify kuadrant manifests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
id: go
- name: Check out code
uses: actions/checkout@v2
- name: run test
run: |
make kuadrant-manifest-update-test
verify-limitador-manifest:
name: Verify limitador manifests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
id: go
- name: Check out code
uses: actions/checkout@v2
- name: run test
run: |
make limitador-operator-manifest-update-test
verify-authorino-manifest:
name: Verify authorino manifests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
id: go
- name: Check out code
uses: actions/checkout@v2
- name: remove existing kustomize
run: |
# not necessary when https://github.com/Kuadrant/authorino/pull/150 is removed
rm -rf /usr/local/bin/kustomize /home/runner/go/bin/controller-gen
- name: run test
run: |
make authorino-operator-manifest-update-test
131 changes: 34 additions & 97 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,31 @@ PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
GO ?= go
KUADRANT_NAMESPACE=kuadrant-system

include utils.mk

all: help

.PHONY : help
help: Makefile
@sed -n 's/^##//p' $<

# Kind tool
# Ginkgo tool
GINKGO = $(PROJECT_PATH)/bin/ginkgo
$(GINKGO):
$(call go-install-tool,$(GINKGO),github.com/onsi/ginkgo/[email protected])

KIND = $(PROJECT_PATH)/bin/kind
KIND_CLUSTER_NAME = kuadrant-local
KIND_VERSION = v0.20.0
$(KIND):
$(call go-install-tool,$(KIND),sigs.k8s.io/kind@$(KIND_VERSION))

.PHONY: kind
kind: $(KIND) ## Download kind locally if necessary.

# istioctl tool
ISTIOCTL=$(PROJECT_PATH)/bin/istioctl
ISTIOVERSION = 1.17.2
$(ISTIOCTL):
mkdir -p $(PROJECT_PATH)/bin
$(eval TMP := $(shell mktemp -d))
cd $(TMP); curl -sSL https://istio.io/downloadIstio | ISTIO_VERSION=$(ISTIOVERSION) sh -
cp $(TMP)/istio-$(ISTIOVERSION)/bin/istioctl ${ISTIOCTL}
-rm -rf $(TMP)
KUSTOMIZE = $(PROJECT_PATH)/bin/kustomize
$(KUSTOMIZE):
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])

.PHONY: istioctl
istioctl: $(ISTIOCTL)

# Ginkgo tool
GINKGO = $(PROJECT_PATH)/bin/ginkgo
$(GINKGO):
$(call go-install-tool,$(GINKGO),github.com/onsi/ginkgo/[email protected])
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.

## test: Run unit tests
.PHONY : test
Expand All @@ -53,6 +43,28 @@ test: fmt vet $(GINKGO)
install: fmt vet
GOBIN=$(PROJECT_PATH)/bin $(GO) install

.PHONY: prepare-local-cluster
prepare-local-cluster: $(KIND) ## Deploy locally kuadrant operator from the current code
$(MAKE) kind-delete-cluster
$(MAKE) kind-create-cluster

.PHONY: env-setup
env-setup:
$(MAKE) olm-install
$(MAKE) gateway-api-install
$(MAKE) istio-install

## local-setup: Sets up Kind cluster with GatewayAPI manifests and istio GW, nothing Kuadrant. Build and install kuadrantctl binary
.PHONY: local-setup
local-setup:
$(MAKE) prepare-local-cluster
$(MAKE) env-setup

## local-cleanup: Delete local cluster
.PHONY: local-cleanup
local-cleanup: ## Delete local cluster
$(MAKE) kind-delete-cluster

.PHONY : fmt
fmt:
$(GO) fmt ./...
Expand All @@ -61,80 +73,5 @@ fmt:
vet:
$(GO) vet ./...

# Generates istio manifests with patches.
.PHONY: generate-istio-manifests
generate-istio-manifests: istioctl
$(ISTIOCTL) manifest generate --set profile=minimal --set values.gateways.istio-ingressgateway.autoscaleEnabled=false --set values.pilot.autoscaleEnabled=false --set values.global.istioNamespace=kuadrant-system -f istiomanifests/patches/istio-externalProvider.yaml -o istiomanifests/autogenerated

.PHONY: istio-manifest-update-test
istio-manifest-update-test: generate-istio-manifests
git diff --exit-code ./istiomanifests/autogenerated
[ -z "$$(git ls-files --other --exclude-standard --directory --no-empty-directory ./istiomanifests/autogenerated)" ]

# Generates kuadrant manifests.
KUADRANTVERSION=main
KUADRANT_CONTROLLER_IMAGE=quay.io/kuadrant/kuadrant-controller:$(KUADRANTVERSION)
.PHONY: generate-kuadrant-manifests
generate-kuadrant-manifests:
$(eval TMP := $(shell mktemp -d))
cd $(TMP); git clone --depth 1 --branch $(KUADRANTVERSION) https://github.com/kuadrant/kuadrant-controller.git
cd $(TMP)/kuadrant-controller; make kustomize
cd $(TMP)/kuadrant-controller/config/manager; $(TMP)/kuadrant-controller/bin/kustomize edit set image controller=${KUADRANT_CONTROLLER_IMAGE}
cd $(TMP)/kuadrant-controller/config/default; $(TMP)/kuadrant-controller/bin/kustomize edit set namespace $(KUADRANT_NAMESPACE)
cd $(TMP)/kuadrant-controller; bin/kustomize build config/default -o $(PROJECT_PATH)/kuadrantmanifests/autogenerated/kuadrant.yaml
-rm -rf $(TMP)

.PHONY: kuadrant-manifest-update-test
kuadrant-manifest-update-test: generate-kuadrant-manifests
git diff --exit-code ./kuadrantmanifests/autogenerated
[ -z "$$(git ls-files --other --exclude-standard --directory --no-empty-directory ./kuadrantmanifests/autogenerated)" ]

# Generates limitador manifests.
LIMITADOR_OPERATOR_VERSION=main
LIMITADOR_OPERATOR_IMAGE=quay.io/kuadrant/limitador-operator:$(LIMITADOR_OPERATOR_VERSION)
.PHONY: generate-limitador-operator-manifests
generate-limitador-operator-manifests:
$(eval TMP := $(shell mktemp -d))
cd $(TMP); git clone --depth 1 --branch $(LIMITADOR_OPERATOR_VERSION) https://github.com/kuadrant/limitador-operator.git
cd $(TMP)/limitador-operator; make kustomize
cd $(TMP)/limitador-operator/config/manager; $(TMP)/limitador-operator/bin/kustomize edit set image controller=$(LIMITADOR_OPERATOR_IMAGE)
cd $(TMP)/limitador-operator/config/default; $(TMP)/limitador-operator/bin/kustomize edit set namespace $(KUADRANT_NAMESPACE)
cd $(TMP)/limitador-operator; bin/kustomize build config/default -o $(PROJECT_PATH)/limitadormanifests/autogenerated/limitador-operator.yaml
-rm -rf $(TMP)

.PHONY: limitador-operator-manifest-update-test
limitador-operator-manifest-update-test: generate-limitador-operator-manifests
git diff --exit-code ./limitadormanifests/autogenerated
[ -z "$$(git ls-files --other --exclude-standard --directory --no-empty-directory ./limitadormanifests/autogenerated)" ]

# Generates authorino operator manifests.
AUTHORINO_OPERATOR_VERSION=main
.PHONY: generate-authorino-operator-manifests
generate-authorino-operator-manifests:
curl -sSf https://raw.githubusercontent.com/Kuadrant/authorino-operator/$(AUTHORINO_OPERATOR_VERSION)/config/deploy/manifests.yaml > $(PROJECT_PATH)/authorinomanifests/autogenerated/authorino-operator.yaml

.PHONY: authorino-manifest-update-test
authorino-operator-manifest-update-test: generate-authorino-operator-manifests
git diff --exit-code ./authorinomanifests/autogenerated
[ -z "$$(git ls-files --other --exclude-standard --directory --no-empty-directory ./authorinomanifests/autogenerated)" ]

.PHONY : cluster-cleanup
cluster-cleanup: $(KIND)
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)

.PHONY : cluster-setup
cluster-setup: $(KIND) cluster-cleanup
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config utils/kind/cluster.yaml

GOLANGCI-LINT=$(PROJECT_PATH)/bin/golangci-lint
$(GOLANGCI-LINT):
mkdir -p $(PROJECT_PATH)/bin
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PROJECT_PATH)/bin v1.41.1

.PHONY: golangci-lint
golangci-lint: $(GOLANGCI-LINT)

.PHONY: run-lint
run-lint: $(GOLANGCI-LINT)
$(GOLANGCI-LINT) run --timeout 2m

# Include last to avoid changing MAKEFILE_LIST used above
include ./make/*.mk
32 changes: 0 additions & 32 deletions authorinomanifests/assets.go

This file was deleted.

Loading

0 comments on commit a2f1c88

Please sign in to comment.