Skip to content

Commit dba88ee

Browse files
butler54beraldolealclaude
committed
feat: update RHDP tooling and wrapper scripts
Update RHDP cluster definition tooling, wrapper script improvements, gen-secrets simplification, and letsencrypt chart version bump. Co-authored-by: Beraldo Leal <bleal@redhat.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2cbfd47 commit dba88ee

5 files changed

Lines changed: 122 additions & 42 deletions

File tree

charts/all/letsencrypt/Chart.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
apiVersion: v2
22
name: letsencrypt
3-
description: A Helm chart to add letsencrypt support to Validated Patterns.
3+
description: >-
4+
DEPRECATED: This chart is unsupported and will be removed in a future release.
5+
Trustee 1.0 uses cert-manager for certificate management, making Let's Encrypt
6+
integration unnecessary. A Helm chart to add letsencrypt support to Validated Patterns.
7+
deprecated: true
48

59
type: application
610

rhdp/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
typer
22
rich
3-
Jinja2
3+
Jinja2
4+
typing_extensions

rhdp/rhdp-cluster-define.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,22 @@
1313
from typing_extensions import Annotated
1414

1515

16-
def get_default_cluster_configs() -> List[Dict]:
17-
"""Get default cluster configurations"""
16+
def get_default_cluster_configs(prefix: str = "") -> List[Dict]:
17+
"""Get default cluster configurations
18+
19+
Args:
20+
prefix: Optional prefix to add to cluster name and directory
21+
"""
22+
if prefix:
23+
return [
24+
{
25+
"name": f"coco-{prefix}",
26+
"directory": f"openshift-install-{prefix}",
27+
"cluster_network_cidr": "10.128.0.0/14",
28+
"machine_network_cidr": "10.0.0.0/16",
29+
"service_network_cidr": "172.30.0.0/16",
30+
}
31+
]
1832
return [
1933
{
2034
"name": "coco",
@@ -135,23 +149,35 @@ def run(
135149
multicluster: Annotated[
136150
bool, typer.Option("--multicluster", help="Deploy hub and spoke clusters")
137151
] = False,
152+
prefix: Annotated[
153+
str, typer.Option("--prefix", help="Prefix for cluster name and directory")
154+
] = "",
138155
):
139156
"""
140157
Region flag requires an azure region key which can be (authoritatively)
141158
requested with: "az account list-locations -o table".
142159
143160
Use --multicluster flag to deploy both hub (coco-hub) and spoke (coco-spoke)
144161
clusters.
162+
163+
Use --prefix to add a prefix to cluster name and install directory, enabling
164+
multiple cluster deployments (e.g., --prefix cluster1 creates coco-cluster1
165+
in openshift-install-cluster1).
145166
"""
146167
validate_dir()
147168

148169
# Choose cluster configurations based on multicluster flag
149170
if multicluster:
171+
if prefix:
172+
rprint("WARNING: --prefix is ignored when using --multicluster")
150173
cluster_configs = get_multicluster_configs()
151174
rprint("Setting up multicluster deployment (hub and spoke)")
152175
else:
153-
cluster_configs = get_default_cluster_configs()
154-
rprint("Setting up single cluster deployment")
176+
cluster_configs = get_default_cluster_configs(prefix)
177+
if prefix:
178+
rprint(f"Setting up single cluster deployment with prefix: {prefix}")
179+
else:
180+
rprint("Setting up single cluster deployment")
155181

156182
cleanup(pathlib.Path.cwd(), cluster_configs)
157183
setup_install(

rhdp/wrapper.sh

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,56 @@ get_python_cmd() {
1414
fi
1515
}
1616

17-
if [ "$#" -ne 1 ]; then
18-
echo "Error: Exactly one argument is required."
19-
echo "Usage: $0 {azure-region-code}"
17+
# Parse arguments
18+
AZUREREGION=""
19+
PREFIX=""
20+
21+
while [[ $# -gt 0 ]]; do
22+
case $1 in
23+
--prefix)
24+
PREFIX="$2"
25+
shift 2
26+
;;
27+
--prefix=*)
28+
PREFIX="${1#*=}"
29+
shift
30+
;;
31+
-*)
32+
echo "Error: Unknown option $1"
33+
echo "Usage: $0 [--prefix <prefix>] {azure-region-code}"
34+
echo "Example: $0 eastasia"
35+
echo "Example: $0 --prefix cluster1 eastasia"
36+
exit 1
37+
;;
38+
*)
39+
if [ -z "$AZUREREGION" ]; then
40+
AZUREREGION="$1"
41+
else
42+
echo "Error: Too many positional arguments."
43+
echo "Usage: $0 [--prefix <prefix>] {azure-region-code}"
44+
exit 1
45+
fi
46+
shift
47+
;;
48+
esac
49+
done
50+
51+
if [ -z "$AZUREREGION" ]; then
52+
echo "Error: Azure region is required."
53+
echo "Usage: $0 [--prefix <prefix>] {azure-region-code}"
2054
echo "Example: $0 eastasia"
55+
echo "Example: $0 --prefix cluster1 eastasia"
2156
exit 1
2257
fi
23-
AZUREREGION=$1
58+
59+
# Set install directory based on prefix
60+
if [ -n "$PREFIX" ]; then
61+
INSTALL_DIR="openshift-install-${PREFIX}"
62+
echo "Using prefix: $PREFIX"
63+
echo "Install directory: $INSTALL_DIR"
64+
else
65+
INSTALL_DIR="openshift-install"
66+
fi
2467

2568
echo "---------------------"
2669
echo "Validating configuration"
@@ -40,6 +83,17 @@ if ! command -v yq &> /dev/null; then
4083
exit 1
4184
fi
4285

86+
# Check if podman is available and running
87+
if ! command -v podman &> /dev/null; then
88+
echo "ERROR: podman is required but not installed"
89+
exit 1
90+
fi
91+
92+
if ! podman info &> /dev/null; then
93+
echo "ERROR: podman is installed but not responding"
94+
exit 1
95+
fi
96+
4397
# Extract clusterGroupName from values-global.yaml using yq
4498
CLUSTER_GROUP_NAME=$(yq eval '.main.clusterGroupName' values-global.yaml)
4599

@@ -113,27 +167,35 @@ echo "---------------------"
113167
echo "defining cluster"
114168
echo "---------------------"
115169
PYTHON_CMD=$(get_python_cmd)
116-
$PYTHON_CMD rhdp/rhdp-cluster-define.py ${AZUREREGION}
170+
if [ -n "$PREFIX" ]; then
171+
$PYTHON_CMD rhdp/rhdp-cluster-define.py --prefix "${PREFIX}" ${AZUREREGION}
172+
else
173+
$PYTHON_CMD rhdp/rhdp-cluster-define.py ${AZUREREGION}
174+
fi
117175
echo "---------------------"
118176
echo "cluster defined"
119177
echo "---------------------"
120178
sleep 10
121179
echo "---------------------"
122180
echo "openshift-install"
123181
echo "---------------------"
124-
openshift-install create cluster --dir=./openshift-install
182+
openshift-install create cluster --dir=./${INSTALL_DIR}
125183
echo "openshift-install done"
126184
echo "---------------------"
127185
echo "setting up secrets"
128186

129187
bash ./scripts/gen-secrets.sh
130188

189+
echo "---------------------"
190+
echo "retrieving PCR measurements"
191+
echo "---------------------"
192+
bash ./scripts/get-pcr.sh
131193

132194
sleep 60
133195
echo "---------------------"
134196
echo "pattern install"
135197
echo "---------------------"
136-
export KUBECONFIG="$(pwd)/openshift-install/auth/kubeconfig"
198+
export KUBECONFIG="$(pwd)/${INSTALL_DIR}/auth/kubeconfig"
137199

138200

139201
./pattern.sh make install

scripts/gen-secrets.sh

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,36 @@
11
#!/usr/bin/env bash
22

33
echo "Creating secrets as required"
4-
echo
4+
echo
55

66
COCO_SECRETS_DIR="${HOME}/.coco-pattern"
7-
SECURITY_POLICY_FILE="${COCO_SECRETS_DIR}/security-policy-config.json"
8-
SSH_KEY_FILE="${COCO_SECRETS_DIR}/id_rsa"
97
KBS_PRIVATE_KEY="${COCO_SECRETS_DIR}/kbsPrivateKey"
108
KBS_PUBLIC_KEY="${COCO_SECRETS_DIR}/kbsPublicKey"
11-
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1210
VALUES_FILE="${HOME}/values-secret-coco-pattern.yaml"
1311

1412
mkdir -p ${COCO_SECRETS_DIR}
1513

16-
if [ ! -f "${SECURITY_POLICY_FILE}" ]; then
17-
echo "Creating security policy"
18-
cat > ${SECURITY_POLICY_FILE} <<EOF
19-
{
20-
"default": [
21-
{
22-
"type": "insecureAcceptAnything"
23-
}],
24-
"transports": {}
25-
}
26-
EOF
14+
SSH_KEY_FILE="${COCO_SECRETS_DIR}/id_rsa"
2715

16+
if [ "${COCO_ENABLE_SSH_DEBUG:-false}" = "true" ]; then
17+
if [ ! -f "${SSH_KEY_FILE}" ]; then
18+
echo "Creating ssh keys for podvm debug access"
19+
rm -f "${SSH_KEY_FILE}.pub"
20+
ssh-keygen -f "${SSH_KEY_FILE}" -N ""
21+
fi
2822
fi
2923

3024
if [ ! -f "${KBS_PRIVATE_KEY}" ]; then
31-
echo "Creating kbs keys"
32-
rm -f "${KBS_PUBLIC_KEY}"
33-
openssl genpkey -algorithm ed25519 > ${KBS_PRIVATE_KEY}
34-
openssl pkey -in "${KBS_PRIVATE_KEY}" -pubout -out "${KBS_PUBLIC_KEY}"
35-
fi
36-
37-
if [ ! -f "${SSH_KEY_FILE}" ]; then
38-
echo "Creating ssh keys"
39-
rm -f "${SSH_KEY_FILE}.pub"
40-
ssh-keygen -f "${SSH_KEY_FILE}" -N ""
25+
echo "Creating kbs keys"
26+
rm -f "${KBS_PUBLIC_KEY}"
27+
openssl genpkey -algorithm ed25519 >${KBS_PRIVATE_KEY}
28+
openssl pkey -in "${KBS_PRIVATE_KEY}" -pubout -out "${KBS_PUBLIC_KEY}"
4129
fi
4230

43-
4431
## Copy a sample values file if this stuff doesn't exist
4532

4633
if [ ! -f "${VALUES_FILE}" ]; then
47-
echo "No values file was found copying template.. please review before deploying"
48-
cp "${SCRIPT_DIR}/../values-secret.yaml.template" "${VALUES_FILE}"
49-
fi
34+
echo "No values file was found copying template.. please review before deploying"
35+
cp "${SCRIPT_DIR}/../values-secret.yaml.template" "${VALUES_FILE}"
36+
fi

0 commit comments

Comments
 (0)