1package v1
2
3import (
4 "time"
5 "strings"
6)
7
8// ImagePolicy is the Schema for the imagepolicies API
9#ImagePolicy: {
10 _embeddedResource
11
12 // APIVersion defines the versioned schema of this representation of an object.
13 // Servers should convert recognized schemas to the latest internal value, and
14 // may reject unrecognized values.
15 // More info:
16 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
17 apiVersion?: string
18
19 // Kind is a string value representing the REST resource this object represents.
20 // Servers may infer this from the endpoint the client submits requests to.
21 // Cannot be updated.
22 // In CamelCase.
23 // More info:
24 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
25 kind?: string
26 metadata?: {}
27
28 // ImagePolicySpec defines the parameters for calculating the
29 // ImagePolicy.
30 spec?: {
31 // DigestReflectionPolicy governs the setting of the `.status.latestRef.digest` field.
32 //
33 // Never: The digest field will always be set to the empty string.
34 //
35 // IfNotPresent: The digest field will be set to the digest of the elected
36 // latest image if the field is empty and the image did not change.
37 //
38 // Always: The digest field will always be set to the digest of the elected
39 // latest image.
40 //
41 // Default: Never.
42 digestReflectionPolicy?: "Always" | "IfNotPresent" | "Never"
43
44 // FilterTags enables filtering for only a subset of tags based on a set of
45 // rules. If no rules are provided, all the tags from the repository will be
46 // ordered and compared.
47 filterTags?: {
48 // Extract allows a capture group to be extracted from the specified regular
49 // expression pattern, useful before tag evaluation.
50 extract?: string
51
52 // Pattern specifies a regular expression pattern used to filter for image
53 // tags.
54 pattern?: string
55 }
56
57 // ImageRepositoryRef points at the object specifying the image
58 // being scanned
59 imageRepositoryRef!: {
60 // Name of the referent.
61 name!: string
62
63 // Namespace of the referent, when not specified it acts as LocalObjectReference.
64 namespace?: string
65 }
66
67 // Interval is the length of time to wait between
68 // refreshing the digest of the latest tag when the
69 // reflection policy is set to "Always".
70 //
71 // Defaults to 10m.
72 interval?: =~"^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
73
74 // Policy gives the particulars of the policy to be followed in
75 // selecting the most recent image
76 policy!: {
77 // Alphabetical set of rules to use for alphabetical ordering of the tags.
78 alphabetical?: {
79 // Order specifies the sorting order of the tags. Given the letters of the
80 // alphabet as tags, ascending order would select Z, and descending order
81 // would select A.
82 order?: "asc" | "desc"
83 }
84
85 // Numerical set of rules to use for numerical ordering of the tags.
86 numerical?: {
87 // Order specifies the sorting order of the tags. Given the integer values
88 // from 0 to 9 as tags, ascending order would select 9, and descending order
89 // would select 0.
90 order?: "asc" | "desc"
91 }
92
93 // SemVer gives a semantic version range to check against the tags
94 // available.
95 semver?: {
96 // Range gives a semver range for the image tag; the highest
97 // version within the range that's a tag yields the latest image.
98 range!: string
99 }
100 }
101
102 // This flag tells the controller to suspend subsequent policy reconciliations.
103 // It does not apply to already started reconciliations. Defaults to false.
104 suspend?: bool
105 }
106
107 // ImagePolicyStatus defines the observed state of ImagePolicy
108 status?: {
109 conditions?: [...{
110 // lastTransitionTime is the last time the condition transitioned from one status to another.
111 // This should be when the underlying condition changed. If that is not known,
112 // then using the time when the API field changed is acceptable.
113 lastTransitionTime!: time.Time
114
115 // message is a human readable message indicating details about the transition.
116 // This may be an empty string.
117 message!: strings.MaxRunes(
118 32768,
119 )
120
121 // observedGeneration represents the .metadata.generation that the condition was set based upon.
122 // For instance, if .metadata.generation is currently 12, but the
123 // .status.conditions[x].observedGeneration is 9, the condition is out of date
124 // with respect to the current state of the instance.
125 observedGeneration?: int64 & int & >=0
126
127 // reason contains a programmatic identifier indicating the reason for the
128 // condition's last transition.
129 // Producers of specific condition types may define expected values and meanings for this field,
130 // and whether the values are considered a guaranteed API.
131 // The value should be a CamelCase string.
132 // This field may not be empty.
133 reason!: strings.MaxRunes(
134 1024,
135 ) &
136 strings.MinRunes(
137 1,
138 ) &
139 =~"^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$"
140
141 // status of the condition, one of True, False, Unknown.
142 status!: "True" | "False" | "Unknown"
143
144 // type of condition in CamelCase or in foo.example.com/CamelCase.
145 type!: strings.MaxRunes(
146 316,
147 ) &
148 =~"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$"
149 }]
150
151 // LastHandledReconcileAt holds the value of the most recent
152 // reconcile request value, so a change of the annotation value
153 // can be detected.
154 lastHandledReconcileAt?: string
155
156 // LatestRef gives the first in the list of images scanned by
157 // the image repository, when filtered and ordered according
158 // to the policy.
159 latestRef?: {
160 // Digest is the image's digest.
161 digest?: string
162
163 // Name is the bare image's name.
164 name!: string
165
166 // Tag is the image's tag.
167 tag!: string
168 }
169 observedGeneration?: int64 & int
170
171 // ObservedPreviousRef is the observed previous LatestRef. It is used
172 // to keep track of the previous and current images.
173 observedPreviousRef?: {
174 // Digest is the image's digest.
175 digest?: string
176
177 // Name is the bare image's name.
178 name!: string
179
180 // Tag is the image's tag.
181 tag!: string
182 }
183 }
184
185 _embeddedResource: {
186 apiVersion!: string
187 kind!: string
188 metadata?: {...}
189 }
190 apiVersion: "image.toolkit.fluxcd.io/v1"
191 kind: "ImagePolicy"
192 metadata!: {
193 name!: string
194 namespace!: string
195 labels?: [string]: string
196 annotations?: [string]: string
197 ...
198 }
199}