Skip to content

Commit

Permalink
Load local image in local-deploy (#192)
Browse files Browse the repository at this point in the history
* Load local image in local-deploy

* Remove a trivial comment

* Add kind-load-image target

* Fix 'kind load image-archive' command

It doesn't support input from STDIN

* Change imagePullPolicy to IfNotPresent

When deployed on KinD, the image is pre-pushed to KinD from the local registry.
When deployed on OCP, OCP will pull the image from quay.io.
  • Loading branch information
ronensc authored May 3, 2022
1 parent 0ad8917 commit 251f96a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,20 @@ create-kind-cluster: $(KIND) ## Create cluster
delete-kind-cluster: $(KIND) ## Delete cluster
$(KIND) delete cluster

.PHONY: kind-load-image
kind-load-image: ## Load image to kind
ifeq ($(OCI_RUNTIME),$(shell which docker))
# This is an optimization for docker provider. "kind load docker-image" can load an image directly from docker's
# local registry. For other providers (i.e. podman), we must use "kind load image-archive" instead.
$(KIND) load docker-image $(DOCKER_IMG):$(DOCKER_TAG)
else
$(eval tmpfile="/tmp/flp.tar")
-rm $(tmpfile)
$(OCI_RUNTIME) save $(DOCKER_IMG):$(DOCKER_TAG) -o $(tmpfile)
$(KIND) load image-archive $(tmpfile)
-rm $(tmpfile)
endif

##@ metrics

.PHONY: generate-configuration
Expand All @@ -236,7 +250,7 @@ generate-configuration: $(KIND) ## Generate metrics configuration
##@ End2End

.PHONY: local-deployments-deploy
local-deployments-deploy: $(KIND) deploy-prometheus deploy-loki deploy-grafana deploy deploy-netflow-simulator
local-deployments-deploy: $(KIND) deploy-prometheus deploy-loki deploy-grafana build-image kind-load-image deploy deploy-netflow-simulator
kubectl get pods
kubectl rollout status -w deployment/flowlogs-pipeline
kubectl logs -l app=flowlogs-pipeline
Expand Down
4 changes: 3 additions & 1 deletion contrib/kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ spec:
- containerPort: 6343
- containerPort: 2055
- containerPort: 2056
imagePullPolicy: Always
# When deployed on KinD, the image is pre-pushed to KinD from the local registry.
# When deployed on OCP, OCP will pull the image from quay.io.
imagePullPolicy: IfNotPresent
volumeMounts:
- name: configuration
mountPath: "/etc/flowlogs-pipeline/"
Expand Down

0 comments on commit 251f96a

Please sign in to comment.