Un-hardcode the copier image

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
This commit is contained in:
Dimitris Karakasilis
2022-12-15 12:29:49 +02:00
parent 4e5e383b78
commit cfc4ebf308
3 changed files with 10 additions and 10 deletions

View File

@@ -326,7 +326,6 @@ func (r *OSArtifactReconciler) genJob(artifact buildv1alpha1.OSArtifact) *batchv
pod.InitContainers = append(pod.InitContainers, buildGCECloudImageContainer) pod.InitContainers = append(pod.InitContainers, buildGCECloudImageContainer)
} }
// TODO: Shell out to `kubectl cp`? Why not?
// TODO: Does it make sense to build the image and not push it? Maybe remove // TODO: Does it make sense to build the image and not push it? Maybe remove
// this flag? // this flag?
if pushImage { if pushImage {
@@ -334,9 +333,7 @@ func (r *OSArtifactReconciler) genJob(artifact buildv1alpha1.OSArtifact) *batchv
} }
pod.Containers = []v1.Container{ pod.Containers = []v1.Container{
// TODO: Add kubectl to osbuilder-tools? createPushToServerImageContainer(r.CopierImage, r.ArtifactPodInfo),
//createPushToServerImageContainer(r.ToolImage),
createPushToServerImageContainer("bitnami/kubectl", r.ArtifactPodInfo),
} }
jobLabels := genJobLabel(artifact.Name) jobLabels := genJobLabel(artifact.Name)

View File

@@ -48,11 +48,11 @@ type ArtifactPodInfo struct {
// OSArtifactReconciler reconciles a OSArtifact object // OSArtifactReconciler reconciles a OSArtifact object
type OSArtifactReconciler struct { type OSArtifactReconciler struct {
client.Client client.Client
Scheme *runtime.Scheme Scheme *runtime.Scheme
restConfig *rest.Config restConfig *rest.Config
clientSet *kubernetes.Clientset clientSet *kubernetes.Clientset
ServingImage, ToolImage string ServingImage, ToolImage, CopierImage string
ArtifactPodInfo ArtifactPodInfo ArtifactPodInfo ArtifactPodInfo
} }
func genObjectMeta(artifact buildv1alpha1.OSArtifact) metav1.ObjectMeta { func genObjectMeta(artifact buildv1alpha1.OSArtifact) metav1.ObjectMeta {

View File

@@ -52,10 +52,12 @@ func main() {
var metricsAddr string var metricsAddr string
var enableLeaderElection bool var enableLeaderElection bool
var probeAddr string var probeAddr string
var serveImage, toolImage string var serveImage, toolImage, copierImage string
var copyToPodLabel, copyToNamespace, copyToPath, copierRole string var copyToPodLabel, copyToNamespace, copyToPath, copierRole string
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&copierImage, "copier-image", "quay.io/kairos/kubectl", "The image that is used to copy artifacts to the server pod.")
flag.StringVar(&serveImage, "serve-image", "nginx", "Serve image.") flag.StringVar(&serveImage, "serve-image", "nginx", "Serve image.")
// It needs luet inside // It needs luet inside
flag.StringVar(&toolImage, "tool-image", "quay.io/kairos/osbuilder-tools:latest", "Tool image.") flag.StringVar(&toolImage, "tool-image", "quay.io/kairos/osbuilder-tools:latest", "Tool image.")
@@ -106,6 +108,7 @@ func main() {
Client: mgr.GetClient(), Client: mgr.GetClient(),
ServingImage: serveImage, ServingImage: serveImage,
ToolImage: toolImage, ToolImage: toolImage,
CopierImage: copierImage,
ArtifactPodInfo: controllers.ArtifactPodInfo{ ArtifactPodInfo: controllers.ArtifactPodInfo{
Label: copyToPodLabel, Label: copyToPodLabel,
Namespace: copyToNamespace, Namespace: copyToNamespace,