-
Notifications
You must be signed in to change notification settings - Fork 59
WIP / PoC: Native multi-cluster openshift-applier run #13
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
oybed
wants to merge
1
commit into
redhat-cop:main
Choose a base branch
from
oybed:multi-cluster
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
3 changes: 3 additions & 0 deletions
3
inventory/sample-multi-clusters.d/files/cluster1/projects/my-project1.param
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,3 @@ | ||
| NAMESPACE=my-project1 | ||
| NAMESPACE_DISPLAY_NAME=My Example Project 1 | ||
| NAMESPACE_DESCRIPTION=Example of creating a project in cluster 1 |
3 changes: 3 additions & 0 deletions
3
inventory/sample-multi-clusters.d/files/cluster2/projects/your-project1.param
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,3 @@ | ||
| NAMESPACE=your-project1 | ||
| NAMESPACE_DISPLAY_NAME=Your Example Project 1 | ||
| NAMESPACE_DESCRIPTION=Example of creating a project in cluster 2 |
17 changes: 17 additions & 0 deletions
17
inventory/sample-multi-clusters.d/inventory/host_vars/cluster1.yml
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,17 @@ | ||
| --- | ||
|
|
||
| ansible_connection: local | ||
|
|
||
| openshift_login_url: https://console.cluster1.example.com | ||
| openshift_token: R45tdflgkj123asdf_sdfit | ||
| # openshift_insecure: true | ||
|
|
||
|
|
||
| openshift_cluster_content: | ||
| - object: projects | ||
| content: | ||
| - name: "my project 1" | ||
| template: https://raw.githubusercontent.com/redhat-cop/cluster-lifecycle/master/files/projectrequest/template.yml | ||
| params: "{{ inventory_dir }}/../files/cluster1/projects/my-project1.param" | ||
| template_action: create | ||
|
|
15 changes: 15 additions & 0 deletions
15
inventory/sample-multi-clusters.d/inventory/host_vars/cluster2.yml
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,15 @@ | ||
| --- | ||
|
|
||
| ansible_connection: local | ||
|
|
||
| openshift_login_url: https://console.cluster2.example.com | ||
| openshift_token: ssdflsdkf34l5jk34l5kjvdf | ||
| # openshift_insecure: true | ||
|
|
||
| openshift_cluster_content: | ||
| - object: projects | ||
| content: | ||
| - name: "your project 1" | ||
| template: https://raw.githubusercontent.com/redhat-cop/cluster-lifecycle/master/files/projectrequest/template.yml | ||
| params: "{{ inventory_dir }}/../files/cluster2/projects/your-project1.param" | ||
| template_action: create |
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,6 @@ | ||
|
|
||
|
|
||
| [seed-hosts] | ||
| cluster1 | ||
| cluster2 | ||
|
|
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| --- | ||
| - hosts: seed-hosts[0] | ||
| - hosts: seed-hosts | ||
| roles: | ||
| - openshift-applier |
Binary file not shown.
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
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,19 @@ | ||
| --- | ||
|
|
||
| - name: "Create temporary dir" | ||
| tempfile: | ||
| state: directory | ||
| prefix: "openshift-{{ ansible_host }}" | ||
| register: openshift_config_tempdir | ||
| notify: | ||
| - "Cleanup OpenShift config" | ||
|
|
||
| - name: "Define temporary config dir" | ||
| set_fact: | ||
| kubeconfig: "{{ openshift_config_tempdir.path }}/config" | ||
|
|
||
| - name: "Capture OpenShift Config based on token" | ||
| command: > | ||
| oc login --token={{ openshift_token }} {{ openshift_insecure | ternary('--insecure-skip-tls-verify', '') }} {{ openshift_login_url }} | ||
| environment: | ||
| KUBECONFIG: "{{ kubeconfig }}" | ||
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
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.
This will cause pre-existing applier inventories to fail if not set. I would suggest two things:
openshift_insecureso that it is not required.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.
@etsauer yes, there are multiple things that need to be polished before this can be merged. Main intent for the PR was to have a discussion starting point around the concept (and if it's worth spending time on it)