Skip to content

Add optional message to be shown to template #472

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

Merged
merged 4 commits into from
Dec 14, 2021

Conversation

afbjorklund
Copy link
Member

Show example with current values already in place.

Currently just shown as regular INFO log messages.

As mentioned in #470 (comment)

Example:

INFO[0032] [hostagent] The final requirement 1 of 1 is satisfied 
INFO[0032] READY. Run `limactl shell docker` to open the shell. 
INFO[0032] To run `docker` on the host (assumes docker-cli is installed): 
INFO[0032] $ export DOCKER_HOST=unix:///home/anders/.lima/docker/sock/docker.sock 
INFO[0032] $ docker ...                                 

@jandubois
Copy link
Member

I like it!

  1. Needs (commented out) sample setting/documentation in pkg/limayaml/default.yaml.

  2. Should use the addGlobalFields logic from cmd/limactl/list.go (move it to the store package, so it can be shared). That way we have the same set of template variables (adds IdentityFile and LimaHome for now).

jandubois
jandubois previously approved these changes Dec 12, 2021
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

HostArch string
LimaHome string
IdentityFile string
}
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 we have to consolidate this struct into what we have for sockets

data := map[string]string{
"Dir": instDir,
"Home": home,
"Name": filepath.Base(instDir),
"UID": user.Uid,
"User": user.Username,
"Instance": filepath.Base(instDir), // DEPRECATED, use `{{.Name}}`
"LimaHome": limaHome, // DEPRECATED, (use `Dir` instead of `{{.LimaHome}}/{{.Instance}}`
}

Having two similar but different structs is confusing.

Copy link
Member Author

Choose a reason for hiding this comment

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

We consolidated the one from "limactl list", but didn't do anything about the socket templates

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks, but I think we have to consolidate the template struct into what we already have for sockets

https://github.com/lima-vm/lima/pull/472/files#r767601007

@jandubois
Copy link
Member

Thanks, but I think we have to consolidate the template struct into what we already have for sockets

I don't think that works too well.

For guestSocket the Home and User fields have different values; the user inside the VM may be lima if the host user is not valid, and Home is /home/$USER.linux.

For hostSocket we support additional "deprecated" fields, that we don't want to show up in limactl list --list-fields.

If we want to consolidate, then we can only do this for hostSocket, but we would also have to add tags on the deprecated fields, and check for them in the reflection code that lists field names.

@jandubois
Copy link
Member

For hostSocket we support additional "deprecated" fields, that we don't want to show up in limactl list --list-fields.

Turns out InstanceDir (redundant with plain Dir) is the only field we want to hide, as LimaHome is used by limactl list.

@afbjorklund
Copy link
Member Author

afbjorklund commented Dec 13, 2021

I found another issue with architecture, it was amd64 on the host but translated to x86_64 in the VM.

Arch

HostArch

I didn't end up using it now, but thought it might come in handy for instance when downloading a client...

@jandubois
Copy link
Member

I found another issue with architecture, it was amd64 on the host but translated to x86_64 in the VM.

Can you point to where it is used as amd64 (except in HostArch in this PR)?

I would say that HostArch should be set to x86_64 to be consistent with the values we use in lima.yaml (aarch64 and x86_64.

I don't think we need to include the GOARCH values as well; you can use templating to translate, if you really have to:

curl ... tarball.{{if eq .HostArch "x86_64"}}amd64{{else})arm64{{end}}.tar.tz

We can always add more names later, if they seem to be useful, but we can't remove them without breaking compatibility, so I would not add more than we need. I'm fine with HostArch and HostOS though.

@afbjorklund
Copy link
Member Author

afbjorklund commented Dec 13, 2021

Can you point to where it is used as amd64 (except in HostArch in this PR)?

It wasn't used per se, I just happened to list both in the same template test...

But maybe should use the lima function to set them, instead of the "raw" vars

like resolveArch does it

type Arch

Show example with current values already in place.

Currently just shown as regular INFO log messages.

Signed-off-by: Anders F Björklund <[email protected]>
On macOS and Windows, "podman-remote" is called "podman".

On Linux, make sure that it calls the $CONTAINER_HOST...

Signed-off-by: Anders F Björklund <[email protected]>
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit ecc4f8b into lima-vm:master Dec 14, 2021
@AkihiroSuda AkihiroSuda added this to the v0.8.0 milestone Dec 14, 2021
@afbjorklund afbjorklund deleted the message branch December 16, 2021 06:31
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.

3 participants