timoni icon indicating copy to clipboard operation
timoni copied to clipboard

Feature Request: Add namespace label to bundle instance

Open ghost opened this issue 1 year ago • 1 comments

Timoni is awesome, but when I use Talos and want to create a local-storage-bundle, I need a namespace that has a label:

"pod-security.kubernetes.io/enforce": "privileged"

How is it possible to maybe add that as an option to the namespace parameter in the instance?
I would expect it to be:

namespace: {
    name:   "local-path-storage"
    labels: {
        "pod-security.kubernetes.io/enforce": "privileged"
    }
}

Below is the complete bundle definition for local-path-storage and provisioner, which includes the creation of a namespace with the required label if it does not already exist:

// Bundle definition for local-path-storage and provisioner
bundle: {
    apiVersion: "v1alpha1"
    name:       "local-storage-bundle"
    instances: {
        // Helm release for local-path-provisioner
        "local-path-provisioner": {
            module: {
                url:     "oci://ghcr.io/stefanprodan/modules/flux-helm-release"
                version: "latest"
            }
            namespace: {
                name: "local-path-storage"
                labels: {
                    "pod-security.kubernetes.io/enforce": "privileged"
                }
            }
            values: {
                repository: {
                    url: "https://charts.containeroo.ch"
                }
                chart: {
                    name:    "local-path-provisioner"
                    version: "0.0.31"
                }
                helmValues: {
                    nodePathMap: [
                        {
                            node:  "DEFAULT_PATH_FOR_NON_LISTED_NODES"
                            paths: ["/var/local-path-provisioner"]
                        }
                    ]
                    storageClass: {
                        name:         "local-path"
                        defaultClass: true
                    }
                }
            }
        }
    }
}

ghost avatar Nov 17 '24 12:11 ghost

This would be a breaking change to the bundle API. I'm considering adding namespaceMetadata as an optional field that would allow setting both labels and annotations.

PS. The current workaround is to have your own module that provisions the namespaces in your cluster.

stefanprodan avatar Dec 15 '24 12:12 stefanprodan