diff --git a/KubernetesWorkflow/K8sController.cs b/KubernetesWorkflow/K8sController.cs index 4e324f9..d06070d 100644 --- a/KubernetesWorkflow/K8sController.cs +++ b/KubernetesWorkflow/K8sController.cs @@ -219,6 +219,19 @@ namespace KubernetesWorkflow } } } + }, + new V1NetworkPolicyIngressRule + { + FromProperty = new List + { + new V1NetworkPolicyPeer + { + NamespaceSelector = new V1LabelSelector + { + MatchLabels = GetPrometheusNamespaceSelector() + } + } + } } }, Egress = new List @@ -371,6 +384,11 @@ namespace KubernetesWorkflow return new Dictionary { { "kubernetes.io/metadata.name", "default" } }; } + private IDictionary GetPrometheusNamespaceSelector() + { + return new Dictionary { { "kubernetes.io/metadata.name", "monitoring" } }; + } + private IDictionary GetAnnotations(ContainerRecipe[] containerRecipes) { return containerRecipes.First().PodAnnotations.GetAnnotations();