Skip to content

Commit

Permalink
blueprint test
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumigatus committed Aug 29, 2023
1 parent e6f4130 commit 7e803f3
Show file tree
Hide file tree
Showing 11 changed files with 202 additions and 52 deletions.
10 changes: 9 additions & 1 deletion apis/blueprint/v1alpha1/zz_blueprint_types.go

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

11 changes: 11 additions & 0 deletions apis/blueprint/v1alpha1/zz_generated.deepcopy.go

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

40 changes: 40 additions & 0 deletions apis/blueprint/v1alpha1/zz_generated.resolvers.go

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

38 changes: 19 additions & 19 deletions apis/blueprint/v1alpha1/zz_generated_terraformed.go

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

4 changes: 2 additions & 2 deletions apis/blueprint/v1alpha1/zz_groupversion_info.go

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

30 changes: 18 additions & 12 deletions config/blueprint/config.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
package repository
package blueprint

import "github.com/upbound/upjet/pkg/config"

// Configure configures individual resources by adding custom ResourceConfigurators.
func Configure(p *config.Provider) {
p.AddResourceConfigurator("vra_blueprint", func(r *config.Resource) {

r.ShortGroup = "blueprint"
r.Version = "v1alpha1"
})
p.AddResourceConfigurator("vra_blueprint", func(r *config.Resource) {

p.AddResourceConfigurator("vra_blueprint_version", func(r *config.Resource) {

r.ShortGroup = "blueprint.version"
r.Version = "v1alpha1"
})
}
r.ShortGroup = "blueprint"
r.Version = "v1alpha1"
r.References["project_id"] = config.Reference{
Type: "github.com/ankasoftco/upjet-provider-vra/apis/project/v1alpha1.Blueprint",
}
})

p.AddResourceConfigurator("vra_blueprint_version", func(r *config.Resource) {

r.ShortGroup = "blueprint.version"
r.Version = "v1alpha1"
r.References["project_id"] = config.Reference{
Type: "Blueprint", //github.com/crossplane-contrib/upjet-provider-vra/apis/blueprint/v1alpha1.Blueprint
}
})
}
12 changes: 6 additions & 6 deletions config/deployment/config.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package repository
package deployment

import "github.com/upbound/upjet/pkg/config"

// Configure configures individual resources by adding custom ResourceConfigurators.
func Configure(p *config.Provider) {
p.AddResourceConfigurator("vra_deployment", func(r *config.Resource) {
r.ShortGroup = "deployment"
r.Version = "v1alpha1"
})
}
p.AddResourceConfigurator("vra_deployment", func(r *config.Resource) {
r.ShortGroup = "deployment"
r.Version = "v1alpha1"
})
}
12 changes: 6 additions & 6 deletions config/project/config.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package repository
package project

import "github.com/upbound/upjet/pkg/config"

// Configure configures individual resources by adding custom ResourceConfigurators.
func Configure(p *config.Provider) {
p.AddResourceConfigurator("vra_project", func(r *config.Resource) {
p.AddResourceConfigurator("vra_project", func(r *config.Resource) {

r.ShortGroup = "project"
r.Version = "v1alpha1"
})
}
r.ShortGroup = "project"
r.Version = "v1alpha1"
})
}
14 changes: 14 additions & 0 deletions examples/blueprint/blueprint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: blueprint.version.crossplane.io/v1alpha1
kind: Blueprint
metadata:
name: test-blueprint-1
spec:
forProvider:
name: 'test-blueprint-1'
description: 'test-blueprint-1 - alpcan - caner'

projectIdRef:
name: 'test-project-1'

providerConfigRef:
name: vra-test
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
name: blueprints.blueprint.version.crossplane.io
name: blueprints.blueprint.crossplane.io
spec:
group: blueprint.version.crossplane.io
group: blueprint.crossplane.io
names:
categories:
- crossplane
Expand Down Expand Up @@ -75,6 +75,79 @@ spec:
type: string
projectId:
type: string
projectIdRef:
description: Reference to a Project in project to populate projectId.
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
projectIdSelector:
description: Selector for a Project in project to populate projectId.
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
requestScopeOrg:
description: Flag to indicate blueprint can be requested from
any project in org
Expand Down Expand Up @@ -269,8 +342,6 @@ spec:
x-kubernetes-validations:
- message: name is a required parameter
rule: self.managementPolicy == 'ObserveOnly' || has(self.forProvider.name)
- message: projectId is a required parameter
rule: self.managementPolicy == 'ObserveOnly' || has(self.forProvider.projectId)
status:
description: BlueprintStatus defines the observed state of Blueprint.
properties:
Expand Down
Loading

0 comments on commit 7e803f3

Please sign in to comment.