Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KIM Integration - more concise step implementation #1218

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
73 changes: 26 additions & 47 deletions internal/process/provisioning/create_runtime_resource_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,59 +201,38 @@ func (s *CreateRuntimeResourceStep) createShootProvider(operation *internal.Oper
maxSurge := intstr.FromInt32(int32(DefaultIfParamNotSet(values.ZonesCount, operation.ProvisioningParameters.Parameters.MaxSurge)))
maxUnavailable := intstr.FromInt32(int32(DefaultIfParamNotSet(0, operation.ProvisioningParameters.Parameters.MaxUnavailable)))

max := int32(DefaultIfParamNotSet(values.DefaultAutoScalerMax, operation.ProvisioningParameters.Parameters.AutoScalerMax))
min := int32(DefaultIfParamNotSet(values.DefaultAutoScalerMin, operation.ProvisioningParameters.Parameters.AutoScalerMin))

if values.ProviderType == "openstack" {
return imv1.Provider{
Type: values.ProviderType,
Workers: []gardener.Worker{
{
Name: "cpu-worker-0",
Machine: gardener.Machine{
Type: DefaultIfParamNotSet(values.DefaultMachineType, operation.ProvisioningParameters.Parameters.MachineType),
Image: &gardener.ShootMachineImage{
Name: s.config.MachineImage,
Version: &s.config.MachineImageVersion,
},
scalerMax := int32(DefaultIfParamNotSet(values.DefaultAutoScalerMax, operation.ProvisioningParameters.Parameters.AutoScalerMax))
scalerMin := int32(DefaultIfParamNotSet(values.DefaultAutoScalerMin, operation.ProvisioningParameters.Parameters.AutoScalerMin))

provider := imv1.Provider{
Type: values.ProviderType,
Workers: []gardener.Worker{
{
Name: "cpu-worker-0",
Machine: gardener.Machine{
Type: DefaultIfParamNotSet(values.DefaultMachineType, operation.ProvisioningParameters.Parameters.MachineType),
Image: &gardener.ShootMachineImage{
Name: s.config.MachineImage,
Version: &s.config.MachineImageVersion,
},
Maximum: max,
Minimum: min,
MaxSurge: &maxSurge,
MaxUnavailable: &maxUnavailable,
Zones: values.Zones,
},
Maximum: scalerMax,
Minimum: scalerMin,
MaxSurge: &maxSurge,
MaxUnavailable: &maxUnavailable,
Zones: values.Zones,
},
}, nil
},
}

} else {
if values.ProviderType != "openstack" {
volumeSize := strconv.Itoa(DefaultIfParamNotSet(values.VolumeSizeGb, operation.ProvisioningParameters.Parameters.VolumeSizeGb))

return imv1.Provider{
Type: values.ProviderType,
Workers: []gardener.Worker{
{
Name: "cpu-worker-0",
Machine: gardener.Machine{
Type: DefaultIfParamNotSet(values.DefaultMachineType, operation.ProvisioningParameters.Parameters.MachineType),
Image: &gardener.ShootMachineImage{
Name: s.config.MachineImage,
Version: &s.config.MachineImageVersion,
},
},
Maximum: max,
Minimum: min,
MaxSurge: &maxSurge,
MaxUnavailable: &maxUnavailable,
Zones: values.Zones,
Volume: &gardener.Volume{
Type: ptr.String(values.DiskType),
VolumeSize: fmt.Sprintf("%sGi", volumeSize),
},
},
},
}, nil
provider.Workers[0].Volume = &gardener.Volume{
Type: ptr.String(values.DiskType),
VolumeSize: fmt.Sprintf("%sGi", volumeSize),
}
}
return provider, nil
}

func (s *CreateRuntimeResourceStep) createHighAvailabilityConfiguration() *gardener.HighAvailability {
Expand Down
Loading