docker / compose-on-kubernetes

Deploy applications described in Compose onto Kubernetes clusters
Apache License 2.0
1.42k stars 159 forks source link

Add ability to change pull policy on install #36

Closed chris-crone closed 5 years ago

chris-crone commented 5 years ago

Allows setting the image pull policy on install using a -pull-policy flag. Note that the flag is ignored if installed in debug or coverage modes.

The default pull policy of Always is maintained.

Tested manually using the following command against a clean Kubernetes cluster:

$ ./bin/installer -namespace=compose -etcd-servers=http://compose-etcd-client:2379 -tag=v0.4.16 -skip-liveness-probes=true -pull-policy Never
INFO[0000] Checking installation state                  
INFO[0000] Install image with tag "v0.4.16" in namespace "compose" 
INFO[0000] Api server: image: "docker/kube-compose-dev-api-server:v0.4.16", pullPolicy: "Never" 
INFO[0000] Controller: image: "docker/kube-compose-dev-controller:v0.4.16", pullPolicy: "Never" 

$ kubectl get all -n compose
NAME                                                                  READY   STATUS              RESTARTS   AGE
pod/compose-5b9f95796d-gc7lr                                          0/1     ErrImageNeverPull   0          8s
pod/compose-api-86cccb67cf-xpqmd                                      0/1     ErrImageNeverPull   0          8s
pod/compose-etcd-0000                                                 1/1     Running             0          1m
pod/compose-etcd-0001                                                 1/1     Running             0          59s
pod/compose-etcd-0002                                                 1/1     Running             0          20s
pod/etcd-operator-etcd-operator-etcd-backup-operator-6b58f6899ktz9g   1/1     Running             0          1m
pod/etcd-operator-etcd-operator-etcd-operator-69f56d5647-vvf4c        1/1     Running             0          1m
pod/etcd-operator-etcd-operator-etcd-restore-operator-7b7584d5n6qx8   1/1     Running             0          1m
chris-crone commented 5 years ago

I've made this WIP as I need to add at least a unit test.

chris-crone commented 5 years ago

@silvin-lubecki @simonferquel Refactored and added unit test.