Skip to content

Commit

Permalink
Migration guide: Deployments scaling part (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
zroubalik authored Aug 5, 2020
1 parent 658f24b commit be8625a
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 2 deletions.
10 changes: 8 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,23 @@ name = "Architecture"
parent = "docs"
weight = 3

[[menu.docs]]
url = "/docs/migration/"
name = "Migration Guide"
parent = "docs"
weight = 4

[[menu.docs]]
url = "/docs/faq/"
name = "FAQ"
parent = "docs"
weight = 4
weight = 5

[[menu.docs]]
url = "/docs/troubleshooting/"
name = "Troubleshooting"
parent = "docs"
weight = 5
weight = 6

[[menu.main]]
url = "/blog"
Expand Down
89 changes: 89 additions & 0 deletions content/docs/2.0/migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
+++
title = "Migration Guide"
+++

## Migrating from KEDA v1 to v2

Please note that you **can not** run both KEDA v1 and v2 on the same Kubernetes cluster. You need to [uninstall](../../1.5/deploy) KEDA v1 first, in order to [install](../deploy) and use KEDA v2.

KEDA v2 is using a new API namespace for it's Custom Resources Definitions (CRD): `keda.sh` instead of `keda.k8s.io` and introduces a new Custom Resource for scaling of Jobs. See full details on KEDA Custom Resources [here](../concepts/#custom-resources-crd).

### Scaling of Deployments
In order to scale `Deployments` with KEDA v2, you need to do only a few modifications to existing v1 `ScaledObjects` definitions, so they comply with v2:
- Change the value of `apiVersion` property from `keda.k8s.io/v1alpha1` to `keda.sh/v1alpha1`
- Rename property `spec.scaleTargetRef.deploymentName` to `spec.scaleTargetRef.name`
- Label `deploymentName` (in `metadata.labels.`) is no longer needed to be specified on v2 ScaledObject (it was mandatory on older versions of v1)

Please see the examples below or refer to the full [v2 ScaledObject Specification](../concepts/scaling-deployments/#scaledobject-spec)

**Example of v1 ScaledObject**
```yaml
apiVersion: keda.k8s.io/v1alpha1
kind: ScaledObject
metadata:
name: {scaled-object-name}
labels:
deploymentName: {deployment-name}
spec:
scaleTargetRef:
deploymentName: {deployment-name}
containerName: {container-name}
pollingInterval: 30
cooldownPeriod: 300
minReplicaCount: 0
maxReplicaCount: 100
triggers:
# {list of triggers to activate the deployment}
```

**Example of v2 ScaledObject**
```yaml
apiVersion: keda.sh/v1alpha1 # <--- Property value was changed
kind: ScaledObject
metadata: # <--- labels.deploymentName is not needed
name: {scaled-object-name}
spec:
scaleTargetRef:
name: {deployment-name} # <--- Property name was changed
containerName: {container-name}
pollingInterval: 30
cooldownPeriod: 300
minReplicaCount: 0
maxReplicaCount: 100
triggers:
# {list of triggers to activate the deployment}
```


### Scaling of Jobs

TODO description

Please see the examples below or refer to the full [v2 ScaledJob Specification](../concepts/scaling-jobs/#scaledjob-spec)

**Example of v1 ScaledObject for Jobs scaling**
```yaml
apiVersion: keda.k8s.io/v1alpha1
kind: ScaledObject
metadata:
name: {scaled-object-name}
spec:
scaleType: job
jobTargetRef:
parallelism: 1
completions: 1
activeDeadlineSeconds: 600
backoffLimit: 6
template:
# {job template}
pollingInterval: 30
cooldownPeriod: 300
minReplicaCount: 0
maxReplicaCount: 100
triggers:
# {list of triggers to create jobs}
```

**Example of v2 ScaledJob**

TODO

0 comments on commit be8625a

Please sign in to comment.