exiting with an error when a capability cannot be found.
This commit is contained in:
		
							parent
							
								
									852833764c
								
							
						
					
					
						commit
						144a624985
					
				@ -112,7 +112,8 @@ func (t *PolicyTemplates) NamespaceTemplates(policyType string, capabilities []s
 | 
				
			|||||||
			log.Printf("Found template for capability '%s'", capability)
 | 
								log.Printf("Found template for capability '%s'", capability)
 | 
				
			||||||
			res = append(res, tmpl)
 | 
								res = append(res, tmpl)
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			log.Printf("Capability '%s' not found", capability)
 | 
								fmt.Fprintf(os.Stderr, "ERROR: Capability '%s' not found\n", capability)
 | 
				
			||||||
 | 
								os.Exit(1)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return res
 | 
						return res
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										23
									
								
								cmd/policygen/templates/netpol/namespace/monitored.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								cmd/policygen/templates/netpol/namespace/monitored.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					{{- if not .Open }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					apiVersion: networking.k8s.io/v1
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: allow-monitoring
 | 
				
			||||||
 | 
					  namespace: {{.Name}}
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  podSelector:
 | 
				
			||||||
 | 
					    matchLabels: {}
 | 
				
			||||||
 | 
					  policyTypes:
 | 
				
			||||||
 | 
					    - Ingress
 | 
				
			||||||
 | 
					  ingress:
 | 
				
			||||||
 | 
					    - from:
 | 
				
			||||||
 | 
					        - podSelector:
 | 
				
			||||||
 | 
					            matchLabels:
 | 
				
			||||||
 | 
					              app.kubernetes.io/name: prometheus
 | 
				
			||||||
 | 
					          namespaceSelector:
 | 
				
			||||||
 | 
					            matchLabels:
 | 
				
			||||||
 | 
					              kubernetes.io/metadata.name: monitoring
 | 
				
			||||||
 | 
					      ports:
 | 
				
			||||||
 | 
					        - port: prometheus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  {{- end }}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user