Skip to content

Commit

Permalink
simplify instance types docs gen and gen for hypervisor
Browse files Browse the repository at this point in the history
  • Loading branch information
bwagner5 committed Jun 16, 2022
1 parent edf8c7c commit ea348e3
Show file tree
Hide file tree
Showing 3 changed files with 550 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ codegen: ## Generate code. Must be run if changes are made to ./pkg/apis/...

docgen: ## Generate docs
go run hack/docs/metrics_gen_docs.go pkg/ website/content/en/preview/tasks/metrics.md
go run hack/docs/instancetypes_gen_docs.go ${KARPENTER_SUBNET_SELECTOR} website/content/en/preview/AWS/instance-types.md
go run hack/docs/instancetypes_gen_docs.go website/content/en/preview/AWS/instance-types.md

release: ## Generate release manifests and publish a versioned container image.
$(WITH_GOFLAGS) ./hack/release.sh
Expand Down
18 changes: 10 additions & 8 deletions hack/docs/instancetypes_gen_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import (
"encoding/json"
"flag"
"fmt"
"log"
"os"
"sort"
"strings"

"github.com/aws/karpenter/pkg/apis/provisioning/v1alpha5"
"github.com/aws/karpenter/pkg/cloudprovider"
"github.com/aws/karpenter/pkg/cloudprovider/aws"
Expand All @@ -15,28 +20,25 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/util/sets"
"log"
"os"
"sort"
"strings"
)

func main() {
flag.Parse()
if flag.NArg() != 2 {
log.Printf("Usage: %s subnet-discovery-tag-value path/to/markdown.md", os.Args[0])
if flag.NArg() != 1 {
log.Printf("Usage: %s path/to/markdown.md", os.Args[0])
os.Exit(1)
}

os.Setenv("AWS_SDK_LOAD_CONFIG", "true")
os.Setenv("AWS_REGION", "us-east-1")
ctx := context.Background()

cp := aws.NewCloudProvider(ctx, cloudprovider.Options{
ClientSet: nil,
KubeClient: nil,
})
provider := v1alpha1.AWS{SubnetSelector: map[string]string{
"karpenter.sh/discovery": flag.Arg(0),
"*": "*",
}}
var buf bytes.Buffer
enc := json.NewEncoder(&buf)
Expand All @@ -51,7 +53,7 @@ func main() {
log.Fatalf("listing instance types, %s", err)
}

outputFileName := flag.Arg(1)
outputFileName := flag.Arg(0)
f, err := os.Create(outputFileName)
if err != nil {
log.Fatalf("error creating output file %s, %s", outputFileName, err)
Expand Down

0 comments on commit ea348e3

Please sign in to comment.