Skip to content

Commit

Permalink
Revert "v1alpha2 API changes (#477)" (#490)
Browse files Browse the repository at this point in the history
This reverts commit 8aab1e5.
  • Loading branch information
ellistarn committed Jun 30, 2021
1 parent 8aab1e5 commit d48734f
Show file tree
Hide file tree
Showing 47 changed files with 258 additions and 338 deletions.
14 changes: 8 additions & 6 deletions Makefile
Expand Up @@ -63,11 +63,6 @@ codegen: ## Generate code. Must be run if changes are made to ./pkg/apis/...
# CRDs don't currently jive with VolatileTime, which has an Any type.
perl -pi -e 's/Any/string/g' charts/karpenter/templates/provisioning.karpenter.sh_provisioners.yaml
hack/boilerplate.sh
gen-crd-api-reference-docs \
-api-dir ./pkg/apis/provisioning/v1alpha2 \
-config $(shell go env GOMODCACHE)/github.com/ahmetb/gen-crd-api-reference-docs@v0.2.0/example-config.json \
-out-file docs/README.md \
-template-dir $(shell go env GOMODCACHE)/github.com/ahmetb/gen-crd-api-reference-docs@v0.2.0/template

publish: ## Generate release manifests and publish a versioned container image.
@aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin $(RELEASE_REPO)
Expand All @@ -78,7 +73,14 @@ publish: ## Generate release manifests and publish a versioned container image.
helm: ## Generate Helm Chart
cd charts;helm lint karpenter;helm package karpenter;helm repo index .

docs: ## Generate Docs
gen-crd-api-reference-docs \
-api-dir ./pkg/apis/provisioning/v1alpha1 \
-config $(shell go env GOMODCACHE)/github.com/ahmetb/gen-crd-api-reference-docs@v0.2.0/example-config.json \
-out-file docs/README.md \
-template-dir $(shell go env GOMODCACHE)/github.com/ahmetb/gen-crd-api-reference-docs@v0.2.0/template

toolchain: ## Install developer toolchain
./hack/toolchain.sh

.PHONY: help dev ci release test battletest verify codegen apply delete publish helm toolchain licenses
.PHONY: help dev ci release test battletest verify codegen apply delete publish helm docs toolchain licenses
Expand Up @@ -16,7 +16,7 @@ spec:
singular: provisioner
scope: Namespaced
versions:
- name: v1alpha2
- name: v1alpha1
schema:
openAPIV3Schema:
description: Provisioner is the Schema for the Provisioners API
Expand All @@ -36,7 +36,7 @@ spec:
description: Architecture constrains the underlying node architecture
type: string
cluster:
description: Cluster that launched nodes connect to.
description: ClusterSpec configures the cluster that the provisioner operates against. If not specified, it will default to using the controller's kube-config.
properties:
caBundle:
description: CABundle is required for nodes to verify API Server certificates.
Expand Down Expand Up @@ -88,13 +88,9 @@ spec:
- key
type: object
type: array
ttlSecondsAfterEmpty:
description: "TTLSecondsAfterEmpty is the number of seconds the controller will wait before attempting to terminate a node, measured from when the node is detected to be empty. A Node is considered to be empty when it does not have pods scheduled to it, excluding daemonsets. \n Termination due to underutilization is disabled if this field is not set."
format: int64
type: integer
ttlSecondsUntilExpired:
description: "TTLSecondsUntilExpired is the number of seconds the controller will wait before terminating a node, measured from when the node is created. This is useful to implement features like eventually consistent node upgrade, memory leak protection, and disruption testing. \n Termination due to expiration is disabled if this field is not set."
format: int64
ttlSeconds:
description: TTLSeconds determines how long to wait before attempting to terminate a node.
format: int32
type: integer
zones:
description: Zones constrains where nodes will be launched by the Provisioner. If unspecified, defaults to all zones in the region. Cannot be specified if label "topology.kubernetes.io/zone" is specified.
Expand Down
4 changes: 2 additions & 2 deletions charts/karpenter/templates/webhook/webhooks.yaml
Expand Up @@ -15,7 +15,7 @@ webhooks:
- apiGroups:
- provisioning.karpenter.sh
apiVersions:
- v1alpha2
- v1alpha1
resources:
- provisioners
provisioners/status
Expand All @@ -42,7 +42,7 @@ webhooks:
- apiGroups:
- provisioning.karpenter.sh
apiVersions:
- v1alpha2
- v1alpha1
resources:
- provisioners
provisioners/status
Expand Down
6 changes: 3 additions & 3 deletions cmd/controller/main.go
Expand Up @@ -22,9 +22,9 @@ import (
"github.com/awslabs/karpenter/pkg/cloudprovider"
"github.com/awslabs/karpenter/pkg/cloudprovider/registry"
"github.com/awslabs/karpenter/pkg/controllers"
"github.com/awslabs/karpenter/pkg/controllers/allocation"
"github.com/awslabs/karpenter/pkg/controllers/reallocation"
"github.com/awslabs/karpenter/pkg/controllers/termination"
"github.com/awslabs/karpenter/pkg/controllers/provisioning/v1alpha1/allocation"
"github.com/awslabs/karpenter/pkg/controllers/provisioning/v1alpha1/reallocation"
termination "github.com/awslabs/karpenter/pkg/controllers/terminating/v1alpha1"
"github.com/awslabs/karpenter/pkg/utils/log"

"go.uber.org/zap/zapcore"
Expand Down
104 changes: 30 additions & 74 deletions docs/README.md
@@ -1,23 +1,23 @@
<p>Packages:</p>
<ul>
<li>
<a href="#provisioning.karpenter.sh%2fv1alpha2">provisioning.karpenter.sh/v1alpha2</a>
<a href="#provisioning.karpenter.sh%2fv1alpha1">provisioning.karpenter.sh/v1alpha1</a>
</li>
</ul>
<h2 id="provisioning.karpenter.sh/v1alpha2">provisioning.karpenter.sh/v1alpha2</h2>
<h2 id="provisioning.karpenter.sh/v1alpha1">provisioning.karpenter.sh/v1alpha1</h2>
<p>
<p>Package v1alpha2 contains API Schema definitions for the v1alpha2 API group</p>
<p>Package v1alpha1 contains API Schema definitions for the v1alpha1 API group</p>
</p>
Resource Types:
<ul></ul>
<h3 id="provisioning.karpenter.sh/v1alpha2.Cluster">Cluster
<h3 id="provisioning.karpenter.sh/v1alpha1.ClusterSpec">ClusterSpec
</h3>
<p>
(<em>Appears on:</em>
<a href="#provisioning.karpenter.sh/v1alpha2.ProvisionerSpec">ProvisionerSpec</a>)
<a href="#provisioning.karpenter.sh/v1alpha1.ProvisionerSpec">ProvisionerSpec</a>)
</p>
<p>
<p>Cluster configures the cluster that the provisioner operates against. If
<p>ClusterSpec configures the cluster that the provisioner operates against. If
not specified, it will default to using the controller&rsquo;s kube-config.</p>
</p>
<table>
Expand Down Expand Up @@ -63,11 +63,11 @@ string
</tr>
</tbody>
</table>
<h3 id="provisioning.karpenter.sh/v1alpha2.Constraints">Constraints
<h3 id="provisioning.karpenter.sh/v1alpha1.Constraints">Constraints
</h3>
<p>
(<em>Appears on:</em>
<a href="#provisioning.karpenter.sh/v1alpha2.ProvisionerSpec">ProvisionerSpec</a>)
<a href="#provisioning.karpenter.sh/v1alpha1.ProvisionerSpec">ProvisionerSpec</a>)
</p>
<p>
<p>Constraints are applied to all nodes created by the provisioner. They can be
Expand Down Expand Up @@ -165,7 +165,7 @@ string
</tr>
</tbody>
</table>
<h3 id="provisioning.karpenter.sh/v1alpha2.Provisioner">Provisioner
<h3 id="provisioning.karpenter.sh/v1alpha1.Provisioner">Provisioner
</h3>
<p>
<p>Provisioner is the Schema for the Provisioners API</p>
Expand Down Expand Up @@ -196,7 +196,7 @@ Refer to the Kubernetes API documentation for the fields of the
<td>
<code>spec</code></br>
<em>
<a href="#provisioning.karpenter.sh/v1alpha2.ProvisionerSpec">
<a href="#provisioning.karpenter.sh/v1alpha1.ProvisionerSpec">
ProvisionerSpec
</a>
</em>
Expand All @@ -209,21 +209,20 @@ ProvisionerSpec
<td>
<code>cluster</code></br>
<em>
<a href="#provisioning.karpenter.sh/v1alpha2.Cluster">
Cluster
<a href="#provisioning.karpenter.sh/v1alpha1.ClusterSpec">
ClusterSpec
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Cluster that launched nodes connect to.</p>
</td>
</tr>
<tr>
<td>
<code>Constraints</code></br>
<em>
<a href="#provisioning.karpenter.sh/v1alpha2.Constraints">
<a href="#provisioning.karpenter.sh/v1alpha1.Constraints">
Constraints
</a>
</em>
Expand All @@ -232,40 +231,19 @@ Constraints
<p>
(Members of <code>Constraints</code> are embedded into this type.)
</p>
<em>(Optional)</em>
<p>Constraints are applied to all nodes launched by this provisioner.</p>
</td>
</tr>
<tr>
<td>
<code>ttlSecondsAfterEmpty</code></br>
<em>
int64
</em>
</td>
<td>
<em>(Optional)</em>
<p>TTLSecondsAfterEmpty is the number of seconds the controller will wait
before attempting to terminate a node, measured from when the node is
detected to be empty. A Node is considered to be empty when it does not
have pods scheduled to it, excluding daemonsets.</p>
<p>Termination due to underutilization is disabled if this field is not set.</p>
<p>Constraints applied to nodes created by the provisioner</p>
</td>
</tr>
<tr>
<td>
<code>ttlSecondsUntilExpired</code></br>
<code>ttlSeconds</code></br>
<em>
int64
int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>TTLSecondsUntilExpired is the number of seconds the controller will wait
before terminating a node, measured from when the node is created. This
is useful to implement features like eventually consistent node upgrade,
memory leak protection, and disruption testing.</p>
<p>Termination due to expiration is disabled if this field is not set.</p>
<p>TTLSeconds determines how long to wait before attempting to terminate a node.</p>
</td>
</tr>
</table>
Expand All @@ -275,7 +253,7 @@ memory leak protection, and disruption testing.</p>
<td>
<code>status</code></br>
<em>
<a href="#provisioning.karpenter.sh/v1alpha2.ProvisionerStatus">
<a href="#provisioning.karpenter.sh/v1alpha1.ProvisionerStatus">
ProvisionerStatus
</a>
</em>
Expand All @@ -285,11 +263,11 @@ ProvisionerStatus
</tr>
</tbody>
</table>
<h3 id="provisioning.karpenter.sh/v1alpha2.ProvisionerSpec">ProvisionerSpec
<h3 id="provisioning.karpenter.sh/v1alpha1.ProvisionerSpec">ProvisionerSpec
</h3>
<p>
(<em>Appears on:</em>
<a href="#provisioning.karpenter.sh/v1alpha2.Provisioner">Provisioner</a>)
<a href="#provisioning.karpenter.sh/v1alpha1.Provisioner">Provisioner</a>)
</p>
<p>
<p>ProvisionerSpec is the top level provisioner specification. Provisioners
Expand All @@ -315,21 +293,20 @@ pod.spec.nodeSelector[&ldquo;provisioning.karpenter.sh/name&rdquo;]=$PROVISIONER
<td>
<code>cluster</code></br>
<em>
<a href="#provisioning.karpenter.sh/v1alpha2.Cluster">
Cluster
<a href="#provisioning.karpenter.sh/v1alpha1.ClusterSpec">
ClusterSpec
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Cluster that launched nodes connect to.</p>
</td>
</tr>
<tr>
<td>
<code>Constraints</code></br>
<em>
<a href="#provisioning.karpenter.sh/v1alpha2.Constraints">
<a href="#provisioning.karpenter.sh/v1alpha1.Constraints">
Constraints
</a>
</em>
Expand All @@ -338,49 +315,28 @@ Constraints
<p>
(Members of <code>Constraints</code> are embedded into this type.)
</p>
<em>(Optional)</em>
<p>Constraints are applied to all nodes launched by this provisioner.</p>
</td>
</tr>
<tr>
<td>
<code>ttlSecondsAfterEmpty</code></br>
<em>
int64
</em>
</td>
<td>
<em>(Optional)</em>
<p>TTLSecondsAfterEmpty is the number of seconds the controller will wait
before attempting to terminate a node, measured from when the node is
detected to be empty. A Node is considered to be empty when it does not
have pods scheduled to it, excluding daemonsets.</p>
<p>Termination due to underutilization is disabled if this field is not set.</p>
<p>Constraints applied to nodes created by the provisioner</p>
</td>
</tr>
<tr>
<td>
<code>ttlSecondsUntilExpired</code></br>
<code>ttlSeconds</code></br>
<em>
int64
int32
</em>
</td>
<td>
<em>(Optional)</em>
<p>TTLSecondsUntilExpired is the number of seconds the controller will wait
before terminating a node, measured from when the node is created. This
is useful to implement features like eventually consistent node upgrade,
memory leak protection, and disruption testing.</p>
<p>Termination due to expiration is disabled if this field is not set.</p>
<p>TTLSeconds determines how long to wait before attempting to terminate a node.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="provisioning.karpenter.sh/v1alpha2.ProvisionerStatus">ProvisionerStatus
<h3 id="provisioning.karpenter.sh/v1alpha1.ProvisionerStatus">ProvisionerStatus
</h3>
<p>
(<em>Appears on:</em>
<a href="#provisioning.karpenter.sh/v1alpha2.Provisioner">Provisioner</a>)
<a href="#provisioning.karpenter.sh/v1alpha1.Provisioner">Provisioner</a>)
</p>
<p>
<p>ProvisionerStatus defines the observed state of Provisioner</p>
Expand Down Expand Up @@ -424,5 +380,5 @@ its target, and indicates whether or not those conditions are met.</p>
<hr/>
<p><em>
Generated with <code>gen-crd-api-reference-docs</code>
on git commit <code>36276c4</code>.
on git commit <code>08b78c7</code>.
</em></p>
3 changes: 1 addition & 2 deletions docs/aws/README.md
Expand Up @@ -98,7 +98,7 @@ kubectl patch deployment karpenter-controller \
Create a default Provisioner that launches nodes configured with cluster name, endpoint, and caBundle.
```bash
cat <<EOF | kubectl apply -f -
apiVersion: provisioning.karpenter.sh/v1alpha2
apiVersion: provisioning.karpenter.sh/v1alpha1
kind: Provisioner
metadata:
name: default
Expand All @@ -107,7 +107,6 @@ spec:
name: ${CLUSTER_NAME}
caBundle: $(aws eks describe-cluster --name ${CLUSTER_NAME} --query "cluster.certificateAuthority.data" --output json)
endpoint: $(aws eks describe-cluster --name ${CLUSTER_NAME} --query "cluster.endpoint" --output json)
ttlSecondsAfterEmpty: 30
EOF
kubectl get provisioner default -oyaml
```
Expand Down
12 changes: 1 addition & 11 deletions docs/aws/examples/provisioner.yaml
Expand Up @@ -3,24 +3,14 @@ kind: Provisioner
metadata:
name: default
spec:
# Provisioned nodes connect to this cluster
# Provisioned nodes will be configured to connect to this cluster
cluster:
name: "${CLUSTER_NAME}"
caBundle: "${CLUSTER_CA_BUNDLE}"
endpoint: "${CLUSTER_ENDPOINT}"

# If nil, the feature is disabled, nodes will never expire
ttlSecondsUntilExpired: 2592000 # 30 Days = 60 * 60 * 24 * 30 Seconds;

# If nil, the feature is disabled, nodes will never scale down due to low utilization
ttlSecondsAfterEmpty: 30

# Provisioned nodes will have these taints
taints:
- key: example.com/special-taint
effect: NoSchedule

# Provisioned nodes will have these labels
labels:
##### AWS Specific #####
# Constrain node launch template, default="bottlerocket"
Expand Down

0 comments on commit d48734f

Please sign in to comment.