Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: v1beta1 #4744

Merged
merged 6 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/karpenter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ helm upgrade --install --namespace karpenter --create-namespace \
| logConfig.errorOutputPaths | list | `["stderr"]` | Log errorOutputPaths - defaults to stderr only |
| logConfig.logEncoding | string | `"console"` | Log encoding - defaults to console - must be one of 'json', 'console' |
| logConfig.logLevel | object | `{"controller":"debug","global":"debug","webhook":"error"}` | Component-based log configuration |
| logConfig.logLevel.controller | string | `"debug"` | Controller log level, defaults to 'debug' |
| logConfig.logLevel.global | string | `"debug"` | Global log level, defaults to 'debug' |
| logConfig.logLevel.webhook | string | `"error"` | Error log level, defaults to 'error' |
| logConfig.outputPaths | list | `["stdout"]` | Log outputPaths - defaults to stdout only |
| logEncoding | string | `"console"` | Global log encoding (Deprecated: Use logConfig.logEncoding instead) |
| logLevel | string | `"debug"` | Global log level |
Expand Down
1 change: 1 addition & 0 deletions charts/karpenter/crds/karpenter.sh_nodeclaims.yaml
1 change: 1 addition & 0 deletions charts/karpenter/crds/karpenter.sh_nodepools.yaml
6 changes: 6 additions & 0 deletions charts/karpenter/templates/aggregate-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ rules:
- apiGroups: ["karpenter.sh"]
resources: ["provisioners", "provisioners/status", "machines", "machines/status"]
verbs: ["get", "list", "watch", "create", "delete", "patch"]
- apiGroups: ["karpenter.sh"]
resources: ["nodepools", "nodepools/status", "nodeclaims", "nodeclaims/status"]
verbs: ["get", "list", "watch", "create", "delete", "patch"]
- apiGroups: ["karpenter.k8s.aws"]
resources: ["awsnodetemplates"]
verbs: ["get", "list", "watch", "create", "delete", "patch"]
- apiGroups: ["karpenter.k8s.aws"]
resources: ["ec2nodeclasses"]
verbs: ["get", "list", "watch", "create", "delete", "patch"]
9 changes: 9 additions & 0 deletions charts/karpenter/templates/clusterrole-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ rules:
- apiGroups: ["karpenter.sh"]
resources: ["provisioners", "provisioners/status", "machines", "machines/status"]
verbs: ["get", "list", "watch"]
- apiGroups: ["karpenter.sh"]
resources: ["nodepools", "nodepools/status", "nodeclaims", "nodeclaims/status"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["pods", "nodes", "persistentvolumes", "persistentvolumeclaims", "replicationcontrollers", "namespaces"]
verbs: ["get", "list", "watch"]
Expand All @@ -56,6 +59,12 @@ rules:
- apiGroups: ["karpenter.sh"]
resources: ["provisioners", "provisioners/status"]
verbs: ["update", "patch"]
- apiGroups: ["karpenter.sh"]
resources: ["nodeclaims", "nodeclaims/status"]
verbs: ["create", "delete", "update", "patch"]
- apiGroups: ["karpenter.sh"]
resources: ["nodepools", "nodepools/status"]
verbs: ["update", "patch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "patch"]
Expand Down
6 changes: 3 additions & 3 deletions charts/karpenter/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ metadata:
rules:
# Read
- apiGroups: ["karpenter.k8s.aws"]
resources: ["awsnodetemplates"]
resources: ["awsnodetemplates", "ec2nodeclasses"]
verbs: ["get", "list", "watch"]
# Write
- apiGroups: ["karpenter.k8s.aws"]
resources: ["awsnodetemplates", "awsnodetemplates/status"]
resources: ["awsnodetemplates", "awsnodetemplates/status", "ec2nodeclasses", "ec2nodeclasses/status"]
verbs: ["patch", "update"]
{{- if .Values.webhook.enabled }}
- apiGroups: ["admissionregistration.k8s.io"]
Expand All @@ -45,4 +45,4 @@ rules:
resources: ["mutatingwebhookconfigurations"]
verbs: ["update"]
resourceNames: ["defaulting.webhook.karpenter.k8s.aws"]
{{- end }}
{{- end }}
24 changes: 24 additions & 0 deletions charts/karpenter/templates/webhooks-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,36 @@ webhooks:
- karpenter.sh
apiVersions:
- v1alpha5
operations:
- CREATE
- UPDATE
resources:
- provisioners
- provisioners/status
scope: '*'
- apiGroups:
- karpenter.sh
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
- DELETE
resources:
- nodeclaims
- nodeclaims/status
scope: '*'
- apiGroups:
- karpenter.sh
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- nodepools
- nodepools/status
scope: '*'
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down
36 changes: 30 additions & 6 deletions charts/karpenter/templates/webhooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,28 @@ webhooks:
- awsnodetemplates
- awsnodetemplates/status
scope: '*'
- apiGroups:
- karpenter.k8s.aws
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- ec2nodeclasses
- ec2nodeclasses/status
scope: '*'
- apiGroups:
- karpenter.sh
apiVersions:
- v1alpha5
resources:
- provisioners
- provisioners/status
operations:
- CREATE
- UPDATE
resources:
- provisioners
- provisioners/status
scope: '*'
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down Expand Up @@ -74,14 +86,26 @@ webhooks:
- awsnodetemplates
- awsnodetemplates/status
scope: '*'
- apiGroups:
- karpenter.k8s.aws
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- ec2nodeclasses
- ec2nodeclasses/status
scope: '*'
- apiGroups:
- karpenter.sh
apiVersions:
- v1alpha5
resources:
- provisioners
- provisioners/status
operations:
- CREATE
- UPDATE
resources:
- provisioners
- provisioners/status
scope: '*'
{{- end }}
3 changes: 3 additions & 0 deletions charts/karpenter/values.yaml
jonathan-innis marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ logConfig:
logEncoding: console
# -- Component-based log configuration
logLevel:
# -- Global log level, defaults to 'debug'
global: debug
# -- Controller log level, defaults to 'debug'
controller: debug
# -- Error log level, defaults to 'error'
webhook: error
# -- Global Settings to configure Karpenter
settings:
Expand Down
1 change: 1 addition & 0 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func main() {
op.SubnetProvider,
op.SecurityGroupProvider,
op.InstanceProfileProvider,
op.InstanceProvider,
jonathan-innis marked this conversation as resolved.
Show resolved Hide resolved
op.PricingProvider,
op.AMIProvider,
)...).
Expand Down
6 changes: 3 additions & 3 deletions designs/v1beta1-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ spec:
owner: amazon
subnetSelectorTerms:
- tags:
compute.k8s.aws/discovery: cluster-name
karpenter.sh/discovery: cluster-name
- id: subnet-1234
securityGroupSelectorTerms:
- tags:
compute.k8s.aws/discovery: cluster-name
karpenter.sh/discovery: cluster-name
- name: default-security-group
role: karpenter-node-role
userData: |
Expand Down Expand Up @@ -253,7 +253,7 @@ spec:
nodeClass:
name: default
kind: EC2NodeClass
apiVersion: compute.k8s.aws/v1beta1
apiVersion: karpenter.k8s.aws/v1beta1
taints:
- key: example.com/special-taint
effect: NoSchedule
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/PuerkitoBio/goquery v1.8.1
github.com/avast/retry-go v3.0.0+incompatible
github.com/aws/aws-sdk-go v1.45.25
github.com/aws/karpenter-core v0.31.1-0.20231013203304-4239902b18b9
github.com/aws/karpenter-core v0.31.1-0.20231018213242-4555b8dfcd10
github.com/aws/karpenter/tools/kompat v0.0.0-20231010173459-62c25a3ea85c
github.com/imdario/mergo v0.3.16
github.com/mitchellh/hashstructure/v2 v2.0.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ 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-core v0.31.1-0.20231018213242-4555b8dfcd10 h1:ZKoz01A7DXGVEi0V4tGMd0LbLHEesIzFzYlFQTMQXSE=
github.com/aws/karpenter-core v0.31.1-0.20231018213242-4555b8dfcd10/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
2 changes: 1 addition & 1 deletion hack/docgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

compatibilitymatrix() {
go run hack/docs/version_compatibility.go hack/docs/compatibility-karpenter.yaml "$(git describe --exact-match --tags || echo "no tag")"
go run hack/docs/compatibilitymetrix_gen_docs.go website/content/en/preview/upgrade-guide.md hack/docs/compatibility-karpenter.yaml 6
go run hack/docs/compatibilitymetrix_gen_docs.go website/content/en/preview/upgrading/compatibility.md hack/docs/compatibility-karpenter.yaml 6
}


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) {
jonathan-innis marked this conversation as resolved.
Show resolved Hide resolved
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