Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install/image-references
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ spec:
- name: machine-os-content
from:
kind: DockerImage
name: registry.svc.ci.openshift.org/rhcos/maipo@sha256:83a6d461628380f1dcc057ffef4909992f593b72c5aa4db2e01c0b130004afea
name: registry.svc.ci.openshift.org/rhcos/maipo@sha256:61dc83d62cfb5054c4c5532bd2478742a0711075ef5151572e63f94babeacc1a
6 changes: 5 additions & 1 deletion pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ func generateMachineConfigForName(config *RenderConfig, role, name, path string)
return nil, fmt.Errorf("error transpiling ct config to Ignition config: %v", err)
}

return MachineConfigFromIgnConfig(role, name, ignCfg), nil
mcfg := MachineConfigFromIgnConfig(role, name, ignCfg)
// And inject the osimageurl here
mcfg.Spec.OSImageURL = config.OSImageURL

return mcfg, nil
}

const (
Expand Down
46 changes: 46 additions & 0 deletions test/e2e/osimageurl_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package e2e_test

import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/openshift/machine-config-operator/cmd/common"
)

func TestOSImageURL(t *testing.T) {
cb, err := common.NewClientBuilder("")
if err != nil {
t.Fatalf("%#v", err)
}
mcClient := cb.MachineConfigClientOrDie("mc-file-add")

// grab the latest worker- MC
mcp, err := mcClient.MachineconfigurationV1().MachineConfigPools().Get("worker", metav1.GetOptions{})
if err != nil {
t.Fatalf("%#v", err)
}

mc, err := mcClient.MachineconfigurationV1().MachineConfigs().Get(mcp.Status.Configuration.Name, metav1.GetOptions{})
if err != nil {
t.Fatalf("%#v", err)
}

if mc.Spec.OSImageURL == "" {
t.Fatalf("Empty OSImageURL for %s", mc.Name)
}

// grab the latest master- MC
mcp, err = mcClient.MachineconfigurationV1().MachineConfigPools().Get("master", metav1.GetOptions{})
if err != nil {
t.Fatalf("%#v", err)
}
mc, err = mcClient.MachineconfigurationV1().MachineConfigs().Get(mcp.Status.Configuration.Name, metav1.GetOptions{})
if err != nil {
t.Fatalf("%#v", err)
}

if mc.Spec.OSImageURL == "" {
t.Fatalf("Empty OSImageURL for %s", mc.Name)
}
}