-
Notifications
You must be signed in to change notification settings - Fork 19
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
Extend type of Chart ref to work with OCI protocol correctly #2
Comments
@mkjpryor Hey, do you accept any pull requests? |
@NikPaushkin We would welcome a PR to implement this! Rather than accepting all strings, you should be able to define an OCI URI using OciUrl = stricturl(allowed_schemes = {"oci"}) This would be my preferred method. |
For anyone looking for a workaround consider monkeypatching Client.get_chart(). Here is what I came up with: from pyhelm3 import Client, Chart
import typing as t
from typing_extensions import Annotated
from pydantic import (
Field,
DirectoryPath,
FilePath,
HttpUrl,
)
Name = Annotated[str, Field(pattern=r"^[a-z0-9-]+$")]
OCIPath = Annotated[str, Field(pattern=r"oci:\/\/*")]
class OCIChart(Chart):
ref: t.Union[DirectoryPath, FilePath, HttpUrl, OCIPath, Name] = Field(
...,
)
async def get_chart_oci(self, chart_ref, *, devel=False, repo=None, version=None):
metadata = await self._command.show_chart(
chart_ref,
devel=devel,
repo=repo,
version=version
)
return OCIChart(
_command=self._command,
ref=chart_ref,
repo=repo,
metadata=metadata
)
# Monkey patch the get_chart method of the Client class
Client.get_chart = get_chart_oci
client = Client() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HTTP links are only allowed now here https://github.com/stackhpc/pyhelm3/blob/main/pyhelm3/models.py#L185. Could use simple
str
type or implement a custom one since Pydantic (and nobody tbh) doesn't know what OCI protocol is.The text was updated successfully, but these errors were encountered: