open-component-model / ocm-project

OCM Project Backlog
Apache License 2.0
0 stars 0 forks source link

ocm cli doesn't accept extra identity helmChart because it is not all lowercase but ocm-controller is looking for camel-case helmChart #69

Open dee0 opened 2 months ago

dee0 commented 2 months ago

See here https://github.com/open-component-model/ocm-controller/blob/main/api/v1alpha1/constants.go#L23 there is the const with the value 'helmChart'

And here https://github.com/open-component-model/ocm-controller/blob/f56a4d62a17064b390cd1ce81eb0151de02fba46/pkg/ocm/ocm.go#L550 you can see ocm-controller is looking for the extra identity with this key value in order to determine if the repository name it is constructing needs to include the value. ( So that flux is able to consume the repository )

I attempted to include this extra identity value in my component descriptor like so resources:

However the command failed because only all lower case identity names are allowed ocm --cred :type=OCIRegistry --cred :hostname=hanaservice-dev.common.repositories.cloud.sap --cred username=hanaservice-dev --cred 'password=V80CqMZ407xU' add componentversions --create --file ./component-archive ./component.yaml processing ./component.yaml... processing document 1... processing index 1 found 1 component adding component dmi.csi.sap/dmi-multcloud-service-provisioner:v1.0.27... Error: failed adding component "dmi.csi.sap/dmi-multcloud-service-provisioner"(./component.yaml[1][1]): resources: entry 1: extraIdentity[helmChart]: Invalid value: "helmChart": a identity label or name must consist of lower case alphanumeric characters, '-', '_' or '+', and must start and end with an alphanumeric character

The cli and the controller should follow the same rules wrt what is an acceptable name for extra identify info.

Skarlso commented 2 months ago

The extra identity needs to be provided for ocm-controller, not ocm. Apart from that, it needs to be helmChart and not helmchart. Meaning, you don't provide it to ocm component's file. You provide it when you define a resource in a localization/configuration/resource where the resource is a helmchart. ocm-controller can't figure out on its own that it's dealing with a helm chart, because the media type is OCI because of various reasons in OCM.

Skarlso commented 2 weeks ago

@dee0 Can we close this now?