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

Update README and cue files for populating the fields table #20

Merged
merged 1 commit into from
Feb 8, 2024
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
416 changes: 306 additions & 110 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cue.mod/pkg/timoni.sh/core/v1alpha1/image.cue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (

// Reference is the image address computed from repository, tag and digest
// in the format [REPOSITORY]:[TAG]@[DIGEST].
// +nodoc
reference: string

if digest != "" && tag != "" {
Expand Down
9 changes: 7 additions & 2 deletions cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ import "strings"

// Standard Kubernetes labels: app name, version and managed-by.
labels: {
"\(#StdLabelName)": name
"\(#StdLabelVersion)": #Version
// +nodoc
"\(#StdLabelName)": name
// +nodoc
"\(#StdLabelVersion)": #Version
// +nodoc
"\(#StdLabelManagedBy)": "timoni"
}

Expand All @@ -69,6 +72,7 @@ import "strings"
namespace: #Meta.namespace

labels: #Meta.labels
// +nodoc
labels: "\(#StdLabelComponent)": #Component

annotations?: #Annotations
Expand Down Expand Up @@ -99,6 +103,7 @@ import "strings"
name: #Meta.name + "-" + #Component

labels: #Meta.labels
// +nodoc
labels: "\(#StdLabelComponent)": #Component

annotations?: #Annotations
Expand Down
1 change: 1 addition & 0 deletions cue.mod/pkg/timoni.sh/core/v1alpha1/selector.cue
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ package v1alpha1
labels: #Labels

// Standard Kubernetes label: app name.
// +nodoc
labels: "\(#StdLabelName)": #Name
}
2 changes: 2 additions & 0 deletions cue.mod/pkg/timoni.sh/core/v1alpha1/semver.cue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ import (
let minMajor = strconv.Atoi(strings.Split(#Minimum, ".")[0])
let minMinor = strconv.Atoi(strings.Split(#Minimum, ".")[1])

// +nodoc
major: int & >=minMajor
major: strconv.Atoi(strings.Split(#Version, ".")[0])

// +nodoc
minor: int & >=minMinor
minor: strconv.Atoi(strings.Split(#Version, ".")[1])
}
1 change: 1 addition & 0 deletions templates/config/component.cue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
livenessProbe: corev1.#Probe
// is a selector which must be true for the pod to fit on a node.
nodeSelector: timoniv1.#Labels
// +nodoc
nodeSelector: "kubernetes.io/os": "linux"
// is the annotations for the pod.
podAnnotations?: timoniv1.#Annotations
Expand Down
16 changes: 9 additions & 7 deletions templates/config/config.cue
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@ import (
#Config: {
// The kubeVersion is a required field, set at apply-time
// via timoni.cue by querying the user's Kubernetes API.
// +nodoc
kubeVersion!: string
// Using the kubeVersion you can enforce a minimum Kubernetes minor version.
// By default, the minimum Kubernetes version is set to 1.20.
// +nodoc
clusterVersion: timoniv1.#SemVer & {#Version: kubeVersion, #Minimum: "1.27.0"}

// The moduleVersion is set from the user-supplied module version.
// This field is used for the `app.kubernetes.io/version` label.
// +nodoc
moduleVersion!: string

// Metadata (common to all resources)
metadata: timoniv1.#Metadata & {#Version: moduleVersion}
// +nodoc
metadata: labels: (timoniv1.#StdLabelPartOf): "cert-manager"

// Reference to one or more secrets to be used when pulling images
Expand Down Expand Up @@ -50,12 +54,6 @@ import (
highAvailability: {
// Enable high availability features
enabled: *false | true
// Number of replicas of the cert-manager controller to run
controllerReplicas: *2 | int
// Number of replicas of the cert-manager webhook to run
webhookReplicas: *3 | int
// Number of replicas of the cert-manager caInjector to run
caInjectorReplicas: *2 | int
}

leaderElection: {
Expand All @@ -79,21 +77,25 @@ import (
monitoring: #Monitoring & {
namespace: *metadata.namespace | string
}

if highAvailability.enabled {
replicas: *2 | uint16 & >2
}

podDisruptionBudget: enabled: *highAvailability.enabled | bool
}
webhook: #Webhook & {
if highAvailability.enabled {
replicas: *3 | uint16 & >3
}

podDisruptionBudget: enabled: *highAvailability.enabled | bool
}
caInjector: #CAInjector & {
if highAvailability.enabled {
replicas: *2 | uint16 & >2
}

podDisruptionBudget: enabled: *highAvailability.enabled | bool
}

Expand All @@ -108,7 +110,7 @@ import (

#Duration: string & =~"^[+-]?((\\d+h)?(\\d+m)?(\\d+s)?(\\d+ms)?(\\d+(us|µs))?(\\d+ns)?)$"
#Percent: string & =~"^(100|[1-9][0-9]?)%$"
#PdbValue: (int &>=0) | #Percent
#PdbValue: (int & >=0) | #Percent

#Monitoring: {
// Enable Prometheus monitoring for the cert-manager controller to use with the Prometheus Operator.
Expand Down
9 changes: 7 additions & 2 deletions timoni.cue
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ timoni: {
config: values
// These values are injected at runtime by Timoni.
config: {
// +nodoc
metadata: {
name: string @tag(name)
// +nodoc
name: string @tag(name)
// +nodoc
namespace: string @tag(namespace)
}
// +nodoc
moduleVersion: string @tag(mv, var=moduleVersion)
kubeVersion: string @tag(kv, var=kubeVersion)
// +nodoc
kubeVersion: string @tag(kv, var=kubeVersion)
}
}

Expand Down
Loading