Skip to content

Commit 1094676

Browse files
authored
Merge pull request #24 from SovereignCloudStack/feat/support-scs2
Feat/support scs2
2 parents 1fb643b + 61bf3cf commit 1094676

6 files changed

Lines changed: 89 additions & 15 deletions

05-deploy-cstack.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ source "$SET"
1616
# Sanity checks
1717
if test -z "$CS_MAINVER"; then echo "Configure CS_MAINVER"; exit 2; fi
1818
if test -z "$CS_VERSION"; then echo "Configure CS_VERSION"; exit 3; fi
19+
if test -z "$CS_SERIES"; then echo "Configure CS_SERIES, default to scs2"; CS_SERIES=scs2; fi
1920
# if test -z "$CL_PATCHVER"; then echo "Configure CL_PATCHVER"; exit 4; fi
2021
# Create ClusterStack yaml
2122
cat > ~/tmp/clusterstack-$CS_MAINVER.yaml <<EOF
@@ -26,7 +27,7 @@ metadata:
2627
namespace: "$CS_NAMESPACE"
2728
spec:
2829
provider: openstack
29-
name: scs
30+
name: "$CS_SERIES"
3031
kubernetesVersion: "$CS_MAINVER"
3132
channel: custom
3233
autoSubscribe: false

06-wait-clusterclass.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,34 @@ else
1313
fi
1414
# Read settings -- make sure you can trust it
1515
source "$SET"
16+
if test -z "$CS_SERIES"; then echo "Configure CS_SERIES, default to scs2"; CS_SERIES=scs2; fi
1617
# If we have an array, match what CS_VERSION we want to wait for
1718
if test "${CS_VERSION:0:1}" = "["; then
1819
VERSIONS="$(echo $CS_VERSION | sed -e 's/\[//' -e 's/\]//' -e 's/,/ /g')"
1920
for ver in $VERSIONS; do
20-
#echo "Wait for clusterstackrelease -n $CS_NAMESPACE openstack-scs-${CS_MAINVER/./-}-${ver/./-} readiness"
21-
echo "Wait for clusterstackrelease -n $CS_NAMESPACE openstack-scs-${CS_MAINVER/./-}-${ver/./-} creation"
22-
kubectl wait -n "$CS_NAMESPACE" clusterstackrelease openstack-scs-${CS_MAINVER/./-}-${ver/./-} --for create
21+
echo "Wait for clusterstackrelease -n $CS_NAMESPACE openstack-${CS_SERIES}-${CS_MAINVER/./-}-${ver/./-} creation"
22+
kubectl wait -n "$CS_NAMESPACE" clusterstackrelease openstack-${CS_SERIES}-${CS_MAINVER/./-}-${ver/./-} --for create
2323
done
2424
VERSIONS=$(kubectl get clusterstackreleases -n $CS_NAMESPACE -o "custom-columns=NAME:.metadata.name,K8SVER:.status.kubernetesVersion")
2525
echo -e "# Table of registered clusterstackreleases:\n$VERSIONS"
2626
while read csnm k8sver; do
2727
if test "$csnm" = "NAME"; then continue; fi
2828
if test "$k8sver" = "v$CL_PATCHVER"; then
29-
CS_VERSION="v${csnm#openstack-scs-?-??-v}"
29+
CS_VERSION="v${csnm#openstack-${CS_SERIES}-?-??-v}"
3030
CS_VERSION="${CS_VERSION//-/.}"
3131
CS_VERSION="${CS_VERSION/./-}"
32+
#echo "$CS_VERSION"
3233
break
3334
fi
3435
done < <(echo "$VERSIONS")
3536
if test "${CS_VERSION:0:1}" = "["; then
3637
echo "No clusterstackrelease with v$CL_PATCHVER found"
3738
fi
3839
else
39-
echo "Wait for clusterstackrelease -n $CS_NAMESPACE openstack-scs-${CS_MAINVER/./-}-${CS_VERSION/./-} readiness"
40-
kubectl wait -n "$CS_NAMESPACE" clusterstackrelease openstack-scs-${CS_MAINVER/./-}-${CS_VERSION/./-} --for condition=ready
40+
echo "Wait for clusterstackrelease -n $CS_NAMESPACE openstack-${CS_SERIES}-${CS_MAINVER/./-}-${CS_VERSION/./-} readiness"
41+
kubectl wait -n "$CS_NAMESPACE" clusterstackrelease openstack-${CS_SERIES}-${CS_MAINVER/./-}-${CS_VERSION/./-} --for condition=ready
4142
fi
42-
echo "# Wait for clusterclass -n $CS_NAMESPACE openstack-scs-${CS_MAINVER/./-}-${CS_VERSION} creation"
43-
kubectl wait -n "$CS_NAMESPACE" clusterclass openstack-scs-${CS_MAINVER/./-}-${CS_VERSION} --for create
43+
echo "# Wait for clusterclass -n $CS_NAMESPACE openstack-${CS_SERIES}-${CS_MAINVER/./-}-${CS_VERSION} creation"
44+
kubectl wait -n "$CS_NAMESPACE" clusterclass openstack-${CS_SERIES}-${CS_MAINVER/./-}-${CS_VERSION} --for create
4445
kubectl get clusterclasses -n "$CS_NAMESPACE"
4546
kubectl get images -n "$CS_NAMESPACE"

07-cluster-secret.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ else
1313
fi
1414
# Read settings -- make sure you can trust it
1515
source "$SET"
16+
if test -z "$CS_SERIES"; then echo "Configure CS_SERIES, default to scs2"; CS_SERIES=scs2; fi
1617
# Read helper
1718
THISDIR=$(dirname $0)
1819
source "$THISDIR/_yaml_parse.sh"
@@ -37,6 +38,7 @@ else
3738
fi
3839

3940
OLD_UMASK=$(umask)
41+
CL_NAME_B64=$(echo -n openstack | base64 -w0)
4042

4143
# Deal with per-cluster secrets
4244
# A few cases:

08-create-cluster.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ source "$SET"
1414
# Sanity checks
1515
if test -z "$CS_MAINVER"; then echo "Configure CS_MAINVER"; exit 2; fi
1616
if test -z "$CS_VERSION"; then echo "Configure CS_VERSION"; exit 3; fi
17+
if test -z "$CS_SERIES"; then echo "Configure CS_SERIES, default to scs2"; CS_SERIES=scs2; fi
1718
if test -z "$CL_PATCHVER"; then echo "Configure CL_PATCHVER"; exit 4; fi
1819
if test -z "$CL_NAME"; then echo "Configure CL_NAME"; exit 5; fi
1920
if test -z "$CL_PODCIDR"; then echo "Configure CL_PODCIDR"; exit 6; fi
@@ -27,7 +28,7 @@ if test "${CS_VERSION:0:1}" = "["; then
2728
while read csnm k8sver; do
2829
if test "$csnm" = "NAME"; then continue; fi
2930
if test "$k8sver" = "v$CL_PATCHVER"; then
30-
CS_VERSION="v${csnm#openstack-scs-?-??-v}"
31+
CS_VERSION="v${csnm#openstack-${CS_SERIES}-?-??-v}"
3132
CS_VERSION="${CS_VERSION//-/.}"
3233
CS_VERSION="${CS_VERSION/./-}"
3334
break
@@ -44,8 +45,12 @@ else
4445
fi
4546
# Distinguish between old (cloud.config) and new style (clouds.yaml) secrets
4647
# This depends on the clusterstackrelease, not on whether or not we have a newsecret
47-
#if kubectl get -n $CS_NAMESPACE clusterstackreleases.clusterstack.x-k8s.io openstack-scs-${CS_MAINVER/./-}-${CS_VERSION/./-} -o jsonpath='{.status.resources}' | grep openstack-scs-${CS_MAINVER/./-}-${CS_VERSION}-clouds-yaml >/dev/null 2>&1; then
48-
CFGSTYLE=$(kubectl get clusterclasses.cluster.x-k8s.io -n $CS_NAMESPACE openstack-scs-${CS_MAINVER/./-}-$CS_VERSION -o jsonpath='{.metadata.annotations.configStyle}' || true)
48+
#if kubectl get -n $CS_NAMESPACE clusterstackreleases.clusterstack.x-k8s.io openstack-${CS_SERIES}-${CS_MAINVER/./-}-${CS_VERSION/./-} -o jsonpath='{.status.resources}' | grep openstack-${CS_SERIES}-${CS_MAINVER/./-}-${CS_VERSION}-clouds-yaml >/dev/null 2>&1; then
49+
if test "$CS_SERIES" = "scs2"; then
50+
CFGSTYLE="clouds-yaml"
51+
else
52+
CFGSTYLE=$(kubectl get clusterclasses.cluster.x-k8s.io -n $CS_NAMESPACE openstack-${CS_SERIES}-${CS_MAINVER/./-}-$CS_VERSION -o jsonpath='{.metadata.annotations.configStyle}' || true)
53+
fi
4954
if test "$CFGSTYLE" = "clouds-yaml"; then
5055
MGD_SEC="managed-secret: clouds-yaml$SECRETSUFFIX"
5156
else
@@ -89,7 +94,7 @@ spec:
8994
cidrBlocks:
9095
- "$CL_SVCCIDR"
9196
topology:
92-
class: openstack-scs-${CS_MAINVER/./-}-$CS_VERSION
97+
class: openstack-${CS_SERIES}-${CS_MAINVER/./-}-$CS_VERSION
9398
controlPlane:
9499
replicas: $CL_CTRLNODES
95100
version: v$CL_PATCHVER
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Cluster settings template
1+
# Cluster settings template (scs cluster stack series)
22
# This is a file to be sourced from bash
33
# Don't do this with untrusted files!
44
#
@@ -19,6 +19,8 @@ OS_CLOUD=${OS_CLOUD:-openstack}
1919
CS_MAINVER=
2020
# CS Template versions that matches, should be an array, e.g. [v1, v2, v0-git.XXXXXXX]
2121
CS_VERSION=
22+
# CS Series (scs or scs2)
23+
CS_SERIES=scs
2224
### Now the per workload cluster settings
2325
# Full K8s Version Maj.Min.Patch, without leading 'v', e.g. 1.32.3 (this is per cluster)
2426
CL_PATCHVER=
@@ -35,7 +37,8 @@ CL_SVCCIDR=10.96.0.0/14
3537
CL_CTRLNODES=1
3638
# Number of (initial) worker nodes
3739
CL_WRKRNODES=1
38-
# Additional clusterclass variables in key=value syntax (;-separated), defaults are
40+
# Additional clusterClass variables in key=value syntax (;-separated), names come from
41+
# the clusterClass -- they will change with scs2 series. Defaults in scs are:
3942
# apiserver_loadbalancer=octavia-ovn;
4043
# controller_flavor=SCS-2V-4-20s; controller_root_disk=0
4144
# worker_flavor=SCS-2V-4; worker_root_disk=25

cluster-settings-template.scs2.env

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Cluster settings template (scs2 cluster stack series)
2+
# This is a file to be sourced from bash
3+
# Don't do this with untrusted files!
4+
#
5+
# TODO: Check whether we can make this more compatible with v1 KaaS
6+
#
7+
### Management cluster
8+
# You do not normally override it
9+
#KUBECONFIG=~/.kube/config
10+
### Per namespace: secrets
11+
# The namespace to keep your CS objects for a set of clusters (use e.g. cloud project name)
12+
CS_NAMESPACE=clusterns
13+
# Location of the clouds.yaml (default: ~/.config/openstack/clouds.yaml)
14+
CLOUDS_YAML=~/.config/openstack/clouds.yaml
15+
# Name of the cloud in there (default: openstack, any name works now)
16+
OS_CLOUD=${OS_CLOUD:-openstack}
17+
### Per cluster stack settings
18+
# Kubernetes Maj.Min, e.g. 1.32 (without leading v), can be left empty (see last line)
19+
CS_MAINVER=
20+
# CS Template versions that match, should be an array, e.g. [v1, v2, v0-git.XXXXXXX]
21+
CS_VERSION=
22+
# CS Series (scs or scs2)
23+
CS_SERIES=scs2
24+
### Now the per workload cluster settings
25+
# Full K8s Version Maj.Min.Patch, without leading 'v', e.g. 1.32.3 (this is per cluster)
26+
CL_PATCHVER=
27+
# Cluster name
28+
CL_NAME=
29+
# Restr. Application credentials per cluster -- set lifetime in days (0/"": do not create ACs)
30+
# Regularly run 07-cluster-secret.sh to refresh/rotate AppCreds! You need openstacktools installed for this.
31+
CL_APPCRED_LIFETIME=
32+
# Pod CIDR (e.g. 172.16.0.0/16)
33+
CL_PODCIDR=172.16.0.0/18
34+
# Service CIDR (e.g. 10.96.0.0/12)
35+
CL_SVCCIDR=10.96.0.0/14
36+
# Number of (initial) control plane nodes
37+
CL_CTRLNODES=1
38+
# Number of (initial) worker nodes
39+
CL_WRKRNODES=1
40+
# Additional clusterClass variables in key=value syntax (;-separated), the names come
41+
# from the clusterClass, these changed from scs to scs2. With scs2, defaults are
42+
# apiServerLoadBalancer=octavia-ovn
43+
# controlPlaneFlavor=SCS-2V-4; controlPlaneRootDisk
44+
# workerFlavor=SCS-4V-8; workerRootDisk
45+
# dnsNameservers=[5.1.66.255,185.150.99.255]
46+
# workerAdditionalBlockDevices= (Use [{name: <NAME>; sizeGiB: <SIZE>}, ...])
47+
# apiServerLoadBalancerOctaviaAmphoraAllowedCIDRs=
48+
# imageIsOrc=true
49+
# (The following should not be touched; normally)
50+
# imageName=; imageAddVersion=true
51+
# additionalBlockDevices=; disableAPIServerFloatingIP=false; sshKeyName=
52+
# k8sVersion=$CL_PATCHVER; networkExternalID=$EXTNETUUID; networkMTU=
53+
# controlPlaneAvailabilityZones=; controlPlaneOmitAvailabilityZone=true
54+
# openstackSecurityGroups=; controlPlaneServerGroupID=; workerServerGroupID=
55+
# securityGroups=; securityGroupIDs=; workerSecurityGroups=; workerSecurityGroupIDs=
56+
# certSANs=; oidcConfig=; nodeCIDR=10.8.0.0/20
57+
# dentityRef = { name: openstack; cloudName: openstack }
58+
# Example: CL_VARIABLES="apiServerLoadBalancer=octavia-ovn;dnsNameservers=[9.9.9.9,1.1.1.1]"
59+
CL_VARIABLES="apiServerLoadBalancer=octavia-ovn"
60+
### Autofill magic, don't touch
61+
CS_NAMESPACE=${CS_NAMESPACE:-$OS_CLOUD}
62+
CS_MAINVER=${CS_MAINVER:-${CL_PATCHVER%.*}}

0 commit comments

Comments
 (0)