Skip to content

Commit 435179f

Browse files
committed
OCPBUGS-15844: Enable FIPS in agent ISO
1 parent 5c9ce8a commit 435179f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

pkg/asset/agent/image/kargs.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
// Kargs is an Asset that generates the additional kernel args.
1313
type Kargs struct {
1414
consoleArgs string
15+
fips bool
1516
}
1617

1718
// Dependencies returns the assets on which the Kargs asset depends.
@@ -31,6 +32,9 @@ func (a *Kargs) Generate(dependencies asset.Parents) error {
3132
logrus.Debugf("Added kernel args to enable serial console for %s %s platform", hiveext.ExternalPlatformType, string(models.PlatformTypeOci))
3233
a.consoleArgs = " console=ttyS0"
3334
}
35+
36+
a.fips = agentClusterInstall.FIPSEnabled()
37+
3438
return nil
3539
}
3640

@@ -41,5 +45,9 @@ func (a *Kargs) Name() string {
4145

4246
// KernelCmdLine returns the data to be appended to the kernel arguments.
4347
func (a *Kargs) KernelCmdLine() []byte {
44-
return []byte(a.consoleArgs)
48+
cmdLine := a.consoleArgs
49+
if a.fips {
50+
cmdLine += " fips=1"
51+
}
52+
return []byte(cmdLine)
4553
}

pkg/asset/agent/manifests/agentclusterinstall.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,15 @@ func (a *AgentClusterInstall) validateSupportedPlatforms() field.ErrorList {
434434
return allErrs
435435
}
436436

437+
// FIPSEnabled returns whether FIPS is enabled in the cluster configuration.
438+
func (a *AgentClusterInstall) FIPSEnabled() bool {
439+
icOverrides := agentClusterInstallInstallConfigOverrides{}
440+
if err := json.Unmarshal([]byte(a.Config.Annotations[installConfigOverrides]), &icOverrides); err == nil {
441+
return icOverrides.FIPS
442+
}
443+
return false
444+
}
445+
437446
// GetExternalPlatformName returns the platform name for the external platform.
438447
func (a *AgentClusterInstall) GetExternalPlatformName() string {
439448
if a.Config != nil && a.Config.Spec.ExternalPlatformSpec != nil {

0 commit comments

Comments
 (0)