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

move default provisioner to helm post-install hook #810

Merged
merged 3 commits into from
Nov 17, 2021
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ apply: ## Deploy the controller into your ~/.kube/config cluster

delete: ## Delete the controller from your ~/.kube/config cluster
helm template karpenter charts/karpenter --namespace karpenter \
$(HELM_OPTS) \
--set serviceAccount.create=false \
--set defaultProvisioner.create=false \
| kubectl delete -f -

codegen: ## Generate code. Must be run if changes are made to ./pkg/apis/...
Expand Down
4 changes: 4 additions & 0 deletions charts/karpenter/templates/controller/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ spec:
httpGet:
path: /healthz
port: 8081
readinessProbe:
httpGet:
path: /readyz
port: 8081
env:
- name: CLUSTER_NAME
value: {{ .Values.controller.clusterName }}
Expand Down
3 changes: 3 additions & 0 deletions charts/karpenter/templates/default_provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ apiVersion: karpenter.sh/v1alpha5
kind: Provisioner
metadata:
name: default
annotations:
"helm.sh/hook": post-install
"helm.sh/resource-policy": keep
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do these do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this tells helm that it's a post-install hook and to keep the resource rather than deleting it right after applying.

spec:
{{ if .Values.defaultProvisioner.ttlSecondsAfterEmpty }}
ttlSecondsAfterEmpty: {{ .Values.defaultProvisioner.ttlSecondsAfterEmpty }}
Expand Down
4 changes: 4 additions & 0 deletions charts/karpenter/templates/webhook/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ spec:
httpGet:
scheme: HTTPS
port: 8443
readinessProbe:
httpGet:
scheme: HTTPS
port: 8443
env:
- name: CLUSTER_NAME
value: {{ .Values.controller.clusterName }}
Expand Down
5 changes: 4 additions & 1 deletion pkg/controllers/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ func (m *GenericControllerManager) RegisterControllers(ctx context.Context, cont
}
}
if err := m.AddHealthzCheck("healthz", healthz.Ping); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you call this livez (liveness)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't tell if this is a joke. If it's not, the convention is healthz for liveness check

panic(fmt.Sprintf("Failed to add readiness probe, %s", err.Error()))
panic(fmt.Sprintf("Failed to add health probe, %s", err.Error()))
}
if err := m.AddReadyzCheck("readyz", healthz.Ping); err != nil {
panic(fmt.Sprintf("Failed to add ready probe, %s", err.Error()))
}
return m
}
Expand Down
5 changes: 3 additions & 2 deletions website/content/en/docs/getting-started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ eksctl. Thus, we don't need the helm chart to do that.
```bash
helm repo add karpenter https://charts.karpenter.sh
helm repo update
helm upgrade --install --skip-crds karpenter karpenter/karpenter --namespace karpenter \
--create-namespace --set serviceAccount.create=false --version 0.4.1 \
helm upgrade --install karpenter karpenter/karpenter --namespace karpenter \
--create-namespace --set serviceAccount.create=false --version 0.4.3 \
--set controller.clusterName=${CLUSTER_NAME} \
--set controller.clusterEndpoint=$(aws eks describe-cluster --name ${CLUSTER_NAME} --query "cluster.endpoint" --output json) \
--set defaultProvisioner.create=false \
--wait # for the defaulting webhook to install before creating a Provisioner
```

Expand Down