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

Allow external ups service #61

Open
wants to merge 2 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
79 changes: 43 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,49 @@ FROM ansibleplaybookbundle/apb-base

LABEL "com.redhat.apb.spec"=\
"dmVyc2lvbjogMS4wCm5hbWU6IHVuaWZpZWRwdXNoLWFwYgpkZXNjcmlwdGlvbjogQWVyb0dlYXIg\
VW5pZmllZFB1c2ggU2VydmVyCmJpbmRhYmxlOiBUcnVlCmFzeW5jOiBvcHRpb25hbAp0YWdzOiAK\
ICAtIG1vYmlsZS1zZXJ2aWNlCiAgLSBtb2JpbGUtY2xpZW50LWVuYWJsZWQKbWV0YWRhdGE6CiAg\
ZGlzcGxheU5hbWU6IFVuaWZpZWQgUHVzaCBTZXJ2ZXIKICBsb25nRGVzY3JpcHRpb246ICJBbiBB\
UEIgZGVwbG95aW5nIHRoZSBBZXJvR2VhciBVbmlmaWVkUHVzaCBTZXJ2ZXIgd2l0aCBwZXJzaXN0\
ZW50IHN0b3JhZ2UgYW5kIGF1dGhlbnRpY2F0aW9uIHRocm91Z2ggT3BlbnNoaWZ0IgogIGltYWdl\
VXJsOiAiaHR0cHM6Ly9wYnMudHdpbWcuY29tL3Byb2ZpbGVfaW1hZ2VzLzE3OTQ0NDAwMDUvYWVy\
b2dlYXJfaWNvbi0xXzQwMHg0MDAucG5nIgogIGRvY3VtZW50YXRpb25Vcmw6ICJodHRwczovL2dp\
dGh1Yi5jb20vYWVyb2dlYXJjYXRhbG9nL3VuaWZpZWRwdXNoLWFwYi9ibG9iL21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/apb/actions
COPY roles /opt/ansible/roles
Expand Down
14 changes: 13 additions & 1 deletion apb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@ plans:
metadata:
mobileclient_bind_parameters_data:
- '{"name": "CLIENT_ID", "value": "metadata.name", "type": "path"}'
parameters: []
parameters:
- name: SHARED_UPS
required: False
type: bool
title: Connect to an existing UPS
- name: SHARED_HOST
required: False
type: string
title: URL of the shared UPS service
- name: SHARED_HOST_TOKEN
required: False
type: string
title: Auth token for the shared UPS service - Leave blank if not using shared UPS
bind_parameters:
- name: CLIENT_ID
required: True
Expand Down
10 changes: 10 additions & 0 deletions roles/provision-unifiedpush-apb/tasks/provision-ups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@
spec_tls_termination: edge
register: ups_route

- set_fact:
ups_route: "{{ ups_route.route.spec.host }}"

- set_fact:
ups_route: "{{ SHARED_HOST }}"
when: SHARED_UPS | bool

- set_fact:
auth_token: "{{ SHARED_HOST_TOKEN | default(' ') }}"

# We need to wait for the deployment to be ready before we can exit the ansible job
- name: "Wait for all UPS containers to become ready"
shell: oc get pods --namespace={{ namespace }} --selector="deploymentconfig={{ ups_deploymentconfig_name }}" -o jsonpath='{.items[*].status.containerStatuses[?(@.ready==true)].ready}'| wc -w
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ metadata:
stringData:
type: "{{ ups_secret_name }}"
name: "{{ ups_secret_name }}"
uri: "{{ ups_protocol}}://{{ ups_route.route.spec.host }}"
uri: "{{ ups_protocol}}://{{ ups_route }}"
ups_auth_token: "{{ auth_token }}"
applicationId: "{{ namespace_push_app.json.pushApplicationID }}"
3 changes: 2 additions & 1 deletion roles/provision-unifiedpush-apb/templates/secret.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ metadata:
stringData:
type: "{{ ups_secret_name }}"
name: "{{ ups_secret_name }}"
uri: "{{ ups_protocol}}://{{ ups_route.route.spec.host }}"
uri: "{{ ups_protocol}}://{{ ups_route }}"
ups_auth_token: "{{ auth_token }}"
applicationId: "{{ namespace_push_app.json.pushApplicationID }}"