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

ARM Support for halcyon-kubernetes #41

Merged
merged 7 commits into from
Jan 25, 2017
Merged

Conversation

aric49
Copy link
Member

@aric49 aric49 commented Jan 24, 2017

Enabling ARM and ARM64 Support for halcyon-kubernetes deployment feature enhancement requested by @ravishivt

To enable ARM Support:

  1. in group_vars/all.yml, set arm_enabled: true
  2. set kube_sdn: flannel

@ravishivt -- Let me know if this is the functionality you are looking for.


This change is Reviewable

Copy link
Collaborator

@v1k0d3n v1k0d3n left a comment

Choose a reason for hiding this comment

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

I'd like to see this performed in a more ansible-native way, querying the system for platform specifics, and deploying as such. I think this will result in less forethought from the operator and it will just....work (for n=x platform).

@@ -18,6 +18,8 @@ bootstrap_os: ubuntu
public_iface: enp0s3
nat_iface: enp0s3
proxy_enable: false
#Only enable this if you are deploying on ARM or ARM64 with Fannel SDN provider
arm_enabled: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

@aric49 one approach I was thinking was to read off of the system for the type of architecture, rather than including additional flags for each of them. For instance, Ansible can be used to return system traits...use that rather than piling on our global_vars inputs.

Copy link
Member Author

Choose a reason for hiding this comment

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

@v1k0d3n I was thinking along similar lines originally. However, I don't have an arm environment I can use to validate that the playbooks are going to run. I thought that adding it to group_vars would be a good initial approach so that the users can turn it on or off as needed. I agree that pulling it dynamically is a better approach, I just don't have a way to test it at the moment. Any ideas?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the setup module output on my arm64 boards, there are two ansible variables we could use. Alternatively, we could pull it directly from the board using uname -m.

"ansible_machine": "aarch64",
"ansible_architecture": "aarch64",

To map these architecture strings to the names used in actual docker image, take a look at the case statement in https://github.com/kubernetes/kubernetes/blob/85d328f8da12f0f0e5b7e6dd2356e56cd584fc3e/hack/local-up-cluster.sh#L234

We could exclude s390x and x86 because google doesn't even release images for those. https://console.cloud.google.com/kubernetes/images/list?location=GLOBAL&project=google-containers CTRL+F for a common k8s image like "kube-apiserver" and note the architectures kubernetes supports.

As for needing test instances, I can try to put up a couple instances on the internet. Alternatively, scaleway has pretty cheap arm64 VPS instances at $2.99/month.

Copy link
Collaborator

@v1k0d3n v1k0d3n Jan 24, 2017

Choose a reason for hiding this comment

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

i would strongly suggest using facts based on the CPU for arm64. we can always take a stab at it, and let @ravishivt try it. we can also see if @luxas would be willing to try our project, since he is a great Pi resource on the Kubernetes team. @aric49 if all else fails...I will bring the infamous Pi Cluster to the office, and you can use that to test with. :)

@aric49 aric49 closed this Jan 24, 2017
@aric49
Copy link
Member Author

aric49 commented Jan 24, 2017

Re-opening PR for re-factoring

@aric49 aric49 reopened this Jan 24, 2017
@aric49
Copy link
Member Author

aric49 commented Jan 24, 2017

I refactored this PR so it will dynamically check to see if the system is ARM-based by parsing the output of uname -a, as per @ravishivt

@@ -14,7 +14,18 @@
# limitations under the License.
#

#For ARM support only
- name: Checking for ARM support
shell: uname -a | grep -i "arm"
Copy link
Contributor

@ravishivt ravishivt Jan 24, 2017

Choose a reason for hiding this comment

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

arm64 boards actually return back aarch64 and arm boards return arm.*. We'll need to do a conditional logic similar to https://github.com/kubernetes/kubernetes/blob/85d328f8da12f0f0e5b7e6dd2356e56cd584fc3e/hack/local-up-cluster.sh#L234. Also, uname -m gives the machine info so you won't have to grep the output.

From Raspberry Pi (32-bit ARM, arm)

$ uname -a
Linux rpi2 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l armv7l armv7l GNU/Linux
$ uname -m
armv7l

From Odroid C2 (64-bit ARM, arm64)

$ uname -a
Linux ravi-arm51 3.14.79-103 #1 SMP PREEMPT Fri Jan 13 07:06:12 BRST 2017 aarch64 aarch64 aarch64 GNU/Linux
$ uname -m
aarch64

ignore_errors: true

- name: deploying the kubernetes dashboard - ARM support only
shell: curl -sSL https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml | sed "s/amd64/arm64/g" | kubectl create -f -
Copy link
Contributor

Choose a reason for hiding this comment

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

The replacement of arm or arm64 should be dependent on architecture. See other comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

So if I am understanding your comments properly, if the uname -m output returns: aarch64, or arm*, then we need to replace the amd64 strings in the kubernetes manifest with arm64, correct?

I am asking because I was thinking through an approach in which I grab the value of "ansible_architecture" (same output as uname -m) and using that value in your sed clause.. However, based on your examples, I don't think that is a valid approach. I am trying to think through this from the perspective of supporting not only ARM and x86 but others as well. Do you know if any other architectures are supported in Flannel, or is it just x86/64 and ARM? If not, I will only need to test if "x86" is in the ansible_architecture variable and if it isn't, then use your sed clause to replace with arm.

Let me know if this sounds like a good approach to move forward with.

Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding your first question, that logic is not quite correct. There are two common ARM architectures that we should support, arm and arm64. They are fairly popular, think of Raspberry Pi's and their competitors with more modern architectures (Odroid C2, Pine64). So we need to conditionally check if the device is arm64 or arm and then do a sed replacement based on that. The tricky part is that uname -m doesn't return arm or arm64 directly. It returns either arm<> or aarch64. The case statement from my earlier link gives an example of how to translate uname -m to the right image name. Order of checks do matter.

I am trying to think through this from the perspective of supporting not only ARM and x86 but others as well. Do you know if any other architectures are supported in Flannel, or is it just x86/64 and ARM?

My goal is the same regarding support for other architectures, not just arm boards. Flannel currently has released images for amd64, arm, arm64, and ppc64le. I came up with that list from kubernetes container registry.

@aric49
Copy link
Member Author

aric49 commented Jan 25, 2017

Thank you for the input @ravishivt! My latest commit addresses all of the possible architecture scenarios for Flannel and dashboard deployments. Please review and see if this is a good solution.

Copy link
Collaborator

@v1k0d3n v1k0d3n left a comment

Choose a reason for hiding this comment

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

much better @aric49. this covers other scenarios that could come up re: architecture.

@ravishivt can you please test this know and let us know how this works for you? be aware that you may run into docker issue #42, but i have asked for changes on this PR.

@v1k0d3n v1k0d3n merged commit dd0a6a1 into att-comdev:master Jan 25, 2017
@ravishivt
Copy link
Contributor

I will give it a go. I glanced through the code and it looks good. Great work @aric49!

@v1k0d3n v1k0d3n mentioned this pull request Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants