Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default values for probes #339

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion api/v1beta2/openlibertyapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ const (
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Reconciled')].reason",priority=1,description="Reason for the failure of reconcile condition"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Reconciled')].message",priority=1,description="Failure message from reconcile condition"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",priority=0,description="Age of the resource"
//+operator-sdk:csv:customresourcedefinitions:displayName="OpenLibertyApplication",resources={{Deployment,v1},{Service,v1},{StatefulSet,v1},{Route,v1},{HorizontalPodAutoscaler,v1},{ServiceAccount,v1},{Secret,v1}}
// +operator-sdk:csv:customresourcedefinitions:displayName="OpenLibertyApplication",resources={{Deployment,v1},{Service,v1},{StatefulSet,v1},{Route,v1},{HorizontalPodAutoscaler,v1},{ServiceAccount,v1},{Secret,v1}}

// Represents the deployment of an Open Liberty application
type OpenLibertyApplication struct {
Expand Down Expand Up @@ -536,6 +536,21 @@ func (p *OpenLibertyApplicationProbes) GetStartupProbe() *corev1.Probe {
return p.Startup
}

// GetDefaultLivenessProbe returns default values for liveness probe
func (p *OpenLibertyApplicationProbes) GetDefaultLivenessProbe(ba common.BaseComponent) *corev1.Probe {
return common.GetDefaultMicroProfileLivenessProbe(ba)
}

// GetDefaultReadinessProbe returns default values for readiness probe
func (p *OpenLibertyApplicationProbes) GetDefaultReadinessProbe(ba common.BaseComponent) *corev1.Probe {
return common.GetDefaultMicroProfileReadinessProbe(ba)
}

// GetDefaultStartupProbe returns default values for startup probe
func (p *OpenLibertyApplicationProbes) GetDefaultStartupProbe(ba common.BaseComponent) *corev1.Probe {
return common.GetDefaultMicroProfileStartupProbe(ba)
}

// GetVolumes returns volumes slice
func (cr *OpenLibertyApplication) GetVolumes() []corev1.Volume {
return cr.Spec.Volumes
Expand Down
1 change: 1 addition & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions bundle/tests/scorecard/kuttl/probe/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 120
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: probes-liberty
spec:
selector:
matchLabels:
app.kubernetes.io/instance: probes-liberty
template:
spec:
containers:
- livenessProbe:
failureThreshold: 3
httpGet:
path: /health/live
port: 9443
scheme: HTTPS
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
readinessProbe:
failureThreshold: 3
httpGet:
path: /health/ready
port: 9443
scheme: HTTPS
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
startupProbe:
failureThreshold: 3
httpGet:
path: /health/started
port: 9443
scheme: HTTPS
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
status:
observedGeneration: 4
readyReplicas: 1
replicas: 1
updatedReplicas: 1
14 changes: 14 additions & 0 deletions bundle/tests/scorecard/kuttl/probe/03-liberty-probe-defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: apps.openliberty.io/v1beta2
kind: OpenLibertyApplication
metadata:
name: probes-liberty
spec:
# Add fields here
applicationImage: icr.io/appcafe/open-liberty/samples/getting-started
service:
port: 9443
replicas: 1
probes:
startup: {}
liveness: {}
readiness: {}
29 changes: 29 additions & 0 deletions bundle/tests/scorecard/kuttl/probe/04-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 120
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: probes-liberty
spec:
selector:
matchLabels:
app.kubernetes.io/instance: probes-liberty
template:
spec:
containers:
- startupProbe:
failureThreshold: 3
httpGet:
path: /health/started
port: 9443
scheme: HTTPS
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
status:
observedGeneration: 5
readyReplicas: 1
replicas: 1
updatedReplicas: 1
20 changes: 20 additions & 0 deletions bundle/tests/scorecard/kuttl/probe/04-errors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: probes-liberty
spec:
selector:
matchLabels:
app.kubernetes.io/instance: probes-liberty
template:
spec:
containers:
- livenessProbe:
failureThreshold: 3
readinessProbe:
failureThreshold: 3
status:
observedGeneration: 5
replicas: 1
readyReplicas: 1
updatedReplicas: 1
13 changes: 13 additions & 0 deletions bundle/tests/scorecard/kuttl/probe/04-liberty-probe-undef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apps.openliberty.io/v1beta2
kind: OpenLibertyApplication
metadata:
name: probes-liberty
spec:
# Add fields here
applicationImage: icr.io/appcafe/open-liberty/samples/getting-started
service:
port: 9443
probes:
startup: {}
liveness:
readiness:
30 changes: 30 additions & 0 deletions bundle/tests/scorecard/kuttl/probe/05-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 120
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: probes-liberty
spec:
selector:
matchLabels:
app.kubernetes.io/instance: probes-liberty
template:
spec:
containers:
- startupProbe:
failureThreshold: 3
httpGet:
path: /health/started
port: 9443
scheme: HTTPS
initialDelaySeconds: 3
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
status:
observedGeneration: 6
readyReplicas: 1
replicas: 1
updatedReplicas: 1
20 changes: 20 additions & 0 deletions bundle/tests/scorecard/kuttl/probe/05-errors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: probes-liberty
spec:
selector:
matchLabels:
app.kubernetes.io/instance: probes-liberty
template:
spec:
containers:
- livenessProbe:
failureThreshold: 3
readinessProbe:
failureThreshold: 3
status:
observedGeneration: 6
replicas: 1
readyReplicas: 1
updatedReplicas: 1
15 changes: 15 additions & 0 deletions bundle/tests/scorecard/kuttl/probe/05-liberty-probe-override.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: apps.openliberty.io/v1beta2
kind: OpenLibertyApplication
metadata:
name: probes-liberty
spec:
# Add fields here
applicationImage: icr.io/appcafe/open-liberty/samples/getting-started
service:
port: 9443
replicas: 1
probes:
startup:
initialDelaySeconds: 3
readiness:
liveness:
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/OpenLiberty/open-liberty-operator
go 1.16

require (
github.com/application-stacks/runtime-component-operator v0.8.1-0.20220405182540-00ecc1f1f51d
github.com/application-stacks/runtime-component-operator v0.8.1-0.20220406013638-131565c1b2b8
github.com/coreos/prometheus-operator v0.41.1
github.com/go-logr/logr v0.3.0
github.com/openshift/api v0.0.0-20201019163320-c6a5ec25f267
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ github.com/aphistic/golf v0.0.0-20180712155816-02c07f170c5a/go.mod h1:3NqKYiepwy
github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3stzu0Xys=
github.com/application-stacks/runtime-component-operator v0.8.1-0.20220405182540-00ecc1f1f51d h1:wqeot/blEksWnzophJTZ9ANxiizdK7Z1kGIhjOinu2s=
github.com/application-stacks/runtime-component-operator v0.8.1-0.20220405182540-00ecc1f1f51d/go.mod h1:h365eRTO2WuA+IYMxW/DrOZCqePnX7NyxN5MzqsV20k=
github.com/application-stacks/runtime-component-operator v0.8.1-0.20220406013638-131565c1b2b8 h1:Y5UssB0JvjHogKaIu7D2Z79wH1QOtwjGjQgU9jJ5pp4=
github.com/application-stacks/runtime-component-operator v0.8.1-0.20220406013638-131565c1b2b8/go.mod h1:h365eRTO2WuA+IYMxW/DrOZCqePnX7NyxN5MzqsV20k=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading