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

Avoid build on linera net up --kubernetes #2986

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

ndr-ds
Copy link
Contributor

@ndr-ds ndr-ds commented Nov 29, 2024

Motivation

When testing kubernetes related config changes locally with linera net up --kubernetes, there's no way to just use an existing docker image (if you're not testing something on the linera binaries, there's no need to rebuild the docker image every time)

Proposal

Add options to skip building the image and just use an existing one. The name of the image to use also became a configurable option

Test Plan

Ran linera net up --kubernetes locally with these new arguments

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

Copy link
Contributor Author

ndr-ds commented Nov 29, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ndr-ds ndr-ds requested review from christos-h, jvff, ma2bd and Twey November 29, 2024 19:13
@ndr-ds ndr-ds force-pushed the 11-28-avoid_build_on_linera_net_up_--kubernetes branch from b6242ce to a872d17 Compare December 2, 2024 14:40
@ndr-ds ndr-ds force-pushed the 11-28-avoid_build_on_linera_net_up_--kubernetes branch from a872d17 to 37758e3 Compare December 2, 2024 21:11
Comment on lines +1007 to +1016
/// Don't build docker image. This assumes that the image is already built.
#[cfg(feature = "kubernetes")]
#[arg(long, default_value = "false")]
no_build: bool,

/// The name of the docker image to use.
#[cfg(feature = "kubernetes")]
#[arg(long, default_value = "linera:latest")]
docker_image_name: String,

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the link with the kubernetes feature and why --kubernetes in the title of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

--kubernetes calls the kubernetes version of linera net up, which needs to be compiled with the kubernetes feature. But if you don't compile with the kubernetes feature, the --kubernetes option is not even available.
You can still compile with the kubernetes feature and run just linera net up without --kubernetes, and it won't run the kubernetes version

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. I misread the test plan (which could have mentioned these extra arguments)

Copy link
Contributor

@ma2bd ma2bd Dec 2, 2024

Choose a reason for hiding this comment

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

nit: It's hard to understand the context because the motivation section doesn't mention kubernetes (and locally superficially seems contradictory although now I remember we have kind).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I edited the motivation, hopefully it's clearer now

@Twey
Copy link
Contributor

Twey commented Dec 2, 2024

Rather than adding a single parameter, I think it would be more Kubernetes-idiomatic to provide some arbitrary YAML configuration file that gets patched onto the relevant Kubernetes configuration.

Copy link
Contributor Author

ndr-ds commented Dec 2, 2024

Rather than adding a single parameter, I think it would be more Kubernetes-idiomatic to provide some arbitrary YAML configuration file that gets patched onto the relevant Kubernetes configuration.

@Twey I'm not sure I get it 🤔 Are you talking about the --docker-image-name option?

@@ -17,7 +17,7 @@ impl DockerImage {
&self.name
}

pub async fn build(name: String, binaries: &BuildArg, github_root: &PathBuf) -> Result<Self> {
pub async fn build(name: &String, binaries: &BuildArg, github_root: &PathBuf) -> Result<Self> {
Copy link
Contributor

Choose a reason for hiding this comment

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

&str?

fn new(
network: Network,
testing_prng_seed: Option<u64>,
binaries: BuildArg,
no_build: bool,
docker_image_name: String,
Copy link
Contributor

@christos-h christos-h Dec 3, 2024

Choose a reason for hiding this comment

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

If this is &str (I don't think you need ownership) wouldn't it make life easier (no cloning everywhere)?

All the futures are joined at the end of the function so there are no borrows which will outlive the reference (I think).

@ndr-ds ndr-ds force-pushed the 11-28-avoid_build_on_linera_net_up_--kubernetes branch from 37758e3 to 1b117c3 Compare December 3, 2024 21:33
@ndr-ds ndr-ds changed the base branch from main to 12-03-remotenet_-_existingnet December 3, 2024 21:34
@ndr-ds ndr-ds changed the base branch from 12-03-remotenet_-_existingnet to graphite-base/2986 December 4, 2024 14:12
@ndr-ds ndr-ds force-pushed the 11-28-avoid_build_on_linera_net_up_--kubernetes branch from 1b117c3 to 6266ccd Compare December 4, 2024 14:12
@ndr-ds ndr-ds force-pushed the graphite-base/2986 branch from 3a4b51d to 909b3e7 Compare December 4, 2024 14:12
@ndr-ds ndr-ds changed the base branch from graphite-base/2986 to main December 4, 2024 14:13
@ndr-ds ndr-ds force-pushed the 11-28-avoid_build_on_linera_net_up_--kubernetes branch from 6266ccd to 3650595 Compare December 4, 2024 14:13
Copy link
Contributor Author

ndr-ds commented Dec 4, 2024

Will merge this for now, but @Twey lmk if you have any reservations with this approach, and I can refine it in a follow up PR

Copy link
Contributor Author

ndr-ds commented Dec 4, 2024

Merge activity

  • Dec 4, 9:16 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Dec 4, 9:16 AM EST: A user merged this pull request with Graphite.

@ndr-ds ndr-ds merged commit 91cbd05 into main Dec 4, 2024
22 checks passed
@ndr-ds ndr-ds deleted the 11-28-avoid_build_on_linera_net_up_--kubernetes branch December 4, 2024 14:16
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.

4 participants