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

Minor changes to readme (use source). Instruct KO to build and push t… #1168

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
37 changes: 23 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
### CONFIG #
#
SHELL := bash # we want bash behaviour in all shell invocations

PLATFORM := $(shell uname)
platform := $(shell echo $(PLATFORM) | tr A-Z a-z)
ifeq ($(PLATFORM),Darwin)
platform_alt = macOS
else
platform_alt = $(platform)
endif

ARCH := $(shell uname -m)
ifeq ($(ARCH),x86_64)
arch_alt = amd64
else
arch_alt = arm64
endif

# https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
RED := \033[0;31m
Expand Down Expand Up @@ -52,7 +59,7 @@ endif
GCLOUD_SDK_VERSION := 437.0.1
GCLOUD_BIN := gcloud-$(GCLOUD_SDK_VERSION)-$(PLATFORM)-x86_64
GCLOUD := $(LOCAL_BIN)/$(GCLOUD_BIN)
GCLOUD_SDK_FILE := google-cloud-sdk-$(GCLOUD_SDK_VERSION)-$(PLATFORM)-x86_64.tar.gz
GCLOUD_SDK_FILE := google-cloud-sdk-$(GCLOUD_SDK_VERSION)-$(PLATFORM)-$(ARCH).tar.gz
GCLOUD_SDK_URL := https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/$(GCLOUD_SDK_FILE)
GOOGLE_CLOUD_SDK_BIN := $(LOCAL_BIN)/google-cloud-sdk/bin
PATH := $(GOOGLE_CLOUD_SDK_BIN):$(PATH)
Expand All @@ -78,7 +85,7 @@ releases-gcloud:

KO_RELEASES := /~https://github.com/ko-build/ko/releases
KO_VERSION := 0.14.1
KO_BIN_DIR := $(LOCAL_BIN)/ko_$(KO_VERSION)_$(PLATFORM)_x86_64
KO_BIN_DIR := $(LOCAL_BIN)/ko_$(KO_VERSION)_$(PLATFORM)_$(ARCH)
KO_URL := $(KO_RELEASES)/download/v$(KO_VERSION)/$(notdir $(KO_BIN_DIR)).tar.gz
KO := $(KO_BIN_DIR)/ko
$(KO): | $(CURL) $(LOCAL_BIN)
Expand All @@ -96,8 +103,8 @@ releases-ko:

KIND_RELEASES := /~https://github.com/kubernetes-sigs/kind/releases
KIND_VERSION := 0.20.0
KIND_URL := $(KIND_RELEASES)/download/v$(KIND_VERSION)/kind-$(platform)-amd64
KIND := $(LOCAL_BIN)/kind_$(KIND_VERSION)_$(platform)_amd64
KIND_URL := $(KIND_RELEASES)/download/v$(KIND_VERSION)/kind-$(platform)-$(arch_alt)
KIND := $(LOCAL_BIN)/kind_$(KIND_VERSION)_$(platform)_$(arch_alt)
$(KIND): | $(CURL) $(LOCAL_BIN)
$(CURL) --progress-bar --fail --location --output $(KIND) "$(KIND_URL)"
touch $(KIND)
Expand All @@ -114,8 +121,8 @@ releases-kind:
# using this Go version instead: /~https://github.com/a8m/envsubst#docs
ENVSUBST_RELEASES := /~https://github.com/a8m/envsubst/releases
ENVSUBST_VERSION := 1.4.2
ENVSUBST_URL := $(ENVSUBST_RELEASES)/download/v$(ENVSUBST_VERSION)/envsubst-$(PLATFORM)-x86_64
ENVSUBST := $(LOCAL_BIN)/envsubst-$(ENVSUBST_VERSION)-$(PLATFORM)-x86_64
ENVSUBST_URL := $(ENVSUBST_RELEASES)/download/v$(ENVSUBST_VERSION)/envsubst-$(PLATFORM)-$(ARCH)
ENVSUBST := $(LOCAL_BIN)/envsubst-$(ENVSUBST_VERSION)-$(PLATFORM)-$(ARCH)
# We want to fail if variables are not set or empty.
ENVSUBST_SAFE := $(ENVSUBST) -no-unset -no-empty
$(ENVSUBST): | $(CURL) $(LOCAL_BIN)
Expand All @@ -132,7 +139,7 @@ releases-envsubst:
KUBECTL_RELEASES := /~https://github.com/kubernetes/kubernetes/tags
# Keep this in sync with KIND_K8S_VERSION
KUBECTL_VERSION := 1.25.9
KUBECTL_BIN := kubectl-$(KUBECTL_VERSION)-$(platform)-amd64
KUBECTL_BIN := kubectl-$(KUBECTL_VERSION)-$(platform)-$(arch_alt)
KUBECTL_URL := https://storage.googleapis.com/kubernetes-release/release/v$(KUBECTL_VERSION)/bin/$(platform)/amd64/kubectl
KUBECTL := $(LOCAL_BIN)/$(KUBECTL_BIN)
$(KUBECTL): | $(CURL) $(LOCAL_BIN)
Expand All @@ -154,8 +161,8 @@ endif

K9S_RELEASES := /~https://github.com/derailed/k9s/releases
K9S_VERSION := 0.25.18
K9S_BIN_DIR := $(LOCAL_BIN)/k9s-$(K9S_VERSION)-$(platform)-x86_64
K9S_URL := $(K9S_RELEASES)/download/v$(K9S_VERSION)/k9s_$(platform)_x86_64.tar.gz
K9S_BIN_DIR := $(LOCAL_BIN)/k9s-$(K9S_VERSION)-$(platform)-$(ARCH)
K9S_URL := $(K9S_RELEASES)/download/v$(K9S_VERSION)/k9s_$(platform)_$(ARCH).tar.gz
K9S := $(K9S_BIN_DIR)/k9s
$(K9S): | $(CURL) $(LOCAL_BIN) $(KUBECTL)
$(CURL) --progress-bar --fail --location --output $(K9S_BIN_DIR).tar.gz "$(K9S_URL)"
Expand All @@ -174,7 +181,7 @@ k9s: | $(KUBECONFIG) $(K9S) ## Terminal ncurses UI for K8S

GH_RELEASES := /~https://github.com/cli/cli/releases
GH_VERSION := 2.31.0
GH_DIR := $(LOCAL_BIN)/gh_$(GH_VERSION)_$(platform_alt)_amd64
GH_DIR := $(LOCAL_BIN)/gh_$(GH_VERSION)_$(platform_alt)_$(arch_alt)
GH_URL := $(GH_RELEASES)/download/v$(GH_VERSION)/$(notdir $(GH_DIR)).tar.gz
GH := $(GH_DIR)/bin/gh
$(GH): | $(CURL) $(LOCAL_BIN)
Expand All @@ -192,8 +199,8 @@ releases-gh:

KN_RELEASES := /~https://github.com/knative/client/releases
KN_VERSION := 1.10.0
KN_BIN := kn-$(KN_VERSION)-$(platform)-amd64
KN_URL := $(KN_RELEASES)/download/knative-v$(KN_VERSION)/kn-$(platform)-amd64
KN_BIN := kn-$(KN_VERSION)-$(platform)-$(arch_alt)
KN_URL := $(KN_RELEASES)/download/knative-v$(KN_VERSION)/kn-$(platform)-$(arch_alt)
KN := $(LOCAL_BIN)/$(KN_BIN)
$(KN): | $(CURL) $(LOCAL_BIN)
$(CURL) --progress-bar --fail --location --output $(KN) "$(KN_URL)"
Expand Down Expand Up @@ -359,10 +366,12 @@ install-knative-eventing: | $(KUBECONFIG) $(KUBECTL) ## Install Knative Eventing

.PHONY: install
install: | $(KUBECTL) $(KO) install-knative-eventing install-rabbitmq-cluster-operator install-rabbitmq-topology-operator ## Install local dev Knative Eventing RabbitMQ - manages all dependencies, including K8S components
$(KO) apply --filename config/broker
$(KO) apply --local --platform=linux/amd64,linux/arm64 --filename config/broker && \
./test/copy_images.sh
$(KUBECTL) wait --for=condition=available deploy/rabbitmq-broker-controller --timeout=60s --namespace $(EVENTING_NAMESPACE)
$(KUBECTL) wait --for=condition=available deploy/rabbitmq-broker-webhook --timeout=60s --namespace $(EVENTING_NAMESPACE)
$(KO) apply --filename config/source
$(KO) apply --local --platform=linux/amd64,linux/arm64 --filename config/source && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need this, ko apply already does what we need, sure this does not work on m1 macs without this line?

./test/copy_images.sh
$(KUBECTL) wait --for=condition=available deploy/pingsource-mt-adapter --timeout=60s --namespace knative-eventing

.PHONY: test-e2e-publish
Expand Down
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ components and running tests - everything done with `make`.
### Create environment

```
make .envrc && . .envrc
make .envrc && source .envrc
```

Here we create our environment file containing patched `PATH`, various exports, etc.
Expand Down
2 changes: 2 additions & 0 deletions test/copy_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
for image in `docker images|grep kind.local | awk '{ print $1 }'`; do kind load docker-image $image; done