Skip to content

Commit

Permalink
Add the NodeClaim indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Oct 17, 2023
1 parent 7bc302f commit 9c5e801
Show file tree
Hide file tree
Showing 16 changed files with 676 additions and 834 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
sigs.k8s.io/controller-runtime v0.16.2
)

replace github.com/aws/karpenter-core => github.com/jonathan-innis/karpenter-core v0.0.0-20231012191332-1e368cfd9c25
replace github.com/aws/karpenter-core => github.com/jonathan-innis/karpenter-core v0.0.0-20231017081815-4e8c54e9d993

require (
contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect
Expand Down
7 changes: 3 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHS
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
github.com/aws/aws-sdk-go v1.45.25 h1:c4fLlh5sLdK2DCRTY1z0hyuJZU4ygxX8m1FswL6/nF4=
github.com/aws/aws-sdk-go v1.45.25/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/karpenter-core v0.31.1-0.20231013203304-4239902b18b9 h1:j0iZuhoAKHrt0oqfSiKDqvHMnV/t45wi0loG1lEqdUw=
github.com/aws/karpenter-core v0.31.1-0.20231013203304-4239902b18b9/go.mod h1:rb3kp/3cj38tACF6udfpmIvKoQMwirSVoHNlrd66LyE=
github.com/aws/karpenter/tools/kompat v0.0.0-20231010173459-62c25a3ea85c h1:oXWwIttmjYLbBKhLazG21aQvpJ3NOOr8IXhCJ/p6e/M=
github.com/aws/karpenter/tools/kompat v0.0.0-20231010173459-62c25a3ea85c/go.mod h1:l/TIBsaCx/IrOr0Xvlj/cHLOf05QzuQKEZ1hx2XWmfU=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
Expand Down Expand Up @@ -168,6 +166,7 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
Expand Down Expand Up @@ -224,8 +223,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jonathan-innis/karpenter-core v0.0.0-20231012191332-1e368cfd9c25 h1:ouaAwe6U5+LIgvgnAfwa7gMnFKtpvgrRMc6ATJlCiP4=
github.com/jonathan-innis/karpenter-core v0.0.0-20231012191332-1e368cfd9c25/go.mod h1:rb3kp/3cj38tACF6udfpmIvKoQMwirSVoHNlrd66LyE=
github.com/jonathan-innis/karpenter-core v0.0.0-20231017081815-4e8c54e9d993 h1:EglPHmaL2cGCrf7UTji0Hqe+o3dSP5E4ZBA3YfXpdz4=
github.com/jonathan-innis/karpenter-core v0.0.0-20231017081815-4e8c54e9d993/go.mod h1:rb3kp/3cj38tACF6udfpmIvKoQMwirSVoHNlrd66LyE=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
Expand Down
5 changes: 3 additions & 2 deletions hack/docs/configuration_gen_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ func main() {
topDoc := fmt.Sprintf("%s%s\n\n", startDocSections[0], genStart)
bottomDoc := fmt.Sprintf("\n%s%s", genEnd, endDocSections[1])

opts := options.New()
fs := flag.NewFlagSet("karpenter", flag.ContinueOnError)
(&options.Options{}).AddFlags(fs)

envVarsBlock := "| Environment Variable | CLI Flag | Description |\n"
envVarsBlock += "|--|--|--|\n"
opts.FlagSet.VisitAll(func(f *flag.Flag) {
fs.VisitAll(func(f *flag.Flag) {
if f.DefValue == "" {
envVarsBlock += fmt.Sprintf("| %s | %s | %s|\n", strings.ReplaceAll(strings.ToUpper(f.Name), "-", "_"), "\\-\\-"+f.Name, f.Usage)
} else {
Expand Down
10 changes: 10 additions & 0 deletions hack/docs/instancetypes_gen_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,20 @@ func (m *FakeManager) GetConfig() *rest.Config {
return &rest.Config{}
}

func (m *FakeManager) GetFieldIndexer() client.FieldIndexer {
return &FakeFieldIndexer{}
}

func (m *FakeManager) Elected() <-chan struct{} {
return make(chan struct{}, 1)
}

type FakeFieldIndexer struct{}

func (f *FakeFieldIndexer) IndexField(_ context.Context, _ client.Object, _ string, _ client.IndexerFunc) error {
return nil
}

func main() {
flag.Parse()
if flag.NArg() != 1 {
Expand Down
5 changes: 1 addition & 4 deletions hack/docs/metrics_gen_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ description: >
"These metrics are available by default at `karpenter.karpenter.svc.cluster.local:8000/metrics` configurable via the `METRICS_PORT` environment variable documented [here](../settings)\n")
previousSubsystem := ""

// Ignore nodeClaimSubsystem and nodePoolSubsystem metrics until NodeClaims are released
allMetrics = lo.Reject(allMetrics, func(m metricInfo, _ int) bool {
return m.subsystem == "nodeclaims" || m.subsystem == "nodepools"
})
for _, metric := range allMetrics {
// Controller Runtime naming is different in that they don't specify a namespace or subsystem
// Getting the metrics requires special parsing logic
Expand Down Expand Up @@ -275,6 +271,7 @@ func getIdentMapping(identName string) (string, error) {
"interruptionSubsystem": "interruption",
"nodeTemplateSubsystem": "nodetemplate",
"deprovisioningSubsystem": "deprovisioning",
"disruptionSubsystem": "disruption",
"consistencySubsystem": "consistency",
"batcherSubsystem": "cloudprovider_batcher",
"cloudProviderSubsystem": "cloudprovider",
Expand Down
Loading

0 comments on commit 9c5e801

Please sign in to comment.