Skip to content

Commit

Permalink
Avoid dirty git state (#300)
Browse files Browse the repository at this point in the history
* Avoid dirty git state

Before this commit, when running 'make deploy-dev' or 'make
deploy-kind' the files
config/default/overlays/dev/manager_image_patch.yaml
and
config/default/overlays/kind/manager_image_patch.yaml
showed local changes.

After this commit the git state won't be dirty anymore.
  • Loading branch information
ansd authored Sep 2, 2020
1 parent 094c920 commit 458514b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
20 changes: 6 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ deploy-manager: ## Deploy manager

deploy-manager-dev:
kustomize build config/crd | kubectl apply -f -
kustomize build config/default/overlays/dev | kubectl apply -f -
kustomize build config/default/overlays/dev | sed 's@((operator_docker_image))@"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"@' | kubectl apply -f -

deploy-sample: ## Deploy RabbitmqCluster defined in config/sample/base
kustomize build config/samples/base | kubectl apply -f -
Expand Down Expand Up @@ -81,13 +81,13 @@ deploy-namespace-rbac:

deploy: manifests deploy-namespace-rbac deploy-manager ## Deploy operator in the configured Kubernetes cluster in ~/.kube/config

deploy-dev: check-env-docker-credentials docker-build-dev patch-dev manifests deploy-namespace-rbac docker-registry-secret deploy-manager-dev ## Deploy operator in the configured Kubernetes cluster in ~/.kube/config, with local changes
deploy-dev: check-env-docker-credentials docker-build-dev manifests deploy-namespace-rbac docker-registry-secret deploy-manager-dev ## Deploy operator in the configured Kubernetes cluster in ~/.kube/config, with local changes

deploy-kind: check-env-docker-repo git-commit-sha patch-kind manifests deploy-namespace-rbac ## Load operator image and deploy operator into current KinD cluster
deploy-kind: check-env-docker-repo git-commit-sha manifests deploy-namespace-rbac ## Load operator image and deploy operator into current KinD cluster
docker build --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT) .
kind load docker-image $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)
kustomize build config/crd | kubectl apply -f -
kustomize build config/default/overlays/kind | kubectl apply -f -
kustomize build config/default/overlays/kind | sed 's@((operator_docker_image))@"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"@' | kubectl apply -f -

generate-installation-manifests:
mkdir -p installation
Expand All @@ -106,23 +106,15 @@ docker-push: check-env-docker-repo

git-commit-sha:
ifeq ("", git diff --stat)
GIT_COMMIT="$(shell git rev-parse --short HEAD)"
GIT_COMMIT=$(shell git rev-parse --short HEAD)
else
GIT_COMMIT="$(shell git rev-parse --short HEAD)-"
GIT_COMMIT=$(shell git rev-parse --short HEAD)-
endif

docker-build-dev: check-env-docker-repo git-commit-sha
docker build --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT) .
docker push $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)

patch-dev: check-env-docker-repo git-commit-sha
@echo "updating kustomize image patch file for manager resource"
sed -i'' -e 's@image: .*@image: '"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"'@' ./config/default/overlays/dev/manager_image_patch.yaml

patch-kind: check-env-docker-repo git-commit-sha
@echo "updating kustomize image patch file for manager resource"
sed -i'' -e 's@image: .*@image: '"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"'@' ./config/default/overlays/kind/manager_image_patch.yaml

kind-prepare: ## Prepare KIND to support LoadBalancer services
# Note that created LoadBalancer services will have an unreachable external IP
@kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml
Expand Down
3 changes: 1 addition & 2 deletions config/default/overlays/dev/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ spec:
template:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: dev.registry.pivotal.io/p-rabbitmq-for-kubernetes/rabbitmq-for-kubernetes-operator:e89ed15-
- image: ((operator_docker_image))
name: operator
imagePullPolicy: Always
3 changes: 1 addition & 2 deletions config/default/overlays/kind/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ spec:
template:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: dev.registry.pivotal.io/p-rabbitmq-for-kubernetes/rabbitmq-for-kubernetes-operator:5a5e6bf-
- image: ((operator_docker_image))
name: operator
imagePullPolicy: IfNotPresent

0 comments on commit 458514b

Please sign in to comment.