From 42f58f482fc645021f725d01892bc001d23da29c Mon Sep 17 00:00:00 2001 From: Heba Elayoty Date: Wed, 18 Jan 2023 15:36:06 -0800 Subject: [PATCH] Roll back unrelated changes Signed-off-by: Heba Elayoty --- cmd/init-container/main.go | 4 ++++ pkg/network/aci_network.go | 4 ---- pkg/provider/aci.go | 17 +++++++++-------- pkg/provider/config.go | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/cmd/init-container/main.go b/cmd/init-container/main.go index 19570c69..8c9bc16f 100644 --- a/cmd/init-container/main.go +++ b/cmd/init-container/main.go @@ -82,6 +82,10 @@ func main() { return true }, func() error { var providerNetwork network.ProviderNetwork + if azConfig.AKSCredential != nil { + providerNetwork.VnetName = azConfig.AKSCredential.VNetName + providerNetwork.VnetResourceGroup = azConfig.AKSCredential.VNetResourceGroup + } // Check or set up a network for VK log.G(ctx).Debug("setting up the network configuration") err = providerNetwork.SetVNETConfig(ctx, &azConfig) diff --git a/pkg/network/aci_network.go b/pkg/network/aci_network.go index f6245c82..cae5f9fa 100644 --- a/pkg/network/aci_network.go +++ b/pkg/network/aci_network.go @@ -46,10 +46,6 @@ func (pn *ProviderNetwork) SetVNETConfig(ctx context.Context, azConfig *auth.Con ctx, span := trace.StartSpan(ctx, "network.SetVNETConfig") defer span.End() - if azConfig.AKSCredential != nil { - pn.VnetName = azConfig.AKSCredential.VNetName - pn.VnetResourceGroup = azConfig.AKSCredential.VNetResourceGroup - } // the VNET subscription ID by default is authentication subscription ID. // We need to override when using cross subscription virtual network resource pn.VnetSubscriptionID = azConfig.AuthConfig.SubscriptionID diff --git a/pkg/provider/aci.go b/pkg/provider/aci.go index 7c57b93b..6720ca76 100644 --- a/pkg/provider/aci.go +++ b/pkg/provider/aci.go @@ -73,7 +73,7 @@ type ACIProvider struct { resourceManager *manager.ResourceManager containerGroupExtensions []*client2.Extension enabledFeatures *featureflag.FlagIdentifier - ProviderNetwork network.ProviderNetwork + providernetwork network.ProviderNetwork resourceGroup string region string @@ -193,11 +193,12 @@ func NewACIProvider(ctx context.Context, config string, azConfig auth.Config, az if azConfig.AKSCredential != nil { p.resourceGroup = azConfig.AKSCredential.ResourceGroup p.region = azConfig.AKSCredential.Region - + p.providernetwork.VnetName = azConfig.AKSCredential.VNetName + p.providernetwork.VnetResourceGroup = azConfig.AKSCredential.VNetResourceGroup } - if p.ProviderNetwork.VnetResourceGroup == "" { - p.ProviderNetwork.VnetResourceGroup = p.resourceGroup + if p.providernetwork.VnetResourceGroup == "" { + p.providernetwork.VnetResourceGroup = p.resourceGroup } // If the log analytics file has been specified, load workspace credentials from the file if logAnalyticsAuthFile := os.Getenv("LOG_ANALYTICS_AUTH_LOCATION"); logAnalyticsAuthFile != "" { @@ -250,11 +251,11 @@ func NewACIProvider(ctx context.Context, config string, azConfig auth.Config, az return nil, err } - if err := p.ProviderNetwork.SetVNETConfig(ctx, &azConfig); err != nil { + if err := p.providernetwork.SetVNETConfig(ctx, &azConfig); err != nil { return nil, err } - if p.ProviderNetwork.SubnetName != "" { + if p.providernetwork.SubnetName != "" { // windows containers don't support kube-proxy nor realtime metrics if p.operatingSystem != string(azaci.OperatingSystemTypesWindows) { err = p.setACIExtensions(ctx) @@ -342,7 +343,7 @@ func (p *ACIProvider) CreatePod(ctx context.Context, pod *v1.Pod) error { }) } } - if len(ports) > 0 && p.ProviderNetwork.SubnetName == "" { + if len(ports) > 0 && p.providernetwork.SubnetName == "" { cg.ContainerGroupPropertiesWrapper.ContainerGroupProperties.IPAddress = &azaci.IPAddress{ Ports: &ports, Type: azaci.ContainerGroupIPAddressTypePublic, @@ -364,7 +365,7 @@ func (p *ACIProvider) CreatePod(ctx context.Context, pod *v1.Pod) error { "CreationTimestamp": &podCreationTimestamp, } - p.ProviderNetwork.AmendVnetResources(ctx, *cg, pod, p.clusterDomain) + p.providernetwork.AmendVnetResources(ctx, *cg, pod, p.clusterDomain) // windows containers don't support kube-proxy nor realtime metrics if cg.ContainerGroupPropertiesWrapper.ContainerGroupProperties.OsType != azaci.OperatingSystemTypesWindows { diff --git a/pkg/provider/config.go b/pkg/provider/config.go index 7cf3decf..1188d5c3 100644 --- a/pkg/provider/config.go +++ b/pkg/provider/config.go @@ -58,7 +58,7 @@ func (p *ACIProvider) loadConfig(r io.Reader) error { // default subnet name if config.SubnetName != "" { - p.ProviderNetwork.SubnetName = config.SubnetName + p.providernetwork.SubnetName = config.SubnetName } if config.SubnetCIDR != "" { if config.SubnetName == "" {