-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for hostpath persistent volume definitions
hostpath volumes [1] mount a file or directory from the host node’s filesystem into a pod. This adds support for declaring a hostPath volume as a persistent volume and do a persistent volume claim for one for the hosted registry. [1]: https://kubernetes.io/docs/concepts/storage/volumes/#hostpath
- Loading branch information
David Moreau-Simard
committed
Nov 7, 2017
1 parent
7b2afd7
commit 81292a9
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
- name: Get registry DeploymentConfig | ||
oc_obj: | ||
namespace: "{{ openshift_hosted_registry_namespace }}" | ||
state: list | ||
kind: dc | ||
name: "{{ openshift_hosted_registry_name }}" | ||
register: registry_dc | ||
|
||
- name: Wait for registry pods | ||
oc_obj: | ||
namespace: "{{ openshift_hosted_registry_namespace }}" | ||
state: list | ||
kind: pod | ||
selector: "{% for label, value in registry_dc.results.results[0].spec.selector.iteritems() %}{{ label }}={{ value }}{% if not loop.last %},{% endif %}{% endfor %}" | ||
register: registry_pods | ||
until: | ||
- "registry_pods.results.results[0]['items'] | count > 0" | ||
# There must be as many matching pods with 'Ready' status True as there are expected replicas | ||
- "registry_pods.results.results[0]['items'] | oo_collect(attribute='status.conditions') | oo_collect(attribute='status', filters={'type': 'Ready'}) | map('bool') | select | list | count == openshift_hosted_registry_replicas | int" | ||
delay: 10 | ||
retries: "{{ (600 / 10) | int }}" | ||
|
||
- name: Determine registry fsGroup and runAsUser | ||
set_fact: | ||
openshift_hosted_registry_fsgroup: "{{ registry_pods.results.results[0]['items'][0].spec.securityContext.fsGroup }}" | ||
openshift_hosted_registry_runasuser: "{{ registry_pods.results.results[0]['items'][0].spec.containers[0].securityContext.runAsUser }}" | ||
|
||
# https://docs.openshift.com/container-platform/3.6/install_config/registry/deploy_registry_existing_clusters.html#registry-non-production-use | ||
- name: Ensure permissions on the hostpath match the pod configuration | ||
file: | ||
path: "{{ openshift.hosted.registry.storage.hostpath.path }}" | ||
state: directory | ||
owner: "{{ openshift_hosted_registry_runasuser }}" | ||
group: "{{ openshift_hosted_registry_fsgroup }}" | ||
mode: "2750" |