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 kubernetes.YAML support to ramalama serve #327

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Oct 17, 2024

Fixes: #183

@rhatdan rhatdan changed the title Add kubernetes.YAML support to ramalama serverve Add kubernetes.YAML support to ramalama serve Oct 17, 2024
@rhatdan
Copy link
Member Author

rhatdan commented Oct 18, 2024

@ygalblum @umohnani8 @mrunalp @haircommander PTAL to make sure my kube YAML looks ok

@haircommander
Copy link

LGTM

kind: Pod
metadata:
labels:
app: tini-pod

Choose a reason for hiding this comment

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

Why postfix the name with -pod?

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't I have to name these different then the tini container?

Choose a reason for hiding this comment

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

No, these are two different entities

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed -pod

args: ['--port', '8080', '-m', '/run/model']
ports:
- containerPort: 8080
hostPort: 8080

Choose a reason for hiding this comment

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

I think it's best not to the hostPort

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 only do hostPort if different?

Choose a reason for hiding this comment

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

In most cases hostPort is not really used in K8S. Endpoints are exposed via Services. Maybe consider setting the port's name

Copy link
Member Author

Choose a reason for hiding this comment

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

name: tini-port?

- containerPort: 8080
hostPort: 8080
volumeMounts:
- mountPath: /run/model

Choose a reason for hiding this comment

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

This indentation works, but we should keep the way arrays are indented consistent

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

name: dri
volumes:
- name model
hostPath:

Choose a reason for hiding this comment

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

How is this expected to work on K8S?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes this is the goal.

Choose a reason for hiding this comment

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

I don't think hostPath will be used for these type of data. It will probably use a persistent volume

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes i am hoping to change this to use an image at some point. But if you could give me an example of what it should look like?


return mounts + volumes

def kube(self, model, args, exec_args):

Choose a reason for hiding this comment

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

My experience with generating YAML files with templates has always been a poor one. There was always some indentation that got botched. I think a better solution is to create a dict and dump it using the pyyaml library by calling print(yaml.dump(d))

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool, do you have an example of a template for a kube.yaml?

#
# Created with ramalama-0.0.17
apiVersion: v1
kind: Pod

Choose a reason for hiding this comment

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

Come to think about it I think a Deployment will be more useful than a Pod

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed

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.

Add podman serve --generate kube MODEL
3 participants