Skip to content

Commit 732271d

Browse files
Merge pull request #7540 from zaneb/fips
OCPBUGS-15844: Enable FIPS in agent ISO
2 parents bc15daa + 435179f commit 732271d

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

pkg/asset/agent/image/kargs.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,29 @@ 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.
1819
func (a *Kargs) Dependencies() []asset.Asset {
1920
return []asset.Asset{
20-
&manifests.AgentManifests{},
21+
&manifests.AgentClusterInstall{},
2122
}
2223
}
2324

2425
// Generate generates the kernel args configurations for the agent ISO image and PXE assets.
2526
func (a *Kargs) Generate(dependencies asset.Parents) error {
26-
agentManifests := &manifests.AgentManifests{}
27-
dependencies.Get(agentManifests)
27+
agentClusterInstall := &manifests.AgentClusterInstall{}
28+
dependencies.Get(agentClusterInstall)
2829

2930
// Add kernel args for external oci platform
30-
if agentManifests.GetExternalPlatformName() == string(models.PlatformTypeOci) {
31+
if agentClusterInstall.GetExternalPlatformName() == string(models.PlatformTypeOci) {
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/agent.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,6 @@ func (m *AgentManifests) GetPullSecretData() string {
111111
return m.PullSecret.StringData[".dockerconfigjson"]
112112
}
113113

114-
// GetExternalPlatformName returns the platform name for the external platform.
115-
func (m *AgentManifests) GetExternalPlatformName() string {
116-
var platformName string
117-
if m.AgentClusterInstall.Spec.ExternalPlatformSpec != nil {
118-
platformName = m.AgentClusterInstall.Spec.ExternalPlatformSpec.PlatformName
119-
}
120-
return platformName
121-
}
122-
123114
func (m *AgentManifests) finish() error {
124115
if err := m.validateAgentManifests().ToAggregate(); err != nil {
125116
return errors.Wrapf(err, "invalid agent configuration")

pkg/asset/agent/manifests/agentclusterinstall.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,20 @@ func (a *AgentClusterInstall) validateSupportedPlatforms() field.ErrorList {
433433
}
434434
return allErrs
435435
}
436+
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+
446+
// GetExternalPlatformName returns the platform name for the external platform.
447+
func (a *AgentClusterInstall) GetExternalPlatformName() string {
448+
if a.Config != nil && a.Config.Spec.ExternalPlatformSpec != nil {
449+
return a.Config.Spec.ExternalPlatformSpec.PlatformName
450+
}
451+
return ""
452+
}

0 commit comments

Comments
 (0)