forked from eclipse-jkube/jkube
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test (gradle-plugin/it) : Add E2E test to verify SpringBootHealthChec…
…kEnricher detects management health probe endpoints Related to eclipse-jkube#2665 Add gradle integration test to verify that SpringBootHealthCheckEnricher adds `/actuator/health/readiness` for readiness probe and `/actuator/health/liveness` for liveness probe when `management.health.probes.enabled` property is enabled in application.properties Signed-off-by: Rohan Kumar <[email protected]>
- Loading branch information
1 parent
64e498e
commit a2c2943
Showing
6 changed files
with
434 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
gradle-plugin/it/src/it/spring-boot-managementhealthprobes/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
plugins { | ||
id 'org.eclipse.jkube.kubernetes' version "${jKubeVersion}" | ||
id 'org.eclipse.jkube.openshift' version "${jKubeVersion}" | ||
id 'org.springframework.boot' version '2.7.17' | ||
id 'io.spring.dependency-management' version '1.0.15.RELEASE' | ||
id 'java' | ||
} | ||
|
||
group = 'org.eclipse.jkube.integration.tests.gradle' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'org.springframework.boot:spring-boot-starter-actuator' | ||
} | ||
|
||
kubernetes { | ||
offline = true | ||
} | ||
openshift { | ||
offline = true | ||
} |
123 changes: 123 additions & 0 deletions
123
gradle-plugin/it/src/it/spring-boot-managementhealthprobes/expected/kubernetes.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "9779" | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/version: "@ignore@" | ||
name: spring-boot-managementhealthprobes | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
- apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/version: "@ignore@" | ||
name: spring-boot-managementhealthprobes | ||
spec: | ||
replicas: 1 | ||
revisionHistoryLimit: 2 | ||
selector: | ||
matchLabels: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
template: | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/version: "@ignore@" | ||
name: spring-boot-managementhealthprobes | ||
spec: | ||
containers: | ||
- env: | ||
- name: KUBERNETES_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: HOSTNAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
image: gradle/spring-boot-managementhealthprobes:latest | ||
imagePullPolicy: IfNotPresent | ||
livenessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /actuator/health/liveness | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 180 | ||
successThreshold: 1 | ||
name: spring-boot | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
protocol: TCP | ||
- containerPort: 9779 | ||
name: prometheus | ||
protocol: TCP | ||
- containerPort: 8778 | ||
name: jolokia | ||
protocol: TCP | ||
readinessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /actuator/health/readiness | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 10 | ||
successThreshold: 1 | ||
securityContext: | ||
privileged: false |
163 changes: 163 additions & 0 deletions
163
gradle-plugin/it/src/it/spring-boot-managementhealthprobes/expected/openshift.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "9779" | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
app.openshift.io/vcs-ref: "@ignore@" | ||
app.openshift.io/vcs-uri: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/version: "@ignore@" | ||
name: spring-boot-managementhealthprobes | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
- apiVersion: apps.openshift.io/v1 | ||
kind: DeploymentConfig | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
app.openshift.io/vcs-ref: "@ignore@" | ||
app.openshift.io/vcs-uri: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/version: "@ignore@" | ||
name: spring-boot-managementhealthprobes | ||
spec: | ||
replicas: 1 | ||
revisionHistoryLimit: 2 | ||
selector: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
strategy: | ||
rollingParams: | ||
timeoutSeconds: 3600 | ||
type: Rolling | ||
template: | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
app.openshift.io/vcs-ref: "@ignore@" | ||
app.openshift.io/vcs-uri: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/version: "@ignore@" | ||
name: spring-boot-managementhealthprobes | ||
spec: | ||
containers: | ||
- env: | ||
- name: KUBERNETES_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
image: spring-boot-managementhealthprobes:latest | ||
imagePullPolicy: IfNotPresent | ||
livenessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /actuator/health/liveness | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 180 | ||
successThreshold: 1 | ||
name: spring-boot | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
protocol: TCP | ||
- containerPort: 9779 | ||
name: prometheus | ||
protocol: TCP | ||
- containerPort: 8778 | ||
name: jolokia | ||
protocol: TCP | ||
readinessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /actuator/health/readiness | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 10 | ||
successThreshold: 1 | ||
securityContext: | ||
privileged: false | ||
triggers: | ||
- type: ConfigChange | ||
- imageChangeParams: | ||
automatic: true | ||
containerNames: | ||
- spring-boot | ||
from: | ||
kind: ImageStreamTag | ||
name: spring-boot-managementhealthprobes:latest | ||
type: ImageChange | ||
- apiVersion: route.openshift.io/v1 | ||
kind: Route | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
app.openshift.io/vcs-ref: "@ignore@" | ||
app.openshift.io/vcs-uri: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: spring-boot-managementhealthprobes | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: spring-boot-managementhealthprobes | ||
app.kubernetes.io/version: "@ignore@" | ||
name: spring-boot-managementhealthprobes | ||
spec: | ||
port: | ||
targetPort: 8080 | ||
to: | ||
kind: Service | ||
name: spring-boot-managementhealthprobes |
24 changes: 24 additions & 0 deletions
24
...gementhealthprobes/src/main/java/org/eclipse/jkube/it/gradle/spring/boot/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.it.gradle.spring.boot; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Application { | ||
public static void main(String[] args) { | ||
SpringApplication.run(Application.class, args); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...in/it/src/it/spring-boot-managementhealthprobes/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Copyright (c) 2019 Red Hat, Inc. | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at: | ||
# | ||
# https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
# Contributors: | ||
# Red Hat, Inc. - initial API and implementation | ||
# | ||
|
||
management.health.probes.enabled=true |
Oops, something went wrong.