Skip to content

Commit

Permalink
add checking for invalid characters that will break .mdx generation i…
Browse files Browse the repository at this point in the history
…n docs to hack/schema/main.go; fix sync-config-schema.yaml vcluster-config syncing (#2348)

Signed-off-by: Paweł Bojanowski <[email protected]>
  • Loading branch information
hidalgopl authored Dec 18, 2024
1 parent 7b17dc7 commit 4ff82b3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sync-config-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ jobs:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
RELEASE_TAG: ${{ steps.release.outputs.release_tag }}
run: |
rm -rf vcluster-config/ || true
git clone --single-branch https://github.com/loft-sh/vcluster-config.git
# copy generated schema from vcluster chart values to vcluster-config
cp chart/values.schema.json vcluster-config/values.schema.json
cp -R config/. vcluster-config/config/
Expand Down
2 changes: 1 addition & 1 deletion chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@
},
"version": {
"type": "string",
"description": "Version specifies k8s components (scheduler, kube-controller-manager \u0026 apiserver) version.\nIt is a shortcut for controlPlane.distro.k8s.apiServer.image.tag,\ncontrolPlane.distro.k8s.controllerManager.image.tag and\ncontrolPlane.distro.k8s.scheduler.image.tag\nIf e.g. controlPlane.distro.k8s.version is set to v1.30.1 and\ncontrolPlane.distro.k8s.scheduler.image.tag\n(or controlPlane.distro.k8s.controllerManager.image.tag or controlPlane.distro.k8s.apiServer.image.tag)\nis set to v1.31.0,\nvalue from controlPlane.distro.k8s.\u003ccontrolPlane-component\u003e.image.tag will be used\n(where \u003ccontrolPlane-component is apiServer, controllerManager and scheduler)."
"description": "Version specifies k8s components (scheduler, kube-controller-manager \u0026 apiserver) version.\nIt is a shortcut for controlPlane.distro.k8s.apiServer.image.tag,\ncontrolPlane.distro.k8s.controllerManager.image.tag and\ncontrolPlane.distro.k8s.scheduler.image.tag\nIf e.g. controlPlane.distro.k8s.version is set to v1.30.1 and\ncontrolPlane.distro.k8s.scheduler.image.tag\n(or controlPlane.distro.k8s.controllerManager.image.tag or controlPlane.distro.k8s.apiServer.image.tag)\nis set to v1.31.0,\nvalue from controlPlane.distro.k8s.(controlPlane-component).image.tag will be used\n(where controlPlane-component is apiServer, controllerManager and scheduler)."
},
"apiServer": {
"$ref": "#/$defs/DistroContainerEnabled",
Expand Down
4 changes: 2 additions & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ controlPlane:
# controlPlane.distro.k8s.scheduler.image.tag
# (or controlPlane.distro.k8s.controllerManager.image.tag or controlPlane.distro.k8s.apiServer.image.tag)
# is set to v1.31.0,
# value from controlPlane.distro.k8s.<controlPlane-component>.image.tag will be used
# (where <controlPlane-component is apiServer, controllerManager and scheduler).
# value from controlPlane.distro.k8s.(controlPlane-component).image.tag will be used
# (where controlPlane-component is apiServer, controllerManager and scheduler).
version: ""
# APIServer holds configuration specific to starting the api server.
apiServer:
Expand Down
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,8 @@ type DistroK8s struct {
// controlPlane.distro.k8s.scheduler.image.tag
//(or controlPlane.distro.k8s.controllerManager.image.tag or controlPlane.distro.k8s.apiServer.image.tag)
// is set to v1.31.0,
// value from controlPlane.distro.k8s.<controlPlane-component>.image.tag will be used
// (where <controlPlane-component is apiServer, controllerManager and scheduler).
// value from controlPlane.distro.k8s.(controlPlane-component).image.tag will be used
// (where controlPlane-component is apiServer, controllerManager and scheduler).
Version string `json:"version,omitempty"`

// APIServer holds configuration specific to starting the api server.
Expand Down
6 changes: 6 additions & 0 deletions hack/schema/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ func getReflector() (*jsonschema.Reflector, error) {
}
r.CommentMap = commentMap

for k, comment := range commentMap {
if strings.Contains(comment, "<") || strings.Contains(comment, ">") {
return nil, fmt.Errorf("comment for %s (%s) contains '<' or '>', please remove it because it will break docs generation", k, comment)
}
}

return r, nil
}

Expand Down

0 comments on commit 4ff82b3

Please sign in to comment.