Skip to content

Commit

Permalink
feat(stateful-set): update strategy (#523) (#592)
Browse files Browse the repository at this point in the history
* feat(stateful-set): update strategy (#523)

Resolves #372

(cherry picked from commit e47888d)
Signed-off-by: Eli Polonsky <epolon@amazon.com>

* chore: self mutation

Signed-off-by: github-actions <github-actions@github.com>

Co-authored-by: github-actions <github-actions@github.com>
  • Loading branch information
iliapolo and github-actions committed Apr 14, 2022
1 parent 5836fdd commit ee50a00
Show file tree
Hide file tree
Showing 5 changed files with 424 additions and 2 deletions.
101 changes: 101 additions & 0 deletions docs/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -4087,6 +4087,7 @@ StatefulSet.Builder.create(Construct scope, java.lang.String id)
// .defaultSelector(java.lang.Boolean)
// .podManagementPolicy(PodManagementPolicy)
// .replicas(java.lang.Number)
// .strategy(StatefulSetUpdateStrategy)
.build();
```

Expand Down Expand Up @@ -4260,6 +4261,15 @@ Number of desired pods.

---

##### `strategy`<sup>Optional</sup> <a name="org.cdk8s.plus20.StatefulSetProps.parameter.strategy"></a>

- *Type:* [`org.cdk8s.plus20.StatefulSetUpdateStrategy`](#org.cdk8s.plus20.StatefulSetUpdateStrategy)
- *Default:* RollingUpdate with partition set to 0

Indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.

---

#### Methods <a name="Methods"></a>

##### `addContainer` <a name="org.cdk8s.plus20.StatefulSet.addContainer"></a>
Expand Down Expand Up @@ -4437,6 +4447,18 @@ public PodSecurityContext getSecurityContext();

---

##### `strategy`<sup>Required</sup> <a name="org.cdk8s.plus20.StatefulSet.property.strategy"></a>

```java
public StatefulSetUpdateStrategy getStrategy();
```

- *Type:* [`org.cdk8s.plus20.StatefulSetUpdateStrategy`](#org.cdk8s.plus20.StatefulSetUpdateStrategy)

The update startegy of this stateful set.

---

##### `volumes`<sup>Required</sup> <a name="org.cdk8s.plus20.StatefulSet.property.volumes"></a>

```java
Expand Down Expand Up @@ -9929,6 +9951,7 @@ StatefulSetProps.builder()
// .defaultSelector(java.lang.Boolean)
// .podManagementPolicy(PodManagementPolicy)
// .replicas(java.lang.Number)
// .strategy(StatefulSetUpdateStrategy)
.build();
```

Expand Down Expand Up @@ -10146,6 +10169,52 @@ Number of desired pods.

---

##### `strategy`<sup>Optional</sup> <a name="org.cdk8s.plus20.StatefulSetProps.property.strategy"></a>

```java
public StatefulSetUpdateStrategy getStrategy();
```

- *Type:* [`org.cdk8s.plus20.StatefulSetUpdateStrategy`](#org.cdk8s.plus20.StatefulSetUpdateStrategy)
- *Default:* RollingUpdate with partition set to 0

Indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.

---

### StatefulSetUpdateStrategyRollingUpdateOptions <a name="org.cdk8s.plus20.StatefulSetUpdateStrategyRollingUpdateOptions"></a>

Options for `StatefulSetUpdateStrategy.rollingUpdate`.

#### Initializer <a name="[object Object].Initializer"></a>

```java
import org.cdk8s.plus20.StatefulSetUpdateStrategyRollingUpdateOptions;

StatefulSetUpdateStrategyRollingUpdateOptions.builder()
// .partition(java.lang.Number)
.build();
```

##### `partition`<sup>Optional</sup> <a name="org.cdk8s.plus20.StatefulSetUpdateStrategyRollingUpdateOptions.property.partition"></a>

```java
public java.lang.Number getPartition();
```

- *Type:* `java.lang.Number`
- *Default:* 0

If specified, all Pods with an ordinal that is greater than or equal to the partition will be updated when the StatefulSet's .spec.template is updated. All Pods with an ordinal that is less than the partition will not be updated, and, even if they are deleted, they will be recreated at the previous version.

If the partition is greater than replicas, updates to the pod template will not be propagated to Pods.
In most cases you will not need to use a partition, but they are useful if you want to stage an
update, roll out a canary, or perform a phased roll out.

> https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions

---

### Sysctl <a name="org.cdk8s.plus20.Sysctl"></a>

Sysctl defines a kernel parameter to be set.
Expand Down Expand Up @@ -12072,6 +12141,38 @@ Options.



### StatefulSetUpdateStrategy <a name="org.cdk8s.plus20.StatefulSetUpdateStrategy"></a>

StatefulSet update strategies.


#### Static Functions <a name="Static Functions"></a>

##### `onDelete` <a name="org.cdk8s.plus20.StatefulSetUpdateStrategy.onDelete"></a>

```java
import org.cdk8s.plus20.StatefulSetUpdateStrategy;

StatefulSetUpdateStrategy.onDelete()
```

##### `rollingUpdate` <a name="org.cdk8s.plus20.StatefulSetUpdateStrategy.rollingUpdate"></a>

```java
import org.cdk8s.plus20.StatefulSetUpdateStrategy;

StatefulSetUpdateStrategy.rollingUpdate()
StatefulSetUpdateStrategy.rollingUpdate(StatefulSetUpdateStrategyRollingUpdateOptions options)
```

###### `options`<sup>Optional</sup> <a name="org.cdk8s.plus20.StatefulSetUpdateStrategy.parameter.options"></a>

- *Type:* [`org.cdk8s.plus20.StatefulSetUpdateStrategyRollingUpdateOptions`](#org.cdk8s.plus20.StatefulSetUpdateStrategyRollingUpdateOptions)

---



### Volume <a name="org.cdk8s.plus20.Volume"></a>

- *Implements:* [`org.cdk8s.plus20.IStorage`](#org.cdk8s.plus20.IStorage)
Expand Down
115 changes: 113 additions & 2 deletions docs/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -5917,7 +5917,8 @@ cdk8s_plus_20.StatefulSet(
service: Service,
default_selector: bool = None,
pod_management_policy: PodManagementPolicy = None,
replicas: typing.Union[int, float] = None
replicas: typing.Union[int, float] = None,
strategy: StatefulSetUpdateStrategy = None
)
```

Expand Down Expand Up @@ -6091,6 +6092,15 @@ Number of desired pods.

---

##### `strategy`<sup>Optional</sup> <a name="cdk8s_plus_20.StatefulSetProps.parameter.strategy"></a>

- *Type:* [`cdk8s_plus_20.StatefulSetUpdateStrategy`](#cdk8s_plus_20.StatefulSetUpdateStrategy)
- *Default:* RollingUpdate with partition set to 0

Indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.

---

#### Methods <a name="Methods"></a>

##### `add_container` <a name="cdk8s_plus_20.StatefulSet.add_container"></a>
Expand Down Expand Up @@ -6642,6 +6652,18 @@ security_context: PodSecurityContext

---

##### `strategy`<sup>Required</sup> <a name="cdk8s_plus_20.StatefulSet.property.strategy"></a>

```python
strategy: StatefulSetUpdateStrategy
```

- *Type:* [`cdk8s_plus_20.StatefulSetUpdateStrategy`](#cdk8s_plus_20.StatefulSetUpdateStrategy)

The update startegy of this stateful set.

---

##### `volumes`<sup>Required</sup> <a name="cdk8s_plus_20.StatefulSet.property.volumes"></a>

```python
Expand Down Expand Up @@ -12135,7 +12157,8 @@ cdk8s_plus_20.StatefulSetProps(
service: Service,
default_selector: bool = None,
pod_management_policy: PodManagementPolicy = None,
replicas: typing.Union[int, float] = None
replicas: typing.Union[int, float] = None,
strategy: StatefulSetUpdateStrategy = None
)
```

Expand Down Expand Up @@ -12353,6 +12376,52 @@ Number of desired pods.

---

##### `strategy`<sup>Optional</sup> <a name="cdk8s_plus_20.StatefulSetProps.property.strategy"></a>

```python
strategy: StatefulSetUpdateStrategy
```

- *Type:* [`cdk8s_plus_20.StatefulSetUpdateStrategy`](#cdk8s_plus_20.StatefulSetUpdateStrategy)
- *Default:* RollingUpdate with partition set to 0

Indicates the StatefulSetUpdateStrategy that will be employed to update Pods in the StatefulSet when a revision is made to Template.

---

### StatefulSetUpdateStrategyRollingUpdateOptions <a name="cdk8s_plus_20.StatefulSetUpdateStrategyRollingUpdateOptions"></a>

Options for `StatefulSetUpdateStrategy.rollingUpdate`.

#### Initializer <a name="[object Object].Initializer"></a>

```python
import cdk8s_plus_20

cdk8s_plus_20.StatefulSetUpdateStrategyRollingUpdateOptions(
partition: typing.Union[int, float] = None
)
```

##### `partition`<sup>Optional</sup> <a name="cdk8s_plus_20.StatefulSetUpdateStrategyRollingUpdateOptions.property.partition"></a>

```python
partition: typing.Union[int, float]
```

- *Type:* `typing.Union[int, float]`
- *Default:* 0

If specified, all Pods with an ordinal that is greater than or equal to the partition will be updated when the StatefulSet's .spec.template is updated. All Pods with an ordinal that is less than the partition will not be updated, and, even if they are deleted, they will be recreated at the previous version.

If the partition is greater than replicas, updates to the pod template will not be propagated to Pods.
In most cases you will not need to use a partition, but they are useful if you want to stage an
update, roll out a canary, or perform a phased roll out.

> https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions

---

### Sysctl <a name="cdk8s_plus_20.Sysctl"></a>

Sysctl defines a kernel parameter to be set.
Expand Down Expand Up @@ -15008,6 +15077,48 @@ The TCP port to connect to on the container.



### StatefulSetUpdateStrategy <a name="cdk8s_plus_20.StatefulSetUpdateStrategy"></a>

StatefulSet update strategies.


#### Static Functions <a name="Static Functions"></a>

##### `on_delete` <a name="cdk8s_plus_20.StatefulSetUpdateStrategy.on_delete"></a>

```python
import cdk8s_plus_20

cdk8s_plus_20.StatefulSetUpdateStrategy.on_delete()
```

##### `rolling_update` <a name="cdk8s_plus_20.StatefulSetUpdateStrategy.rolling_update"></a>

```python
import cdk8s_plus_20

cdk8s_plus_20.StatefulSetUpdateStrategy.rolling_update(
partition: typing.Union[int, float] = None
)
```

###### `partition`<sup>Optional</sup> <a name="cdk8s_plus_20.StatefulSetUpdateStrategyRollingUpdateOptions.parameter.partition"></a>

- *Type:* `typing.Union[int, float]`
- *Default:* 0

If specified, all Pods with an ordinal that is greater than or equal to the partition will be updated when the StatefulSet's .spec.template is updated. All Pods with an ordinal that is less than the partition will not be updated, and, even if they are deleted, they will be recreated at the previous version.

If the partition is greater than replicas, updates to the pod template will not be propagated to Pods.
In most cases you will not need to use a partition, but they are useful if you want to stage an
update, roll out a canary, or perform a phased roll out.

> https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions

---



### Volume <a name="cdk8s_plus_20.Volume"></a>

- *Implements:* [`cdk8s_plus_20.IStorage`](#cdk8s_plus_20.IStorage)
Expand Down

0 comments on commit ee50a00

Please sign in to comment.