cue.dev/x/crd/fluxcd.io@v0.9.0

notification/v1/schema.cue raw

  1package v1
  2
  3import (
  4	"list"
  5	"strings"
  6	"time"
  7)
  8
  9// Receiver is the Schema for the receivers API.
 10#Receiver: {
 11	_embeddedResource
 12
 13	// APIVersion defines the versioned schema of this representation of an object.
 14	// Servers should convert recognized schemas to the latest internal value, and
 15	// may reject unrecognized values.
 16	// More info:
 17	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
 18	apiVersion?: string
 19
 20	// Kind is a string value representing the REST resource this object represents.
 21	// Servers may infer this from the endpoint the client submits requests to.
 22	// Cannot be updated.
 23	// In CamelCase.
 24	// More info:
 25	// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
 26	kind?:     string
 27	metadata?: {}
 28
 29	// ReceiverSpec defines the desired state of the Receiver.
 30	spec?: {
 31		// Events specifies the list of event types to handle,
 32		// e.g. 'push' for GitHub or 'Push Hook' for GitLab.
 33		events?: [...string]
 34
 35		// Interval at which to reconcile the Receiver with its Secret references.
 36		interval?: =~"^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
 37
 38		// OIDCProviders specifies the OIDC providers used to authenticate incoming
 39		// requests when Type is 'generic-oidc'. The provider whose IssuerURL matches
 40		// the token's 'iss' claim is used to verify the token signature, expiration
 41		// and audience, and to evaluate the configured CEL validations against the
 42		// token claims.
 43		oidcProviders?: [...{
 44			// Audience is the expected audience ('aud' claim) for tokens issued by
 45			// this provider. Defaults to 'notification-controller'.
 46			audience?: string
 47
 48			// IssuerURL is the OIDC issuer URL used for provider discovery. It must
 49			// match the 'iss' claim of tokens issued by this provider.
 50			issuerURL!: =~"^https?://"
 51
 52			// Validations is the list of CEL boolean expressions evaluated against the
 53			// token claims and the variables. The request is accepted only if all of
 54			// them evaluate to true; the message of each failing expression is returned
 55			// to the caller.
 56			//
 57			// At least one validation is required. A valid signature alone does not
 58			// authorize a request: public issuers issue tokens to any caller on the
 59			// platform, so the validations must constrain the caller's identity claims
 60			// (e.g. 'repository_owner' for GitHub Actions).
 61			validations!: list.MinItems(1) & [...{
 62				// Expression is the CEL boolean expression to evaluate.
 63				expression!: string
 64
 65				// Message is returned to the caller when the expression evaluates to false.
 66				message!: string
 67			}]
 68
 69			// Variables is an optional list of named CEL expressions, evaluated in order
 70			// and exposed as 'vars.<name>'. Each expression can read the token claims
 71			// via 'claims' and any variable defined before it. Use it to share
 72			// sub-expressions across validations.
 73			variables?: [...{
 74				// Expression is the CEL expression that defines the variable value.
 75				expression!: string
 76
 77				// Name is the variable name; it must be a valid CEL identifier.
 78				name!: string
 79			}]
 80		}]
 81
 82		// ResourceFilter is a CEL expression expected to return a boolean that is
 83		// evaluated for each resource referenced in the Resources field when a
 84		// webhook is received. If the expression returns false then the controller
 85		// will not request a reconciliation for the resource.
 86		// The expression can read the resource metadata via 'res' and the webhook
 87		// request body via 'req'. For generic-oidc receivers, the verified OIDC
 88		// token claims are also available via 'claims'.
 89		// When the expression is specified the controller will parse it and mark
 90		// the object as terminally failed if the expression is invalid or does not
 91		// return a boolean.
 92		resourceFilter?: string
 93
 94		// A list of resources to be notified about changes.
 95		resources!: [...{
 96			// API version of the referent
 97			apiVersion?: string
 98
 99			// Filter is a CEL expression expected to return a boolean that is evaluated
100			// for each resource matched by this reference when a webhook is received,
101			// in addition to the top-level resourceFilter. A reconciliation is requested
102			// only when both expressions (when set) return true.
103			// The expression can read the resource metadata via 'res' and the webhook
104			// request body via 'req'. For generic-oidc receivers, the verified OIDC
105			// token claims are also available via 'claims'.
106			// When the expression is specified the controller will parse it and mark
107			// the object as terminally failed if the expression is invalid or does not
108			// return a boolean.
109			filter?: string
110
111			// Kind of the referent
112			kind!: "Bucket" |
113				"GitRepository" |
114				"Kustomization" |
115				"HelmRelease" |
116				"HelmChart" |
117				"HelmRepository" |
118				"ImageRepository" |
119				"ImagePolicy" |
120				"ImageUpdateAutomation" |
121				"OCIRepository" |
122				"ArtifactGenerator" |
123				"ExternalArtifact"
124
125			// MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
126			// map is equivalent to an element of matchExpressions, whose key field is "key", the
127			// operator is "In", and the values array contains only "value". The requirements are ANDed.
128			// MatchLabels requires the name to be set to `*`.
129			matchLabels?: [string]: string
130
131			// Name of the referent
132			// If multiple resources are targeted `*` may be set.
133			name!: strings.MaxRunes(
134				253,
135			) & strings.MinRunes(
136				1,
137			)
138
139			// Namespace of the referent
140			namespace?: strings.MaxRunes(
141				253,
142			) & strings.MinRunes(
143				1,
144			)
145		}]
146
147		// SecretRef specifies the Secret containing the token used
148		// to validate the payload authenticity. The Secret must contain a 'token'
149		// key. For GCR receivers, the Secret must also contain an 'email' key
150		// with the IAM service account email configured on the Pub/Sub push
151		// subscription, and an 'audience' key with the expected OIDC token audience.
152		//
153		// Required for all receiver types except 'generic-oidc', which authenticates
154		// requests using the OIDC token instead and must not set this field.
155		secretRef?: {
156			// Name of the referent.
157			name!: string
158		}
159
160		// Suspend tells the controller to suspend subsequent
161		// events handling for this receiver.
162		suspend?: bool
163
164		// Type of webhook sender, used to determine
165		// the validation procedure and payload deserialization.
166		type!: "generic" |
167			"generic-hmac" |
168			"generic-oidc" |
169			"github" |
170			"gitlab" |
171			"bitbucket" |
172			"harbor" |
173			"dockerhub" |
174			"quay" |
175			"gcr" |
176			"nexus" |
177			"acr" |
178			"cdevents"
179	}
180
181	// ReceiverStatus defines the observed state of the Receiver.
182	status?: {
183		// Conditions holds the conditions for the Receiver.
184		conditions?: [...{
185			// lastTransitionTime is the last time the condition transitioned from one status to another.
186			// This should be when the underlying condition changed. If that is not known,
187			// then using the time when the API field changed is acceptable.
188			lastTransitionTime!: time.Time
189
190			// message is a human readable message indicating details about the transition.
191			// This may be an empty string.
192			message!: strings.MaxRunes(
193				32768,
194			)
195
196			// observedGeneration represents the .metadata.generation that the condition was set based upon.
197			// For instance, if .metadata.generation is currently 12, but the
198			// .status.conditions[x].observedGeneration is 9, the condition is out of date
199			// with respect to the current state of the instance.
200			observedGeneration?: int64 & int & >=0
201
202			// reason contains a programmatic identifier indicating the reason for the
203			// condition's last transition.
204			// Producers of specific condition types may define expected values and meanings for this field,
205			// and whether the values are considered a guaranteed API.
206			// The value should be a CamelCase string.
207			// This field may not be empty.
208			reason!: strings.MaxRunes(
209				1024,
210			) &
211			strings.MinRunes(
212				1,
213			) &
214			=~"^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$"
215
216			// status of the condition, one of True, False, Unknown.
217			status!: "True" | "False" | "Unknown"
218
219			// type of condition in CamelCase or in foo.example.com/CamelCase.
220			type!: strings.MaxRunes(
221				316,
222			) &
223			=~"^([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])$"
224		}]
225
226		// LastHandledReconcileAt holds the value of the most recent
227		// reconcile request value, so a change of the annotation value
228		// can be detected.
229		lastHandledReconcileAt?: string
230
231		// ObservedGeneration is the last observed generation of the Receiver object.
232		observedGeneration?: int64 & int
233
234		// WebhookPath is the generated incoming webhook address in the format
235		// of '/hook/sha256sum(token+name+namespace)'.
236		webhookPath?: string
237	}
238
239	_embeddedResource: {
240		apiVersion!: string
241		kind!:       string
242		metadata?:   {...}
243	}
244	apiVersion: "notification.toolkit.fluxcd.io/v1"
245	kind:       "Receiver"
246	metadata!: {
247		name!:      string
248		namespace!: string
249		labels?: [string]:      string
250		annotations?: [string]: string
251		...
252	}
253}