Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Ingress and Route generation refactor. #1730

Merged
merged 2 commits into from
Jan 3, 2020

Conversation

devang-gaur
Copy link
Contributor

No description provided.

@devang-gaur devang-gaur added the pr/wip Work in Progress, do not merge label Oct 11, 2019
@devang-gaur devang-gaur force-pushed the ingress_corrections branch 2 times, most recently from 7d79251 to cb35f85 Compare November 8, 2019 14:12
@devang-gaur devang-gaur force-pushed the ingress_corrections branch 2 times, most recently from 6e1d279 to 3b34467 Compare November 28, 2019 09:10
@@ -92,7 +92,10 @@
@Parameter
private List<ServiceAccountConfig> serviceAccounts;

private List<IngressRule> ingressRules;
Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove import above too

@devang-gaur
Copy link
Contributor Author

@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., enableIngress , expose = true to enable invokation of RouteEnricher and IngressEnricher ?

In simpler words, do we want Ingress.yaml to be generated by default for Kubernetes runtime mode?
@manusa

@devang-gaur devang-gaur removed the pr/wip Work in Progress, do not merge label Dec 1, 2019
Copy link
Member

@rohanKanojia rohanKanojia left a 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 add IngressController and should be done by cluster admins. But maybe we should at least check whether there is some IngressController 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import

Copy link
Contributor Author

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?
Copy link
Member

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)) {
Copy link
Member

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?

Copy link
Contributor Author

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);
Copy link
Member

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={})]

Copy link
Contributor Author

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) {
Copy link
Member

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
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove import above too

Copy link
Member

@manusa manusa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rohanKanojia rohanKanojia merged commit 818b653 into fabric8io:master Jan 3, 2020
@devang-gaur
Copy link
Contributor Author

#1374

@devang-gaur
Copy link
Contributor Author

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?

@devang-gaur devang-gaur added the jkube/pending The issue/PR has to be taken care of in JKube https://github.com/eclipse/jkube label Jan 29, 2020
rohanKanojia added a commit to rohanKanojia/jkube that referenced this pull request May 28, 2020
rohanKanojia added a commit to rohanKanojia/jkube that referenced this pull request May 28, 2020
rohanKanojia added a commit to rohanKanojia/jkube that referenced this pull request Jun 4, 2020
rohanKanojia added a commit to rohanKanojia/jkube that referenced this pull request Jun 4, 2020
rohanKanojia added a commit to rohanKanojia/jkube that referenced this pull request Jun 4, 2020
manusa pushed a commit to eclipse-jkube/jkube that referenced this pull request Jun 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
jkube/pending The issue/PR has to be taken care of in JKube https://github.com/eclipse/jkube
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants