Skip to content

Commit

Permalink
Merge pull request #28 from rafaelvzago/zago
Browse files Browse the repository at this point in the history
Updates on skupper install  and deploy workload roles
  • Loading branch information
rafaelvzago authored Feb 5, 2025
2 parents ccdaaf4 + 9127d4e commit 2235aa3
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 34 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/run_hello.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: x64

# Running MAKEFILE to build the collection
- name: Running MAKEFILE
Expand Down Expand Up @@ -57,14 +58,16 @@ jobs:
# Run Tests
- name: Run Hello World Test
env:
ANSIBLE_PYTHON_INTERPRETER: python3
run: |
export KUBECONFIG=~/.kube/config
make hello
# Archive Test Results
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-results
path: test_results/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
# Archive Test Results
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-results
path: test_results/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ROOT_PATH := $(shell pwd)
COLLECTION_PATH := $(ROOT_PATH)/collections/ansible_collections/rhsiqe/skupper
TAR_NAME := rhsiqe-skupper-0.1.9.tar.gz
TAR_NAME := rhsiqe-skupper-0.1.10.tar.gz
TAR_PATH := $(COLLECTION_PATH)/$(TAR_NAME)

build:
Expand Down
2 changes: 1 addition & 1 deletion collections/ansible_collections/rhsiqe/skupper/galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: rhsiqe
name: skupper
version: 0.1.9
version: 0.1.10
readme: README.md
authors:
- Rafael Zago <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,17 @@
retries: 10
delay: 10

- name: Wait for Skupper router pods to be ready
kubernetes.core.k8s_info:
kubeconfig: "{{ kubeconfig }}"
kind: Pod
namespace: "{{ namespace }}"
register: skupper_pods

- name: Wait for all pods in the namespace to be in Running state
kubernetes.core.k8s_info:
kubeconfig: "{{ kubeconfig }}"
kind: Pod
namespace: "{{ skupper_site_namespace }}"
namespace: "{{ namespace }}"
label_selectors:
- app.kubernetes.io/part-of in (skupper, skupper-network-observer)
register: skupper_pods
until: skupper_pods.resources | map(attribute='status.phase') | select('equalto', 'Running') | list | length == skupper_pods.resources | length
until: >
(skupper_pods.resources | length > 0) and
(skupper_pods.resources | map(attribute='status.phase') | select('equalto', 'Running') | list | length == skupper_pods.resources | length)
retries: 30
delay: 10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@
kubeconfig: "{{ kubeconfig }}"
kind: Pod
namespace: "{{ namespace }}"
label_selectors:
- app={{ deploy_workload_deployment_name }}
register: workload_pods
until: workload_pods.resources | map(attribute='status.phase') | select('equalto', 'Running')
until: workload_pods.resources | selectattr('status.phase', 'equalto', 'Running') | list | length == deploy_workload_replicas
retries: 30
delay: 10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ install_skupper_version: 'v2'
install_skupper_skupper_release_name: skupper-setup # Skupper release name
install_skupper_install_output_path: "/tmp/localhost" # Must be set in the playbook or inventory
install_skupper_scope: cluster # Skupper scope or namespace
install_skupper_namespace: "" # Skupper namespace
install_skupper_namespace: "skupper-operator" # Skupper namespace
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,60 @@
version: "{{ install_skupper_version }}"
update: true

- name: Install Skupper using Helm
- name: Generating HELM files
ansible.builtin.command:
cmd: make generate-skupper-helm-chart
chdir: "{{ skupper_folder }}"
register: generate_helm_files

- name: Print the output of the command
ansible.builtin.debug:
msg: "{{ generate_helm_files.stdout_lines }}"

- name: Install Skupper using Helm Namespace Scope
kubernetes.core.helm:
chart_ref: "{{ skupper_folder }}/charts/skupper-setup"
chart_ref: "{{ skupper_folder }}/charts/skupper"
name: "{{ install_skupper_skupper_release_name }}"
namespace: "{{ install_skupper_namespace | default('default') }}"
kubeconfig: "{{ kubeconfig }}"
values:
scope: "{{ install_skupper_scope }}"
wait: true
replace: false
namespace: "{{ install_skupper_namespace }}"
when: install_skupper_scope == 'namespace'
ignore_errors: true

- name: Create skupper-operator namespace based on the value of install_skupper_operator_namespace
kubernetes.core.k8s:
definition:
apiVersion: v1
kind: Namespace
metadata:
name: "{{ install_skupper_namespace }}"
kubeconfig: "{{ kubeconfig }}"
when: install_skupper_scope == 'cluster'

- name: Install Skupper using Helm (Cluster Scope)
kubernetes.core.helm:
chart_ref: "{{ skupper_folder }}/charts/skupper"
name: "{{ install_skupper_skupper_release_name }}"
kubeconfig: "{{ kubeconfig }}"
values:
scope: "{{ install_skupper_scope }}"
wait: true
replace: false
release_namespace: "{{ install_skupper_namespace }}"
when: install_skupper_scope == 'cluster'
ignore_errors: true

- name: Validate Skupper controller pod status
kubernetes.core.k8s_info:
api_version: v1
kind: Pod
namespace: skupper
namespace: "{{ install_skupper_namespace | default('skupper') }}"
kubeconfig: "{{ kubeconfig }}"
label_selectors:
- app.kubernetes.io/part-of in (skupper, skupper-network-observer)
register: skupper_pods_info
retries: 30
delay: 5
Expand All @@ -42,7 +77,7 @@
- skupper_pods_info.resources is defined
- (skupper_pods_info.resources | selectattr('metadata.name', 'regex', 'skupper-controller') | list | length) > 0
- (skupper_pods_info.resources | selectattr('metadata.name', 'regex', 'skupper-controller') | selectattr('status.phase', '==', 'Running') | list | length) > 0
failed_when: false
failed_when: false

- name: Clean up Skupper repository directory
ansible.builtin.file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@
kubernetes.core.k8s_info:
kubeconfig: "{{ kubeconfig }}"
kind: Pod
namespace: "{{ skupper_site_namespace }}"
namespace: "{{ namespace }}"
label_selectors:
- app.kubernetes.io/part-of in (skupper, skupper-network-observer)
register: skupper_pods
until: skupper_pods.resources | map(attribute='status.phase') | select('equalto', 'Running') | list | length == skupper_pods.resources | length
until: >
(skupper_pods.resources | length > 0) and
(skupper_pods.resources | map(attribute='status.phase') | select('equalto', 'Running') | list | length == skupper_pods.resources | length)
retries: 30
delay: 10

Expand Down
2 changes: 1 addition & 1 deletion collections/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ collections:
version: 3.2.0

- name: rhsiqe.skupper
version: 0.1.9
version: 0.1.10
2 changes: 2 additions & 0 deletions docs/roles/deploy_workload.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This Ansible role automates the deployment of a workload in a Kubernetes cluster
- Creates a Deployment resource with the specified replicas and container image.
- **Wait for Deployment Readiness:**
- Ensures the workload is running by verifying pod statuses.
- Based on the label app: <deploy_workload_deployment_name>
- Based on the number of replicas: <deploy_workload_replicas>
- **Display Pod Information:**
- Outputs the names of the running pods for the deployed workload.

Expand Down
4 changes: 3 additions & 1 deletion docs/roles/install_skupper.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This Ansible role automates the installation of Skupper using its Helm chart, en
- Deploys Skupper in the specified Kubernetes namespace using the Helm chart.
- There are two installation modes: `cluster` and `namespace`.
- `cluster`: Installs Skupper in the entire Kubernetes cluster.
- The skupper controller namespace needs to be specified in the `skupper_namespace` variable.
- `namespace`: Installs Skupper in a specific namespace.
- **Clean Up Temporary Directory:**
- Removes the cloned repository to maintain a clean environment.
Expand All @@ -31,7 +32,7 @@ This Ansible role automates the installation of Skupper using its Helm chart, en
| `install_skupper_skupper_release_name`| `skupper-setup` | Release name for Skupper. |
| `install_skupper_install_output_path` | `/tmp/localhost` | Directory where the repository will be cloned temporarily. |
| `install_skupper_scope` | `cluster` | Scope of the Skupper installation (cluster or namespace). |
| `skupper_namespace` | `default` | Kubernetes namespace for Skupper installation. |
| `skupper_namespace` | `default` | Kubernetes namespace for Skupper installation. If `cluster`, specify the namespace where the Skupper controller will be deployed. |

## Example Usage

Expand Down Expand Up @@ -72,6 +73,7 @@ skupper_namespace: "west-namespace"
- The new Helm-based installation method simplifies the deployment and management of Skupper in Kubernetes clusters.
- Ensure the `kubernetes.core.helm` plugin is installed and properly configured on the control node.
- This role supports Helm version 3 and above, leveraging its capabilities for reliable Kubernetes deployments.
- The role will check the pods in the specified namespace to ensure that the Skupper controller is running successfully based on the labelSelector=app.kubernetes.io/part-of=skupper

## License

Expand Down
1 change: 1 addition & 0 deletions scenarios/hello-world/hello-world.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
name: rhsiqe.skupper.install_skupper
when:
- not skip_skupper_install | default(false) | bool
- "'west' in inventory_hostname"
vars:
install_skupper_install_output_path: "{{ temp_dir_path }}"

Expand Down
7 changes: 0 additions & 7 deletions scenarios/hello-world/inventory/host_vars/east.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ kubeconfig: "{{ ansible_env.HOME }}/.kube/config"
# Namespace configuration
namespace_name: hello-world-east

# Installation configuration for Skupper
install_skupper_skupper_repository: 'https://github.com/skupperproject/skupper.git'
install_skupper_version: '2.0.0-preview-2'
install_skupper_skupper_release_name: skupper-setup
install_skupper_scope: namespace
install_skupper_namespace: "{{ namespace_prefix }}-{{ namespace_name }}"

# Deployment configuration for workload
deploy_workload_workload_image: "{{ skupper_test_image_hello_world_backend }}"
deploy_workload_deployment_name: "backend"
Expand Down
6 changes: 3 additions & 3 deletions scenarios/hello-world/inventory/host_vars/west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ namespace_name: hello-world-west

# Installation configuration for Skupper
install_skupper_skupper_repository: 'https://github.com/skupperproject/skupper.git'
install_skupper_version: '2.0.0-preview-2'
install_skupper_version: '2.0.0-rc1'
install_skupper_skupper_release_name: skupper-setup
install_skupper_scope: namespace
install_skupper_namespace: "{{ namespace_prefix }}-{{ namespace_name }}"
install_skupper_scope: cluster
install_skupper_namespace: "skupper-operator"

# Deployment configuration for workload
deploy_workload_workload_image: "{{ skupper_test_image_hello_world_frontend }}"
Expand Down

0 comments on commit 2235aa3

Please sign in to comment.