stefanprodan / timoni

Timoni is a package manager for Kubernetes, powered by CUE and inspired by Helm.
https://timoni.sh
Apache License 2.0
1.51k stars 67 forks source link

Recommended Labels - Name and Instance #299

Closed Nalum closed 8 months ago

Nalum commented 8 months ago

Should the Timoni schema be updated so that the name provided to timoni build is set in the label app.kubernetes.io/instance and then the label app.kubernetes.io/name is set in the config as part of the metadata setup?

https://github.com/stefanprodan/timoni/blob/f44c6a8f11d915998616ae0394e73b760bd70439/schemas/timoni.sh/core/v1alpha1/metadata.cue#L44-L49

    #App: string & strings.MaxRunes(63)

    // Standard Kubernetes labels: app name, instance name, version and managed-by.
    labels: {
        "\(#StdLabelName)":      #App
        "\(#StdLabelInstance)":  name
        "\(#StdLabelVersion)":   #Version
        "\(#StdLabelManagedBy)": "timoni"
    }
    metadata: timoniv1.#Metadata & {#Version: moduleVersion, #App: "cert-manager"}
Nalum commented 8 months ago

Or should it be like this?

    #App: string & strings.MaxRunes(63)

    // Standard Kubernetes labels: part of, instance name, version and managed-by.
    labels: {
        "\(#StdLabelPartOf)":    #App
        "\(#StdLabelInstance)":  name
        "\(#StdLabelVersion)":   #Version
        "\(#StdLabelManagedBy)": "timoni"
    }

And then in each object the module maintainer would set:

stefanprodan commented 8 months ago

The instance name and namespace are set automatically by Timoni's server-side apply engine to track ownership, every object has these labels in cluster:

instance.timoni.sh/name: <NAME>
instance.timoni.sh/namespace: <NAMESPACE>

Given this, I didn't want to add the Kubernetes instance label as it would be confusing.

I suggest you add the app.kubernetes.io/part-of label to your modules, this can be done in the #Config with:

#Config: {
    metadata: labels: (timoniv1.#StdLabelPartOf): "cert-manager"
}
ametad commented 7 months ago

(moved this comment to a new issue https://github.com/stefanprodan/timoni/issues/338)