Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node affinity to example modules #236

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions docs/bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bundle: {
}
podinfo: {
module: url: "oci://ghcr.io/stefanprodan/modules/podinfo"
module: version: "6.5.2"
module: version: "6.5.3"
namespace: "podinfo"
values: caching: {
enabled: true
Expand Down Expand Up @@ -84,8 +84,8 @@ Apply the Bundle on the cluster:
waiting for 2 resource(s) to become ready...
resources are ready
applying instance podinfo
pulling oci://ghcr.io/stefanprodan/modules/podinfo:6.5.2
using module timoni.sh/podinfo version 6.5.2
pulling oci://ghcr.io/stefanprodan/modules/podinfo:6.5.3
using module timoni.sh/podinfo version 6.5.3
installing podinfo in namespace podinfo
ServiceAccount/podinfo/podinfo created
Service/podinfo/podinfo created
Expand Down Expand Up @@ -125,7 +125,7 @@ Build the Bundle and print the resulting Kubernetes resources for all the Bundle
metadata:
labels:
app.kubernetes.io/name: podinfo
app.kubernetes.io/version: 6.5.2
app.kubernetes.io/version: 6.5.3
name: podinfo
namespace: podinfo
---
Expand All @@ -145,7 +145,7 @@ List the managed resources from a bundle and their rollout status:
```text
last applied 2023-10-08T20:21:19Z
module oci://ghcr.io/stefanprodan/modules/redis:7.2.2
digest: sha256:0e1f9cfbd020230e4e9f8c3b14bc728df932793d02d4f0a26512737af6df2dc8
digest: sha256:22ab5f4f0158f02b353c168f21a54901a45b2a56865fcc470e5492120deb4111
ServiceAccount/podinfo/redis Current Resource is current
ConfigMap/podinfo/redis Current Resource is always ready
Service/podinfo/redis Current Service is ready
Expand All @@ -155,8 +155,8 @@ List the managed resources from a bundle and their rollout status:
PersistentVolumeClaim/podinfo/redis-master Current PVC is Bound

last applied 2023-10-08T20:21:19Z
module oci://ghcr.io/stefanprodan/modules/podinfo:6.5.2
digest: sha256:6feb340acfc8f566bad9d4fa1e71a3cd0feade41a00750428b4f1b0b5e3c86a0
module oci://ghcr.io/stefanprodan/modules/podinfo:6.5.3
digest: sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f
ServiceAccount/podinfo/podinfo Current Resource is always ready
Service/podinfo/podinfo Current Service is ready
Deployment/podinfo/podinfo Current Deployment is available. Replicas: 1
Expand All @@ -174,7 +174,7 @@ List the instances in Bundle `podinfo` across all namespaces:

```text
NAME NAMESPACE MODULE VERSION LAST APPLIED BUNDLE
podinfo podinfo oci://ghcr.io/stefanprodan/modules/podinfo 6.5.2 2023-09-10T16:20:07Z podinfo
podinfo podinfo oci://ghcr.io/stefanprodan/modules/podinfo 6.5.3 2023-09-10T16:20:07Z podinfo
redis podinfo oci://ghcr.io/stefanprodan/modules/redis 7.2.2 2023-09-10T16:20:00Z podinfo
```

Expand Down Expand Up @@ -254,7 +254,7 @@ When not specified, the version defaults to `latest`, which pulls the module OCI
```cue
module: {
url: "oci://ghcr.io/stefanprodan/modules/podinfo"
version: "6.5.2"
version: "6.5.3"
}
```

Expand All @@ -270,7 +270,7 @@ The `instance.module.digest` is an optional field that specifies the OCI digest
```cue
module: {
url: "oci://ghcr.io/stefanprodan/modules/podinfo"
digest: "sha256:6feb340acfc8f566bad9d4fa1e71a3cd0feade41a00750428b4f1b0b5e3c86a0"
digest: "sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f"
}
```

Expand All @@ -280,8 +280,8 @@ upstream digest of the version matches the specified `instance.module.digest`.
```cue
module: {
url: "oci://ghcr.io/stefanprodan/modules/podinfo"
version: "6.5.2"
digest: "sha256:6feb340acfc8f566bad9d4fa1e71a3cd0feade41a00750428b4f1b0b5e3c86a0"
version: "6.5.3"
digest: "sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f"
}
```

Expand Down
8 changes: 4 additions & 4 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ in a new namespace:
```console
$ timoni -n test apply podinfo oci://ghcr.io/stefanprodan/modules/podinfo --version latest
pulling oci://ghcr.io/stefanprodan/modules/podinfo:latest
using module timoni.sh/podinfo version 6.5.2
using module timoni.sh/podinfo version 6.5.3
installing podinfo in namespace test
Namespace/test created
ServiceAccount/test/podinfo created
Expand All @@ -57,9 +57,9 @@ To get more information on an instance, you can use the `timoni inspect` sub-com
```console
$ timoni -n test inspect module podinfo
name: timoni.sh/podinfo
version: 6.5.2
version: 6.5.3
repository: oci://ghcr.io/stefanprodan/modules/podinfo
digest: sha256:0e1f9cfbd020230e4e9f8c3b14bc728df932793d02d4f0a26512737af6df2dc8
digest: sha256:22ab5f4f0158f02b353c168f21a54901a45b2a56865fcc470e5492120deb4111
```

To learn more about the available commands, use `timoni inspect --help`.
Expand Down Expand Up @@ -134,7 +134,7 @@ bundle: {
}
podinfo: {
module: url: "oci://ghcr.io/stefanprodan/modules/podinfo"
module: version: "6.5.2"
module: version: "6.5.3"
namespace: "podinfo"
values: caching: {
enabled: true
Expand Down
6 changes: 3 additions & 3 deletions examples/bundles/podinfo.cue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bundle: {
module: {
url: "oci://ghcr.io/stefanprodan/modules/redis"
version: "7.2.2"
digest: "sha256:0e1f9cfbd020230e4e9f8c3b14bc728df932793d02d4f0a26512737af6df2dc8"
digest: "sha256:22ab5f4f0158f02b353c168f21a54901a45b2a56865fcc470e5492120deb4111"
}
namespace: "podinfo"
values: {
Expand All @@ -23,8 +23,8 @@ bundle: {
podinfo: {
module: {
url: "oci://ghcr.io/stefanprodan/modules/podinfo"
version: "6.5.2"
digest: "sha256:6feb340acfc8f566bad9d4fa1e71a3cd0feade41a00750428b4f1b0b5e3c86a0"
version: "6.5.3"
digest: "sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f"
}
namespace: "podinfo"
values: caching: {
Expand Down
1 change: 1 addition & 0 deletions examples/minimal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ timoni -n default delete minimal
| `topologySpreadConstraints:` | `[...corev1.#TopologySpreadConstraint]` | `[]` | [Kubernetes pod topology spread constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints) |
| `podSecurityContext:` | `corev1.#PodSecurityContext` | `{}` | [Kubernetes pod security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context) |
| `securityContext:` | `corev1.#SecurityContext` | `{}` | [Kubernetes container security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context) |
| `test: enabled:` | `bool` | `false` | Run end-to-end tests at install and upgrades |

#### Recommended values

Expand Down
7 changes: 7 additions & 0 deletions examples/minimal/debug_values.cue
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@ values: {
digest: ""
}
}
affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: [{
matchExpressions: [{
key: "kubernetes.io/os"
operator: "In"
values: ["linux"]
}]
}]
}
30 changes: 15 additions & 15 deletions examples/minimal/templates/job.cue
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ import (
]
}]
restartPolicy: "Never"
if _config.podSecurityContext != _|_ {
securityContext: _config.podSecurityContext
}
if _config.topologySpreadConstraints != _|_ {
topologySpreadConstraints: _config.topologySpreadConstraints
}
if _config.affinity != _|_ {
affinity: _config.affinity
}
if _config.tolerations != _|_ {
tolerations: _config.tolerations
}
if _config.imagePullSecrets != _|_ {
imagePullSecrets: _config.imagePullSecrets
}
}
}
backoffLimit: 1
if _config.podSecurityContext != _|_ {
securityContext: _config.podSecurityContext
}
if _config.topologySpreadConstraints != _|_ {
topologySpreadConstraints: _config.topologySpreadConstraints
}
if _config.affinity != _|_ {
affinity: _config.affinity
}
if _config.tolerations != _|_ {
tolerations: _config.tolerations
}
if _config.imagePullSecrets != _|_ {
imagePullSecrets: _config.imagePullSecrets
}
}
}
11 changes: 10 additions & 1 deletion examples/redis/templates/config.cue
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,19 @@ import (
seccompProfile: type: "RuntimeDefault"
} | corev1.#SecurityContext

// Pod affinity settings (common to all deployments)
affinity: corev1.#Affinity
affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: [{
matchExpressions: [{
key: "kubernetes.io/os"
operator: "In"
values: ["linux"]
}]
}]

// Pod optional settings (common to all deployments)
podAnnotations?: {[ string]: string}
tolerations?: [ ...corev1.#Toleration]
affinity?: corev1.#Affinity
topologySpreadConstraints?: [...corev1.#TopologySpreadConstraint]

// Service
Expand Down
2 changes: 1 addition & 1 deletion examples/redis/values.cue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ values: {
image: {
repository: "cgr.dev/chainguard/redis"
tag: "7.2.2"
digest: "sha256:8969ecdfa82ed7d0d10596163ba9b7063879e0b1ccb57d054d10aa9d99bd1ce5"
digest: "sha256:4622102d87353643c6fe0b9d6607e740aef7cdd59cc90e8f275a06c4642a584c"
}
}