allow osbuilder to inject ecr specific env var to exporter

This commit is contained in:
Sebastian Florek
2025-01-29 12:24:18 +01:00
parent d69f69a0c6
commit dcc3f0efc3
11 changed files with 66 additions and 18 deletions

View File

@@ -54,12 +54,31 @@ type SecretKeySelector struct {
Key string `json:"key,omitempty"`
}
type RegistryCloud string
const (
// RegistryCloudECR ensures that special env variables will be injected
// into the exporter job to allow kaniko to automatically auth with the
// ecr registry to push the images.
RegistryCloudECR RegistryCloud = "ecr"
// RegistryCloudOther requires from user to provide username/password secret
// in order for kaniko to be able to authenticate with the container registry.
RegistryCloudOther RegistryCloud = "other"
)
type OutputImage struct {
Registry string `json:"registry,omitempty"`
Repository string `json:"repository,omitempty"`
Tag string `json:"tag,omitempty"`
Username string `json:"username,omitempty"`
PasswordSecretKeyRef *SecretKeySelector `json:"passwordSecretKeyRef,omitempty"`
// +kubebuilder:validation:Enum=ecr;other
// +kubebuilder:default=other
// +required
Cloud RegistryCloud `json:"cloud"`
// +optional
Registry string `json:"registry,omitempty"`
// +optional
Repository string `json:"repository,omitempty"`
// +optional
Tag string `json:"tag,omitempty"`
// +optional
DockerConfigSecretKeyRef *SecretKeySelector `json:"dockerConfigSecretKeyRef,omitempty"`
}
type ArtifactPhase string

View File

@@ -151,8 +151,8 @@ func (in *OSArtifactStatus) DeepCopy() *OSArtifactStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OutputImage) DeepCopyInto(out *OutputImage) {
*out = *in
if in.PasswordSecretKeyRef != nil {
in, out := &in.PasswordSecretKeyRef, &out.PasswordSecretKeyRef
if in.DockerConfigSecretKeyRef != nil {
in, out := &in.DockerConfigSecretKeyRef, &out.DockerConfigSecretKeyRef
*out = new(SecretKeySelector)
**out = **in
}