Skip to content

Commit

Permalink
Migrate Network pkg to Azure SDK v2
Browse files Browse the repository at this point in the history
Signed-off-by: Heba Elayoty <hebaelayoty@gmail.com>
  • Loading branch information
helayoty committed Jan 24, 2023
1 parent a628b01 commit 054a274
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 68 deletions.
6 changes: 3 additions & 3 deletions pkg/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func TestSetAuthConfigWithAuthFile(t *testing.T) {
if err != nil {
t.Error(err)
}
assert.Check(t, azConfig.Authorizer != nil, "Authorizer should be nil")
assert.Check(t, azConfig.Token != "", "Authorizer should be nil")

}

Expand Down Expand Up @@ -201,7 +201,7 @@ func TestSetAuthConfigWithAKSCredFile(t *testing.T) {
if err != nil {
t.Error(err)
}
assert.Check(t, azConfig.Authorizer != nil, "Authorizer should be nil")
assert.Check(t, azConfig.Token != "", "Authorizer should be nil")

}

Expand Down Expand Up @@ -245,5 +245,5 @@ func TestSetAuthConfigWithEnvVariablesOnly(t *testing.T) {
if err != nil {
t.Error(err)
}
assert.Check(t, azConfig.Authorizer != nil, "Authorizer should be nil")
assert.Check(t, azConfig.Token != "", "Authorizer should be nil")
}
60 changes: 0 additions & 60 deletions pkg/client/retry.go

This file was deleted.

3 changes: 2 additions & 1 deletion pkg/provider/aci.go
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,8 @@ func getProbe(probe *v1.Probe, ports []v1.ContainerPort) (*azaciv2.ContainerProb
for i := range probe.Handler.Exec.Command {
commands = append(commands, &probe.Handler.Exec.Command[i])
}
exec = &azaciv2.ContainerExec{

exec = azaciv2.ContainerExec{
Command: commands,
}
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/provider/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import (
"net"
"strings"

azaci "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2"
"github.com/BurntSushi/toml"
"github.com/virtual-kubelet/node-cli/provider"
)

type providerConfig struct {
ResourceGroup string
Region string
OperatingSystem string
OperatingSystem azaci.OperatingSystemTypes
CPU string
Memory string
Pods string
Expand Down Expand Up @@ -47,10 +48,10 @@ func (p *ACIProvider) loadConfig(r io.Reader) error {

// Default to Linux if the operating system was not defined in the config.
if config.OperatingSystem == "" {
config.OperatingSystem = provider.OperatingSystemLinux
config.OperatingSystem = azaci.OperatingSystemTypesLinux
} else {
// Validate operating system from config.
ok := provider.ValidOperatingSystems[config.OperatingSystem]
ok := provider.ValidOperatingSystems[string(config.OperatingSystem)]
if !ok {
return fmt.Errorf("%q is not a valid operating system, try one of the following instead: %s", config.OperatingSystem, strings.Join(provider.ValidOperatingSystems.Names(), " | "))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/vk_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (p *ACIProvider) ConfigureNode(ctx context.Context, node *v1.Node) {
node.Status.Conditions = p.nodeConditions()
node.Status.Addresses = p.nodeAddresses()
node.Status.DaemonEndpoints = p.nodeDaemonEndpoints()
node.Status.NodeInfo.OperatingSystem = p.operatingSystem
node.Status.NodeInfo.OperatingSystem = string(p.operatingSystem)
node.ObjectMeta.Labels["alpha.service-controller.kubernetes.io/exclude-balancer"] = "true"
node.ObjectMeta.Labels["node.kubernetes.io/exclude-from-external-load-balancers"] = "true"

Expand Down

0 comments on commit 054a274

Please sign in to comment.