Skip to content

Commit e591520

Browse files
committed
WIP
1 parent f1c0f20 commit e591520

File tree

209 files changed

+41547
-1700
lines changed

Some content is hidden

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

209 files changed

+41547
-1700
lines changed

.github/workflows/lint.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,6 @@ jobs:
2424
- name: Checkout code
2525
uses: actions/checkout@v6
2626

27-
- name: Check for prohibited vcluster import in config dir
28-
run: |
29-
#!/bin/bash
30-
set -e
31-
32-
IMPORT="github.com/loft-sh/vcluster"
33-
PATTERN="\"$IMPORT(\"|/)"
34-
FOUND_FILES=$(find ./config -name "*.go" -not -path "./config/legacyconfig/*" -print0 | xargs -0 grep -l -E "$PATTERN" 2>/dev/null || true)
35-
36-
if [ -n "$FOUND_FILES" ]; then
37-
echo "❌ ERROR: Prohibited import prefix '$IMPORT' found in:"
38-
echo "$FOUND_FILES"
39-
exit 1
40-
fi
41-
4227
- uses: actions/setup-go@v6
4328
with:
4429
go-version-file: ./go.mod

.github/workflows/sync-config-schema.yaml

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -101,35 +101,17 @@ jobs:
101101
echo "Extracted minor version: ${MINOR_VERSION_WITH_PATCH} from tag: ${RELEASE_TAG}"
102102
103103
# Determine target folder - use version folder for RC releases, main for beta
104-
VCLUSTER_CONFIG_BRANCH="main"
105104
if [[ "${RELEASE_TAG}" == *"-rc"* ]]; then
106105
TARGET_VERSION="${MINOR_VERSION_WITH_PATCH}"
107106
echo "RC release detected, using versioned folder: ${TARGET_VERSION}"
108-
VCLUSTER_CONFIG_BRANCH="vcluster-v${MAJOR_VERSION}.${MINOR_VERSION}"
109107
else
110108
TARGET_VERSION="main"
111109
echo "Beta release detected, using main folder"
112110
fi
113-
echo "Using vcluster-config tag: ${VCLUSTER_CONFIG_BRANCH}"
114111
115112
# clone vcluster-config and vcluster-docs
116113
git clone --single-branch https://github.com/loft-sh/vcluster-docs.git
117114
118-
# try to clone the tagged version, if it does not exist, fallback to main
119-
git clone --branch "${VCLUSTER_CONFIG_BRANCH}" --depth 1 https://github.com/loft-sh/vcluster-config.git || git clone --single-branch https://github.com/loft-sh/vcluster-config.git
120-
121-
# generate vcluster.schema.json based on the current platform.schema.json in vcluster-config
122-
# and values.schema.json from alpha / beta release
123-
cp chart/values.schema.json vcluster-config/values.schema.json
124-
cd vcluster-config/
125-
go mod tidy
126-
go mod vendor
127-
128-
go run ./hack/main.go
129-
130-
# copy generated vcluster.schema.json to the docs
131-
cd ../
132-
133115
# Check if versioned docs folder exists. If it exists, use it; otherwise use main.
134116
# Versioned folders are created independently by the docs release process.
135117
if [[ -d "vcluster-docs/vcluster_versioned_docs/version-${TARGET_VERSION}" ]]; then
@@ -141,8 +123,8 @@ jobs:
141123
fi
142124
143125
mkdir -p "vcluster-docs/configsrc/vcluster/${DOCS_VERSION}/"
144-
cp config/values.yaml "vcluster-docs/configsrc/vcluster/${DOCS_VERSION}/default_values.yaml"
145-
cp vcluster-config/vcluster.schema.json "vcluster-docs/configsrc/vcluster/${DOCS_VERSION}/vcluster.schema.json"
126+
cp chart/values.yaml "vcluster-docs/configsrc/vcluster/${DOCS_VERSION}/default_values.yaml"
127+
cp chart/values.schema.json "vcluster-docs/configsrc/vcluster/${DOCS_VERSION}/vcluster.schema.json"
146128
147129
# generate vCluster partials in docs
148130
cd vcluster-docs/
@@ -175,54 +157,3 @@ jobs:
175157
gh pr close "${branch_name}" --comment "Closing to recreate with updated changes from ${RELEASE_TAG}" || true
176158
gh pr create --fill --head "${branch_name}"
177159
echo "Create PR in vcluster-docs"
178-
179-
180-
- name: Update vcluster schema in vcluster-config
181-
# update only on beta, -rc and stable versions
182-
if: ${{ steps.release.outputs.is_alpha_version == 'false' }}
183-
env:
184-
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
185-
RELEASE_TAG: ${{ steps.release.outputs.release_tag }}
186-
PARSED_VERSION: ${{ steps.semver.outputs.parsed_version }}
187-
run: |
188-
rm -rf vcluster-config/ || true
189-
git clone https://github.com/loft-sh/vcluster-config.git
190-
# copy generated schema from vcluster chart values to vcluster-config
191-
cp chart/values.schema.json vcluster-config/values.schema.json
192-
cp -R config/. vcluster-config/config/
193-
194-
cd vcluster-config
195-
196-
# We have to replace our config dependency so that we do not introduce vcluster as a whole as transitive dependecy.
197-
find ./config/legacyconfig -type f -exec sed -i "s#github.com/loft-sh/vcluster/config#github.com/loft-sh/vcluster-config/config#g" {} +
198-
199-
# Align deps, if there have been any relevant changes in vcluster.
200-
go mod tidy
201-
go mod vendor
202-
203-
git add --all
204-
205-
# if there are no changes, exit early
206-
if git diff-index --quiet HEAD --; then
207-
exit 0
208-
fi
209-
echo "Changes detected"
210-
211-
# Determine the tag to update based on the release version
212-
# Use parsed version from semver action
213-
MAJOR_VERSION=$(echo "${PARSED_VERSION}" | jq -r '.major')
214-
MINOR_VERSION=$(echo "${PARSED_VERSION}" | jq -r '.minor')
215-
216-
# Use the vcluster-vX.Y format for tags
217-
TARGET_TAG="vcluster-v${MAJOR_VERSION}.${MINOR_VERSION}"
218-
219-
# commit changes
220-
git commit -m "chore: sync config/*.go and values.schema.json to vCluster version ${RELEASE_TAG}"
221-
222-
# Update the existing tag to point to the new commit
223-
git tag -f "${TARGET_TAG}"
224-
# push the commit
225-
git push origin HEAD:main
226-
git push -u origin -f "${TARGET_TAG}"
227-
228-
echo "vcluster-config tag ${TARGET_TAG} updated to vCluster version ${RELEASE_TAG}"

chart/templates/_rbac.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
Whether to create a role and role binding to access the platform API key secret
180180
*/}}
181181
{{- define "vcluster.rbac.createPlatformSecretRole" -}}
182-
{{- $createRBAC := dig "platform" "apiKey" "createRBAC" true .Values.external -}}
182+
{{- $createRBAC := dig "apiKey" "createRBAC" true .Values.platform -}}
183183
{{- if and $createRBAC (ne (include "vcluster.rbac.platformSecretNamespace" .) .Release.Namespace) }}
184184
{{- true -}}
185185
{{- end }}
@@ -189,14 +189,14 @@
189189
Namespace containing the vCluster platform secret
190190
*/}}
191191
{{- define "vcluster.rbac.platformSecretNamespace" -}}
192-
{{- dig "platform" "apiKey" "namespace" .Release.Namespace .Values.external | default .Release.Namespace -}}
192+
{{- dig "apiKey" "namespace" .Release.Namespace .Values.platform | default .Release.Namespace -}}
193193
{{- end -}}
194194

195195
{{/*
196196
Name specifies the secret name containing the vCluster platform licenses and tokens
197197
*/}}
198198
{{- define "vcluster.rbac.platformSecretName" -}}
199-
{{- dig "platform" "apiKey" "secretName" "vcluster-platform-api-key" .Values.external | quote -}}
199+
{{- dig "apiKey" "secretName" "" .Values.platform | default "vcluster-platform-api-key" | quote -}}
200200
{{- end -}}
201201

202202
{{- define "vcluster.rbac.platformRoleName" -}}

chart/tests/platform-secret-role_test.yaml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,28 @@ templates:
55
tests:
66
- it: check explicitly disabled
77
set:
8-
external:
9-
platform:
10-
apiKey:
11-
namespace: "some-other-namespace"
12-
createRBAC: false
8+
platform:
9+
apiKey:
10+
namespace: "some-other-namespace"
11+
createRBAC: false
1312
asserts:
1413
- hasDocuments:
1514
count: 0
1615

1716
- it: check disabled on empty namespace
1817
set:
19-
external:
20-
platform:
21-
apiKey:
22-
namespace: ""
18+
platform:
19+
apiKey:
20+
namespace: ""
2321
asserts:
2422
- hasDocuments:
2523
count: 0
2624

2725
- it: check disabled on implicit same namespace
2826
set:
29-
external:
30-
platform:
31-
apiKey:
32-
secretName: "some-other-secret"
27+
platform:
28+
apiKey:
29+
secretName: "some-other-secret"
3330
asserts:
3431
- hasDocuments:
3532
count: 0
@@ -38,11 +35,10 @@ tests:
3835
release:
3936
namespace: test
4037
set:
41-
external:
42-
platform:
43-
apiKey:
44-
secretName: "my-secret-name"
45-
namespace: "some-other-namespace"
38+
platform:
39+
apiKey:
40+
secretName: "my-secret-name"
41+
namespace: "some-other-namespace"
4642
asserts:
4743
- hasDocuments:
4844
count: 2
@@ -80,10 +76,9 @@ tests:
8076
release:
8177
namespace: test
8278
set:
83-
external:
84-
platform:
85-
apiKey:
86-
namespace: "some-other-namespace"
79+
platform:
80+
apiKey:
81+
namespace: "some-other-namespace"
8782
asserts:
8883
- hasDocuments:
8984
count: 2

0 commit comments

Comments
 (0)