update osbuilder/osartifact

This commit is contained in:
Sebastian Florek
2025-01-30 21:07:00 +01:00
parent 6733cc712b
commit ebe602b113
9 changed files with 52 additions and 7 deletions

View File

@@ -80,6 +80,14 @@ type ExporterSpec struct {
// ExtraEnvVars allows to append extra env vars to the exporter pods. // ExtraEnvVars allows to append extra env vars to the exporter pods.
// +optional // +optional
ExtraEnvVars *[]corev1.EnvVar `json:"extraEnvVars,omitempty"` ExtraEnvVars *[]corev1.EnvVar `json:"extraEnvVars,omitempty"`
// Image is the image used for exporter pods
// +optional
Image string `json:"image,omitempty"`
// ExtraArgs allows appending args to the exporter image.
// +optional
ExtraArgs []string `json:"extraArgs,omitempty"`
} }
func (in *ExporterSpec) IsECRRegistry() bool { func (in *ExporterSpec) IsECRRegistry() bool {

View File

@@ -46,6 +46,11 @@ func (in *ExporterSpec) DeepCopyInto(out *ExporterSpec) {
} }
} }
} }
if in.ExtraArgs != nil {
in, out := &in.ExtraArgs, &out.ExtraArgs
*out = make([]string, len(*in))
copy(*out, *in)
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExporterSpec. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExporterSpec.

View File

@@ -5,4 +5,4 @@ maintainers:
- name: Plural - name: Plural
email: support@plural.sh email: support@plural.sh
type: application type: application
version: 0.6.2 version: 0.7.0

View File

@@ -27,6 +27,13 @@ spec:
{{- with .Values.exporter.extraEnvVars }} {{- with .Values.exporter.extraEnvVars }}
extraEnvVars: {{ . | toYaml | nindent 4 }} extraEnvVars: {{ . | toYaml | nindent 4 }}
{{- end }} {{- end }}
{{- if .Values.exporter.image }}
image: {{ .Values.exporter.image }}
{{- end }}
{{ with .Values.exporter.extraArgs }}
extraArgs:
{{- . | toYaml | nindent 6 }}
{{- end }}
registry: registry:
name: {{ .Values.exporter.registry.name }} name: {{ .Values.exporter.registry.name }}
type: {{ .Values.exporter.registry.type }} type: {{ .Values.exporter.registry.type }}

View File

@@ -61,11 +61,15 @@ extraCloudConfig: ~
exporter: exporter:
serviceAccount: serviceAccount:
annotations: ~ annotations: ~
# Defines extra env vars that will be added to the exporter pob # Defines extra env vars that will be added to the exporter pod
# extraEnvVars: # extraEnvVars:
# - name: MY_ENV_VAR # - name: MY_ENV_VAR
# value: myvalue # value: myvalue
extraEnvVars: [] extraEnvVars: []
# Image used for exporter pods
image: ~
# Allows appending args to the exporter image
extraArgs: []
registry: registry:
# Container registry DNS name where we should export packed ISO images # Container registry DNS name where we should export packed ISO images
name: ~ name: ~

View File

@@ -1,8 +1,8 @@
apiVersion: v2 apiVersion: v2
name: osbuilder name: osbuilder
description: A Helm chart for osbuilder description: A Helm chart for osbuilder
appVersion: 0.3.0 appVersion: 0.4.0
version: 0.1.14 version: 0.1.15
dependencies: dependencies:
- name: cert-manager - name: cert-manager
version: v1.16.3 version: v1.16.3

View File

@@ -75,6 +75,11 @@ spec:
Exporter when provided it will spawn an exporter job that Exporter when provided it will spawn an exporter job that
pushes images built by the osbuilder to the provided registry. pushes images built by the osbuilder to the provided registry.
properties: properties:
extraArgs:
description: ExtraArgs allows appending args to the exporter image.
items:
type: string
type: array
extraEnvVars: extraEnvVars:
description: ExtraEnvVars allows to append extra env vars to the description: ExtraEnvVars allows to append extra env vars to the
exporter pods. exporter pods.
@@ -196,6 +201,9 @@ spec:
- name - name
type: object type: object
type: array type: array
image:
description: Image is the image used for exporter pods
type: string
registry: registry:
description: Registry is a registry spec used to push the final description: Registry is a registry spec used to push the final
images built by the osbuilder. images built by the osbuilder.

View File

@@ -75,6 +75,11 @@ spec:
Exporter when provided it will spawn an exporter job that Exporter when provided it will spawn an exporter job that
pushes images built by the osbuilder to the provided registry. pushes images built by the osbuilder to the provided registry.
properties: properties:
extraArgs:
description: ExtraArgs allows appending args to the exporter image.
items:
type: string
type: array
extraEnvVars: extraEnvVars:
description: ExtraEnvVars allows to append extra env vars to the description: ExtraEnvVars allows to append extra env vars to the
exporter pods. exporter pods.
@@ -196,6 +201,9 @@ spec:
- name - name
type: object type: object
type: array type: array
image:
description: Image is the image used for exporter pods
type: string
registry: registry:
description: Registry is a registry spec used to push the final description: Registry is a registry spec used to push the final
images built by the osbuilder. images built by the osbuilder.

View File

@@ -309,14 +309,19 @@ func (r *OSArtifactReconciler) checkExport(ctx context.Context, artifact *osbuil
tag = "latest" tag = "latest"
} }
image := artifact.Spec.Exporter.Image
if len(image) == 0 {
image = "gcr.io/kaniko-project/executor:latest"
}
container := corev1.Container{ container := corev1.Container{
Name: "exporter", Name: "exporter",
Image: "gcr.io/kaniko-project/executor:latest", Image: image,
Args: []string{ Args: append([]string{
"--context=/artifacts/", "--context=/artifacts/",
"--dockerfile=/artifacts/Dockerfile", "--dockerfile=/artifacts/Dockerfile",
fmt.Sprintf("--destination=%s/%s:%s", artifact.Spec.Exporter.Registry.Name, artifact.Spec.Exporter.Registry.Image.Repository, tag), fmt.Sprintf("--destination=%s/%s:%s", artifact.Spec.Exporter.Registry.Name, artifact.Spec.Exporter.Registry.Image.Repository, tag),
}, }, artifact.Spec.Exporter.ExtraArgs...),
VolumeMounts: []corev1.VolumeMount{ VolumeMounts: []corev1.VolumeMount{
{ {
Name: "artifacts", Name: "artifacts",