Kaynağa Gözat

add aks machine type option and update domain list

Alexander Belanger 4 yıl önce
ebeveyn
işleme
b5e000a49e

+ 12 - 0
api/server/handlers/infra/forms.go

@@ -812,6 +812,18 @@ tabs:
           value: West US 3
         - label: Norway East
           value: Norway East
+    - type: select
+      label: ⚙️ Application Machine Type
+      variable: app_machine_type
+      settings:
+        default: Standard_A2_v2
+        options:
+        - label: Standard A2
+          value: Standard_A2_v2
+        - label: Standard A4
+          value: Standard_A4_v2
+        - label: Standard D2
+          value: Standard_D2_v3
     - type: string-input
       label: 👤 Issuer Email
       required: true

+ 13 - 12
internal/kubernetes/prometheus/metrics.go

@@ -55,6 +55,7 @@ type SimpleIngress struct {
 // NGINX
 func GetIngressesWithNGINXAnnotation(clientset kubernetes.Interface) ([]SimpleIngress, error) {
 	res := make([]SimpleIngress, 0)
+	foundMap := make(map[string]bool)
 
 	v1beta1IngressList, v1beta1Err := clientset.NetworkingV1beta1().Ingresses("").List(context.TODO(), metav1.ListOptions{})
 	v1IngressList, v1Err := clientset.NetworkingV1().Ingresses("").List(context.TODO(), metav1.ListOptions{})
@@ -65,32 +66,32 @@ func GetIngressesWithNGINXAnnotation(clientset kubernetes.Interface) ([]SimpleIn
 
 	if v1beta1Err == nil && len(v1beta1IngressList.Items) > 0 {
 		for _, ingress := range v1beta1IngressList.Items {
-			if ingressAnn, found := ingress.ObjectMeta.Annotations["kubernetes.io/ingress.class"]; found && ingressAnn == "nginx" {
-				res = append(res, SimpleIngress{
-					Name:      ingress.ObjectMeta.Name,
-					Namespace: ingress.ObjectMeta.Namespace,
-				})
-			} else if *ingress.Spec.IngressClassName == "nginx" {
+			ingressAnn, found := ingress.ObjectMeta.Annotations["kubernetes.io/ingress.class"]
+			uid := fmt.Sprintf("%s/%s", ingress.ObjectMeta.Namespace, ingress.ObjectMeta.Name)
+
+			if _, exists := foundMap[uid]; !exists && ((found && ingressAnn == "nginx") || *ingress.Spec.IngressClassName == "nginx") {
 				res = append(res, SimpleIngress{
 					Name:      ingress.ObjectMeta.Name,
 					Namespace: ingress.ObjectMeta.Namespace,
 				})
+
+				foundMap[uid] = true
 			}
 		}
 	}
 
 	if v1Err == nil && len(v1IngressList.Items) > 0 {
 		for _, ingress := range v1IngressList.Items {
-			if ingressAnn, found := ingress.ObjectMeta.Annotations["kubernetes.io/ingress.class"]; found && (ingressAnn == "nginx") {
-				res = append(res, SimpleIngress{
-					Name:      ingress.ObjectMeta.Name,
-					Namespace: ingress.ObjectMeta.Namespace,
-				})
-			} else if *ingress.Spec.IngressClassName == "nginx" {
+			ingressAnn, found := ingress.ObjectMeta.Annotations["kubernetes.io/ingress.class"]
+			uid := fmt.Sprintf("%s/%s", ingress.ObjectMeta.Namespace, ingress.ObjectMeta.Name)
+
+			if _, exists := foundMap[uid]; !exists && ((found && ingressAnn == "nginx") || *ingress.Spec.IngressClassName == "nginx") {
 				res = append(res, SimpleIngress{
 					Name:      ingress.ObjectMeta.Name,
 					Namespace: ingress.ObjectMeta.Namespace,
 				})
+
+				foundMap[uid] = true
 			}
 		}
 	}