Skip to content

Commit 6e82434

Browse files
authored
Merge pull request #293 from stefanprodan/objref
Add `#ObjectReference` to Timoni's CUE schemas
2 parents c4c685a + 9a56cc1 commit 6e82434

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

Diff for: examples/minimal/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ timoni -n default delete minimal
5252
| `metadata: labels:` | `{[ string]: string}` | `{}` | Common labels for all resources |
5353
| `metadata: annotations:` | `{[ string]: string}` | `{}` | Common annotations for all resources |
5454
| `podAnnotations:` | `{[ string]: string}` | `{}` | Annotations applied to pods |
55-
| `imagePullSecrets:` | `[...corev1.LocalObjectReference]` | `[]` | [Kubernetes image pull secrets](https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod) |
55+
| `imagePullSecrets:` | `[...timoniv1.ObjectReference]` | `[]` | [Kubernetes image pull secrets](https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod) |
5656
| `tolerations:` | `[ ...corev1.#Toleration]` | `[]` | [Kubernetes toleration](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration) |
5757
| `affinity:` | `corev1.#Affinity` | `{}` | [Kubernetes affinity and anti-affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) |
5858
| `resources:` | `timoniv1.#ResourceRequirements` | `{}` | [Kubernetes resource requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers) |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2023 Stefan Prodan
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package v1alpha1
5+
6+
import "strings"
7+
8+
// ObjectReference is a reference to a Kubernetes object.
9+
#ObjectReference: {
10+
// Name of the referent.
11+
name!: string & strings.MaxRunes(256)
12+
13+
// Namespace of the referent.
14+
namespace?: string & strings.MaxRunes(256)
15+
16+
// API version of the referent.
17+
apiVersion?: string & strings.MaxRunes(256)
18+
19+
// Kind of the referent.
20+
kind?: string & strings.MaxRunes(256)
21+
}

Diff for: examples/minimal/templates/config.cue

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ import (
7777
// Pod optional settings.
7878
podAnnotations?: {[string]: string}
7979
podSecurityContext?: corev1.#PodSecurityContext
80-
imagePullSecrets?: [...corev1.LocalObjectReference]
80+
imagePullSecrets?: [...timoniv1.ObjectReference]
8181
tolerations?: [...corev1.#Toleration]
8282
affinity?: corev1.#Affinity
8383
topologySpreadConstraints?: [...corev1.#TopologySpreadConstraint]

Diff for: schemas/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ The Timoni's CUE schemas are included in the modules generated with `timoni mod
2121
with automatic generation of `app.kubernetes.io/component` label.
2222
- `#Selector` - Schema for generating Kubernetes label selectors
2323
with automatic generation of `app.kubernetes.io/name` label.
24+
- `#ObjectReference` - Schema for generating Kubernetes object references
25+
based on `apiVersion`, `kind`, `name` and `namespace`.
2426

2527
### Container Image
2628

Diff for: schemas/timoni.sh/core/v1alpha1/object.cue

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2023 Stefan Prodan
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package v1alpha1
5+
6+
import "strings"
7+
8+
// ObjectReference is a reference to a Kubernetes object.
9+
#ObjectReference: {
10+
// Name of the referent.
11+
name!: string & strings.MaxRunes(256)
12+
13+
// Namespace of the referent.
14+
namespace?: string & strings.MaxRunes(256)
15+
16+
// API version of the referent.
17+
apiVersion?: string & strings.MaxRunes(256)
18+
19+
// Kind of the referent.
20+
kind?: string & strings.MaxRunes(256)
21+
}

0 commit comments

Comments
 (0)