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.
feat (jkube-kit/config) : Support for Startup Probes via XML/DSL conf…
…iguration (eclipse-jkube#1322) Add new startup probe field in resource configuration which should be available in XML maven plugin configuration/ Groovy DSL configuration in maven and gradle plugins respectively. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
- Loading branch information
1 parent
72bf18b
commit 7761690
Showing
17 changed files
with
1,039 additions
and
5 deletions.
There are no files selected for viewing
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
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
89 changes: 89 additions & 0 deletions
89
gradle-plugin/it/src/it/probes-groovy-dsl-config/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,89 @@ | ||
plugins { | ||
id 'org.springframework.boot' version '2.6.6' | ||
id 'io.spring.dependency-management' version '1.0.11.RELEASE' | ||
id 'org.eclipse.jkube.kubernetes' version "${jKubeVersion}" | ||
id 'org.eclipse.jkube.openshift' version "${jKubeVersion}" | ||
id 'java' | ||
} | ||
|
||
group = 'org.eclipse.jkube.it.gradle.probes.groovy.dsl' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-actuator' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
} | ||
|
||
kubernetes { | ||
offline = true | ||
if (probeConfigMode.contains("liveness-readiness")) { | ||
resources { | ||
liveness { | ||
initialDelaySeconds = 0 | ||
timeoutSeconds = 10 | ||
periodSeconds = 30 | ||
failureThreshold = 1 | ||
successThreshold = 1 | ||
getUrl = "http://:8080/actuator/health" | ||
httpHeaders = [Accept: "application/json", "User-agent": "MyUserAgent"] | ||
} | ||
readiness { | ||
initialDelaySeconds = 0 | ||
timeoutSeconds = 10 | ||
periodSeconds = 30 | ||
failureThreshold = 1 | ||
successThreshold = 1 | ||
getUrl = "http://:8080/actuator/health" | ||
httpHeaders = [Accept: "application/json", "User-agent": "MyUserAgent"] | ||
} | ||
} | ||
} | ||
if (probeConfigMode.equals("startup")) { | ||
resources { | ||
startup { | ||
periodSeconds = 30 | ||
failureThreshold = 1 | ||
getUrl = "http://:8080/actuator/health" | ||
} | ||
} | ||
} | ||
} | ||
|
||
openshift { | ||
offline = true | ||
if (probeConfigMode.equals("liveness-readiness")) { | ||
resources { | ||
liveness { | ||
initialDelaySeconds = 0 | ||
timeoutSeconds = 10 | ||
periodSeconds = 30 | ||
failureThreshold = 1 | ||
successThreshold = 1 | ||
getUrl = "http://:8080/actuator/health" | ||
httpHeaders = [Accept: "application/json", "User-agent": "MyUserAgent"] | ||
} | ||
readiness { | ||
initialDelaySeconds = 0 | ||
timeoutSeconds = 10 | ||
periodSeconds = 30 | ||
failureThreshold = 1 | ||
successThreshold = 1 | ||
getUrl = "http://:8080/actuator/health" | ||
httpHeaders = [Accept: "application/json", "User-agent": "MyUserAgent"] | ||
} | ||
} | ||
} | ||
if (probeConfigMode.equals("startup")) { | ||
resources { | ||
startup { | ||
periodSeconds = 30 | ||
failureThreshold = 1 | ||
getUrl = "http://:8080/actuator/health" | ||
} | ||
} | ||
} | ||
} |
122 changes: 122 additions & 0 deletions
122
gradle-plugin/it/src/it/probes-groovy-dsl-config/expected/liveness-readiness/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,122 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
prometheus.io/path: /metrics | ||
jkube.io/git-branch: "@ignore@" | ||
prometheus.io/port: "9779" | ||
prometheus.io/scrape: "true" | ||
jkube.io/git-url: "@ignore@" | ||
jkube.io/git-commit: "@ignore@" | ||
labels: | ||
expose: "true" | ||
app: probes-groovy-dsl-config | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.it.gradle.probes.groovy.dsl | ||
name: probes-groovy-dsl-config | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: probes-groovy-dsl-config | ||
provider: jkube | ||
group: org.eclipse.jkube.it.gradle.probes.groovy.dsl | ||
- apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
jkube.io/git-url: "@ignore@" | ||
jkube.io/git-commit: "@ignore@" | ||
jkube.io/git-branch: "@ignore@" | ||
labels: | ||
app: probes-groovy-dsl-config | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.it.gradle.probes.groovy.dsl | ||
name: probes-groovy-dsl-config | ||
spec: | ||
replicas: 1 | ||
revisionHistoryLimit: 2 | ||
selector: | ||
matchLabels: | ||
app: probes-groovy-dsl-config | ||
provider: jkube | ||
group: org.eclipse.jkube.it.gradle.probes.groovy.dsl | ||
template: | ||
metadata: | ||
annotations: | ||
jkube.io/git-url: "@ignore@" | ||
jkube.io/git-commit: "@ignore@" | ||
jkube.io/git-branch: "@ignore@" | ||
labels: | ||
app: probes-groovy-dsl-config | ||
provider: jkube | ||
version: "@ignore@" | ||
group: org.eclipse.jkube.it.gradle.probes.groovy.dsl | ||
name: probes-groovy-dsl-config | ||
spec: | ||
containers: | ||
- env: | ||
- name: KUBERNETES_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: HOSTNAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
image: dsl/probes-groovy-dsl-config:latest | ||
imagePullPolicy: IfNotPresent | ||
livenessProbe: | ||
failureThreshold: 1 | ||
httpGet: | ||
host: "" | ||
httpHeaders: | ||
- name: Accept | ||
value: application/json | ||
- name: User-agent | ||
value: MyUserAgent | ||
path: /actuator/health | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 0 | ||
periodSeconds: 30 | ||
successThreshold: 1 | ||
timeoutSeconds: 10 | ||
name: spring-boot | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
protocol: TCP | ||
- containerPort: 9779 | ||
name: prometheus | ||
protocol: TCP | ||
- containerPort: 8778 | ||
name: jolokia | ||
protocol: TCP | ||
readinessProbe: | ||
failureThreshold: 1 | ||
httpGet: | ||
host: "" | ||
httpHeaders: | ||
- name: Accept | ||
value: application/json | ||
- name: User-agent | ||
value: MyUserAgent | ||
path: /actuator/health | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 0 | ||
periodSeconds: 30 | ||
successThreshold: 1 | ||
timeoutSeconds: 10 | ||
securityContext: | ||
privileged: false |
Oops, something went wrong.