From 05dddffbeb1b784b208a2729e15422d9bfd73a3b Mon Sep 17 00:00:00 2001 From: Mario Constanti Date: Thu, 3 Nov 2022 14:55:58 +0100 Subject: [PATCH] remove containerd proxy config as we do the containerd proxy config via kubeadm and the build-in config overwrite our own config we have to remove it. Signed-off-by: Mario Constanti --- controllers/cluster_scripts/cloud_init.tmpl | 21 +-------------------- controllers/vcdmachine_controller.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/controllers/cluster_scripts/cloud_init.tmpl b/controllers/cluster_scripts/cloud_init.tmpl index 946091232..0e85e68d2 100644 --- a/controllers/cluster_scripts/cloud_init.tmpl +++ b/controllers/cluster_scripts/cloud_init.tmpl @@ -104,26 +104,7 @@ write_files: systemctl enable --now metering vmtoolsd --cmd "info-set guestinfo.metering.status successful" - vmtoolsd --cmd "info-set guestinfo.postcustomization.proxy.setting.status in_progress" - export HTTP_PROXY="{{.HTTPProxy}}" - export HTTPS_PROXY="{{.HTTPSProxy}}" - export http_proxy="{{.HTTPProxy}}" - export https_proxy="{{.HTTPSProxy}}" - export NO_PROXY="{{.NoProxy}}" - export no_proxy="{{.NoProxy}}" - cat < /etc/systemd/system/containerd.service.d/http-proxy.conf - [Service] - Environment="HTTP_PROXY={{.HTTPProxy}}" - Environment="HTTPS_PROXY={{.HTTPSProxy}}" - Environment="http_proxy={{.HTTPProxy}}" - Environment="https_proxy={{.HTTPSProxy}}" - Environment="no_proxy={{.NoProxy}}" - Environment="NO_PROXY={{.NoProxy}}" - END - systemctl daemon-reload - systemctl restart containerd - vmtoolsd --cmd "info-set guestinfo.postcustomization.proxy.setting.status successful" {{- if .NvidiaGPU }} - + {{- if .NvidiaGPU }} vmtoolsd --cmd "info-set guestinfo.postcustomization.nvidia.runtime.install.status in_progress" distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - diff --git a/controllers/vcdmachine_controller.go b/controllers/vcdmachine_controller.go index 25b2743c3..c80945af4 100644 --- a/controllers/vcdmachine_controller.go +++ b/controllers/vcdmachine_controller.go @@ -11,6 +11,12 @@ import ( _ "embed" // this needs go 1.16+ b64 "encoding/base64" "fmt" + "math" + "strconv" + "strings" + "text/template" + "time" + "github.com/pkg/errors" cpiutil "github.com/vmware/cloud-provider-for-cloud-director/pkg/util" "github.com/vmware/cloud-provider-for-cloud-director/pkg/vcdsdk" @@ -23,7 +29,6 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/klog" - "math" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/annotations" @@ -36,10 +41,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/source" - "strconv" - "strings" - "text/template" - "time" ) type CloudInitScriptInput struct { @@ -67,6 +68,7 @@ const Mebibyte = 1048576 // The following `embed` directives read the file in the mentioned path and copy the content into the declared variable. // These variables need to be global within the package. +// //go:embed cluster_scripts/cloud_init.tmpl var cloudInitScriptTemplate string @@ -75,9 +77,9 @@ type VCDMachineReconciler struct { client.Client } -//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=vcdmachines,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=vcdmachines/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=vcdmachines/finalizers,verbs=update +// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=vcdmachines,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=vcdmachines/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=vcdmachines/finalizers,verbs=update func (r *VCDMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, rerr error) { log := ctrl.LoggerFrom(ctx) @@ -198,7 +200,6 @@ func patchVCDMachine(ctx context.Context, patchHelper *patch.Helper, vcdMachine const ( NetworkConfiguration = "guestinfo.postcustomization.networkconfiguration.status" - ProxyConfiguration = "guestinfo.postcustomization.proxy.setting.status" MeteringConfiguration = "guestinfo.metering.status" KubeadmInit = "guestinfo.postcustomization.kubeinit.status" KubeadmNodeJoin = "guestinfo.postcustomization.kubeadm.node.join.status" @@ -210,7 +211,6 @@ const ( var controlPlanePostCustPhases = []string{ NetworkConfiguration, MeteringConfiguration, - ProxyConfiguration, KubeadmInit, }