Skip to content

Commit a7b9a83

Browse files
committed
Fixup: make golint happy
1 parent 2c1aef1 commit a7b9a83

File tree

6 files changed

+4
-197
lines changed

6 files changed

+4
-197
lines changed

cmd/crc/cmd/start.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ import (
1616
"github.com/crc-org/crc/v2/pkg/crc/cluster"
1717
crcConfig "github.com/crc-org/crc/v2/pkg/crc/config"
1818
"github.com/crc-org/crc/v2/pkg/crc/constants"
19-
"github.com/crc-org/crc/v2/pkg/crc/daemonclient"
2019
crcErrors "github.com/crc-org/crc/v2/pkg/crc/errors"
2120
"github.com/crc-org/crc/v2/pkg/crc/logging"
2221
"github.com/crc-org/crc/v2/pkg/crc/machine/bundle"
2322
"github.com/crc-org/crc/v2/pkg/crc/machine/types"
24-
"github.com/crc-org/crc/v2/pkg/crc/network"
2523
"github.com/crc-org/crc/v2/pkg/crc/preflight"
2624
"github.com/crc-org/crc/v2/pkg/crc/preset"
2725
"github.com/crc-org/crc/v2/pkg/crc/validation"
@@ -340,17 +338,6 @@ func commandLinePrefix(shell string) string {
340338
return "$"
341339
}
342340

343-
func checkDaemonStarted() error {
344-
if crcConfig.GetNetworkMode(config) == network.SystemNetworkingMode {
345-
return nil
346-
}
347-
v, err := daemonclient.GetVersionFromDaemonAPI()
348-
if err != nil {
349-
return err
350-
}
351-
return daemonclient.CheckVersionMismatch(v)
352-
}
353-
354341
func portFallbackWarning() string {
355342
var fallbackPortWarning string
356343
httpScheme := "http"

pkg/crc/machine/driver.go

Lines changed: 0 additions & 75 deletions
This file was deleted.

pkg/crc/machine/driver_linux.go

Lines changed: 0 additions & 50 deletions
This file was deleted.

pkg/crc/machine/start.go

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package machine
22

33
import (
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-
784738
func logBundleDate(crcBundleMetadata *bundle.CrcBundleInfo) {
785739
if buildTime, err := crcBundleMetadata.GetBundleBuildTime(); err == nil {
786740
bundleAgeDays := time.Since(buildTime).Hours() / 24

pkg/crc/machine/virtualmachine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func saveBundleMetadataToConfig(vmName, bundleName string) error {
108108
}
109109

110110
configPath := filepath.Join(configDir, "config.json")
111-
if err := os.WriteFile(configPath, data, 0644); err != nil {
111+
if err := os.WriteFile(configPath, data, 0600); err != nil {
112112
return fmt.Errorf("failed to write config file: %v", err)
113113
}
114114

pkg/crc/machine/vsock.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,6 @@ func enableInternalDNS(gvClient *gvproxyclient.Client) error {
101101
return nil
102102
}
103103

104-
func isOpened(exposed []types.ExposeRequest, port types.ExposeRequest) bool {
105-
for _, alreadyOpenedPort := range exposed {
106-
if port == alreadyOpenedPort {
107-
return true
108-
}
109-
}
110-
return false
111-
}
112-
113104
const (
114105
virtualMachineIP = "192.168.127.2"
115106
hostVirtualIP = "192.168.127.254"

0 commit comments

Comments
 (0)