fix ingress creation for none class (#12273)

rc/2.22.0-rc1
Steven Kang 2024-10-01 14:43:46 +13:00 committed by GitHub
parent ea228c3d6d
commit c0db48b29d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -223,6 +223,11 @@ func (kcl *KubeClient) CreateIngress(namespace string, info models.K8sIngressInf
// convertToK8sIngress converts a Portainer K8sIngressInfo object to a k8s native Ingress object.
// this is required for create and update operations.
func (kcl *KubeClient) convertToK8sIngress(info models.K8sIngressInfo, owner string) netv1.Ingress {
ingressSpec := netv1.IngressSpec{}
if info.ClassName != "" {
ingressSpec.IngressClassName = &info.ClassName
}
result := netv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: info.Name,
@ -230,9 +235,7 @@ func (kcl *KubeClient) convertToK8sIngress(info models.K8sIngressInfo, owner str
Annotations: info.Annotations,
},
Spec: netv1.IngressSpec{
IngressClassName: &info.ClassName,
},
Spec: ingressSpec,
}
labels := make(map[string]string)