Skip to content

Commit

Permalink
Check for OSImageURL individually for each components
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Ganesh <[email protected]>
  • Loading branch information
Rahul Ganesh committed Oct 9, 2023
1 parent 9b37c9f commit 87f3f0c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions pkg/providers/tinkerbell/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,12 @@ func (tb *TemplateBuilder) GenerateCAPISpecControlPlane(clusterSpec *cluster.Spe
return nil, err
}
var OSImageURL string
if clusterSpec.TinkerbellDatacenter.Spec.OSImageURL != "" {
OSImageURL = clusterSpec.TinkerbellDatacenter.Spec.OSImageURL
} else {
OSImageURL = tb.controlPlaneMachineSpec.OSImageURL
}

if cpTemplateConfig == nil {
OSImageURL = clusterSpec.TinkerbellDatacenter.Spec.OSImageURL
if tb.controlPlaneMachineSpec.OSImageURL != "" {
OSImageURL = tb.controlPlaneMachineSpec.OSImageURL
}
versionBundle := bundle.VersionsBundle
cpTemplateConfig = v1alpha1.NewDefaultTinkerbellTemplateConfigCreate(clusterSpec.Cluster, *versionBundle, OSImageURL, tb.tinkerbellIP, tb.datacenterSpec.TinkerbellIP, tb.controlPlaneMachineSpec.OSFamily)
}
Expand All @@ -90,6 +89,7 @@ func (tb *TemplateBuilder) GenerateCAPISpecControlPlane(clusterSpec *cluster.Spe
var etcdTemplateString string
if clusterSpec.Cluster.Spec.ExternalEtcdConfiguration != nil {
etcdMachineSpec = *tb.etcdMachineSpec
OSImageURL = clusterSpec.TinkerbellDatacenter.Spec.OSImageURL
if etcdMachineSpec.OSImageURL != "" {
OSImageURL = etcdMachineSpec.OSImageURL
}
Expand Down Expand Up @@ -121,10 +121,8 @@ func (tb *TemplateBuilder) GenerateCAPISpecControlPlane(clusterSpec *cluster.Spe
func (tb *TemplateBuilder) GenerateCAPISpecWorkers(clusterSpec *cluster.Spec, workloadTemplateNames, kubeadmconfigTemplateNames map[string]string) (content []byte, err error) {
workerSpecs := make([][]byte, 0, len(clusterSpec.Cluster.Spec.WorkerNodeGroupConfigurations))
bundle := clusterSpec.RootVersionsBundle()
var OSImageURL string
if clusterSpec.TinkerbellDatacenter.Spec.OSImageURL != "" {
OSImageURL = clusterSpec.TinkerbellDatacenter.Spec.OSImageURL
}
OSImageURL := clusterSpec.TinkerbellDatacenter.Spec.OSImageURL

for _, workerNodeGroupConfiguration := range clusterSpec.Cluster.Spec.WorkerNodeGroupConfigurations {
workerNodeMachineSpec := tb.WorkerNodeGroupMachineSpecs[workerNodeGroupConfiguration.MachineGroupRef.Name]
wTemplateConfig := clusterSpec.TinkerbellTemplateConfigs[workerNodeMachineSpec.TemplateRef.Name]
Expand Down

0 comments on commit 87f3f0c

Please sign in to comment.