Add liveness and readiness probes (#610)
* Add liveness and readiness probes Signed-off-by: Anatolii Bazko <abazko@redhat.com>pull/617/head
parent
1c4030a696
commit
aa52e2892b
|
|
@ -22,7 +22,6 @@ source "${OPERATOR_REPO}"/.github/bin/common.sh
|
|||
trap "catchFinish" EXIT SIGINT
|
||||
|
||||
prepareTemplates() {
|
||||
disableOpenShiftOAuth ${TEMPLATES}
|
||||
disableUpdateAdminPassword ${TEMPLATES}
|
||||
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
|
||||
setServerExposureStrategy ${TEMPLATES} "single-host"
|
||||
|
|
@ -21,7 +21,6 @@ source "${OPERATOR_REPO}"/.github/bin/common.sh
|
|||
trap "catchFinish" EXIT SIGINT
|
||||
|
||||
prepareTemplates() {
|
||||
disableOpenShiftOAuth ${TEMPLATES}
|
||||
disableUpdateAdminPassword ${TEMPLATES}
|
||||
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
|
||||
setServerExposureStrategy ${TEMPLATES} "single-host"
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020 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
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Get absolute path for root repo directory from github actions context: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions
|
||||
export OPERATOR_REPO="${GITHUB_WORKSPACE}"
|
||||
source "${OPERATOR_REPO}"/.github/bin/common.sh
|
||||
|
||||
# Stop execution on any error
|
||||
trap "catchFinish" EXIT SIGINT
|
||||
|
||||
prepareTemplates() {
|
||||
disableUpdateAdminPassword ${LAST_OPERATOR_TEMPLATE}
|
||||
setIngressDomain ${LAST_OPERATOR_TEMPLATE} "$(minikube ip).nip.io"
|
||||
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
|
||||
}
|
||||
|
||||
runTest() {
|
||||
deployEclipseChe "operator" "minikube" "quay.io/eclipse/che-operator:${LAST_PACKAGE_VERSION}" ${LAST_OPERATOR_TEMPLATE}
|
||||
createWorkspace
|
||||
|
||||
updateEclipseChe ${OPERATOR_IMAGE} ${TEMPLATES}
|
||||
waitEclipseCheDeployed "nightly"
|
||||
|
||||
startExistedWorkspace
|
||||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
initLatestTemplates
|
||||
initStableTemplates "kubernetes" "stable"
|
||||
prepareTemplates
|
||||
buildCheOperatorImage
|
||||
copyCheOperatorImageToMinikube
|
||||
runTest
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020 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
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Get absolute path for root repo directory from github actions context: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions
|
||||
export OPERATOR_REPO="${GITHUB_WORKSPACE}"
|
||||
source "${OPERATOR_REPO}"/.github/bin/common.sh
|
||||
|
||||
# Stop execution on any error
|
||||
trap "catchFinish" EXIT SIGINT
|
||||
|
||||
prepareTemplates() {
|
||||
disableOpenShiftOAuth ${LAST_OPERATOR_TEMPLATE}
|
||||
disableUpdateAdminPassword ${LAST_OPERATOR_TEMPLATE}
|
||||
setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE}
|
||||
}
|
||||
|
||||
runTest() {
|
||||
deployEclipseChe "operator" "minishift" "quay.io/eclipse/che-operator:${LAST_PACKAGE_VERSION}" ${LAST_OPERATOR_TEMPLATE}
|
||||
createWorkspace
|
||||
|
||||
updateEclipseChe ${OPERATOR_IMAGE} ${TEMPLATES}
|
||||
waitEclipseCheDeployed "nightly"
|
||||
|
||||
startExistedWorkspace
|
||||
waitWorkspaceStart
|
||||
}
|
||||
|
||||
init
|
||||
installYq
|
||||
initLatestTemplates
|
||||
initStableTemplates "openshift" "stable"
|
||||
prepareTemplates
|
||||
copyCheOperatorImageToMinishift
|
||||
runTest
|
||||
|
|
@ -25,7 +25,7 @@ jobs:
|
|||
- name: Install jq
|
||||
run: sudo pip install yq
|
||||
- name: Run tests
|
||||
run: /bin/bash .github/bin/minikube/test-latest-olm.sh
|
||||
run: /bin/bash .github/bin/minikube/test-olm.sh
|
||||
# Run this step even the previous step fail
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
|
|
@ -24,7 +24,7 @@ jobs:
|
|||
- name: Install jq
|
||||
run: sudo pip install yq
|
||||
- name: Run tests
|
||||
run: /bin/bash .github/bin/minikube/test-latest-operator-singlehost-gateway.sh
|
||||
run: /bin/bash .github/bin/minikube/test-operator-singlehost-gateway.sh
|
||||
# Run this step even the previous step fail to upload artifacts to GH
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
|
|
@ -43,7 +43,7 @@ jobs:
|
|||
- name: Install jq
|
||||
run: sudo pip install yq
|
||||
- name: Run tests
|
||||
run: /bin/bash .github/bin/minikube/test-latest-operator-singlehost-native.sh
|
||||
run: /bin/bash .github/bin/minikube/test-operator-singlehost-native.sh
|
||||
# Run this step even the previous step fail to upload artifacts to GH
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#
|
||||
# Copyright (c) 2012-2020 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
|
||||
#
|
||||
|
||||
name: Minikube
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
minikube:
|
||||
name: Test Eclipse Che update from stable to nightly
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Provision Minikube cluster
|
||||
run: /bin/bash .github/bin/minikube/provision-cluster.sh
|
||||
- name: Install chectl
|
||||
run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=stable
|
||||
- name: Install jq
|
||||
run: sudo pip install yq
|
||||
- name: Tests
|
||||
run: /bin/bash .github/bin/minikube/test-operator-update.sh
|
||||
# Run this step even the previous step fail
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: minikube-updates-artifacts
|
||||
path: /tmp/artifacts-che
|
||||
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
- name: Install jq
|
||||
run: sudo pip install yq
|
||||
- name: Run tests
|
||||
run: /bin/bash .github/bin/minikube/test-update-olm.sh
|
||||
run: /bin/bash .github/bin/minikube/test-stable-olm-update.sh
|
||||
# Run this step even the previous step fail
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#
|
||||
# Copyright (c) 2012-2020 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
|
||||
#
|
||||
|
||||
name: Minishift
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
minishift:
|
||||
name: Test Eclipse Che update from stable to nightly
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Build Che operator image
|
||||
run: |
|
||||
export OPERATOR_IMAGE=quay.io/eclipse/che-operator:test
|
||||
# coreutils provides a readlink that supports `-f`
|
||||
|
||||
brew install coreutils docker docker-machine
|
||||
|
||||
mkdir -p ~/.docker/machine/cache/
|
||||
sudo curl -Lo ~/.docker/machine/cache/boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v19.03.12/boot2docker.iso
|
||||
|
||||
docker-machine --github-api-token="${{ secrets.GITHUB_TOKEN }}" create --driver virtualbox default
|
||||
eval "$(docker-machine env default)"
|
||||
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
|
||||
|
||||
docker build -t "${OPERATOR_IMAGE}" -f Dockerfile . && docker save "${OPERATOR_IMAGE}" > operator.tar
|
||||
|
||||
docker-machine stop
|
||||
- name: Provision Minishift cluster
|
||||
run: |
|
||||
brew cask install minishift
|
||||
export MINISHIFT_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
||||
minishift start --memory=5500 --vm-driver=virtualbox
|
||||
- name: Install chectl
|
||||
run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=stable
|
||||
- name: Install jq
|
||||
run: sudo pip install yq
|
||||
- name: Replace Minishift default certificates
|
||||
run: /bin/bash .github/bin/minishift/certs.sh
|
||||
- name: Tests
|
||||
run: |
|
||||
eval $(minishift oc-env)
|
||||
/bin/bash .github/bin/minishift/test-operator-update.sh
|
||||
# Run this step even the previous step fail
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
name: minishift-updates-artifacts
|
||||
path: /tmp/artifacts-che
|
||||
|
|
@ -49,7 +49,7 @@ jobs:
|
|||
- name: Run tests
|
||||
run: |
|
||||
eval $(minishift oc-env)
|
||||
/bin/bash .github/bin/minishift/test-latest-operator.sh
|
||||
/bin/bash .github/bin/minishift/test-operator.sh
|
||||
# Run this step even the previous step fail
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
|
|
@ -35,7 +35,7 @@ jobs:
|
|||
- name: Update minishift deprecated certificates and run e2e
|
||||
run: |
|
||||
eval $(minishift oc-env)
|
||||
/bin/bash .github/bin/minishift/test-update-operator.sh
|
||||
/bin/bash .github/bin/minishift/test-stable-operator-update.sh
|
||||
# Run this step even the previous step fail
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ always() }}
|
||||
|
|
@ -35,6 +35,7 @@ import (
|
|||
sdkVersion "github.com/operator-framework/operator-sdk/version"
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/config"
|
||||
"sigs.k8s.io/controller-runtime/pkg/healthz"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
|
||||
)
|
||||
|
|
@ -103,9 +104,6 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Become the leader before proceeding
|
||||
leader.Become(context.TODO(), "che-operator-lock")
|
||||
|
||||
r := ready.NewFileReady()
|
||||
err = r.Set()
|
||||
if err != nil {
|
||||
|
|
@ -114,10 +112,15 @@ func main() {
|
|||
}
|
||||
defer r.Unset()
|
||||
|
||||
// Become the leader before proceeding
|
||||
leader.Become(context.TODO(), "che-operator-lock")
|
||||
|
||||
// Create a new Cmd to provide shared dependencies and start components
|
||||
options := manager.Options{
|
||||
Namespace: namespace,
|
||||
Namespace: namespace,
|
||||
HealthProbeBindAddress: ":6789",
|
||||
}
|
||||
|
||||
mgr, err := manager.New(cfg, options)
|
||||
if err != nil {
|
||||
log.Error(err, "")
|
||||
|
|
@ -158,6 +161,12 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Setup health checks
|
||||
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
|
||||
log.Error(err, "Unable to set up health check")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
logrus.Info("Starting the Cmd")
|
||||
|
||||
// Start the Cmd
|
||||
|
|
|
|||
|
|
@ -84,13 +84,13 @@ metadata:
|
|||
categories: Developer Tools
|
||||
certified: "false"
|
||||
containerImage: quay.io/eclipse/che-operator:nightly
|
||||
createdAt: "2021-01-08T12:41:34Z"
|
||||
createdAt: "2021-01-08T14:09:35Z"
|
||||
description: A Kube-native development solution that delivers portable and collaborative
|
||||
developer workspaces.
|
||||
operatorframework.io/suggested-namespace: eclipse-che
|
||||
repository: https://github.com/eclipse/che-operator
|
||||
support: Eclipse Foundation
|
||||
name: eclipse-che-preview-kubernetes.v7.24.0-64.nightly
|
||||
name: eclipse-che-preview-kubernetes.v7.25.0-66.nightly
|
||||
namespace: placeholder
|
||||
spec:
|
||||
apiservicedefinitions: {}
|
||||
|
|
@ -291,7 +291,8 @@ spec:
|
|||
selector:
|
||||
matchLabels:
|
||||
app: che-operator
|
||||
strategy: {}
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
|
|
@ -357,10 +358,29 @@ spec:
|
|||
value: ca-certs
|
||||
image: quay.io/eclipse/che-operator:nightly
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 10
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 6789
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
name: che-operator
|
||||
ports:
|
||||
- containerPort: 60000
|
||||
name: metrics
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- stat
|
||||
- /tmp/operator-sdk-ready
|
||||
failureThreshold: 10
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
resources: {}
|
||||
restartPolicy: Always
|
||||
serviceAccountName: che-operator
|
||||
|
|
@ -494,4 +514,4 @@ spec:
|
|||
maturity: stable
|
||||
provider:
|
||||
name: Eclipse Foundation
|
||||
version: 7.24.0-64.nightly
|
||||
version: 7.25.0-66.nightly
|
||||
|
|
|
|||
|
|
@ -75,13 +75,13 @@ metadata:
|
|||
categories: Developer Tools, OpenShift Optional
|
||||
certified: "false"
|
||||
containerImage: quay.io/eclipse/che-operator:nightly
|
||||
createdAt: "2021-01-08T12:41:46Z"
|
||||
createdAt: "2021-01-08T14:09:42Z"
|
||||
description: A Kube-native development solution that delivers portable and collaborative
|
||||
developer workspaces in OpenShift.
|
||||
operatorframework.io/suggested-namespace: eclipse-che
|
||||
repository: https://github.com/eclipse/che-operator
|
||||
support: Eclipse Foundation
|
||||
name: eclipse-che-preview-openshift.v7.24.0-64.nightly
|
||||
name: eclipse-che-preview-openshift.v7.25.0-66.nightly
|
||||
namespace: placeholder
|
||||
spec:
|
||||
apiservicedefinitions: {}
|
||||
|
|
@ -306,7 +306,8 @@ spec:
|
|||
selector:
|
||||
matchLabels:
|
||||
app: che-operator
|
||||
strategy: {}
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
|
|
@ -370,10 +371,29 @@ spec:
|
|||
value: ca-certs
|
||||
image: quay.io/eclipse/che-operator:nightly
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 10
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 6789
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
name: che-operator
|
||||
ports:
|
||||
- containerPort: 60000
|
||||
name: metrics
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- stat
|
||||
- /tmp/operator-sdk-ready
|
||||
failureThreshold: 10
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
resources: {}
|
||||
restartPolicy: Always
|
||||
serviceAccountName: che-operator
|
||||
|
|
@ -513,4 +533,4 @@ spec:
|
|||
maturity: stable
|
||||
provider:
|
||||
name: Eclipse Foundation
|
||||
version: 7.24.0-64.nightly
|
||||
version: 7.25.0-66.nightly
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ spec:
|
|||
selector:
|
||||
matchLabels:
|
||||
app: che-operator
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
|
|
@ -86,6 +88,25 @@ spec:
|
|||
value: che-postgres-secret
|
||||
- name: CHE_SERVER_TRUST_STORE_CONFIGMAP_NAME
|
||||
value: ca-certs
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 6789
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
failureThreshold: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- stat
|
||||
- /tmp/operator-sdk-ready
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
failureThreshold: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
restartPolicy: Always
|
||||
serviceAccountName: che-operator
|
||||
terminationGracePeriodSeconds: 5
|
||||
|
|
|
|||
Loading…
Reference in New Issue