-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
ContainerSet
full Hera object (#632)
<!-- Thank you for submitting a PR to Hera! 🚀 --> **Pull Request Checklist** - [x] Fixes #631 - [x] Tests added - [x] Documentation/examples added - [x] [Good commit messages](https://cbea.ms/git-commit/) and/or PR title <!-- Also remember to sign off commits or the DCO check will fail on your PR! --> **Description of PR** <!-- If not linked to an issue, please describe your changes here --> See #631 for the reported issue. This PR fixes the problem by adding backwards compatible fields to the container node to be used under a container set. <!-- Piece of cake! ✨🍰✨ --> --------- Signed-off-by: Flaviu Vadan <flaviuvadan@gmail.com>
- Loading branch information
1 parent
e358864
commit 6e5a503
Showing
5 changed files
with
241 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Container Set With Env | ||
|
||
|
||
|
||
|
||
|
||
|
||
=== "Hera" | ||
|
||
```python linenums="1" | ||
from hera.workflows import ( | ||
ConfigMapEnv, | ||
ConfigMapEnvFrom, | ||
ContainerNode, | ||
ContainerSet, | ||
Env, | ||
ResourceEnv, | ||
SecretEnv, | ||
SecretEnvFrom, | ||
Workflow, | ||
) | ||
|
||
with Workflow(generate_name="secret-env-from-", entrypoint="whalesay") as w: | ||
with ContainerSet(name="whalesay"): | ||
ContainerNode( | ||
name="node", | ||
image="docker/whalesay:latest", | ||
command=["cowsay"], | ||
env_from=[ | ||
SecretEnvFrom(prefix="abc", name="secret", optional=False), | ||
ConfigMapEnvFrom(prefix="abc", name="configmap", optional=False), | ||
], | ||
env=[ | ||
Env(name="test", value="1"), | ||
SecretEnv(name="s1", secret_key="s1", secret_name="abc"), | ||
ResourceEnv(name="r1", resource="abc"), | ||
ConfigMapEnv(name="c1", config_map_key="c1", config_map_name="abc"), | ||
], | ||
) | ||
``` | ||
|
||
=== "YAML" | ||
|
||
```yaml linenums="1" | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: secret-env-from- | ||
spec: | ||
entrypoint: whalesay | ||
templates: | ||
- containerSet: | ||
containers: | ||
- command: | ||
- cowsay | ||
env: | ||
- name: test | ||
value: '1' | ||
- name: s1 | ||
valueFrom: | ||
secretKeyRef: | ||
key: s1 | ||
name: abc | ||
- name: r1 | ||
valueFrom: | ||
resourceFieldRef: | ||
resource: abc | ||
- name: c1 | ||
valueFrom: | ||
configMapKeyRef: | ||
key: c1 | ||
name: abc | ||
envFrom: | ||
- prefix: abc | ||
secretRef: | ||
name: secret | ||
optional: false | ||
- configMapRef: | ||
name: configmap | ||
optional: false | ||
prefix: abc | ||
image: docker/whalesay:latest | ||
name: node | ||
name: whalesay | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: secret-env-from- | ||
spec: | ||
entrypoint: whalesay | ||
templates: | ||
- containerSet: | ||
containers: | ||
- command: | ||
- cowsay | ||
env: | ||
- name: test | ||
value: '1' | ||
- name: s1 | ||
valueFrom: | ||
secretKeyRef: | ||
key: s1 | ||
name: abc | ||
- name: r1 | ||
valueFrom: | ||
resourceFieldRef: | ||
resource: abc | ||
- name: c1 | ||
valueFrom: | ||
configMapKeyRef: | ||
key: c1 | ||
name: abc | ||
envFrom: | ||
- prefix: abc | ||
secretRef: | ||
name: secret | ||
optional: false | ||
- configMapRef: | ||
name: configmap | ||
optional: false | ||
prefix: abc | ||
image: docker/whalesay:latest | ||
name: node | ||
name: whalesay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from hera.workflows import ( | ||
ConfigMapEnv, | ||
ConfigMapEnvFrom, | ||
ContainerNode, | ||
ContainerSet, | ||
Env, | ||
ResourceEnv, | ||
SecretEnv, | ||
SecretEnvFrom, | ||
Workflow, | ||
) | ||
|
||
with Workflow(generate_name="secret-env-from-", entrypoint="whalesay") as w: | ||
with ContainerSet(name="whalesay"): | ||
ContainerNode( | ||
name="node", | ||
image="docker/whalesay:latest", | ||
command=["cowsay"], | ||
env_from=[ | ||
SecretEnvFrom(prefix="abc", name="secret", optional=False), | ||
ConfigMapEnvFrom(prefix="abc", name="configmap", optional=False), | ||
], | ||
env=[ | ||
Env(name="test", value="1"), | ||
SecretEnv(name="s1", secret_key="s1", secret_name="abc"), | ||
ResourceEnv(name="r1", resource="abc"), | ||
ConfigMapEnv(name="c1", config_map_key="c1", config_map_name="abc"), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters