Skip to content

Commit

Permalink
[ISSUE-1119] Updating kubescheduler config in patcher for 1.29 (#216)
Browse files Browse the repository at this point in the history
Signed-off-by: Kacper-Michon-DELL <[email protected]>
  • Loading branch information
Kacper-Michon-DELL authored Mar 15, 2024
1 parent 0d4a0ed commit fca568e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/patcher/patcher_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ const (
configFile = "config.yaml"
config19File = "config-19.yaml"
config23File = "config-23.yaml"
config29File = "config-29.yaml"

policyPath = schedulerFolder + "/" + policyFile
configPath = schedulerFolder + "/" + configFile
config19Path = schedulerFolder + "/" + config19File
config23Path = schedulerFolder + "/" + config23File
config29Path = schedulerFolder + "/" + config29File
)

// newPatcherConfiguration creates patcherConfiguration
Expand All @@ -40,6 +42,7 @@ func newPatcherConfiguration(csi *csibaremetalv1.Deployment) (*patcherConfigurat
targetPolicy: path.Join(vanillaManifestsFolder, policyPath),
targetConfig19: path.Join(vanillaManifestsFolder, config19Path),
targetConfig23: path.Join(vanillaManifestsFolder, config23Path),
targetConfig29: path.Join(vanillaManifestsFolder, config29Path),
schedulerFolder: path.Join(vanillaManifestsFolder, schedulerFolder),
manifestsFolder: vanillaManifestsFolder,
kubeconfig: vanillaKubeconfig,
Expand All @@ -51,6 +54,7 @@ func newPatcherConfiguration(csi *csibaremetalv1.Deployment) (*patcherConfigurat
targetPolicy: path.Join(rke2ManifestsFolder, policyPath),
targetConfig19: path.Join(rke2ManifestsFolder, config19Path),
targetConfig23: path.Join(rke2ManifestsFolder, config23Path),
targetConfig29: path.Join(rke2ManifestsFolder, config29Path),
schedulerFolder: path.Join(rke2ManifestsFolder, schedulerFolder),
manifestsFolder: rke2ManifestsFolder,
kubeconfig: rke2Kubeconfig,
Expand Down Expand Up @@ -91,6 +95,7 @@ type patcherConfiguration struct {
targetPolicy string
targetConfig19 string
targetConfig23 string
targetConfig29 string
schedulerFolder string
manifestsFolder string
configMapName string
Expand Down
2 changes: 2 additions & 0 deletions pkg/patcher/patcher_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestNewPatcherConfiguration(t *testing.T) {
targetPolicy: "/etc/kubernetes/manifests/scheduler/policy.yaml",
targetConfig19: "/etc/kubernetes/manifests/scheduler/config-19.yaml",
targetConfig23: "/etc/kubernetes/manifests/scheduler/config-23.yaml",
targetConfig29: "/etc/kubernetes/manifests/scheduler/config-29.yaml",
schedulerFolder: "/etc/kubernetes/manifests/scheduler",
manifestsFolder: "/etc/kubernetes/manifests",
configMapName: "scheduler-configuration",
Expand Down Expand Up @@ -94,6 +95,7 @@ func TestNewPatcherConfiguration(t *testing.T) {
targetPolicy: "/var/lib/rancher/rke2/agent/pod-manifests/scheduler/policy.yaml",
targetConfig19: "/var/lib/rancher/rke2/agent/pod-manifests/scheduler/config-19.yaml",
targetConfig23: "/var/lib/rancher/rke2/agent/pod-manifests/scheduler/config-23.yaml",
targetConfig29: "/var/lib/rancher/rke2/agent/pod-manifests/scheduler/config-29.yaml",
schedulerFolder: "/var/lib/rancher/rke2/agent/pod-manifests/scheduler",
manifestsFolder: "/var/lib/rancher/rke2/agent/pod-manifests",
configMapName: "scheduler-conf",
Expand Down
4 changes: 4 additions & 0 deletions pkg/patcher/scheduler_patcher_vanilla.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ clientConnection:

vanillaConfig19 := fmt.Sprintf(vanillaNewConfigTemplate, "v1beta1", csi.Spec.Scheduler.ExtenderPort, cfg.kubeconfig)
vanillaConfig23 := fmt.Sprintf(vanillaNewConfigTemplate, "v1beta3", csi.Spec.Scheduler.ExtenderPort, cfg.kubeconfig)
vanillaConfig29 := fmt.Sprintf(vanillaNewConfigTemplate, "v1", csi.Spec.Scheduler.ExtenderPort, cfg.kubeconfig)

return &corev1.ConfigMap{
TypeMeta: metav1.TypeMeta{},
Expand All @@ -157,6 +158,7 @@ clientConnection:
configFile: vanillaConfig,
config19File: vanillaConfig19,
config23File: vanillaConfig23,
config29File: vanillaConfig29,
}}, nil
}

Expand Down Expand Up @@ -255,6 +257,8 @@ func (p patcherConfiguration) createPatcherContainers() []corev1.Container {
"--target_config_19_path=" + p.targetConfig19,
"--source_config_23_path=" + configurationPath + "/" + config23File,
"--target_config_23_path=" + p.targetConfig23,
"--source_config_29_path=" + configurationPath + "/" + config29File,
"--target_config_29_path=" + p.targetConfig29,
"--backup-path=" + p.schedulerFolder,
"--platform=" + p.platform,
},
Expand Down

0 comments on commit fca568e

Please sign in to comment.