Skip to content

Commit

Permalink
Removed unwanted usage of private key, set PULL_SECRET_TOKEN as requi…
Browse files Browse the repository at this point in the history
…red by assisted installer agent
  • Loading branch information
pawanpinjarkar committed Jun 6, 2024
1 parent 2da0a8a commit 3ae28e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 3 additions & 6 deletions pkg/asset/agent/image/ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
osImage,
infraEnv.Spec.Proxy,
imageTypeISO,
keyPairAsset.PrivateKey,
keyPairAsset.PublicKey,
caBundleMount)

Expand Down Expand Up @@ -372,9 +371,7 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage,
infraEnvID string,
osImage *models.OsImage,
proxy *v1beta1.Proxy,
imageTypeISO,
privateKey, publicKey string,
caBundleMount string) *agentTemplateData {
imageTypeISO, publicKey, caBundleMount string) *agentTemplateData {
return &agentTemplateData{
ServiceProtocol: "http",
PullSecret: pullSecret,
Expand All @@ -390,7 +387,6 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage,
OSImage: osImage,
Proxy: proxy,
ImageTypeISO: imageTypeISO,
PrivateKeyPEM: privateKey,
PublicKeyPEM: publicKey,
CaBundleMount: caBundleMount,
}
Expand All @@ -412,8 +408,9 @@ func getRendezvousHostEnv(serviceProtocol, nodeZeroIP, token string, workflowTyp
SERVICE_BASE_URL=%s
IMAGE_SERVICE_BASE_URL=%s
AGENT_AUTH_TOKEN=%s
PULL_SECRET_TOKEN=%s
WORKFLOW_TYPE=%s
`, nodeZeroIP, serviceBaseURL.String(), imageServiceBaseURL.String(), token, workflowType)
`, nodeZeroIP, serviceBaseURL.String(), imageServiceBaseURL.String(), token, token, workflowType)
}

func getAddNodesEnv(clusterInfo joiner.ClusterInfo) string {
Expand Down
6 changes: 2 additions & 4 deletions pkg/asset/agent/image/ignition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@ func TestIgnition_getTemplateData(t *testing.T) {
}
clusterName := "test-agent-cluster-install.test"

privateKey := "-----BEGIN EC PUBLIC KEY-----\nMFkwEwYHKoAiDHV4tg==\n-----END EC PUBLIC KEY-----\n"
publicKey := "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIOSCfDNmx0qe6dncV4tg==\n-----END EC PRIVATE KEY-----\n" //nolint:gosec
publicKey := "-----BEGIN EC PUBLIC KEY-----\nMHcCAQEEIOSCfDNmx0qe6dncV4tg==\n-----END EC PUBLIC KEY-----\n" //nolint:gosec

templateData := getTemplateData(clusterName, pullSecret, releaseImageList, releaseImage, releaseImageMirror, haveMirrorConfig, publicContainerRegistries, agentClusterInstall.Spec.ProvisionRequirements.ControlPlaneAgents, agentClusterInstall.Spec.ProvisionRequirements.WorkerAgents, infraEnvID, osImage, proxy, "minimal-iso", privateKey, publicKey, "")
templateData := getTemplateData(clusterName, pullSecret, releaseImageList, releaseImage, releaseImageMirror, haveMirrorConfig, publicContainerRegistries, agentClusterInstall.Spec.ProvisionRequirements.ControlPlaneAgents, agentClusterInstall.Spec.ProvisionRequirements.WorkerAgents, infraEnvID, osImage, proxy, "minimal-iso", publicKey, "")
assert.Equal(t, clusterName, templateData.ClusterName)
assert.Equal(t, "http", templateData.ServiceProtocol)
assert.Equal(t, pullSecret, templateData.PullSecret)
Expand All @@ -107,7 +106,6 @@ func TestIgnition_getTemplateData(t *testing.T) {
assert.Equal(t, infraEnvID, templateData.InfraEnvID)
assert.Equal(t, osImage, templateData.OSImage)
assert.Equal(t, proxy, templateData.Proxy)
assert.Equal(t, privateKey, templateData.PrivateKeyPEM)
assert.Equal(t, publicKey, templateData.PublicKeyPEM)
}

Expand Down

0 comments on commit 3ae28e8

Please sign in to comment.