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 Kustomize dependency #2366

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add Kustomize dependency #2366

wants to merge 3 commits into from

Conversation

fulviodenza
Copy link

@fulviodenza fulviodenza commented Apr 15, 2024

Is this a BUG FIX or a FEATURE ?:

/kind dependencies

What this PR does / why we need it:

This PR adds the dependency for Kustomize as requested in #1307 in the python script to fetch dependencies, the controller-gen was not required anymore.
We can use this PR also to update the tasks.py file in case there are some dependencies to update. Further we should verify the kustomize version.

Release note:

NONE

@@ -32,10 +32,12 @@
default_network = "kind"
extra_network = "network2"
controller_gen_version = "v0.14.0"
kubectl_version = "v1.27.0"
kustomize_version = "v5.4.0"
Copy link
Author

Choose a reason for hiding this comment

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

We should verify that this is actually the version needed, I could not find which exact version metallb uses

Copy link
Member

Choose a reason for hiding this comment

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

I guess the latest should work. What's important is pinning so we'll have reproducible behaviour.

@@ -32,10 +32,12 @@
default_network = "kind"
extra_network = "network2"
controller_gen_version = "v0.14.0"
kubectl_version = "v1.27.0"
kustomize_version = "v5.4.0"
Copy link
Member

Choose a reason for hiding this comment

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

I guess the latest should work. What's important is pinning so we'll have reproducible behaviour.

build_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "build")
kubectl_path = os.path.join(build_path, "kubectl")
controller_gen_path = os.path.join(build_path, "bin", "controller-gen")
kubectl_version = "v1.27.0"
kustomize_path = os.path.join(build_path, "bin", "kustomize")
Copy link
Member

Choose a reason for hiding this comment

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

can you also use this in place where we currently call kustomize straight? IIUC should only be here

fetch_controller_gen()
(also, call fetch_kustomize on top of the function)

Copy link
Author

Choose a reason for hiding this comment

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

Hi, I've added the fetch_kustomize on top of the function as requested,
For what concerns the comment

can you also use this in place where we currently call kustomize straight

I may be misunderstanding, but as it is now I should be already using that kustomize_path when we call kustomize. Did you find any place where I'm missing it?

Copy link
Member

Choose a reason for hiding this comment

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

ah, apologies. I did a quick search and found

res = run("{} kustomize config/{} > {}".format(kubectl_path, layer, output))
where we use kubectl kustomize. Ignore my comment

Copy link
Member

Choose a reason for hiding this comment

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

And checking again, I can't find a place where kustomize_path is used, so it maybe makes sense just to drop it?

Copy link
Author

Choose a reason for hiding this comment

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

Actually I'm using it in my fetch_kustomize function to run the get version command

Copy link
Member

Choose a reason for hiding this comment

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

yep but the point of fetch_kustomize is to fetch it to use it :-)
If we use kubectl kustomize there is no point in even fetching it

Copy link
Member

Choose a reason for hiding this comment

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

so, let's use kustomize in

res = run("{} kustomize config/{} > {}".format(kubectl_path, layer, output))

instead of kubectl kustomize.

Does it make sense?

Copy link
Author

Choose a reason for hiding this comment

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

yeah it makes sense, so I keep the variable kustomize_path and will modify this line of code.

@fedepaol
Copy link
Member

Sorry for the delay. Left a couple of comments. Can you also sign the commit?

@fulviodenza
Copy link
Author

/kind dependencies

Signed-off-by: Fulvio Denza <fulviodenza823@gmail.com>
Signed-off-by: Fulvio Denza <fulviodenza823@gmail.com>
Signed-off-by: Fulvio Denza <fulviodenza823@gmail.com>
@fulviodenza
Copy link
Author

I will fix the commit sign at the end so that I don't have to do it at any rebase

@fedepaol
Copy link
Member

Tried locally, getting the following error:

inv generatemanifests
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to open the file
Warning: /home/fpaoline/devel/upstream/metallb/build/bin/kustomize/kustomize_v5
Warning: .4.0_linux_amd64.tar.gz: No such file or directory
100     9  100     9    0     0     31      0 --:--:-- --:--:-- --:--:--    31
curl: (23) Failure writing output to destination
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0curl: (6) Could not resolve host: xzf
curl: (3) URL rejected: No host part in the URL

@fulviodenza
Copy link
Author

Can i ask you how you are testing it locally? @fedepaol

@fedepaol
Copy link
Member

Can i ask you how you are testing it locally? @fedepaol

I just run inv generatemanifests.
CI failed with the same error: https://github.com/metallb/metallb/actions/runs/8815367797/job/24363517861?pr=2366

@fulviodenza
Copy link
Author

I was looking at the error from the pipeline and I actually wanted to test it locally. Will fix this and back to you

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

2 participants