Skip to content

Commit

Permalink
Adding support for setting imagePullPolicy: Never for local development
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisharm committed Jul 11, 2019
1 parent d875137 commit c40da4f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/controller.image
/*-static
/controller.yaml
/controller-norbac.yaml
/sealedsecret-crd.yaml
/docker/controller
*.iml
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ script:
- ./$EXE_NAME --help || test $? -eq 2
- |
if [ "$TRAVIS_OS_NAME" = linux ]; then
make controller.yaml controller-norbac.yaml CONTROLLER_IMAGE=$CONTROLLER_IMAGE
make controller.yaml controller-norbac.yaml CONTROLLER_IMAGE=$CONTROLLER_IMAGE IMAGE_PULL_POLICY=Never
fi
- |
if [ "$INT_KVERS" != "" ]; then
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DOCKER = docker
GINKGO = ginkgo -p

CONTROLLER_IMAGE = sealed-secrets-controller:latest
IMAGE_PULL_POLICY = Always
KUBECONFIG ?= $(HOME)/.kube/config

GO_PACKAGES = ./...
Expand Down Expand Up @@ -53,7 +54,7 @@ controller.image: docker/Dockerfile docker/controller
mv $@.tmp $@

%.yaml: %.jsonnet
$(KUBECFG) show -V CONTROLLER_IMAGE=$(CONTROLLER_IMAGE) -o yaml $< > $@.tmp
$(KUBECFG) show -V CONTROLLER_IMAGE=$(CONTROLLER_IMAGE) -V IMAGE_PULL_POLICY=$(IMAGE_PULL_POLICY) -o yaml $< > $@.tmp
mv $@.tmp $@

controller.yaml: controller.jsonnet controller.image controller-norbac.jsonnet
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@ $ make test
To run the integration tests:
* Start Minikube
* Build the controller for Linux, so that it can be run within a Docker image - edit the Makefile to add
`GOOS=linux GOARCH=amd64` to `%-static`, and then run `make controller.yaml `
* Alter `controller.yaml` so that `imagePullPolicy: Never`, to ensure that the image you've just built will be
used by Kubernetes
`GOOS=linux GOARCH=amd64` to `%-static`, and then run `make controller.yaml IMAGE_PULL_POLICY=Never`
* Add the sealed-secret CRD and controller to Kubernetes - `kubectl apply -f controller.yaml`
* Revert any changes made to the Makefile to build the Linux controller
* Remove the binaries which were possibly built for another OS - `make clean`
Expand Down
2 changes: 2 additions & 0 deletions controller-norbac.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local trim = function(str) (

local namespace = "kube-system";
local controllerImage = std.extVar("CONTROLLER_IMAGE");
local imagePullPolicy = std.extVar("IMAGE_PULL_POLICY");

// This is a bit odd: Downgrade to apps/v1beta1 so we can continue
// to support k8s v1.6.
Expand All @@ -38,6 +39,7 @@ local v1beta1_Deployment(name) = kube.Deployment(name) {
containers_+: {
controller: kube.Container("sealed-secrets-controller") {
image: controllerImage,
imagePullPolicy: imagePullPolicy,
command: ["controller"],
readinessProbe: {
httpGet: {path: "/healthz", port: "http"},
Expand Down

0 comments on commit c40da4f

Please sign in to comment.