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

Add s390x support #83

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

prabhav-thali
Copy link
Contributor

@prabhav-thali prabhav-thali commented Dec 16, 2024

This adds s390x support. Conditionals were added to handle the Ansible playbook execution which uses ansible_pkg_mgr and ansible_architecture variables.
Tested the same by executing unit tests, node e2e tests, and conformance tests.

@ppc64le-cloud-bot
Copy link
Contributor

Welcome @prabhav-thali! It looks like this is your first PR to ppc64le-cloud/k8s-ansible 🎉

@ppc64le-cloud-bot ppc64le-cloud-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 16, 2024
group_vars/all Outdated
Comment on lines 36 to 38
- kubernetes-test-linux-{{ ansible_architecture }}.tar.gz
- kubernetes-client-linux-{{ ansible_architecture }}.tar.gz
- kubernetes-server-linux-{{ ansible_architecture }}.tar.gz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will the value for this when we run this script from the x86 machine?

Copy link
Contributor Author

@prabhav-thali prabhav-thali Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value returned is x86_64. Should we handle this for intel machine? by mapping x86_64 to amd64 in group_vars/all file and using mapped variable rather than ansible_architecture

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can leave this as is and override this variable with your own stuff(s390x)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reverted this change.

install-k8s.yml Outdated
@@ -6,8 +6,17 @@
- runtime
- download-k8s
- install-k8s
- role: install-cni-plugins
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if we can move this to flannel role

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had kept this generic because it needs to run on both master and workers for flannel.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is fine, but what is stopping us to move this piece of code to install-flannel role? if this is a prerequisite for flannel then it make sense to move to that role.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have implemented this. Let me know if it looks good

install-k8s.yml Outdated

- name: Install networking - calico
hosts: masters
roles:
- install-calico
- role: install-calico
when: ansible_architecture == "ppc64le"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of choosing arch wise, we need to find a way to choose cni type via group args because there is a possibility that you may install flannel on ppc64le as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes added cni_provider variable to handle this

@@ -0,0 +1,10 @@
- name: Download flannel manifest
get_url:
url: "https://raw.githubusercontent.com/flannel-io/flannel/v0.26.1/Documentation/kube-flannel.yml"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to control this version from the group vars so that you can update later in the config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added flannel_version variable to control this from group vars

@@ -14,6 +16,7 @@
- name: Remove domainname from the hostname
shell: |
hostnamectl set-hostname $(hostname | cut -d "." -f1)
when: ansible_architecture == 'ppc64le'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this is not applicable for s390x platform?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For s390x VSIs, domainname is not appended to the hostname.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then this code will not make any difference if it runs!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the arch-based check from here

Comment on lines 34 to 38
if [[ $(uname -m) == "s390x" ]]; then
useradd -s /bin/bash -d /home/nonroot -m nonroot
else
useradd nonroot
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do same instructions on both the platform?
cc @Rajalakshmi-Girish

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested useradd -s /bin/bash -d /home/nonroot -m nonroot on centos:stream9. It seems to work fine. Hence, removed the arch based check.

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall LGTM except one minor comment, please address that.

@Rajalakshmi-Girish ptal the code and add lgtm whenever you are comfortable.

group_vars/all Outdated
Comment on lines 36 to 38
- kubernetes-test-linux-{{ ansible_architecture }}.tar.gz
- kubernetes-client-linux-{{ ansible_architecture }}.tar.gz
- kubernetes-server-linux-{{ ansible_architecture }}.tar.gz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can leave this as is and override this variable with your own stuff(s390x)

@ppc64le-cloud-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mkumatag, prabhav-thali

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ppc64le-cloud-bot ppc64le-cloud-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 3, 2025
Copy link
Contributor

@Rajalakshmi-Girish Rajalakshmi-Girish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value of k8s_tar_bundles: in group_vars/all file can be changed to using {{ ansible_architecture }} variable.

Please ignore. Saw Manju's comment just now.

@Rajalakshmi-Girish
Copy link
Contributor

/lgtm

@ppc64le-cloud-bot ppc64le-cloud-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 3, 2025
@ppc64le-cloud-bot ppc64le-cloud-bot merged commit c203d68 into ppc64le-cloud:master Jan 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants