-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
- Loading branch information
1 parent
2cbe0fc
commit 26b6d30
Showing
12 changed files
with
91 additions
and
84 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
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
39 changes: 32 additions & 7 deletions
39
timoni/podinfo/cue.mod/pkg/timoni.sh/core/v1alpha1/image.cue
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 |
---|---|---|
@@ -1,19 +1,44 @@ | ||
// Copyright 2023 Stefan Prodan | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
// Image defines the schema for an OCI image reference. | ||
import "strings" | ||
|
||
// Image defines the schema for OCI image reference used in Kubernetes PodSpec container image. | ||
#Image: { | ||
|
||
// Repository is the address of a container registry repository. | ||
// An image repository is made up of slash-separated name components, optionally | ||
// prefixed by a registry hostname and port in the format [HOST[:PORT_NUMBER]/]PATH. | ||
repository!: string | ||
tag!: string | ||
digest!: string | ||
|
||
// Reference is the image address computed from | ||
// repository, tag and digest. | ||
// Tag identifies an image in the repository. | ||
// A tag name may contain lowercase and uppercase characters, digits, underscores, periods and dashes. | ||
// A tag name may not start with a period or a dash and may contain a maximum of 128 characters. | ||
tag!: string & strings.MaxRunes(128) | ||
|
||
// Digest uniquely and immutably identifies an image in the repository. | ||
// Spec: https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests. | ||
digest!: string | ||
|
||
// Reference is the image address computed from repository, tag and digest | ||
// in the format [REPOSITORY]:[TAG]@[DIGEST]. | ||
reference: string | ||
|
||
if digest != "" { | ||
if digest != "" && tag != "" { | ||
reference: "\(repository):\(tag)@\(digest)" | ||
} | ||
if digest == "" { | ||
|
||
if digest != "" && tag == "" { | ||
reference: "\(repository)@\(digest)" | ||
} | ||
|
||
if digest == "" && tag != "" { | ||
reference: "\(repository):\(tag)" | ||
} | ||
|
||
if digest == "" && tag == "" { | ||
reference: "\(repository):latest" | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
timoni/podinfo/cue.mod/pkg/timoni.sh/core/v1alpha1/selector.cue
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,21 @@ | ||
// Copyright 2023 Stefan Prodan | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import "strings" | ||
|
||
// Selector defines the schema for Kubernetes Pod label selector used in Deployments, Services, Jobs, etc. | ||
#Selector: { | ||
// Name must be unique within a namespace. Is required when creating resources. | ||
// Name is primarily intended for creation idempotence and configuration definition. | ||
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names | ||
#Name!: string & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) | ||
|
||
// Map of string keys and values that can be used to organize and categorize (scope and select) objects. | ||
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels | ||
labels: {[string & =~"^(([A-Za-z0-9][-A-Za-z0-9_./]*)?[A-Za-z0-9])?$" & strings.MaxRunes(63)]: string & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MaxRunes(63)} | ||
|
||
// Standard Kubernetes label: app name. | ||
labels: "app.kubernetes.io/name": #Name | ||
} |
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
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
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
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