@@ -2,8 +2,6 @@ package machine
22
33import (
44 "context"
5- "crypto/rsa"
6- "crypto/x509"
75 "fmt"
86 "math/rand"
97 "os"
@@ -24,15 +22,13 @@ import (
2422 "github.com/crc-org/crc/v2/pkg/crc/machine/state"
2523 "github.com/crc-org/crc/v2/pkg/crc/machine/types"
2624 "github.com/crc-org/crc/v2/pkg/crc/network"
27- "github.com/crc-org/crc/v2/pkg/crc/network/httpproxy"
2825 "github.com/crc-org/crc/v2/pkg/crc/oc"
2926 crcPreset "github.com/crc-org/crc/v2/pkg/crc/preset"
3027 "github.com/crc-org/crc/v2/pkg/crc/services"
3128 "github.com/crc-org/crc/v2/pkg/crc/services/dns"
3229 crcssh "github.com/crc-org/crc/v2/pkg/crc/ssh"
3330 "github.com/crc-org/crc/v2/pkg/crc/systemd"
3431 "github.com/crc-org/crc/v2/pkg/crc/telemetry"
35- crctls "github.com/crc-org/crc/v2/pkg/crc/tls"
3632 "github.com/crc-org/crc/v2/pkg/crc/validation"
3733 crcos "github.com/crc-org/crc/v2/pkg/os"
3834 "github.com/docker/go-units"
@@ -623,12 +619,12 @@ func createHost(machineConfig config.MachineConfig, preset crcPreset.Preset, pul
623619 // Prepare VM options for macadam
624620 vmOpts := macadam.VMOptions {
625621 DiskImagePath : machineConfig .ImageSourcePath ,
626- DiskSize : int (machineConfig .DiskSize ),
627- Memory : int (machineConfig .Memory ),
622+ DiskSize : int (machineConfig .DiskSize ), // #nosec G115 - disk size is bounded by reasonable values
623+ Memory : int (machineConfig .Memory ), // #nosec G115 - memory is bounded by reasonable values
628624 Name : machineConfig .Name ,
629625 Username : "core" ,
630626 SSHIdentityPath : constants .GetPrivateKeyPath (),
631- CPUs : int (machineConfig .CPUs ),
627+ CPUs : int (machineConfig .CPUs ), // #nosec G115 - CPU count is bounded by reasonable values
632628 CloudInitPath : userDataPath ,
633629 }
634630
@@ -739,48 +735,6 @@ func updateSSHKeyPair(sshRunner *crcssh.Runner) error {
739735 return nil
740736}
741737
742- func copyKubeconfigFileWithUpdatedUserClientCertAndKey (selfSignedCAKey * rsa.PrivateKey , selfSignedCACert * x509.Certificate , srcKubeConfigPath , dstKubeConfigPath string ) error {
743- if _ , err := os .Stat (constants .KubeconfigFilePath ); err == nil {
744- return nil
745- }
746- clientKey , clientCert , err := crctls .GenerateClientCertificate (selfSignedCAKey , selfSignedCACert )
747- if err != nil {
748- return err
749- }
750- return updateClientCrtAndKeyToKubeconfig (clientKey , clientCert , srcKubeConfigPath , dstKubeConfigPath )
751- }
752-
753- func ensureProxyIsConfiguredInOpenShift (ctx context.Context , ocConfig oc.Config , sshRunner * crcssh.Runner , proxy * httpproxy.ProxyConfig ) (err error ) {
754- if ! proxy .IsEnabled () {
755- return nil
756- }
757- logging .Info ("Adding proxy configuration to the cluster..." )
758- return cluster .AddProxyConfigToCluster (ctx , sshRunner , ocConfig , proxy )
759- }
760-
761- func waitForProxyPropagation (ctx context.Context , ocConfig oc.Config , proxyConfig * httpproxy.ProxyConfig ) {
762- if ! proxyConfig .IsEnabled () {
763- return
764- }
765- logging .Info ("Waiting for the proxy configuration to be applied..." )
766- checkProxySettingsForOperator := func () error {
767- proxySet , err := cluster .CheckProxySettingsForOperator (ocConfig , proxyConfig , "marketplace-operator" , "openshift-marketplace" )
768- if err != nil {
769- logging .Debugf ("Error getting proxy setting for openshift-marketplace operator %v" , err )
770- return & crcerrors.RetriableError {Err : err }
771- }
772- if ! proxySet {
773- logging .Debug ("Proxy changes for cluster in progress" )
774- return & crcerrors.RetriableError {Err : fmt .Errorf ("" )}
775- }
776- return nil
777- }
778-
779- if err := crcerrors .Retry (ctx , 300 * time .Second , checkProxySettingsForOperator , 2 * time .Second ); err != nil {
780- logging .Debug ("Failed to propagate proxy settings to cluster" )
781- }
782- }
783-
784738func logBundleDate (crcBundleMetadata * bundle.CrcBundleInfo ) {
785739 if buildTime , err := crcBundleMetadata .GetBundleBuildTime (); err == nil {
786740 bundleAgeDays := time .Since (buildTime ).Hours () / 24
0 commit comments