INNER CODE UNIT · Go
readVAPManifest
kubernetes-sigs/gateway-api · tools/generator/main.go:211
func readVAPManifest(path string) (string, error) {
data, err := os.ReadFile(path)
if err != nil {
return "", fmt.Errorf("failed to read VAP manifest %s: %w", path, err)
}
return string(data), nil
}
// updateVAPManifest stamps the bundle version into the manifest's annotations
// and, for the standard channel, bumps the prohibited-version range.
// The manifest is edited textually rather than round-tripped through a YAML
// marshal to preserve its formatting, comments, and multi-document structure.
func updateVAPManifest(manifest, channel, bundleVersion string) (string, error) {
versionMatch := regexp.MustCompile(`^v(\d+)\.(\d+)`).FindStringSubmatch(bundleVersion)
if versionMatch == nil {
return "", fmt.Errorf("bundle version %q is not of the form vMAJOR.MINOR", bundleVersion)
}
minor, err := strconv.Atoi(versionMatch[2])