Skip to content

Commit

Permalink
Merge pull request openshift#86 from zaneb/ipa-url-api-vip
Browse files Browse the repository at this point in the history
Set IPA URLs using API VIP
  • Loading branch information
openshift-merge-robot authored Dec 5, 2020
2 parents fd85fc4 + 256cb9c commit 8493236
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
22 changes: 8 additions & 14 deletions provisioning/baremetal_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,14 @@ func getProvisioningIPCIDR(config *metal3iov1alpha1.ProvisioningSpec) *string {
return nil
}

func getDeployKernelUrl(config *metal3iov1alpha1.ProvisioningSpec) *string {
if config.ProvisioningIP != "" {
deployKernelUrl := fmt.Sprintf("http://%s/%s", net.JoinHostPort(config.ProvisioningIP, baremetalHttpPort), baremetalKernelUrlSubPath)
return &deployKernelUrl
}
return nil
func getDeployKernelUrl() *string {
deployKernelUrl := fmt.Sprintf("http://localhost:%d/%s", imageCachePort, baremetalKernelUrlSubPath)
return &deployKernelUrl
}

func getDeployRamdiskUrl(config *metal3iov1alpha1.ProvisioningSpec) *string {
if config.ProvisioningIP != "" {
deployRamdiskUrl := fmt.Sprintf("http://%s/%s", net.JoinHostPort(config.ProvisioningIP, baremetalHttpPort), baremetalRamdiskUrlSubPath)
return &deployRamdiskUrl
}
return nil
func getDeployRamdiskUrl() *string {
deployRamdiskUrl := fmt.Sprintf("http://localhost:%d/%s", imageCachePort, baremetalRamdiskUrlSubPath)
return &deployRamdiskUrl
}

func getIronicEndpoint() *string {
Expand All @@ -182,9 +176,9 @@ func getMetal3DeploymentConfig(name string, baremetalConfig *metal3iov1alpha1.Pr
case provisioningInterface:
return &baremetalConfig.ProvisioningInterface
case deployKernelUrl:
return getDeployKernelUrl(baremetalConfig)
return getDeployKernelUrl()
case deployRamdiskUrl:
return getDeployRamdiskUrl(baremetalConfig)
return getDeployRamdiskUrl()
case ironicEndpoint:
return getIronicEndpoint()
case ironicInspectorEndpoint:
Expand Down
8 changes: 4 additions & 4 deletions provisioning/baremetal_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,25 +236,25 @@ func TestGetMetal3DeploymentConfig(t *testing.T) {
name: "Unmanaged DeployKernelUrl",
configName: deployKernelUrl,
spec: unmanagedProvisioning().build(),
expectedValue: "http://172.30.20.3:6180/images/ironic-python-agent.kernel",
expectedValue: "http://localhost:6181/images/ironic-python-agent.kernel",
},
{
name: "Disabled DeployKernelUrl",
configName: deployKernelUrl,
spec: disabledProvisioning().build(),
expectedValue: "http://172.30.20.3:6180/images/ironic-python-agent.kernel",
expectedValue: "http://localhost:6181/images/ironic-python-agent.kernel",
},
{
name: "Unmanaged DeployRamdiskUrl",
configName: deployRamdiskUrl,
spec: unmanagedProvisioning().build(),
expectedValue: "http://172.30.20.3:6180/images/ironic-python-agent.initramfs",
expectedValue: "http://localhost:6181/images/ironic-python-agent.initramfs",
},
{
name: "Disabled DeployRamdiskUrl",
configName: deployRamdiskUrl,
spec: disabledProvisioning().build(),
expectedValue: "http://172.30.20.3:6180/images/ironic-python-agent.initramfs",
expectedValue: "http://localhost:6181/images/ironic-python-agent.initramfs",
},
{
name: "Disabled IronicEndpoint",
Expand Down
1 change: 1 addition & 0 deletions provisioning/baremetal_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ func newMetal3PodTemplateSpec(images *Images, config *metal3iov1alpha1.Provision
InitContainers: initContainers,
Containers: containers,
HostNetwork: true,
DNSPolicy: corev1.DNSClusterFirstWithHostNet,
PriorityClassName: "system-node-critical",
NodeSelector: map[string]string{"node-role.kubernetes.io/master": ""},
SecurityContext: &corev1.PodSecurityContext{
Expand Down
1 change: 1 addition & 0 deletions provisioning/image_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func newImageCachePodTemplateSpec(targetNamespace string, images *Images, provis
},
InitContainers: []corev1.Container{
createInitContainerMachineOsDownloader(images, cacheConfig),
createInitContainerIpaDownloader(images),
},
Containers: []corev1.Container{
createContainerImageCache(images),
Expand Down

0 comments on commit 8493236

Please sign in to comment.