Skip to content

Commit

Permalink
chore: Drop conversion webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jigisha620 committed Aug 27, 2024
1 parent 30853fe commit bbff05c
Show file tree
Hide file tree
Showing 35 changed files with 23 additions and 1,956 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ run: ## Run Karpenter controller binary against your local cluster
SYSTEM_NAMESPACE=${KARPENTER_NAMESPACE} \
KUBERNETES_MIN_VERSION="1.19.0-0" \
DISABLE_LEADER_ELECTION=true \
DISABLE_WEBHOOK=true \
CLUSTER_NAME=${CLUSTER_NAME} \
INTERRUPTION_QUEUE=${CLUSTER_NAME} \
FEATURE_GATES="SpotToSpotConsolidation=true" \
Expand Down Expand Up @@ -106,7 +105,6 @@ verify: tidy download ## Verify code. Includes dependencies, linting, formatting
hack/validation/requirements.sh
hack/validation/labels.sh
cp pkg/apis/crds/* charts/karpenter-crd/templates
hack/mutation/conversion_webhooks_injection.sh
hack/github/dependabot.sh
$(foreach dir,$(MOD_DIRS),cd $(dir) && golangci-lint run $(newline))
@git diff --quiet ||\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1293,17 +1293,3 @@ spec:
storage: false
subresources:
status: {}
{{- if .Values.webhook.enabled }}
conversion:
strategy: Webhook
webhook:
conversionReviewVersions:
- v1beta1
- v1
clientConfig:
service:
name: {{ .Values.webhook.serviceName }}
namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }}
port: {{ .Values.webhook.port }}
{{- end }}

14 changes: 0 additions & 14 deletions charts/karpenter-crd/templates/karpenter.sh_nodeclaims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -816,17 +816,3 @@ spec:
storage: false
subresources:
status: {}
{{- if .Values.webhook.enabled }}
conversion:
strategy: Webhook
webhook:
conversionReviewVersions:
- v1beta1
- v1
clientConfig:
service:
name: {{ .Values.webhook.serviceName }}
namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }}
port: {{ .Values.webhook.port }}
{{- end }}

14 changes: 0 additions & 14 deletions charts/karpenter-crd/templates/karpenter.sh_nodepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1067,17 +1067,3 @@ spec:
storage: false
subresources:
status: {}
{{- if .Values.webhook.enabled }}
conversion:
strategy: Webhook
webhook:
conversionReviewVersions:
- v1beta1
- v1
clientConfig:
service:
name: {{ .Values.webhook.serviceName }}
namespace: {{ .Values.webhook.serviceNamespace | default .Release.Namespace }}
port: {{ .Values.webhook.port }}
{{- end }}

7 changes: 0 additions & 7 deletions charts/karpenter-crd/values.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions charts/karpenter/templates/clusterrole-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ rules:
- apiGroups: ["apps"]
resources: ["daemonsets", "deployments", "replicasets", "statefulsets"]
verbs: ["list", "watch"]
{{- if .Values.webhook.enabled }}
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["watch", "list"]
{{- end }}
- apiGroups: ["policy"]
resources: ["poddisruptionbudgets"]
verbs: ["get", "list", "watch"]
Expand All @@ -68,11 +63,6 @@ rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["delete"]
{{- if .Values.webhook.enabled }}
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["update"]
{{- end }}
{{- with .Values.additionalClusterRoleRules -}}
{{ toYaml . | nindent 2 }}
{{- end -}}
16 changes: 0 additions & 16 deletions charts/karpenter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ spec:
value: "1.19.0-0"
- name: KARPENTER_SERVICE
value: {{ include "karpenter.fullname" . }}
{{- if .Values.webhook.enabled }}
- name: WEBHOOK_PORT
value: "{{ .Values.webhook.port }}"
- name: WEBHOOK_METRICS_PORT
value: "{{ .Values.webhook.metrics.port }}"
{{- end }}
- name: DISABLE_WEBHOOK
value: "{{ not .Values.webhook.enabled }}"
{{- with .Values.logLevel }}
- name: LOG_LEVEL
value: "{{ . }}"
Expand Down Expand Up @@ -159,14 +151,6 @@ spec:
- name: http-metrics
containerPort: {{ .Values.controller.metrics.port }}
protocol: TCP
{{- if .Values.webhook.enabled }}
- name: webhook-metrics
containerPort: {{ .Values.webhook.metrics.port }}
protocol: TCP
- name: https-webhook
containerPort: {{ .Values.webhook.port }}
protocol: TCP
{{- end }}
- name: http
containerPort: {{ .Values.controller.healthProbe.port }}
protocol: TCP
Expand Down
12 changes: 0 additions & 12 deletions charts/karpenter/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@ rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch"]
{{- if .Values.webhook.enabled }}
- apiGroups: [""]
resources: ["configmaps", "secrets"]
verbs: ["get", "list", "watch"]
{{- end }}
# Write
{{- if .Values.webhook.enabled }}
- apiGroups: [""]
resources: ["secrets"]
verbs: ["update"]
resourceNames:
- "{{ include "karpenter.fullname" . }}-cert"
{{- end }}
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["patch", "update"]
Expand Down
14 changes: 0 additions & 14 deletions charts/karpenter/templates/secret-webhook-cert.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions charts/karpenter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,5 @@ spec:
port: {{ .Values.controller.metrics.port }}
targetPort: http-metrics
protocol: TCP
{{- if .Values.webhook.enabled }}
- name: webhook-metrics
port: {{ .Values.webhook.metrics.port }}
targetPort: webhook-metrics
protocol: TCP
- name: https-webhook
port: {{ .Values.webhook.port }}
targetPort: https-webhook
protocol: TCP
{{- end }}
selector:
{{- include "karpenter.selectorLabels" . | nindent 4 }}
8 changes: 0 additions & 8 deletions charts/karpenter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,6 @@ controller:
healthProbe:
# -- The container port to use for http health probe.
port: 8081
webhook:
# -- Whether to enable the webhooks and webhook permissions.
enabled: true
# -- The container port to use for the webhook.
port: 8443
metrics:
# -- The container port to use for webhook metrics.
port: 8001
# -- Global log level, defaults to 'info'
logLevel: info
# -- Log outputPaths - defaults to stdout only
Expand Down
6 changes: 1 addition & 5 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ import (
"github.com/aws/karpenter-provider-aws/pkg/cloudprovider"
"github.com/aws/karpenter-provider-aws/pkg/controllers"
"github.com/aws/karpenter-provider-aws/pkg/operator"
"github.com/aws/karpenter-provider-aws/pkg/webhooks"

"sigs.k8s.io/karpenter/pkg/cloudprovider/metrics"
corecontrollers "sigs.k8s.io/karpenter/pkg/controllers"
coreoperator "sigs.k8s.io/karpenter/pkg/operator"
corewebhooks "sigs.k8s.io/karpenter/pkg/webhooks"
)

func main() {
Expand All @@ -50,7 +48,6 @@ func main() {
op.EventRecorder,
cloudProvider,
)...).
WithWebhooks(ctx, corewebhooks.NewWebhooks()...).
WithControllers(ctx, controllers.NewControllers(
ctx,
op.Manager,
Expand All @@ -69,6 +66,5 @@ func main() {
op.LaunchTemplateProvider,
op.InstanceTypesProvider,
)...).
WithWebhooks(ctx, webhooks.NewWebhooks()...).
Start(ctx, cloudProvider)
Start(ctx)
}
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
knative.dev/pkg v0.0.0-20231010144348-ca8c009405dd
sigs.k8s.io/controller-runtime v0.18.5
sigs.k8s.io/karpenter v1.0.1-0.20240821214627-9469d1919054
sigs.k8s.io/karpenter v1.0.1-0.20240827185856-dccd9c8fcd88
sigs.k8s.io/yaml v1.4.0
)

Expand All @@ -42,7 +42,6 @@ require (
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
Expand Down Expand Up @@ -91,7 +90,6 @@ require (
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/automaxprocs v1.5.3 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.23.0 // indirect
Expand Down
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHfpE=
github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down Expand Up @@ -290,8 +288,6 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
Expand Down Expand Up @@ -373,8 +369,6 @@ go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
Expand Down Expand Up @@ -760,8 +754,8 @@ sigs.k8s.io/controller-runtime v0.18.5 h1:nTHio/W+Q4aBlQMgbnC5hZb4IjIidyrizMai9P
sigs.k8s.io/controller-runtime v0.18.5/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/karpenter v1.0.1-0.20240821214627-9469d1919054 h1:sazFOdf0qboIt5Zx+XPor7iX0H9zfEZCyCeuYHbhhbE=
sigs.k8s.io/karpenter v1.0.1-0.20240821214627-9469d1919054/go.mod h1:e6yDwyO/5+h2NqTkvMmHf9ae/UnKbsOdSYuAnV0NErQ=
sigs.k8s.io/karpenter v1.0.1-0.20240827185856-dccd9c8fcd88 h1:26ADxxiWEYrFaaxXsgJWvdEsHLl+VD6mgfpbS0X8W08=
sigs.k8s.io/karpenter v1.0.1-0.20240827185856-dccd9c8fcd88/go.mod h1:O1xajoh6fC78ef3ahquisK/E857Jh+el2V58OvdcLdM=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
Expand Down
54 changes: 0 additions & 54 deletions hack/mutation/conversion_webhooks_injection.sh

This file was deleted.

11 changes: 0 additions & 11 deletions pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1293,14 +1293,3 @@ spec:
storage: false
subresources:
status: {}
conversion:
strategy: Webhook
webhook:
conversionReviewVersions:
- v1beta1
- v1
clientConfig:
service:
name: karpenter
namespace: kube-system
port: 8443
11 changes: 0 additions & 11 deletions pkg/apis/crds/karpenter.sh_nodeclaims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -816,14 +816,3 @@ spec:
storage: false
subresources:
status: {}
conversion:
strategy: Webhook
webhook:
conversionReviewVersions:
- v1beta1
- v1
clientConfig:
service:
name: karpenter
namespace: kube-system
port: 8443
11 changes: 0 additions & 11 deletions pkg/apis/crds/karpenter.sh_nodepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1067,14 +1067,3 @@ spec:
storage: false
subresources:
status: {}
conversion:
strategy: Webhook
webhook:
conversionReviewVersions:
- v1beta1
- v1
clientConfig:
service:
name: karpenter
namespace: kube-system
port: 8443
Loading

0 comments on commit bbff05c

Please sign in to comment.