Skip to content

Commit

Permalink
feat: add cross reference pn_id in rdb instance (#81)
Browse files Browse the repository at this point in the history
Co-authored-by: Rémy Léone <[email protected]>
  • Loading branch information
yfodil and remyleone authored Jun 28, 2024
1 parent 3e32178 commit 6e57a22
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 1 deletion.
20 changes: 20 additions & 0 deletions apis/rdb/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions apis/rdb/v1alpha1/zz_generated.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion apis/rdb/v1alpha1/zz_instance_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions config/rdb/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func Configure(p *config.Provider) {
r.ExternalName = config.IdentifierFromProvider
r.ShortGroup = shortGroup
r.Kind = "Instance"

r.References["private_network.pn_id"] = config.Reference{
Type: "github.com/scaleway/provider-scaleway/apis/vpc/v1alpha1.PrivateNetwork",
}
})

p.AddResourceConfigurator("scaleway_rdb_privilege", func(r *config.Resource) {
Expand Down
44 changes: 44 additions & 0 deletions examples/rdb/instance_with_private_network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: vpc.scaleway.upbound.io/v1alpha1
kind: PrivateNetwork
metadata:
annotations:
meta.upbound.io/example-id: vpc/v1alpha1/cluster
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
name: crossplane-private-network
providerConfigRef:
name: default
---
apiVersion: v1
kind: Secret
metadata:
name: rdb-instance-secret
namespace: default
stringData:
password: "thiZ_is_v&ry_s3cret"
---
apiVersion: rdb.scaleway.upbound.io/v1alpha1
kind: Instance
metadata:
name: rdb-instance
spec:
forProvider:
name: crossplane-rdb-instance
nodeType: DB-DEV-S
engine: "PostgreSQL-14"
isHaCluster: false
disableBackup: true
userName: admin
privateNetwork:
- pnIdSelector:
matchLabels:
testing.upbound.io/example-name: example
passwordSecretRef:
key: password
name: rdb-instance-secret
namespace: default
providerConfigRef:
name: default
152 changes: 152 additions & 0 deletions package/crds/rdb.scaleway.upbound.io_instances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,82 @@ spec:
The ID of the private network.
The private network ID
type: string
pnIdRef:
description: Reference to a PrivateNetwork in vpc to populate
pnId.
properties:
name:
description: Name of the referenced object.
type: string
policy:
description: Policies for referencing.
properties:
resolution:
default: Required
description: |-
Resolution specifies whether resolution of this reference is required.
The default is 'Required', which means the reconcile will fail if the
reference cannot be resolved. 'Optional' means this reference will be
a no-op if it cannot be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: |-
Resolve specifies when this reference should be resolved. The default
is 'IfNotPresent', which will attempt to resolve the reference only when
the corresponding field is not present. Use 'Always' to resolve the
reference on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
required:
- name
type: object
pnIdSelector:
description: Selector for a PrivateNetwork in vpc to populate
pnId.
properties:
matchControllerRef:
description: |-
MatchControllerRef ensures an object with the same controller reference
as the selecting object is selected.
type: boolean
matchLabels:
additionalProperties:
type: string
description: MatchLabels ensures an object with matching
labels is selected.
type: object
policy:
description: Policies for selection.
properties:
resolution:
default: Required
description: |-
Resolution specifies whether resolution of this reference is required.
The default is 'Required', which means the reconcile will fail if the
reference cannot be resolved. 'Optional' means this reference will be
a no-op if it cannot be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: |-
Resolve specifies when this reference should be resolved. The default
is 'IfNotPresent', which will attempt to resolve the reference only when
the corresponding field is not present. Use 'Always' to resolve the
reference on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
type: object
port:
description: |-
Port of the replica.
Expand Down Expand Up @@ -318,6 +394,82 @@ spec:
The ID of the private network.
The private network ID
type: string
pnIdRef:
description: Reference to a PrivateNetwork in vpc to populate
pnId.
properties:
name:
description: Name of the referenced object.
type: string
policy:
description: Policies for referencing.
properties:
resolution:
default: Required
description: |-
Resolution specifies whether resolution of this reference is required.
The default is 'Required', which means the reconcile will fail if the
reference cannot be resolved. 'Optional' means this reference will be
a no-op if it cannot be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: |-
Resolve specifies when this reference should be resolved. The default
is 'IfNotPresent', which will attempt to resolve the reference only when
the corresponding field is not present. Use 'Always' to resolve the
reference on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
required:
- name
type: object
pnIdSelector:
description: Selector for a PrivateNetwork in vpc to populate
pnId.
properties:
matchControllerRef:
description: |-
MatchControllerRef ensures an object with the same controller reference
as the selecting object is selected.
type: boolean
matchLabels:
additionalProperties:
type: string
description: MatchLabels ensures an object with matching
labels is selected.
type: object
policy:
description: Policies for selection.
properties:
resolution:
default: Required
description: |-
Resolution specifies whether resolution of this reference is required.
The default is 'Required', which means the reconcile will fail if the
reference cannot be resolved. 'Optional' means this reference will be
a no-op if it cannot be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: |-
Resolve specifies when this reference should be resolved. The default
is 'IfNotPresent', which will attempt to resolve the reference only when
the corresponding field is not present. Use 'Always' to resolve the
reference on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
type: object
port:
description: |-
Port of the replica.
Expand Down

0 comments on commit 6e57a22

Please sign in to comment.