Skip to content

Commit

Permalink
karpenter service name is configurable for webhook cert now
Browse files Browse the repository at this point in the history
  • Loading branch information
bwagner5 committed Feb 9, 2022
1 parent 8653484 commit bb12baa
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions charts/karpenter/templates/configmap-logging.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: config-logging
name: karpenter-config-logging
namespace: {{ .Release.Namespace }}
labels:
{{- include "karpenter.labels" . | nindent 4 }}
{{- with .Values.additionalAnnotations }}
annotations:
annotations:-
{{- toYaml . | nindent 4 }}
{{- end }}
data:
Expand Down
4 changes: 4 additions & 0 deletions charts/karpenter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ spec:
value: {{ .Values.clusterName }}
- name: CLUSTER_ENDPOINT
value: {{ .Values.clusterEndpoint }}
- name: KARPENTER_SERVICE
value: {{ include "karpenter.fullname" . }}
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
Expand Down Expand Up @@ -103,6 +105,8 @@ spec:
value: {{ .Values.clusterName }}
- name: CLUSTER_ENDPOINT
value: {{ .Values.clusterEndpoint }}
- name: KARPENTER_SERVICE
value: {{ include "karpenter.fullname" . }}
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
Expand Down
2 changes: 1 addition & 1 deletion charts/karpenter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: karpenter
name: {{ include "karpenter.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "karpenter.labels" . | nindent 4 }}
Expand Down
5 changes: 3 additions & 2 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package main

import (
"context"
"fmt"

"github.com/aws/karpenter/pkg/apis"
"github.com/aws/karpenter/pkg/cloudprovider"
Expand Down Expand Up @@ -45,8 +46,8 @@ func main() {
config := knativeinjection.ParseAndGetRESTConfigOrDie()
ctx := webhook.WithOptions(knativeinjection.WithNamespaceScope(signals.NewContext(), system.Namespace()), webhook.Options{
Port: opts.WebhookPort,
ServiceName: "karpenter",
SecretName: "karpenter-cert",
ServiceName: opts.KarpenterService,
SecretName: fmt.Sprintf("%s-cert", opts.KarpenterService),
})

// Register the cloud provider to attach vendor specific validation logic.
Expand Down
2 changes: 2 additions & 0 deletions pkg/utils/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func MustParse() Options {
opts := Options{}
flag.StringVar(&opts.ClusterName, "cluster-name", env.WithDefaultString("CLUSTER_NAME", ""), "The kubernetes cluster name for resource discovery")
flag.StringVar(&opts.ClusterEndpoint, "cluster-endpoint", env.WithDefaultString("CLUSTER_ENDPOINT", ""), "The external kubernetes cluster endpoint for new nodes to connect with")
flag.StringVar(&opts.KarpenterService, "karpenter-service", env.WithDefaultString("KARPENTER_SERVICE", ""), "The Karpenter Service name for the dynamic webhook certificate")
flag.IntVar(&opts.MetricsPort, "metrics-port", env.WithDefaultInt("METRICS_PORT", 8080), "The port the metric endpoint binds to for operating metrics about the controller itself")
flag.IntVar(&opts.HealthProbePort, "health-probe-port", env.WithDefaultInt("HEALTH_PROBE_PORT", 8081), "The port the health probe endpoint binds to for reporting controller health")
flag.IntVar(&opts.WebhookPort, "port", 8443, "The port the webhook endpoint binds to for validation and mutation of resources")
Expand All @@ -53,6 +54,7 @@ func MustParse() Options {
type Options struct {
ClusterName string
ClusterEndpoint string
KarpenterService string
MetricsPort int
HealthProbePort int
WebhookPort int
Expand Down
2 changes: 1 addition & 1 deletion website/content/en/preview/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ make battletest # More rigorous tests run in CI environment
### Verbose Logging

```bash
kubectl patch configmap config-logging -n karpenter --patch '{"data":{"loglevel.controller":"debug"}}'
kubectl patch configmap karpenter-config-logging -n karpenter --patch '{"data":{"loglevel.controller":"debug"}}'
```

### Debugging Metrics
Expand Down

0 comments on commit bb12baa

Please sign in to comment.