-
Notifications
You must be signed in to change notification settings - Fork 960
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
221 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"net/http" | ||
"os" | ||
"strings" | ||
|
||
"github.com/PuerkitoBio/goquery" | ||
"github.com/samber/lo" | ||
) | ||
|
||
var uri = "https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html" | ||
var outputFileName = "hack/compatibility-karpenter.yaml" | ||
|
||
func main() { | ||
if len(os.Args) != 2 { | ||
log.Fatalf("Usage: %s karpenter version", os.Args[0]) | ||
} | ||
if os.Args[1] == "no tag" { | ||
log.Printf("No version") | ||
os.Exit(1) | ||
} | ||
response := lo.Must(http.Get(uri)) | ||
defer response.Body.Close() | ||
|
||
doc := lo.Must(goquery.NewDocumentFromReader(response.Body)) | ||
supportedEKSversions := doc.Find("ul").Eq(0).Find("li").Find("p").Find("code").Nodes | ||
|
||
// flag for the kompat tool for number of k8s version needed | ||
fmt.Print(len(supportedEKSversions)) | ||
minK8sVersion := supportedEKSversions[len(supportedEKSversions)-1].FirstChild.Data | ||
maxK8sVersion := supportedEKSversions[0].FirstChild.Data | ||
|
||
version := strings.TrimSuffix(strings.TrimPrefix(os.Args[1], "v"), "0") + "x" | ||
appendVersion := fmt.Sprintf( | ||
` | ||
- appVersion: %s | ||
minK8sVersion: %s | ||
maxK8sVersion: %s`, version, minK8sVersion, maxK8sVersion) | ||
|
||
yamlFile, err := os.ReadFile(outputFileName) | ||
if err != nil { | ||
log.Printf("Can't read %s file: %v", os.Args[1], err) | ||
os.Exit(2) | ||
} | ||
|
||
log.Println("writing output to", outputFileName) | ||
f, err := os.Create(outputFileName) | ||
if err != nil { | ||
log.Fatalf("unable to open %s to write generated output: %v", outputFileName, err) | ||
} | ||
f.WriteString(string(yamlFile) + appendVersion) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: "karpenter" | ||
compatibility: | ||
- appVersion: 0.21.x | ||
minK8sVersion: 1.21 | ||
maxK8sVersion: 1.24 | ||
- appVersion: 0.22.x | ||
minK8sVersion: 1.21 | ||
maxK8sVersion: 1.24 | ||
- appVersion: 0.23.x | ||
minK8sVersion: 1.21 | ||
maxK8sVersion: 1.24 | ||
- appVersion: 0.24.x | ||
minK8sVersion: 1.21 | ||
maxK8sVersion: 1.24 | ||
- appVersion: 0.25.x | ||
minK8sVersion: 1.21 | ||
maxK8sVersion: 1.25 | ||
- appVersion: 0.26.x | ||
minK8sVersion: 1.21 | ||
maxK8sVersion: 1.25 | ||
- appVersion: 0.27.x | ||
minK8sVersion: 1.21 | ||
maxK8sVersion: 1.25 | ||
- appVersion: 0.28.x | ||
minK8sVersion: 1.23 | ||
maxK8sVersion: 1.27 | ||
- appVersion: 0.29.x | ||
minK8sVersion: 1.23 | ||
maxK8sVersion: 1.27 | ||
- appVersion: 0.30.x | ||
minK8sVersion: 1.23 | ||
maxK8sVersion: 1.27 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
"strings" | ||
) | ||
|
||
func main() { | ||
if len(os.Args) != 3 { | ||
log.Fatalf("Usage: %s path/to/markdown.md", os.Args[0]) | ||
} | ||
outputFileName := os.Args[1] | ||
mdFile, err := os.ReadFile(outputFileName) | ||
if err != nil { | ||
log.Printf("Can't read %s file: %v", os.Args[1], err) | ||
os.Exit(2) | ||
} | ||
|
||
genStart := "[comment]: <> (the content below is generated from hack/docs/compataiblitymetrix_gen_docs.go)" | ||
genEnd := "[comment]: <> (end docs generated content from hack/docs/compataiblitymetrix_gen_docs.go)" | ||
startDocSections := strings.Split(string(mdFile), genStart) | ||
if len(startDocSections) != 2 { | ||
log.Fatalf("expected one generated comment block start but got %d", len(startDocSections)-1) | ||
} | ||
endDocSections := strings.Split(string(mdFile), genEnd) | ||
if len(endDocSections) != 2 { | ||
log.Fatalf("expected one generated comment block end but got %d", len(endDocSections)-1) | ||
} | ||
topDoc := fmt.Sprintf("%s%s\n\n", startDocSections[0], genStart) | ||
bottomDoc := fmt.Sprintf("\n%s%s", genEnd, endDocSections[1]) | ||
|
||
log.Println("writing output to", outputFileName) | ||
f, err := os.Create(outputFileName) | ||
if err != nil { | ||
log.Fatalf("unable to open %s to write generated output: %v", outputFileName, err) | ||
} | ||
f.WriteString(topDoc + os.Args[2] + "\n" + bottomDoc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
compatibilitymetrix() { | ||
supportedVersion=$(go run hack/code/version_compatibility.go "$(git describe --exact-match --tags || echo "no tag")") | ||
matrixs="$(kompat hack/compatibility-karpenter.yaml -n $supportedVersion)" | ||
go run hack/docs/compatibilitymetrix_gen_docs.go website/content/en/preview/upgrade-guide.md "$matrixs" | ||
} | ||
|
||
|
||
compatibilitymetrix | ||
go run hack/docs/metrics_gen_docs.go pkg/ $(KARPENTER_CORE_DIR)/pkg website/content/en/preview/concepts/metrics.md | ||
go run hack/docs/instancetypes_gen_docs.go website/content/en/preview/concepts/instance-types.md | ||
go run hack/docs/configuration_gen_docs.go website/content/en/preview/concepts/settings.md | ||
cd charts/karpenter && helm-docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ tools() { | |
go install -tags extended github.com/gohugoio/[email protected] | ||
go install golang.org/x/vuln/cmd/govulncheck@latest | ||
go install github.com/onsi/ginkgo/v2/ginkgo@latest | ||
go install github.com/bwagner5/kompat/cmd/kompat@latest | ||
|
||
if ! echo "$PATH" | grep -q "${GOPATH:-undefined}/bin\|$HOME/go/bin"; then | ||
echo "Go workspace's \"bin\" directory is not in PATH. Run 'export PATH=\"\$PATH:\${GOPATH:-\$HOME/go}/bin\"'." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters