Skip to content

Instantly share code, notes, and snippets.

@sanchezl
Created June 24, 2019 15:17
Show Gist options
  • Save sanchezl/7d38ec1f488da8ca4722721d0fb41ea2 to your computer and use it in GitHub Desktop.
Save sanchezl/7d38ec1f488da8ca4722721d0fb41ea2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
operator=kube-apiserver-operator
org=sanchezl
repository=${org}/origin-cluster-${operator}
tag=$(date --utc +%Y%m%d_%H%M%SZ)
echo "Building ${repository} image..."
IMAGE_ORG=${org} make images | tee make-images.log >/dev/null
image="${repository}:${tag}"
docker tag ${repository}:latest ${image}
echo "Pushing ${image} to DockerHub..."
docker push ${image}
echo "Backing up deployment/${operator}..."
oc get --namespace openshift-${operator} deployment/${operator} --output yaml > deployment.${operator}.${tag}.yaml
echo "Patching deployment/${operator}..."
patch="---
spec:
template:
spec:
containers:
- name: kube-apiserver-operator
image: ${image}
env:
- name: OPERATOR_IMAGE
value: ${image}
"
oc patch --namespace openshift-${operator} deployment/${operator} --patch "${patch}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment