Skip to content

Commit

Permalink
Remove openshift-marketplace operator proxy settings
Browse files Browse the repository at this point in the history
Since we are now using a bundle with the cluster-version-operator (CVO)
enabled, crc no longer needs to propagate the proxy settings itself as
CVO does it for the deployments with the `inject-proxy` annotation.

This reverts commits 8674e3, 75414b and f8441b
  • Loading branch information
cfergeau authored and praveenkumar committed Mar 5, 2020
1 parent 44f37cb commit d3e7463
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
23 changes: 2 additions & 21 deletions pkg/crc/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ func AddProxyConfigToCluster(oc oc.OcConfig, proxy *network.ProxyConfig) error {
return nil
}

const internalNoProxy = ".cluster.local,.svc,10.128.0.0/14,172.30.0.0/16"

// AddProxyToKubeletAndCriO adds the systemd drop-in proxy configuration file to the instance,
// both services (kubelet and crio) need to be restarted after this change.
// Since proxy operator is not able to make changes to in the kubelet/crio side,
Expand All @@ -164,8 +162,8 @@ func AddProxyToKubeletAndCriO(sshRunner *ssh.SSHRunner, proxy *network.ProxyConf
proxyTemplate := `[Service]
Environment=HTTP_PROXY=%s
Environment=HTTPS_PROXY=%s
Environment=NO_PROXY=%s,%s`
p := fmt.Sprintf(proxyTemplate, proxy.HttpProxy, proxy.HttpsProxy, internalNoProxy, proxy.GetNoProxyString())
Environment=NO_PROXY=.cluster.local,.svc,10.128.0.0/14,172.30.0.0/16,%s`
p := fmt.Sprintf(proxyTemplate, proxy.HttpProxy, proxy.HttpsProxy, proxy.GetNoProxyString())
// This will create a systemd drop-in configuration for proxy (both for kubelet and crio services) on the VM.
err := sshRunner.SetTextContentAsRoot("/etc/systemd/system/crio.service.d/10-default-env.conf", p, 0644)
if err != nil {
Expand All @@ -178,23 +176,6 @@ Environment=NO_PROXY=%s,%s`
return nil
}

// Only marketplace operator doesn't get updated with proxy when it is set using proxy resource
// All other operators which have `config.openshift.io/inject-proxy` annotation get updated except marketplace.
func AddProxyConfigToMarketplaceOperator(oc oc.OcConfig, proxy *network.ProxyConfig) error {
cmdArgs := []string{"set", "env", "deployment", "marketplace-operator", "-n", "openshift-marketplace",
fmt.Sprintf("HTTP_PROXY=%s", proxy.HttpProxy),
fmt.Sprintf("HTTPS_PROXY=%s", proxy.HttpsProxy),
fmt.Sprintf("NO_PROXY=%s,%s", proxy.GetNoProxyString(), internalNoProxy),
}
if err := oc.WaitForOpenshiftResource("deployment"); err != nil {
return err
}
if _, stderr, err := oc.RunOcCommand(cmdArgs...); err != nil {
return fmt.Errorf("Failed to add proxy details to marketplace-operator %v: %s", err, stderr)
}
return nil
}

func addPullSecretToInstanceDisk(sshRunner *ssh.SSHRunner, pullSec string) error {
err := sshRunner.SetTextContentAsRoot("/var/lib/kubelet/config.json", pullSec, 0600)
if err != nil {
Expand Down
5 changes: 0 additions & 5 deletions pkg/crc/machine/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,11 +820,6 @@ func configProxyForCluster(ocConfig oc.OcConfig, sshRunner *crcssh.SSHRunner, sd
return err
}

logging.Info("Adding proxy configuration to marketplace operator ...")
if err := cluster.AddProxyConfigToMarketplaceOperator(ocConfig, proxy); err != nil {
return err
}

logging.Info("Adding proxy configuration to kubelet and crio service ...")
if err := cluster.AddProxyToKubeletAndCriO(sshRunner, proxy); err != nil {
return err
Expand Down

0 comments on commit d3e7463

Please sign in to comment.