Skip to content

Commit

Permalink
Merge pull request #22 from Surax98/align
Browse files Browse the repository at this point in the history
Align
  • Loading branch information
dciangot authored Jul 19, 2023
2 parents 5f71496 + e4bae68 commit bcd9d30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/common/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func NewServiceAccount() {
}
sa = string(temp)
os.Remove(path + "getSAConfig.sh")
os.Remove(path + "kubeconfig-sa")

for {
returnedVal := SendKubeConfig(sa)
Expand Down Expand Up @@ -210,6 +211,5 @@ func SendKubeConfig(body string) string {
return "200"
}
}

return "400"
}
18 changes: 10 additions & 8 deletions pkg/virtualkubelet/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
common "github.com/CARV-ICS-FORTH/knoc/common"
commonIL "github.com/intertwin-eu/interlink/pkg/common"

exec "github.com/alexellis/go-execute/pkg/v1"
"github.com/containerd/containerd/log"
v1 "k8s.io/api/core/v1"
)
Expand Down Expand Up @@ -135,15 +136,16 @@ func checkPodsStatus(p *VirtualKubeletProvider, ctx context.Context, token strin
for podIndex, podStatus := range ret.PodStatus {
if podStatus.PodStatus == 1 {
NoReq++
cmd := []string{"delete pod " + ret.PodName[podIndex].Name + " -n vk"}
shell := exec.ExecTask{
Command: "kubectl",
Args: cmd,
Shell: true,
}

pod, _ := p.GetPod(ctx, commonIL.InterLinkConfigInst.Namespace, ret.PodName[podIndex].Name)
err := p.DeletePod(ctx, pod)
fmt.Println(err)

if err != nil {
log.L.Println("Could not delete pod. " + pod.Name)
} else {
log.L.Println("Pod " + pod.Name + " successfully deleted")
execReturn, _ := shell.Execute()
if execReturn.Stderr != "" {
fmt.Println("Could not delete pod " + ret.PodName[podIndex].Name)
}
}
}
Expand Down

0 comments on commit bcd9d30

Please sign in to comment.