Skip to content

Commit

Permalink
Merge pull request #319 from k8stopologyawareschedwg/remove_custom_po…
Browse files Browse the repository at this point in the history
…licy

deployer: pass `UpdaterCustomSELinuxPolicy`
  • Loading branch information
ffromani authored Sep 22, 2024
2 parents 21c9507 + fc280d1 commit ff491c0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
13 changes: 7 additions & 6 deletions pkg/commands/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,13 @@ func NewDeployTopologyUpdaterCommand(env *deployer.Environment, commonOpts *opti

env.Log.V(3).Info("detection", "platform", commonOpts.ClusterPlatform, "reason", reason, "version", commonOpts.ClusterVersion, "source", source)
return updaters.Deploy(env, commonOpts.UpdaterType, options.Updater{
Platform: commonOpts.ClusterPlatform,
PlatformVersion: commonOpts.ClusterVersion,
WaitCompletion: commonOpts.WaitCompletion,
RTEConfigData: commonOpts.RTEConfigData,
DaemonSet: options.ForDaemonSet(commonOpts),
EnableCRIHooks: commonOpts.UpdaterCRIHooksEnable,
Platform: commonOpts.ClusterPlatform,
PlatformVersion: commonOpts.ClusterVersion,
WaitCompletion: commonOpts.WaitCompletion,
RTEConfigData: commonOpts.RTEConfigData,
DaemonSet: options.ForDaemonSet(commonOpts),
EnableCRIHooks: commonOpts.UpdaterCRIHooksEnable,
CustomSELinuxPolicy: commonOpts.UpdaterCustomSELinuxPolicy,
})
},
Args: cobra.NoArgs,
Expand Down
13 changes: 7 additions & 6 deletions pkg/commands/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,13 @@ func NewRemoveTopologyUpdaterCommand(env *deployer.Environment, commonOpts *opti

env.Log.V(3).Info("detection", "platform", commonOpts.ClusterPlatform, "reason", reason, "version", commonOpts.ClusterVersion, "source", source)
return updaters.Remove(env, commonOpts.UpdaterType, options.Updater{
Platform: commonOpts.ClusterPlatform,
PlatformVersion: commonOpts.ClusterVersion,
WaitCompletion: commonOpts.WaitCompletion,
RTEConfigData: commonOpts.RTEConfigData,
DaemonSet: options.ForDaemonSet(commonOpts),
EnableCRIHooks: commonOpts.UpdaterCRIHooksEnable,
Platform: commonOpts.ClusterPlatform,
PlatformVersion: commonOpts.ClusterVersion,
WaitCompletion: commonOpts.WaitCompletion,
RTEConfigData: commonOpts.RTEConfigData,
DaemonSet: options.ForDaemonSet(commonOpts),
EnableCRIHooks: commonOpts.UpdaterCRIHooksEnable,
CustomSELinuxPolicy: commonOpts.UpdaterCustomSELinuxPolicy,
})
},
Args: cobra.NoArgs,
Expand Down
13 changes: 7 additions & 6 deletions pkg/deploy/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ func OnCluster(env *deployer.Environment, commonOpts *options.Options) error {
return err
}
if err := updaters.Deploy(env, commonOpts.UpdaterType, options.Updater{
Platform: commonOpts.ClusterPlatform,
PlatformVersion: commonOpts.ClusterVersion,
WaitCompletion: commonOpts.WaitCompletion,
RTEConfigData: commonOpts.RTEConfigData,
DaemonSet: options.ForDaemonSet(commonOpts),
EnableCRIHooks: commonOpts.UpdaterCRIHooksEnable,
Platform: commonOpts.ClusterPlatform,
PlatformVersion: commonOpts.ClusterVersion,
WaitCompletion: commonOpts.WaitCompletion,
RTEConfigData: commonOpts.RTEConfigData,
DaemonSet: options.ForDaemonSet(commonOpts),
EnableCRIHooks: commonOpts.UpdaterCRIHooksEnable,
CustomSELinuxPolicy: commonOpts.UpdaterCustomSELinuxPolicy,
}); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/deployer/platform/detect/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func PlatformFromClients(ctx context.Context, cvLister ClusterVersionsLister, in
}

func Version(ctx context.Context, plat platform.Platform) (platform.Version, error) {
if plat == platform.OpenShift {
if plat == platform.OpenShift || plat == platform.HyperShift {
return OpenshiftVersion(ctx)
}
return KubernetesVersion(ctx)
Expand Down
6 changes: 3 additions & 3 deletions pkg/manifests/rte/rte.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (mf Manifests) Clone() Manifests {
ConfigMap: mf.ConfigMap.DeepCopy(),
}

if mf.plat == platform.OpenShift {
if mf.plat == platform.OpenShift || mf.plat == platform.HyperShift {
// MachineConfig is obsolete starting from OCP v4.18
if mf.MachineConfig != nil {
ret.MachineConfig = mf.MachineConfig.DeepCopy()
Expand Down Expand Up @@ -111,7 +111,7 @@ func (mf Manifests) Render(opts options.UpdaterDaemon) (Manifests, error) {
}
rteupdate.DaemonSet(ret.DaemonSet, mf.plat, rteConfigMapName, opts.DaemonSet)

if mf.plat == platform.OpenShift {
if mf.plat == platform.OpenShift || mf.plat == platform.HyperShift {
selinuxType := selinuxassets.RTEContextType
if mf.MachineConfig != nil {
if opts.Name != "" {
Expand Down Expand Up @@ -185,7 +185,7 @@ func GetManifests(plat platform.Platform, version platform.Version, namespace st
var err error
mf := New(plat)

if plat == platform.OpenShift {
if plat == platform.OpenShift || plat == platform.HyperShift {
if withCustomSELinuxPolicy {
mf.MachineConfig, err = manifests.MachineConfig(manifests.ComponentResourceTopologyExporter, version, withCRIHooks)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/manifests/sched/sched.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (mf Manifests) Render(logger logr.Logger, opts options.Scheduler) (Manifest
schedupdate.ControllerDeployment(ret.DPController, opts.PullIfNotPresent, opts.CtrlPlaneAffinity)
if opts.Namespace != "" {
ret.Namespace.Name = opts.Namespace
} else if mf.plat == platform.OpenShift {
} else if mf.plat == platform.OpenShift || mf.plat == platform.HyperShift {
ret.Namespace.Name = NamespaceOpenShift
}

Expand Down

0 comments on commit ff491c0

Please sign in to comment.