A common use case Flux users have is a multi-tenant monorepo containing the YAML for all tenants. ArtifactGenerator does not support it today because it can only create ExternalArtifact in the same namespace as the ArtifactGenerator, which breaks multi-tenancy i.e. it requires cross-namespace source references in appliers, which in a multi-tenant setup are blocked.
For allowing ExternalArtifact to be created in a different namespace (i.e. not the namespace of the ArtifactGenerator producing it), we need to introduce two fields:
.spec.artifacts[].namespace
.spec.serviceAccountName
CRD XValidation via CEL expressions must block .namespace from being used when .serviceAccountName is not specified.
When .serviceAccountName is specified, source-watcher will impersonate the ServiceAccount for reconciling the ExternalArtifact objects. This means the ServiceAccount will require the necessary RBAC bindings. Because RBAC allows cross-namespace access for ServiceAccounts (since a ServiceAccount is really just a username at the end of the day and RBAC has no concept of namespaces for username), this will allow ExternalArtifact to be created in other namespaces, which in turn will allow cross-namespace source references to remain blocked for multi-tenant setups.
A common use case Flux users have is a multi-tenant monorepo containing the YAML for all tenants. ArtifactGenerator does not support it today because it can only create ExternalArtifact in the same namespace as the ArtifactGenerator, which breaks multi-tenancy i.e. it requires cross-namespace source references in appliers, which in a multi-tenant setup are blocked.
For allowing ExternalArtifact to be created in a different namespace (i.e. not the namespace of the ArtifactGenerator producing it), we need to introduce two fields:
.spec.artifacts[].namespace.spec.serviceAccountNameCRD XValidation via CEL expressions must block
.namespacefrom being used when.serviceAccountNameis not specified.When
.serviceAccountNameis specified, source-watcher will impersonate the ServiceAccount for reconciling the ExternalArtifact objects. This means the ServiceAccount will require the necessary RBAC bindings. Because RBAC allows cross-namespace access for ServiceAccounts (since a ServiceAccount is really just ausernameat the end of the day and RBAC has no concept of namespaces forusername), this will allow ExternalArtifact to be created in other namespaces, which in turn will allow cross-namespace source references to remain blocked for multi-tenant setups.