Skip to content

Commit 73bb33c

Browse files
committed
Use systemd to add the root CA for API server access
this removes the code patching the configmap admin-kubeconfig-client-ca to use the custom CA, instead it copies the generated CA to '/opt/crc/' which is then used by a systemd service to created the required secret and updates the configmap
1 parent df0995f commit 73bb33c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pkg/crc/cluster/cluster.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,10 @@ func EnsureGeneratedClientCAPresentInTheCluster(ctx context.Context, ocConfig oc
197197
}
198198

199199
logging.Info("Updating root CA cert to admin-kubeconfig-client-ca configmap...")
200-
jsonPath := fmt.Sprintf(`'{"data": {"ca-bundle.crt": %q}}'`, selfSignedCAPem)
201-
cmdArgs := []string{"patch", "configmap", "admin-kubeconfig-client-ca",
202-
"-n", "openshift-config", "--patch", jsonPath}
203-
_, stderr, err = ocConfig.RunOcCommand(cmdArgs...)
204-
if err != nil {
205-
return fmt.Errorf("Failed to patch admin-kubeconfig-client-ca config map with new CA` %v: %s", err, stderr)
200+
if err := sshRunner.CopyData(selfSignedCAPem, "/opt/crc/custom-ca.crt", 0644); err != nil {
201+
return fmt.Errorf("Failed to copy generated CA file to VM: %v", err)
206202
}
203+
207204
if err := sshRunner.CopyFile(constants.KubeconfigFilePath, ocConfig.KubeconfigPath, 0644); err != nil {
208205
return fmt.Errorf("Failed to copy generated kubeconfig file to VM: %v", err)
209206
}

0 commit comments

Comments
 (0)