Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Kibana and Cerebro services not getting deleted #302

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pkg/k8sutil/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,19 +262,14 @@ func (k *K8sutil) DeleteServices(clusterName, namespace string) error {

for component, _ := range mgmtServices {

fullClientServiceName := fmt.Sprintf("%s-%s", component, clusterName)
// Check if service exists
s, _ := k.Kclient.CoreV1().Services(namespace).Get(component, metav1.GetOptions{})

// Service exists, delete
if len(s.Name) >= 1 {
fullClientServiceName := fmt.Sprintf("%s-%s", component, clusterName)

if _, err := k.Kclient.CoreV1().Services(namespace).Get(fullClientServiceName, metav1.GetOptions{}); err == nil {
if err := k.Kclient.CoreV1().Services(namespace).Delete(fullClientServiceName, &metav1.DeleteOptions{}); err != nil {
logrus.Error("Could not delete service "+fullClientServiceName+":", err)
}
logrus.Infof("Deleted service: %s", fullClientServiceName)
}

}

return nil
Expand Down