Skip to content

Commit

Permalink
use NotifyContext and remove NotifyNodeStatus
Browse files Browse the repository at this point in the history
Signed-off-by: Heba Elayoty <[email protected]>
  • Loading branch information
helayoty committed Jan 24, 2023
1 parent b886eb7 commit 210515a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 39 deletions.
31 changes: 0 additions & 31 deletions cmd/virtual-kubelet/context.go

This file was deleted.

8 changes: 4 additions & 4 deletions cmd/virtual-kubelet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"net/http"
"os"
"os/signal"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -51,7 +52,7 @@ var (
)

func main() {
ctx, cancel := BaseContext(context.Background())
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()

binaryName := filepath.Base(os.Args[0])
Expand Down Expand Up @@ -226,12 +227,11 @@ func main() {
}

if vkVersion {
p, err := azproviderv2.NewACIProvider(ctx, cfgPath, azConfig, azACIAPIs, cfg, os.Getenv("VKUBELET_POD_IP"), int32(listenPort), operatingSystem, clusterDomain)
// azproviderv2.NewACIProvider(ctx, cfg.ConfigPath, azConfig, azACIAPIs, cfg.ResourceManager, cfg.NodeName, cfg.OperatingSystem, cfg.InternalIP, cfg.DaemonPort, cfg.KubeClusterDomain)
p, err := azproviderv2.NewACIProvider(ctx, cfgPath, azConfig, azACIAPIs, cfg, nodeName, operatingSystem, os.Getenv("VKUBELET_POD_IP"), int32(listenPort), clusterDomain)
return p, nil, err
} else {
p, err := azproviderv1.NewACIProvider(cfgPath, cfg, os.Getenv("VKUBELET_POD_IP"), int32(listenPort), operatingSystem, clusterDomain)
return p, p, err
return p, nil, err
}
},
withConfigureRoutes,
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/aci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ func createTestProvider(aciMocks *MockACIProvider, configMapMocker *MockConfigMa
cfg.Node.Name = fakeNodeName
cfg.Node.Status.NodeInfo.OperatingSystem = "Linux"

provider, err := NewACIProvider(ctx, "example.toml", azConfig, aciMocks, cfg, "0.0.0.0", 10250, "Linux", "cluster.local")
provider, err := NewACIProvider(ctx, "example.toml", azConfig, aciMocks, cfg, fakeNodeName, "Linux", "0.0.0.0", 10250, "cluster.local")
if err != nil {
return nil, err
}
Expand Down
3 changes: 0 additions & 3 deletions provider/aci.go
Original file line number Diff line number Diff line change
Expand Up @@ -1233,9 +1233,6 @@ func (p *ACIProvider) Ping(ctx context.Context) error {
return nil
}

func (p *ACIProvider) NotifyNodeStatus(ctx context.Context, cb func(*v1.Node)) {
}

// getContainerGroup returns a container group from ACI.
func (p *ACIProvider) getContainerGroup(ctx context.Context, namespace, name string) (*aci.ContainerGroup, error) {
cg, status, err := p.aciClient.GetContainerGroup(ctx, p.resourceGroup, fmt.Sprintf("%s-%s", namespace, name))
Expand Down

0 comments on commit 210515a

Please sign in to comment.