-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: source github.com/jsonnet-libs/k8s@8bbdf311
- Loading branch information
1 parent
6c02867
commit f2941f8
Showing
155 changed files
with
75,884 additions
and
0 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
crossplane/1.16/_custom/compositeResourceDefinition.libsonnet
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,78 @@ | ||
local d = import 'doc-util/main.libsonnet'; | ||
|
||
{ | ||
apiextensions+: { | ||
v1+: { | ||
xrd: self.compositeResourceDefinition, | ||
compositeResourceDefinition+: { | ||
|
||
'#new':: d.fn(help=||| | ||
new returns an instance of CompositeResourceDefinition= | ||
For example: xpostgresqlinstances.example.org | ||
- `kind`: XPostgreSQLInstance | ||
- `plural`: xpostgresqlinstances | ||
- `group`: example.org | ||
A common convention is that the XR (composite resource) are prefixed with 'X' | ||
while claim names are not. This lets app team members think of creating a claim | ||
as (e.g.) 'creating a PostgreSQLInstance'. Use `withClaimNames` to set this. | ||
|||, args=[ | ||
d.arg('kind', d.T.string), | ||
d.arg('plural', d.T.string), | ||
d.arg('group', d.T.string), | ||
]), | ||
new(kind, plural, group): | ||
super.new(plural + '.' + group) | ||
+ super.metadata.withAnnotations({ | ||
// Tell Tanka to not set metadata.namespace. | ||
'tanka.dev/namespaced': 'false', | ||
}) | ||
+ super.spec.withGroup(group) | ||
+ super.spec.names.withKind(kind) | ||
+ super.spec.names.withPlural(plural) | ||
, | ||
|
||
'#withClaimNames':: d.fn(help=||| | ||
Sets the ClaimNames attribute. | ||
Example: | ||
- `kind`: PostgreSQLInstance | ||
- `plural`: postgresqlinstances | ||
A common convention is that the XR (composite resource) are prefixed with 'X' | ||
while claim names are not. This lets app team members think of creating a claim | ||
as (e.g.) 'creating a PostgreSQLInstance'. | ||
|||, args=[ | ||
d.arg('kind', d.T.string), | ||
d.arg('plural', d.T.string), | ||
]), | ||
withClaimNames(kind, plural): | ||
super.spec.claimNames.withKind(kind) | ||
+ super.spec.claimNames.withPlural(plural), | ||
|
||
'#mapVersions':: d.fn(help=||| | ||
Sets the ClaimNames attribute. | ||
Example: | ||
- `kind`: PostgreSQLInstance | ||
- `plural`: postgresqlinstances | ||
A common convention is that the XR (composite resource) are prefixed with 'X' | ||
while claim names are not. This lets app team members think of creating a claim | ||
as (e.g.) 'creating a PostgreSQLInstance'. | ||
|||, args=[ | ||
d.arg('kind', d.T.string), | ||
d.arg('plural', d.T.string), | ||
]), | ||
mapVersions(f): { | ||
local versions = super.spec.versions, | ||
spec+: { | ||
versions: std.map(f, versions), | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |
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,54 @@ | ||
local d = import 'doc-util/main.libsonnet'; | ||
|
||
{ | ||
apiextensions+: { | ||
v1+: { | ||
composition+: { | ||
'#fromXRD':: d.fn(help=||| | ||
Create a Composition based on an XRD. | ||
Attributes: | ||
- `name` of the composition | ||
- `namespace` where connectionDetails are propagated too, commonly the the | ||
management namespace (ie. crossplane) | ||
- `provider` of the resources in this composition | ||
- `xrdRef` XRD object with which this composition is compatible | ||
- `xrdVersion` Version of XRD object with which this composition is compatible | ||
|||, args=[ | ||
d.arg('name', d.T.string), | ||
d.arg('namespace', d.T.string), | ||
d.arg('provider', d.T.string), | ||
d.arg('xrdRef', d.T.object), | ||
d.arg('xrdVersion', d.T.string), | ||
]), | ||
fromXRD(name, namespace, provider, xrdRef, xrdVersion): | ||
super.new(name) | ||
+ super.metadata.withAnnotations({ | ||
// Tell Tanka to not set metadata.namespace. | ||
'tanka.dev/namespaced': 'false', | ||
}) | ||
+ super.metadata.withLabels({ | ||
// An optional convention is to include a label of the XRD. This allows easy | ||
// discovery of compatible Compositions. | ||
'crossplane.io/xrd': xrdRef.metadata.name, | ||
// Another optional convention is to include a label of the (most common) | ||
// provider for the resource(s) in this composition. This label can be used in | ||
// 'compositionSelector' in an XR or Claim. | ||
provider: provider, | ||
}) | ||
|
||
// Each Composition must declare that it is compatible with a particular type of | ||
// Composite Resource using its 'compositeTypeRef' field. The referenced | ||
// version must be marked 'referenceable' in the XRD that defines the XR. | ||
+ super.spec.compositeTypeRef.withApiVersion(xrdRef.spec.group + '/' + xrdVersion) | ||
+ super.spec.compositeTypeRef.withKind(xrdRef.spec.names.kind) | ||
|
||
|
||
// When an XR is created in response to a claim Crossplane needs to know where it | ||
// should create the XR's connection secret. This is configured using the | ||
// 'writeConnectionSecretsToNamespace' field. | ||
+ super.spec.withWriteConnectionSecretsToNamespace(namespace), | ||
}, | ||
}, | ||
}, | ||
} |
Oops, something went wrong.