-
Notifications
You must be signed in to change notification settings - Fork 202
Ingress and Route generation refactor. #1730
Ingress and Route generation refactor. #1730
Conversation
3ad3504
to
6ba41b4
Compare
7d79251
to
cb35f85
Compare
cb35f85
to
3909e98
Compare
6e1d279
to
3b34467
Compare
@@ -92,7 +92,10 @@ | |||
@Parameter | |||
private List<ServiceAccountConfig> serviceAccounts; | |||
|
|||
private List<IngressRule> ingressRules; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this wrongfully in my previous PR here: dc5b213#diff-9238e96d57160d3b61190b609607b2d8R95
hence, removing it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove import above too
00e5a62
to
c2412cb
Compare
c2412cb
to
cc5c946
Compare
@ro14nd @rohanKanojia Do we want the IngressEnricher to be included in the default profile for the default yaml manifests generation, like Route for OpenShift? Or should there be a flag/mojo parameter for eg., In simpler words, do we want Ingress.yaml to be generated by default for Kubernetes runtime mode? |
plugin/src/main/java/io/fabric8/maven/plugin/mojo/build/ResourceMojo.java
Show resolved
Hide resolved
enricher/standard/src/main/java/io/fabric8/maven/enricher/standard/IngressEnricher.java
Show resolved
Hide resolved
enricher/standard/src/main/java/io/fabric8/maven/enricher/standard/openshift/RouteEnricher.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me.
-
It would be nice to add some documentation on how to generate Ingress just like we have for routes: http://maven.fabric8.io/#resource-route-generation . Maybe we can add some sample also which can demonstrate
Ingress
generation? -
We are generating ingress even when there is no
IngressController
present. However, it's not the responsibility of plugin to addIngressController
and should be done by cluster admins. But maybe we should at least check whether there is someIngressController
present in the cluster or not, WDYT?
@@ -23,19 +23,24 @@ | |||
import io.fabric8.kubernetes.api.model.ServiceBuilder; | |||
import io.fabric8.kubernetes.api.model.ServicePort; | |||
import io.fabric8.kubernetes.api.model.ServiceSpec; | |||
import io.fabric8.kubernetes.api.model.extensions.Ingress; | |||
import io.fabric8.kubernetes.api.model.extensions.HTTPIngressPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I thought intellij does that automatically. need to check my ide configuration
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Should we try to create an external URL for the given service? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either complete this javadoc or remove it.
*/ | ||
private boolean shouldCreateExternalURLForService(ServiceBuilder service) { | ||
String serviceName = service.getMetadata().getName(); | ||
if ("kubernetes".equals(serviceName) || "kubernetes-ro".equals(serviceName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we comparing Service names here like this? Do we even generate kubernetes
service while resource processing? What's with this kubernetes-ro
service?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are the prefixes for the potential services generated by kubernetes system itself. I took it from the apply mojo.
} | ||
ServiceSpec spec = service.getSpec(); | ||
List<ServicePort> ports = spec.getPorts(); | ||
log.debug("Service " + serviceName + " has ports: " + ports); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is dumping whole object into log statement fine?
[DEBUG] F8: fmp-ingress: Service fabric8-maven-sample-spring-boot has ports: [ServicePort(name=http, nodePort=null, port=8080, protocol=TCP, targetPort=IntOrString(IntVal=8080, Kind=0, StrVal=null, additionalProperties={}), additionalProperties={})]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought its appropriate for log.debug.
protected boolean isExposedService(ServiceBuilder serviceBuilder) { | ||
Service service = serviceBuilder.build(); | ||
return isExposedService(service); | ||
private ObjectMeta removeExposeLabel(ObjectMeta metadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen this method in IngressEnricher
also. Could we please avoid this code duplication?
/** | ||
* Allow enricher to add Metadata to the resources. | ||
* | ||
* @param platformMode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incomplete javadoc
@@ -92,7 +92,10 @@ | |||
@Parameter | |||
private List<ServiceAccountConfig> serviceAccounts; | |||
|
|||
private List<IngressRule> ingressRules; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove import above too
plugin/src/main/java/io/fabric8/maven/plugin/mojo/build/ResourceMojo.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We need to deduce a logic for finding/detecting kubernetes-controllers inside the cluster, as they are not a namespaced resource. In minikube, the default nginx-ingress-controller deployment is in the kube-system namespace but is it a globally followed arrangement? |
No description provided.