Skip to content

Commit 8e575fe

Browse files
Merge pull request #1822 from salasberryfin/backport-to-v0.25
[release/v0.25] backport multiple commits
2 parents 991de6f + 028ff65 commit 8e575fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+17203
-714
lines changed

.github/scripts/fetch-core-capi.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# script-specific variables
4+
CAPI_VERSION="${CAPI_VERSION:-latest}"
5+
CAPI_RELEASE_URL="${CAPI_RELEASE_URL:-https://github.com/rancher-sandbox/cluster-api/releases/${CAPI_VERSION}/core-components.yaml}"
6+
CORE_CAPI_NAMESPACE="${CORE_CAPI_NAMESPACE:-capi-system}"
7+
OUTPUT_DIR="${OUTPUT_DIR:-/tmp}"
8+
OUTPUT_FILE="${OUTPUT_FILE:-core-provider-configmap.yaml}"
9+
MANAGED_BY_LABEL="managed-by.turtles.cattle.io"
10+
11+
# parameters that must be substituted in CAPI manifest
12+
export CAPI_DIAGNOSTICS_ADDRESS=${CAPI_DIAGNOSTICS_ADDRESS:=:8443}
13+
export CAPI_INSECURE_DIAGNOSTICS=${CAPI_INSECURE_DIAGNOSTICS:=false}
14+
export EXP_MACHINE_POOL=${EXP_MACHINE_POOL:=true}
15+
export EXP_CLUSTER_RESOURCE_SET=${EXP_CLUSTER_RESOURCE_SET:=true}
16+
export CLUSTER_TOPOLOGY=${CLUSTER_TOPOLOGY:=true}
17+
export EXP_RUNTIME_SDK=${EXP_RUNTIME_SDK:=false}
18+
export EXP_MACHINE_SET_PREFLIGHT_CHECKS=${EXP_MACHINE_SET_PREFLIGHT_CHECKS:=true}
19+
export EXP_MACHINE_WAITFORVOLUMEDETACH_CONSIDER_VOLUMEATTACHMENTS=${EXP_MACHINE_WAITFORVOLUMEDETACH_CONSIDER_VOLUMEATTACHMENTS:=true}
20+
export EXP_PRIORITY_QUEUE=${EXP_PRIORITY_QUEUE:=false}
21+
22+
# install krew and CAPI Operator plugin
23+
set -x
24+
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
25+
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
26+
KREW="krew-${OS}_${ARCH}" &&
27+
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
28+
tar zxvf "${KREW}.tar.gz" &&
29+
./"${KREW}" install krew
30+
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
31+
kubectl krew index add operator https://github.com/kubernetes-sigs/cluster-api-operator.git
32+
kubectl krew install operator/clusterctl-operator
33+
kubectl operator version
34+
35+
# use CAPI Operator plugin to generate ConfigMap with core CAPI components
36+
kubectl operator preload --core cluster-api:${CORE_CAPI_NAMESPACE} -u ${CAPI_RELEASE_URL} >>${OUTPUT_DIR}/${OUTPUT_FILE}
37+
# this is needed to remove comments in the yaml manifest that contain '{{' which breaks Helm parsing
38+
sed -i '/{{[^-]/d' ${OUTPUT_DIR}/${OUTPUT_FILE}
39+
# label as managed by turtles for easier filtering
40+
sed -i -r 's/^(\s*)(provider\.cluster\.x-k8s\.io\/version:.*)/\1\2\n\1'"${MANAGED_BY_LABEL}"': "true"/' ${OUTPUT_DIR}/${OUTPUT_FILE}
41+
42+
# embed this in Turtles chart
43+
mv ${OUTPUT_DIR}/${OUTPUT_FILE} ./charts/rancher-turtles/templates/${OUTPUT_FILE}

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ jobs:
2929
with:
3030
go-version-file: go.mod
3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v3
32+
uses: github/codeql-action/init@v4
3333
with:
3434
languages: go
3535
- name: Build
3636
run: |
3737
make build
3838
- name: Perform CodeQL Analysis
39-
uses: github/codeql-action/analyze@v3
39+
uses: github/codeql-action/analyze@v4
4040
with:
4141
category: "/language:go"
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Fetch core CAPI components manifest and embed in Turtles chart for air-gapped installations.
2+
on:
3+
schedule:
4+
- cron: "0 0 * * *" # Run every day at midnight (UTC)
5+
# allow running manually on demand
6+
workflow_dispatch:
7+
8+
env:
9+
TURTLES_REF: "${{ github.ref_name }}"
10+
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
11+
12+
jobs:
13+
create-core-capi-turtles-pr:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
steps:
18+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
19+
with:
20+
ref: "${{ env.TURTLES_REF }}"
21+
token: ${{ env.GH_TOKEN }}
22+
# Allow making git push request later on
23+
persist-credentials: true
24+
25+
- name: Configure the committer
26+
run: |
27+
user_id=$(gh api "/users/$APP_USER" --jq .id)
28+
git config --global user.name "$APP_USER"
29+
git config --global user.email "${user_id}+${APP_USER}@users.noreply.github.com"
30+
env:
31+
GH_TOKEN: "${{ env.GH_TOKEN }}"
32+
APP_USER: "${{ github.actor }}"
33+
34+
- name: Run script to fetch components manifest
35+
run: |
36+
CAPI_VERSION=$(curl -s "https://api.github.com/repos/rancher-sandbox/cluster-api/releases/latest" | jq -r ".tag_name")
37+
echo "CAPI_VERSION=${CAPI_VERSION}" >> $GITHUB_ENV
38+
BRANCH="fetch-core-capi-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
39+
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
40+
git checkout -b "$BRANCH" "$TURTLES_REF"
41+
CAPI_VERSION=$CAPI_VERSION ./.github/scripts/fetch-core-capi.sh
42+
git add charts/rancher-turtles
43+
if git diff --cached --quiet; then
44+
echo "No changes detected"
45+
echo "SKIP_PUSH=true" >> $GITHUB_ENV
46+
else
47+
git commit -m "chore: embed core CAPI ${CAPI_VERSION} in Turtles chart"
48+
echo "SKIP_PUSH=false" >> $GITHUB_ENV
49+
fi
50+
51+
- name: Push and create pull request
52+
if: env.SKIP_PUSH == 'false'
53+
env:
54+
GH_TOKEN: "${{ env.GH_TOKEN }}"
55+
run: |
56+
git push origin "$BRANCH"
57+
body="This PR fetches core CAPI $CAPI_VERSION components manifest from release and embeds the template in the Turtles chart for a simplified air-gapped installation."
58+
59+
gh pr create \
60+
--title "chore: embed core CAPI provider $CAPI_VERSION manifest in chart" \
61+
--body "$body" \
62+
--head "${{ github.repository_owner }}:$BRANCH" \
63+
--base "$TURTLES_REF" \
64+
--label "area/installation" \
65+
--label "kind/ci"

.github/workflows/nightly-chart-and-image-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ jobs:
6363
- name: Print helm install command
6464
run: |
6565
echo "Nightly build can be installed using the following command:"
66-
echo "helm install rancher-turtles oci://ghcr.io/${{ github.repository_owner }}/rancher-turtles-chart/rancher-turtles --version 0.0.0-${{ github.sha }} -n rancher-turtles-system --create-namespace --wait"
66+
echo "helm install rancher-turtles oci://ghcr.io/${{ github.repository_owner }}/rancher-turtles-chart/rancher-turtles --version 0.0.0-${{ github.sha }} -n cattle-turtles-system --create-namespace --wait"

.github/workflows/test_chart.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
run: helm install rancher rancher-latest/rancher --namespace cattle-system --create-namespace --set bootstrapPassword=rancheradmin --set replicas=1 --set hostname="e2e.dev.rancher" --set 'extraEnv[0].name=CATTLE_FEATURES' --version ${{ env.RANCHER_VERSION }} --wait
9090

9191
- name: Run chart-testing (install)
92-
run: helm install rancher-turtles out/charts/rancher-turtles/ -n rancher-turtles-system --create-namespace --wait --debug
92+
run: helm install rancher-turtles out/charts/rancher-turtles/ -n cattle-turtles-system --create-namespace --wait --debug
9393

9494
- name: Wait for core provider rollout
9595
run: sleep 30 && kubectl rollout status deployment capi-controller-manager -n capi-system --timeout=10m
@@ -102,10 +102,10 @@ jobs:
102102
fi
103103
104104
- name: Run chart-testing (un-install)
105-
run: helm uninstall rancher-turtles -n rancher-turtles-system --cascade foreground --wait --debug --timeout=10m
105+
run: helm uninstall rancher-turtles -n cattle-turtles-system --cascade foreground --wait --debug --timeout=10m
106106

107107
- name: Run chart re-install
108-
run: helm install rancher-turtles out/charts/rancher-turtles/ -n rancher-turtles-system --create-namespace --wait --debug
108+
run: helm install rancher-turtles out/charts/rancher-turtles/ -n cattle-turtles-system --create-namespace --wait --debug
109109

110110
community-test:
111111
runs-on: ubuntu-latest
@@ -158,7 +158,7 @@ jobs:
158158
run: helm repo add rancher-latest https://releases.rancher.com/server-charts/latest && helm install rancher rancher-latest/rancher --namespace cattle-system --create-namespace --set bootstrapPassword=rancheradmin --set replicas=1 --set hostname="e2e.dev.rancher" --version ${{ env.RANCHER_VERSION }} --wait
159159

160160
- name: Install rancher-turtles chart
161-
run: helm install rancher-turtles out/charts/rancher-turtles/ -n rancher-turtles-system --create-namespace --wait --debug
161+
run: helm install rancher-turtles out/charts/rancher-turtles/ -n cattle-turtles-system --create-namespace --wait --debug
162162

163163
- name: Wait for core provider rollout
164164
run: sleep 30 && kubectl rollout status deployment capi-controller-manager -n capi-system --timeout=10m

.github/workflows/trivy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ jobs:
4646
output: 'trivy-results.sarif'
4747
severity: 'CRITICAL,HIGH'
4848
- name: Upload Trivy scan results to GitHub Security tab
49-
uses: github/codeql-action/upload-sarif@v3
49+
uses: github/codeql-action/upload-sarif@v4
5050
with:
5151
sarif_file: 'trivy-results.sarif'

Tiltfile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if settings.get("trigger_mode") == "manual":
3535
if settings.get("default_registry") != "":
3636
default_registry(settings.get("default_registry"))
3737

38-
always_enable_projects = ["turtles", "turtles-capiproviders"]
38+
always_enable_projects = ["turtles"]
3939

4040
projects = {
4141
"turtles": {
@@ -51,15 +51,6 @@ projects = {
5151
"kustomize_dir": "config/default",
5252
"label": "turtles",
5353
"binary_name" : "manager"
54-
},
55-
"turtles-capiproviders": {
56-
"context": ".",
57-
"live_reload_deps": [
58-
"config"
59-
],
60-
"kustomize_dir": "config/capiproviders",
61-
"label": "turtles-capiproviders",
62-
"op": "apply"
6354
}
6455
}
6556

api/v1alpha1/provider_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (t Type) ToName() string {
5555
case Infrastructure:
5656
return "infrastructure-"
5757
case Core:
58-
return "core-"
58+
return ""
5959
case ControlPlane:
6060
return "control-plane-"
6161
case Bootstrap:

charts/rancher-turtles-providers/Chart.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ keywords:
1414
annotations:
1515
catalog.cattle.io/certified: rancher
1616
catalog.cattle.io/display-name: Rancher Turtles Certified Providers
17-
catalog.cattle.io/kube-version: '>= 1.23.0-0'
18-
catalog.cattle.io/namespace: rancher-turtles-system
17+
catalog.cattle.io/namespace: cattle-turtles-system
1918
catalog.cattle.io/os: linux
2019
catalog.cattle.io/permits-os: linux
21-
catalog.cattle.io/rancher-version: '>= 2.11.0-1'
22-
catalog.cattle.io/release-name: rancher-turtles
20+
catalog.cattle.io/release-name: rancher-turtles-providers
2321
catalog.cattle.io/scope: management
2422
catalog.cattle.io/type: cluster-tool

charts/rancher-turtles/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ annotations:
1515
catalog.cattle.io/certified: rancher
1616
catalog.cattle.io/display-name: Rancher Turtles - the Cluster API Extension
1717
catalog.cattle.io/kube-version: '>= 1.31.4-0 < 1.34.0-0'
18-
catalog.cattle.io/namespace: rancher-turtles-system
18+
catalog.cattle.io/namespace: cattle-turtles-system
1919
catalog.cattle.io/os: linux
2020
catalog.cattle.io/permits-os: linux
2121
catalog.cattle.io/rancher-version: '>= 2.13.0-0 < 2.14.0-0'

0 commit comments

Comments
 (0)