Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions libexec/watcher
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ set -euo pipefail
process_routes() {
local domainname selfLink
local tmpl='.object.spec.host + ":" + .object.metadata.selfLink'

log "watching routes with selector $LETSENCRYPT_ROUTE_SELECTOR"

watch_routes | jq -er --unbuffered "$tmpl" \
| while IFS=: read -r domainname selfLink; do
log "Processing route $selfLink with domain $domainname."
get_certificate "$domainname" "$selfLink"
done
if [ -n domainname ] && [ -n selfLink ]; then
log "Processing route $selfLink with domain $domainname."
get_certificate "$domainname" "$selfLink"
else
log "$(watch_routes)"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we log something more concrete? Ideas?

fi
done
}

while true
Expand Down
3 changes: 3 additions & 0 deletions share/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ is_true() {
;;
esac
}

api_call() {
local uri="${1##/}"; shift
curl --fail -sSH "Authorization: Bearer $SA_TOKEN" \
Expand All @@ -71,9 +72,11 @@ api_call() {
watch_routes() {
local routes_uri
routes_uri="$(route_uri)?watch"

if [ -n "$LETSENCRYPT_ROUTE_SELECTOR" ]; then
routes_uri="$routes_uri&labelSelector=$LETSENCRYPT_ROUTE_SELECTOR"
fi

api_call "$routes_uri" -N
}

Expand Down
4 changes: 2 additions & 2 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ objects:
env:
- name: LETSENCRYPT_CONTACT_EMAIL
value: ${LETSENCRYPT_CONTACT_EMAIL}
image: ibotty/openshift-letsencrypt:latest
image: crossb0w/openshift-letsencrypt:latest
imagePullPolicy: Always
name: watcher
volumeMounts:
Expand All @@ -45,7 +45,7 @@ objects:
env:
- name: LETSENCRYPT_CONTACT_EMAIL
value: ${LETSENCRYPT_CONTACT_EMAIL}
image: ibotty/openshift-letsencrypt:latest
image: crossb0w/openshift-letsencrypt:latest
name: cron
terminationMessagePath: /dev/termination-log
volumeMounts:
Expand Down