Skip to content

Commit

Permalink
feat(helm): namespace, version and repo extracted to dedicated …
Browse files Browse the repository at this point in the history
…properties (#947)

Fixes #940

Signed-off-by: Yair Fried <5310525+yfried@users.noreply.github.com>
  • Loading branch information
yfried authored Dec 28, 2022
1 parent b6309a5 commit 4436532
Show file tree
Hide file tree
Showing 5 changed files with 270 additions and 2 deletions.
78 changes: 78 additions & 0 deletions docs/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,11 @@ Helm.Builder.create(Construct scope, java.lang.String id)
.chart(java.lang.String)
// .helmExecutable(java.lang.String)
// .helmFlags(java.util.List<java.lang.String>)
// .namespace(java.lang.String)
// .releaseName(java.lang.String)
// .repo(java.lang.String)
// .values(java.util.Map<java.lang.String, java.lang.Object>)
// .version(java.lang.String)
.build();
```

Expand Down Expand Up @@ -525,6 +528,14 @@ Additional flags to add to the `helm` execution.

---

##### `namespace`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.parameter.namespace"></a>

- *Type:* `java.lang.String`

Scope all resources in to a given namespace.

---

##### `releaseName`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.parameter.releaseName"></a>

- *Type:* `java.lang.String`
Expand All @@ -536,6 +547,14 @@ The release name.
---

##### `repo`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.parameter.repo"></a>

- *Type:* `java.lang.String`

Chart repository url where to locate the requested chart.

---

##### `values`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.parameter.values"></a>

- *Type:* java.util.Map<java.lang.String, `java.lang.Object`>
Expand All @@ -545,6 +564,20 @@ Values to pass to the chart.

---

##### `version`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.parameter.version"></a>

- *Type:* `java.lang.String`

Version constraint for the chart version to use.

This constraint can be a specific tag (e.g. 1.1.1)
or it may reference a valid range (e.g. ^2.0.0).
If this is not specified, the latest version is used

This name is passed to `helm template --version` and has all the relevant semantics.

---



#### Properties <a name="Properties"></a>
Expand Down Expand Up @@ -1079,8 +1112,11 @@ HelmProps.builder()
.chart(java.lang.String)
// .helmExecutable(java.lang.String)
// .helmFlags(java.util.List<java.lang.String>)
// .namespace(java.lang.String)
// .releaseName(java.lang.String)
// .repo(java.lang.String)
// .values(java.util.Map<java.lang.String, java.lang.Object>)
// .version(java.lang.String)
.build();
```

Expand Down Expand Up @@ -1124,6 +1160,18 @@ Additional flags to add to the `helm` execution.

---

##### `namespace`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.property.namespace"></a>

```java
public java.lang.String getNamespace();
```

- *Type:* `java.lang.String`

Scope all resources in to a given namespace.

---

##### `releaseName`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.property.releaseName"></a>

```java
Expand All @@ -1139,6 +1187,18 @@ The release name.
---

##### `repo`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.property.repo"></a>

```java
public java.lang.String getRepo();
```

- *Type:* `java.lang.String`

Chart repository url where to locate the requested chart.

---

##### `values`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.property.values"></a>

```java
Expand All @@ -1152,6 +1212,24 @@ Values to pass to the chart.

---

##### `version`<sup>Optional</sup> <a name="org.cdk8s.HelmProps.property.version"></a>

```java
public java.lang.String getVersion();
```

- *Type:* `java.lang.String`

Version constraint for the chart version to use.

This constraint can be a specific tag (e.g. 1.1.1)
or it may reference a valid range (e.g. ^2.0.0).
If this is not specified, the latest version is used

This name is passed to `helm template --version` and has all the relevant semantics.

---

### IncludeProps <a name="org.cdk8s.IncludeProps"></a>

#### Initializer <a name="[object Object].Initializer"></a>
Expand Down
82 changes: 80 additions & 2 deletions docs/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,11 @@ cdk8s.Helm(
chart: str,
helm_executable: str = None,
helm_flags: typing.List[str] = None,
namespace: str = None,
release_name: str = None,
values: typing.Mapping[typing.Any] = None
repo: str = None,
values: typing.Mapping[typing.Any] = None,
version: str = None
)
```

Expand Down Expand Up @@ -545,6 +548,14 @@ Additional flags to add to the `helm` execution.

---

##### `namespace`<sup>Optional</sup> <a name="cdk8s.HelmProps.parameter.namespace"></a>

- *Type:* `str`

Scope all resources in to a given namespace.

---

##### `release_name`<sup>Optional</sup> <a name="cdk8s.HelmProps.parameter.release_name"></a>

- *Type:* `str`
Expand All @@ -556,6 +567,14 @@ The release name.
---

##### `repo`<sup>Optional</sup> <a name="cdk8s.HelmProps.parameter.repo"></a>

- *Type:* `str`

Chart repository url where to locate the requested chart.

---

##### `values`<sup>Optional</sup> <a name="cdk8s.HelmProps.parameter.values"></a>

- *Type:* typing.Mapping[`typing.Any`]
Expand All @@ -565,6 +584,20 @@ Values to pass to the chart.

---

##### `version`<sup>Optional</sup> <a name="cdk8s.HelmProps.parameter.version"></a>

- *Type:* `str`

Version constraint for the chart version to use.

This constraint can be a specific tag (e.g. 1.1.1)
or it may reference a valid range (e.g. ^2.0.0).
If this is not specified, the latest version is used

This name is passed to `helm template --version` and has all the relevant semantics.

---



#### Properties <a name="Properties"></a>
Expand Down Expand Up @@ -1101,8 +1134,11 @@ cdk8s.HelmProps(
chart: str,
helm_executable: str = None,
helm_flags: typing.List[str] = None,
namespace: str = None,
release_name: str = None,
values: typing.Mapping[typing.Any] = None
repo: str = None,
values: typing.Mapping[typing.Any] = None,
version: str = None
)
```

Expand Down Expand Up @@ -1146,6 +1182,18 @@ Additional flags to add to the `helm` execution.

---

##### `namespace`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.namespace"></a>

```python
namespace: str
```

- *Type:* `str`

Scope all resources in to a given namespace.

---

##### `release_name`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.release_name"></a>

```python
Expand All @@ -1161,6 +1209,18 @@ The release name.
---

##### `repo`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.repo"></a>

```python
repo: str
```

- *Type:* `str`

Chart repository url where to locate the requested chart.

---

##### `values`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.values"></a>

```python
Expand All @@ -1174,6 +1234,24 @@ Values to pass to the chart.

---

##### `version`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.version"></a>

```python
version: str
```

- *Type:* `str`

Version constraint for the chart version to use.

This constraint can be a specific tag (e.g. 1.1.1)
or it may reference a valid range (e.g. ^2.0.0).
If this is not specified, the latest version is used

This name is passed to `helm template --version` and has all the relevant semantics.

---

### IncludeProps <a name="cdk8s.IncludeProps"></a>

#### Initializer <a name="[object Object].Initializer"></a>
Expand Down
42 changes: 42 additions & 0 deletions docs/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,18 @@ Additional flags to add to the `helm` execution.

---

##### `namespace`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.namespace"></a>

```typescript
public readonly namespace: string;
```

- *Type:* `string`

Scope all resources in to a given namespace.

---

##### `releaseName`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.releaseName"></a>

```typescript
Expand All @@ -971,6 +983,18 @@ The release name.
---

##### `repo`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.repo"></a>

```typescript
public readonly repo: string;
```

- *Type:* `string`

Chart repository url where to locate the requested chart.

---

##### `values`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.values"></a>

```typescript
Expand All @@ -984,6 +1008,24 @@ Values to pass to the chart.

---

##### `version`<sup>Optional</sup> <a name="cdk8s.HelmProps.property.version"></a>

```typescript
public readonly version: string;
```

- *Type:* `string`

Version constraint for the chart version to use.

This constraint can be a specific tag (e.g. 1.1.1)
or it may reference a valid range (e.g. ^2.0.0).
If this is not specified, the latest version is used

This name is passed to `helm template --version` and has all the relevant semantics.

---

### IncludeProps <a name="cdk8s.IncludeProps"></a>

#### Initializer <a name="[object Object].Initializer"></a>
Expand Down
35 changes: 35 additions & 0 deletions src/helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@ export interface HelmProps {
*/
readonly chart: string;

/**
* Chart repository url where to locate the requested chart
*/
readonly repo?: string;

/**
* Version constraint for the chart version to use.
* This constraint can be a specific tag (e.g. 1.1.1)
* or it may reference a valid range (e.g. ^2.0.0).
* If this is not specified, the latest version is used
*
* This name is passed to `helm template --version` and has all the relevant semantics.
*
* @example "1.1.1"
* @example "^2.0.0"
*/
readonly version?: string;

/**
* Scope all resources in to a given namespace.
*/
readonly namespace?: string;

/**
* The release name.
*
Expand Down Expand Up @@ -77,6 +100,18 @@ export class Helm extends Include {
args.push('-f', valuesPath);
}

if (props.repo) {
args.push('--repo', props.repo);
}

if (props.version) {
args.push('--version', props.version);
}

if (props.namespace) {
args.push('--namespace', props.namespace);
}

// custom flags
if (props.helmFlags) {
args.push(...props.helmFlags);
Expand Down
Loading

0 comments on commit 4436532

Please sign in to comment.