Skip to content

Commit

Permalink
fix (jkube-kit) : Remove ExposeEnricher (#1309)
Browse files Browse the repository at this point in the history
Remove all occurences of ExposeEnricher from project.

Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohanKanojia committed Apr 11, 2022
1 parent ded7049 commit 84b0122
Show file tree
Hide file tree
Showing 83 changed files with 11 additions and 299 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Usage:
* Fix #1302: Port volume-permission maven integration tests + docs to gradle
* Fix #1303: Add gradle integration test and docs for AutoTLSEnricher
* Fix #1308: Add documentation for DeploymentConfigEnricher
* Fix #1309: Remove ExposeEnricher from profiles and documentation
* Fix #1310: Add documentation + gradle integration test for ImageChangeTriggerEnricher
* Fix #1311: Add documentation for OpenShift ProjectEnricher
* Fix #1312: Add documentation + gradle integration test for RouteEnricher
Expand Down
1 change: 0 additions & 1 deletion gradle-plugin/doc/src/main/asciidoc/inc/_profiles.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ A profile can also extend another profile to avoid repetition e.g of generators
- jkube-controller-from-configuration
- jkube-openshift-deploymentconfig
- jkube-openshift-project
- jkube-openshift-service-expose
- jkube-openshift-route
----
Expand Down
1 change: 0 additions & 1 deletion gradle-plugin/it/src/it/autotls/expected/openshift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ items:
app.openshift.io/vcs-uri: "@ignore@"
jkube.io/git-commit: "@ignore@"
labels:
expose: "true"
app: autotls
provider: jkube
version: "@ignore@"
Expand Down
1 change: 0 additions & 1 deletion gradle-plugin/it/src/it/configmap/expected/kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ items:
jkube.io/git-branch: "@ignore@"
prometheus.io/port: "9779"
labels:
expose: "true"
provider: jkube
app: configmap
version: "@ignore@"
Expand Down
1 change: 0 additions & 1 deletion gradle-plugin/it/src/it/configmap/expected/openshift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ items:
jkube.io/git-branch: "@ignore@"
prometheus.io/port: "9779"
labels:
expose: "true"
provider: jkube
app: configmap
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: dockerfile-simple
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: dockerfile-simple
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: groovy-dsl-image
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: ingress
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: ingress
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: ingress
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: ingress
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: ingress
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ items:
jkube.io/git-branch: "@ignore@"
keyinservice: valueinservice
labels:
expose: "true"
keyinall: valueinall
keyinservice: valueinservice
app: metadata
Expand Down
1 change: 0 additions & 1 deletion gradle-plugin/it/src/it/metadata/expected/kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ items:
jkube.io/git-branch: "@ignore@"
keyinservice: valueinservice
labels:
expose: "true"
keyinall: valueinall
keyinservice: valueinservice
app: metadata
Expand Down
1 change: 0 additions & 1 deletion gradle-plugin/it/src/it/metadata/expected/openshift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ items:
app.openshift.io/vcs-uri: "@ignore@"
jkube.io/git-commit: "@ignore@"
labels:
expose: "true"
keyinall: valueinall
keyinservice: valueinservice
app: metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: custom-app
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: custom-app
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
provider: custom-provider
project: project-label
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
provider: custom-provider
project: project-label
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: "project-label"
provider: "jkube"
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: "project-label"
provider: "jkube"
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: route
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: route
provider: jkube
version: "@ignore@"
Expand Down
1 change: 0 additions & 1 deletion gradle-plugin/it/src/it/service/expected/kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: service
provider: jkube
version: "@ignore@"
Expand Down
1 change: 0 additions & 1 deletion gradle-plugin/it/src/it/service/expected/openshift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ items:
jkube.io/git-commit: "@ignore@"
jkube.io/git-branch: "@ignore@"
labels:
expose: "true"
app: service
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ items:
jkube.io/git-url: "@ignore@"
jkube.io/git-commit: "@ignore@"
labels:
expose: "true"
app: spring-boot-with-fragment
provider: jkube
version: "@ignore@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ items:
app: volume-permission
provider: jkube
version: "@ignore@"
expose: "true"
group: org.eclipse.jkube.devops.apps
name: jkube-docker-registry
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ items:
app: volume-permission
provider: jkube
version: "@ignore@"
expose: "true"
group: org.eclipse.jkube.devops.apps
name: jkube-docker-registry
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ items:
app: volume-permission
provider: jkube
version: "@ignore@"
expose: "true"
group: org.eclipse.jkube.devops.apps
name: jkube-docker-registry
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ items:
app: volume-permission
provider: jkube
version: "@ignore@"
expose: "true"
group: org.eclipse.jkube.devops.apps
name: jkube-docker-registry
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
- jkube-secret-file

# Route exposure
- jkube-openshift-service-expose
- jkube-openshift-route
- jkube-openshift-project

Expand Down Expand Up @@ -132,7 +131,6 @@
- jkube-controller-from-configuration
- jkube-openshift-deploymentconfig
- jkube-openshift-project
- jkube-openshift-service-expose
- jkube-openshift-route
# Only dependencies, no build, use other resources raw
- name: aggregate
Expand All @@ -152,5 +150,4 @@
generator:
excludes: []
enricher:
excludes:
- jkube-openshift-service-expose
excludes: []
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
- jkube-healthcheck-webapp
- jkube-healthcheck-micronaut

# Route exposure
- jkube-openshift-service-expose
# DeploymentConfigEnricher converts Deployment into DeploymentConfig
- jkube-openshift-deploymentconfig
- jkube-openshift-route
Expand Down Expand Up @@ -147,5 +145,4 @@
generator:
excludes: []
enricher:
excludes:
- jkube-openshift-service-expose
excludes: []
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
import io.fabric8.kubernetes.client.dsl.LogWatch;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.PodResource;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.openshift.api.model.Build;
import io.fabric8.openshift.api.model.DeploymentConfig;
import io.fabric8.openshift.api.model.DeploymentConfigSpec;
Expand Down Expand Up @@ -751,39 +750,6 @@ public static boolean isExposeService(Service service) {
return expose != null && expose.equalsIgnoreCase("true");
}

public static String getServiceExposeUrl(KubernetesClient kubernetes, String namespace, Collection<HasMetadata> resources, long serviceUrlWaitTimeSeconds, String exposeServiceAnnotationKey) throws InterruptedException {
for (HasMetadata entity : resources) {
if (entity instanceof Service) {
Service service = (Service) entity;
String name = KubernetesHelper.getName(service);
Resource<Service> serviceResource = kubernetes.services().inNamespace(namespace).withName(name);
String url = pollServiceForExposeUrl(serviceUrlWaitTimeSeconds, service, serviceResource, exposeServiceAnnotationKey);

// let's not wait for other services
serviceUrlWaitTimeSeconds = 1;
if (StringUtils.isNotBlank(url) && url.startsWith("http")) {
return url;
}
}
}
return null;
}

private static String pollServiceForExposeUrl(long serviceUrlWaitTimeSeconds, Service service, Resource<Service> serviceResource, String exposeSvcAnnotationKey) throws InterruptedException {
String url = null;
// let's wait a little while until there is a service URL in case the exposecontroller is running slow
for (int i = 0; i < serviceUrlWaitTimeSeconds; i++) {
if (i > 0) {
Thread.sleep(1000);
}
url = KubernetesHelper.getAnnotationValue(serviceResource.get(), exposeSvcAnnotationKey);
if (StringUtils.isNotBlank(url) || !KubernetesHelper.isExposeService(service)) {
break;
}
}
return url;
}

public static String getAnnotationValue(HasMetadata item, String annotationKey) {
if (item != null) {
return getOrCreateAnnotations(item).get(annotationKey);
Expand Down
Loading

0 comments on commit 84b0122

Please sign in to comment.