Skip to content

Commit

Permalink
fix auto delete special ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
刘宁 committed Apr 25, 2024
1 parent 8f83e69 commit ba0ae5a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions domain/handler/ingress_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,24 @@ func (h *ingressHandler) CreateOrUpdateForSqbapplication() error {
return err
}

// 查询对应的sqbdeployment,ingressNames加上sqbdeployment对应的ingress
sqbdeploymentList := &qav1alpha1.SQBDeploymentList{}
err = k8sclient.List(h.ctx, sqbdeploymentList, &client.ListOptions{
Namespace: h.sqbapplication.Namespace,
LabelSelector: labels.SelectorFromSet(map[string]string{entity.AppKey: h.sqbapplication.Name}),
})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
for _, sqbdeployment := range sqbdeploymentList.Items {
if sqbdeployment.GetAnnotations()[entity.PublicEntryAnnotationKey] == "true" {
ingressClass := SpecialVirtualServiceIngress(&sqbdeployment)
host := entity.ConfigMapData.GetDomainNameByClass(sqbdeployment.Name, ingressClass)
name := getIngressName(h.sqbapplication.Name, ingressClass, host)
ingressNames = append(ingressNames, name)
}
}

for _, ingress := range ingressList.Items {
if h.isAutoIngress(ingress) && !util.ContainString(ingressNames, ingress.Name) {
if err = Delete(h.ctx, &ingress); err != nil {
Expand Down

0 comments on commit ba0ae5a

Please sign in to comment.