Support Kubernetes style TLS Secrets #4137
Labels
area/api
API related issues and pull requests
area/security
Security related issues and pull requests
enhancement
New feature or request
umbrella-issue
Umbrella issue for tracking progress of a larger effort
There are several Flux APIs that provide a way to configure TLS authentication. These APIs expect the specified Secret to contain three keys, namely
caFile
,certFile
andkeyFile
. This allows for users to specify their TLS data, but it doesn't align with the API of a Kubernetes Secret of type TLS.A TLS secret needs to contain the keys
tls.crt
for the certificate andtls.key
for the private key. While it doesn't specify an exact key for the CA file, the common convention is to useca.crt
as used by cert-manager and ingress-nginx.To make adoption and usage easier, we should adopt these standards in the Flux project as well. This change would require the following things:
OCIRepository, ImageRepository, Provider: Add support for
tls.crt
,tls.key
andca.crt
keys in the Secret specified in.spec.certSecretRef
and deprecate the currently supported keys, in a way that is similar to the deprecation of.spec.secretRef
for TLS data in HelmRepository. Support for the existing keys would be completely dropped when the API receives it's next version bump.HelmRepository: Drop support for the currently supported keys in the Secret specified in
.spec.certSecretRef
and replace it with thetls.crt
,tls.key
andca.crt
.GitRepository: Since GitRepository is v1, we can't drop support for the
caFile
key as a Secret's supported keys are a part of the API and this'd be a breaking change. We can either leave the API as it is or add support for theca.crt
key and support both keys in the controller, but use the new key in docs and for generating Secrets using the Flux CLI.CLI: Atm, we have two commands to generate a Secret with TLS data,
flux create secret tls
,flux create secret helm
where both support the--ca-file
,--cert-file
and--key-file
flags. Since we are separating TLS Secrets throughout the project, we should remove these flags fromflux create secret helm
and have one standard command for generating Secrets with TLS data. Furthermore, the logic behindflux create secret tls
should be updated to generate Secrets using the new keys using the flags--ca-crt
,--tls-key
,--tls-crt
.While
flux create secret git
also supports the--ca-file
flag, since GitRepository expects the CA certificate to be in the same Secret as other auth data, it doesn't make sense to remove the flag altogether. Instead it should also be updated to be--ca-crt
and useca.crt
as the key in the Secret.The text was updated successfully, but these errors were encountered: