Skip to content

Conversation

DhairyaMajmudar
Copy link
Member

@DhairyaMajmudar DhairyaMajmudar commented Aug 1, 2025

Description

The new kro cli package command is useful to convert a RGD file into an OCI image which can be further published into registries like AWS or Docker hub.

Usage

kro package -f [FILE] -t [TAG]

Flags:

Shorthand Flag Usage
-f --file Path to the ResourceGroupDefinition file
-t --tag Tag to the image, Default: Latest

Demo

kro-package.webm

@barney-s barney-s self-assigned this Aug 1, 2025
@barney-s
Copy link
Contributor

barney-s commented Aug 5, 2025

I would add commands related to packaging under kro package similar to helm package?

Maybe the PR description is wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

im missing a test for this command

}
layer.Annotations[ocispec.AnnotationTitle] = filepath.Base(packageConfig.resourceGraphDefinitionFile)

artifactType := "application/vnd.kro.resourcegraphdefinition"
Copy link
Contributor

Choose a reason for hiding this comment

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

can be a global const that people can depend on.

Also probably needs a version (so we can change the format later)

packOpts := oras.PackManifestOptions{
Layers: []ocispec.Descriptor{layer},
ManifestAnnotations: map[string]string{
"kro.run/type": "resourcegraphdefinition",
Copy link
Contributor

Choose a reason for hiding this comment

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

whats the use of this type manifest annotation?

return fmt.Errorf("failed to create OCI layout store: %w", err)
}

mediaType := "application/vnd.kro.resourcegraphdefinition"
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not a valid media type. you store the rgd as yaml right? so the media type would be application/x-yaml or similar that is recognized by IANA.

nameWithoutExt := basename[:len(basename)-len(ext)]
outputTar := nameWithoutExt + ".tar"

if err := packageRGD(outputTar, data, &rgd); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I just noticed that you store the data here from the file. This can be a problem. Imagine if you have an unknown key inside your file. yaml.Unmarshal would work and then that key would be stored in the layer. Im not sure if thats intended. To maintain consistency with a stable media type, I would suggest that you marshal the rgd back into a byte stream and use that so you KNOW the format.

if you dont do this, then you need to at least understand what format the rgd file is in to suffix either +json or +yaml to the media type. Otherwise it will be hard to introspect later.

@k8s-triage-robot
Copy link

Unknown CLA label state. Rechecking for CLA labels.

Send feedback to sig-contributor-experience at kubernetes/community.

/check-cla
/easycla

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 12, 2025
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 26, 2025
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jakobmoellerdev
Copy link
Contributor

@DhairyaMajmudar friendly reminder, are you still interested in working on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants