-
Notifications
You must be signed in to change notification settings - Fork 150
Wait for DNS before install_ca role #3815
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
Open
evallesp
wants to merge
1
commit into
openstack-k8s-operators:main
Choose a base branch
from
evallesp:wait-dns-before-install_ca
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,23 @@ | ||
| # openshift_dns_ready | ||
|
|
||
| A role to wait for the OpenShift DNS operator to be ready before proceeding with tasks that require DNS resolution. | ||
|
|
||
| ## Privilege escalation | ||
|
|
||
| None required. | ||
|
|
||
| ## Parameters | ||
|
|
||
| * `cifmw_openshift_dns_ready_timeout`: (Integer) Timeout in seconds for `oc wait --timeout`. Default: `60`. | ||
| * `cifmw_openshift_dns_ready_path_prefix`: (String) Directories prepended to `PATH` when `cifmw_path` is unset, so non-interactive SSH finds `oc` (e.g. under `~/.crc/bin`). Default includes `~/.crc/bin`, `~/bin`, `~/.local/bin`. | ||
| * `cifmw_path`: (String) When set (framework bootstrap / CRC), used as `PATH` for `oc` instead of the prefix above. | ||
| * `cifmw_openshift_kubeconfig`: (String) Path to kubeconfig file. If set, exported as `KUBECONFIG`. Inherited from framework defaults. | ||
| * `cifmw_openshift_dns_ready_delegate_to`: (String) Optional inventory hostname to run `oc` on. If unset, uses `cifmw_target_host` (hypervisor in adoption/reproducer), then the current host. Override only when needed; a host without `oc` fails. | ||
|
|
||
| ## Usage | ||
|
|
||
| Used before tasks that require DNS resolution in OpenShift, such as downloading certificates from URLs or accessing external services. | ||
|
|
||
| ## How it works | ||
|
|
||
| The role runs `oc wait dns.operator.openshift.io/default --for=condition=Available=true` so the cluster DNS operator is ready before proceeding. The command is delegated when `cifmw_target_host` is set so `oc` runs on the hypervisor (or another host that has the CLI and kubeconfig). `PATH` is set explicitly so delegated runs match interactive shells (where `oc` is often on `PATH` via profile). |
This file contains hidden or 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,25 @@ | ||
| --- | ||
| # Copyright Red Hat, Inc. | ||
| # All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
| # not use this file except in compliance with the License. You may obtain | ||
| # a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
|
|
||
| # All variables intended for modification should be placed in this file. | ||
| # All variables within this role should have a prefix of "cifmw_openshift_dns_ready" | ||
|
|
||
| # Timeout in seconds passed to `oc wait --timeout` | ||
| cifmw_openshift_dns_ready_timeout: 60 | ||
|
|
||
| # Prepended to PATH for non-interactive SSH (login shells often add ~/.crc/bin; Ansible does not). | ||
| cifmw_openshift_dns_ready_path_prefix: "{{ ansible_user_dir }}/.crc/bin:{{ ansible_user_dir }}/bin:{{ ansible_user_dir }}/.local/bin" |
This file contains hidden or 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,30 @@ | ||
| --- | ||
| # Copyright Red Hat, Inc. | ||
| # All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
| # not use this file except in compliance with the License. You may obtain | ||
| # a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
|
|
||
| galaxy_info: | ||
| author: CI Framework | ||
| description: CI Framework Role -- openshift_dns_ready | ||
| company: Red Hat | ||
| license: Apache-2.0 | ||
| min_ansible_version: "2.14" | ||
| namespace: cifmw | ||
| galaxy_tags: | ||
| - cifmw | ||
|
|
||
| # List your role dependencies here, one per line. Be sure to remove the '[]' above, | ||
| # if you add dependencies to this list. | ||
| dependencies: [] |
This file contains hidden or 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,39 @@ | ||
| --- | ||
| # Copyright Red Hat, Inc. | ||
| # All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
| # not use this file except in compliance with the License. You may obtain | ||
| # a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| - name: Wait for DNS operator to be ready | ||
| ansible.builtin.command: | ||
| cmd: >- | ||
| oc wait dns.operator.openshift.io/default | ||
| --for=condition=Available=true | ||
| --timeout={{ cifmw_openshift_dns_ready_timeout }}s | ||
| environment: "{{ _cifmw_dns_ready_env }}" | ||
| vars: | ||
| _cifmw_dns_ready_path: >- | ||
| {{ | ||
| cifmw_path | ||
| | default( | ||
| cifmw_openshift_dns_ready_path_prefix ~ ':' ~ ansible_env.PATH, | ||
| true | ||
| ) | ||
| }} | ||
| _cifmw_dns_ready_env: >- | ||
| {{ | ||
| {'PATH': _cifmw_dns_ready_path} | ||
| | combine({'KUBECONFIG': cifmw_openshift_kubeconfig} if cifmw_openshift_kubeconfig is defined else {}) | ||
| }} | ||
| delegate_to: "{{ cifmw_openshift_dns_ready_delegate_to | default(cifmw_target_host | default(inventory_hostname)) }}" | ||
| changed_when: false |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rebtoor I'm unsure about this tbf. I don't see this used anywhere in the project.
I think this makes load of sense, but also I find that is not easy to debug as might be hard to find the task secuence.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has sense but i want to understand how it really work during the execution. Let's wait for job run.