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 image_arch in flannel image tag #7560

Merged
merged 2 commits into from
Apr 30, 2021
Merged

Add image_arch in flannel image tag #7560

merged 2 commits into from
Apr 30, 2021

Conversation

muzi502
Copy link
Contributor

@muzi502 muzi502 commented Apr 27, 2021

What type of PR is this?

/kind bug

What this PR does / why we need it:

#6166 enabled multi-CPU architecture in Flannel CNI

For flannel image, in download image task flannel image tag is flannel_version, such as quay.io/coreos/flannel:v0.13.0 but in roles/network_plugin/flannel/templates/cni-flannel.yml.j2 file, real image tag is {{ flannel_image_tag }}-{{ arch }}, such as quay.io/coreos/flannel:v0.13.0-amd64 .

This will result in the real image tag is inconsistent with the downloaded image tag especially for offline deploy.

  • this is download flannel image task log

hub.k8s.li is my private docker registry

TASK [download : check_pull_required | Set pull_required if the desired image is not yet loaded] *********************************************************************************
ok: [kube-control-3]
ok: [kube-control-2]
ok: [kube-control-1]
ok: [kube-node-1]
Tuesday 27 April 2021  09:44:51 +0000 (0:00:00.160)       0:02:03.313 *********
Tuesday 27 April 2021  09:44:51 +0000 (0:00:00.119)       0:02:03.432 *********

TASK [download : debug] **********************************************************************************************************************************************************
ok: [kube-control-3] => {
    "msg": "Pull hub.k8s.li/coreos/flannel:v0.13.0 required is: False"
}
ok: [kube-control-2] => {
    "msg": "Pull hub.k8s.li/coreos/flannel:v0.13.0 required is: False"
}
ok: [kube-control-1] => {
    "msg": "Pull hub.k8s.li/coreos/flannel:v0.13.0 required is: False"
}
ok: [kube-node-1] => {
    "msg": "Pull hub.k8s.li/coreos/flannel:v0.13.0 required is: False"
}
  • this is kube-flannel status when complete deploy
kube-system   kube-flannel-47krk                       0/1     Init:ImagePullBackOff   0          48m
kube-system   kube-flannel-cqcjc                       0/1     Init:ImagePullBackOff   0          48m
kube-system   kube-flannel-flpcz                       0/1     Init:ImagePullBackOff   0          48m
kube-system   kube-flannel-xh2pt                       0/1     Init:ImagePullBackOff   0          48m
  Normal   Scheduled  80s                default-scheduler  Successfully assigned kube-system/kube-flannel-lsjxk to kube-control-1
  Normal   Pulling    37s (x3 over 80s)  kubelet            Pulling image "hub.k8s.li/coreos/flannel:v0.13.0-amd64"
  Warning  Failed     34s (x3 over 77s)  kubelet            Failed to pull image "hub.k8s.li/coreos/flannel:v0.13.0-amd64": rpc error: code = NotFound desc = failed to pull and unpack image "hub.k8s.li/coreos/flannel:v0.13.0-amd64": failed to resolve reference "hub.k8s.li/coreos/flannel:v0.13.0-amd64": hub.k8s.li/coreos/flannel:v0.13.0-amd64: not found
  Warning  Failed     34s (x3 over 77s)  kubelet            Error: ErrImagePull
  Normal   BackOff    8s (x4 over 77s)   kubelet            Back-off pulling image "hub.k8s.li/coreos/flannel:v0.13.0-amd64"
  Warning  Failed     8s (x4 over 77s)   kubelet            Error: ImagePullBackOff

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 27, 2021
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 27, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @muzi502. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 27, 2021
@floryut
Copy link
Member

floryut commented Apr 27, 2021

Nice, shouldn't this also have image arch 🤔

image: "{{ flannel_image_repo }}:{{ flannel_image_tag }}"

@muzi502
Copy link
Contributor Author

muzi502 commented Apr 27, 2021

Nice, shouldn't this also have image arch 🤔

image: "{{ flannel_image_repo }}:{{ flannel_image_tag }}"

Sorry i forgot canal 😅

should remove -{{ arch }} and add it in flannel_image_tag , such as flannel_image_tag: "{{ flannel_version }}-{{ image_arch }}" 🤔️

image: {{ flannel_image_repo }}:{{ flannel_image_tag }}-{{ arch }}

flannel_image_tag: "{{ flannel_version }}"

Other images set image arch in it's image_repo or image_tag, such as dnsautoscaler and calico, only flannel set image arch in its's template file.

dnsautoscaler_image_repo: "{{ kube_image_repo }}/cpa/cluster-proportional-autoscaler-{{ image_arch }}"

calico_node_image_tag: "{{ calico_version }}{%- if image_arch != 'amd64' -%}-{{ image_arch }}{%- endif -%}"

find roles -type f -name "*.j2" | xargs grep '_tag }}' | grep arch
roles/network_plugin/flannel/templates/cni-flannel.yml.j2:        image: {{ flannel_image_repo }}:{{ flannel_image_tag }}-{{ arch }}
roles/network_plugin/flannel/templates/cni-flannel.yml.j2:        image: {{ flannel_image_repo }}:{{ flannel_image_tag }}-{{ arch }}

@muzi502 muzi502 changed the title Add image_arch variable when download flannel image Add image_arch flannel image tag Apr 27, 2021
@muzi502 muzi502 changed the title Add image_arch flannel image tag Add image_arch in flannel image tag Apr 27, 2021
@muzi502
Copy link
Contributor Author

muzi502 commented Apr 27, 2021

/cc @floryut
I add image_arch in flannel_image_tag, then use regex_replace(image_arch,'') to remove redundant image_arch

https://github.com/kubernetes-sigs/kubespray/blob/10083fa47e579b49f7cd9736556bd9390e1ecb92/roles/download/defaults/main.yml#L404

image: {{ flannel_image_repo }}:{{ flannel_image_tag | regex_replace(image_arch,'') }}{{ arch }}

flannel's task will create five daemonset with different arch, should keep {{ arch }} variable

[root@kube-control-1 ~]# kubectl get daemonset -n kube-system
NAME                                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
daemonset.apps/kube-flannel              4         4         4       0            4           <none>                   73m
daemonset.apps/kube-flannel-ds-arm       0         0         0       0            0           <none>                   73m
daemonset.apps/kube-flannel-ds-arm64     0         0         0       0            0           <none>                   73m
daemonset.apps/kube-flannel-ds-ppc64le   0         0         0       0            0           <none>                   73m
daemonset.apps/kube-flannel-ds-s390x     0         0         0       0            0           <none>                   73m

This will keep download flannel image tag and real used image tag consistent

@muzi502
Copy link
Contributor Author

muzi502 commented Apr 27, 2021

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Apr 27, 2021
Copy link
Contributor

@oomichi oomichi left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@@ -66,7 +66,7 @@ spec:
serviceAccountName: flannel
containers:
- name: kube-flannel
image: {{ flannel_image_repo }}:{{ flannel_image_tag }}-{{ arch }}
image: {{ flannel_image_repo }}:{{ flannel_image_tag | regex_replace(image_arch,'') }}-{{ arch }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering why we need to remove and add similar string here, but that seems the same as the existing code https://github.com/kubernetes-sigs/kubespray/blob/10083fa47e579b49f7cd9736556bd9390e1ecb92/roles/network_plugin/flannel/templates/cni-flannel.yml.j2#L69

So it is fine to do that.

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 27, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: floryut, muzi502

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 28, 2021
@oomichi
Copy link
Contributor

oomichi commented Apr 30, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 30, 2021
@k8s-ci-robot k8s-ci-robot merged commit 5ea2d1e into kubernetes-sigs:master Apr 30, 2021
@floryut floryut mentioned this pull request May 11, 2021
@muzi502 muzi502 deleted the flannel branch May 29, 2021 17:29
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Jun 12, 2021
* Add image_arch variable when download flannel image

* Fix flannel image tag typo with image arch
sakuraiyuta pushed a commit to sakuraiyuta/kubespray that referenced this pull request Apr 16, 2022
* Add image_arch variable when download flannel image

* Fix flannel image tag typo with image arch
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants