-
Notifications
You must be signed in to change notification settings - Fork 179
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
Add CI script to deploy published releases #1837
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright (C) 2024 ScyllaDB | ||
# | ||
|
||
set -euExo pipefail | ||
shopt -s inherit_errexit | ||
|
||
if [ -z "${ARTIFACTS+x}" ]; then | ||
echo "ARTIFACTS can't be empty" > /dev/stderr | ||
exit 2 | ||
fi | ||
|
||
source "$( dirname "${BASH_SOURCE[0]}" )/../lib/kube.sh" | ||
source "$( dirname "${BASH_SOURCE[0]}" )/lib/e2e.sh" | ||
parent_dir="$( dirname "${BASH_SOURCE[0]}" )" | ||
|
||
trap gather-artifact-on-exit EXIT | ||
|
||
|
||
SO_NODECONFIG_PATH="${SO_NODECONFIG_PATH=${parent_dir}/manifests/cluster/nodeconfig.yaml}" | ||
export SO_NODECONFIG_PATH | ||
|
||
# Make sure there is no default storage class before we create our own so we always use our own provisioner from the release. | ||
for r in $( kubectl get storageclasses -o name ); do kubectl patch "${r}" -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'; done | ||
|
||
SCYLLA_OPERATOR_FEATURE_GATES="${SCYLLA_OPERATOR_FEATURE_GATES:-AllAlpha=true,AllBeta=true}" | ||
export SCYLLA_OPERATOR_FEATURE_GATES | ||
|
||
timeout --foreground -v 10m "${parent_dir}/../ci-deploy-release.sh" "${SO_IMAGE}" | ||
|
||
apply-e2e-workarounds | ||
run-e2e |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2024 ScyllaDB | ||
# | ||
# This script deploys scylla-operator stack. | ||
# Usage: ${0} <operator_image_ref> | ||
# (Avoid using rolling tags.) | ||
|
||
set -euxEo pipefail | ||
shopt -s inherit_errexit | ||
|
||
source "$( dirname "${BASH_SOURCE[0]}" )/lib/kube.sh" | ||
|
||
if [[ -n "${1+x}" ]]; then | ||
operator_image_ref="${1}" | ||
else | ||
echo "Missing operator image ref.\nUsage: ${0} <operator_image_ref>" >&2 >/dev/null | ||
exit 1 | ||
fi | ||
|
||
source_raw="$( skopeo inspect --format='{{ index .Labels "org.opencontainers.image.source" }}' "docker://${operator_image_ref}" )" | ||
if [[ -z "${source_raw}" ]]; then | ||
echo "Image '${operator_image_ref}' is missing source label" >&2 >/dev/null | ||
exit 1 | ||
fi | ||
source_url="${source_raw/"://github.com/"/"://raw.githubusercontent.com/"}" | ||
|
||
revision="$( skopeo inspect --format='{{ index .Labels "org.opencontainers.image.revision" }}' "docker://${operator_image_ref}" )" | ||
if [[ -z "${revision}" ]]; then | ||
echo "Image '${operator_image_ref}' is missing revision label" >&2 >/dev/null | ||
exit 1 | ||
fi | ||
|
||
ARTIFACTS="${ARTIFACTS:-$( mktemp -d )}" | ||
|
||
kubectl_create -n=prometheus-operator -f="${source_url}/${revision}/examples/third-party/prometheus-operator.yaml" | ||
kubectl_create -n=haproxy-ingress -f="${source_url}/${revision}/examples/third-party/haproxy-ingress.yaml" | ||
|
||
kubectl_create -f="${source_url}/${revision}/examples/common/cert-manager.yaml" | ||
# Wait for cert-manager crd and webhooks | ||
kubectl wait --for condition=established --timeout=60s crd/certificates.cert-manager.io crd/issuers.cert-manager.io | ||
for d in cert-manager{,-cainjector,-webhook}; do | ||
kubectl -n=cert-manager rollout status --timeout=5m "deployment.apps/${d}" | ||
done | ||
wait-for-object-creation cert-manager secret/cert-manager-webhook-ca | ||
|
||
mkdir "${ARTIFACTS}/operator" | ||
cat > "${ARTIFACTS}/operator/kustomization.yaml" << EOF | ||
resources: | ||
- ${source_url}/${revision}/deploy/operator.yaml | ||
patches: | ||
- patch: |- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: scylla-operator | ||
namespace: scylla-operator | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: scylla-operator | ||
image: "${operator_image_ref}" | ||
env: | ||
- name: SCYLLA_OPERATOR_IMAGE | ||
value: "${operator_image_ref}" | ||
rzetelskik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
EOF | ||
kubectl kustomize "${ARTIFACTS}/operator" | kubectl_create -n=scylla-operator -f=- | ||
|
||
# Manager needs scylla CRD registered and the webhook running | ||
kubectl wait --for condition=established crd/{scyllaclusters,nodeconfigs}.scylla.scylladb.com | ||
kubectl -n=scylla-operator rollout status --timeout=5m deployment.apps/scylla-operator | ||
kubectl -n=scylla-operator rollout status --timeout=5m deployment.apps/webhook-server | ||
|
||
if [[ -z "${SO_NODECONFIG_PATH:-}" ]]; then | ||
echo "Skipping NodeConfig creation" | ||
else | ||
kubectl_create -f="${SO_NODECONFIG_PATH}" | ||
fi | ||
|
||
rzetelskik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
kubectl_create -n=local-csi-driver -f="${source_url}/${revision}/examples/common/local-volume-provisioner/local-csi-driver/"{00_namespace.yaml,00_scylladb-local-xfs.storageclass.yaml,10_csidriver.yaml,10_driver.serviceaccount.yaml,10_provisioner_clusterrole.yaml,20_provisioner_clusterrolebinding.yaml,50_daemonset.yaml} | ||
kubectl -n=local-csi-driver rollout status --timeout=5m daemonset.apps/local-csi-driver | ||
|
||
mkdir "${ARTIFACTS}/manager" | ||
cat > "${ARTIFACTS}/manager/kustomization.yaml" << EOF | ||
resources: | ||
- ${source_url}/${revision}/deploy/manager-prod.yaml | ||
patches: | ||
- target: | ||
group: scylla.scylladb.com | ||
version: v1 | ||
kind: ScyllaCluster | ||
name: scylla-manager-cluster | ||
patch: | | ||
- op: replace | ||
path: /spec/datacenter/racks/0/storage/storageClassName | ||
value: scylladb-local-xfs | ||
EOF | ||
kubectl kustomize "${ARTIFACTS}/manager" | kubectl_create -n=scylla-manager -f=- | ||
rzetelskik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
wait-for-object-creation scylla-manager statefulset.apps/scylla-manager-cluster-manager-dc-manager-rack | ||
kubectl -n=scylla-manager rollout status --timeout=5m statefulset.apps/scylla-manager-cluster-manager-dc-manager-rack | ||
Comment on lines
+101
to
+102
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: these could be replaced with waiting for our three aggregated conditions on ScyllaCluster without hardcoding names of Operator managed resources. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good point but it's in ci-deploy.sh as well, I'll send a followup. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
kubectl -n=scylla-manager rollout status --timeout=5m deployment.apps/scylla-manager | ||
kubectl -n=scylla-manager rollout status --timeout=5m deployment.apps/scylla-manager-controller | ||
|
||
kubectl -n=haproxy-ingress rollout status --timeout=5m deployment.apps/haproxy-ingress | ||
|
||
kubectl wait --for condition=established crd/{scyllaoperatorconfigs,scylladbmonitorings}.scylla.scylladb.com | ||
kubectl wait --for condition=established crd/{prometheuses,prometheusrules,servicemonitors}.monitoring.coreos.com | ||
rzetelskik marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing wait-for-object-creation from ci-deploy:
scylla-operator/hack/ci-deploy.sh
Line 48 in b7ca9a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be needed, I don't think
kubectl
hits the watch cache.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be removed from the other script then? (not in this pr)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have a tracker for this? Even if it's in the backlog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1945