warden-operator/Makefile
2024-08-04 14:31:00 -05:00

29 lines
938 B
Makefile

REGISTRY ?= git.strudelline.net/james/warden-operator
TAG ?= $(shell date +%Y-%m-%d-%s)
export REGISTRY
export TAG
all: operator-script.yaml deploy.yaml
clean:
yq -i '.spec.template.spec|=(.containers,.initContainers)[].image = "\(strenv(REGISTRY)):latest"' deploy.yaml
touch image/Dockerfile
touch warden-operator-sync
deploy.yaml: image/Dockerfile
docker build -t $(REGISTRY):$(TAG) image
docker tag $(REGISTRY):$(TAG) $(REGISTRY):latest
docker push $(REGISTRY):$(TAG)
docker push $(REGISTRY):latest
yq -i '.spec.template.spec|=(.containers,.initContainers)[].image = "\(strenv(REGISTRY)):\(strenv(TAG))"' deploy.yaml
operator-script.yaml: warden-operator-sync
kubectl create cm warden-operator-sync-script --from-file=warden-operator-sync --dry-run=client -o yaml > operator-script.yaml
deploy: all
kubectl apply -f ns.yaml
kubectl apply -f operator-script.yaml
kubectl apply -f deploy.yaml
kubectl apply -f sa.yaml