-
Notifications
You must be signed in to change notification settings - Fork 764
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 ability to generate .bicep file from a Kubernetes manifest #7812
Conversation
bce2a4f
to
e8af0e5
Compare
81b1eef
to
0e34199
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Bicep.LangServer/Handlers/ImportKubernetesManifestHandler.cs
Outdated
Show resolved
Hide resolved
public Task<ImportKubernetesManifestResponse> Handle(ImportKubernetesManifestRequest request, CancellationToken cancellationToken) | ||
=> helper.ExecuteWithTelemetryAndErrorHandling(async () => { | ||
var bicepFilePath = Path.ChangeExtension(request.ManifestFilePath, ".bicep"); | ||
var manifestContents = await File.ReadAllTextAsync(request.ManifestFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the right thing to do from the VS Code POV? I expected this to take a URI and need to interact with VS Code APIs to get the document. eg: will this work in remote scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a shortcut - the UI side brings up a file picker, meaning that you can only operate on on-disk files. Feels good enough for now, as there's no way I'm aware of to access the 'unsafe' behavior.
If we wanted to extend this in future, we'd need to either have the extension be aware of .yml files, or have the LSP send and receive the full file contents instead of sending/receiving URIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall the conversion algorithm seems good.
importsEnabledExperimental
to VSIX package to enable/disable extensibility.importKubernetesManifest
which takes a path to a kubernetes manifest, and generates a bicep file from it.Microsoft Reviewers: Open in CodeFlow