Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce kcl-version of composition #89

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Introduce kcl-version of composition #89

wants to merge 5 commits into from

Conversation

kaessert
Copy link
Collaborator

@kaessert kaessert commented Oct 24, 2024

Description of your changes

This PR adds a kcl-version of the network-composition.
I also decided to upgrade uptest to the most recent version as it helped me debugging a lot.

I have:

  • Read and followed Upbound's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, as appropriate.

How has this code been tested

I ran following targets:

  • make check-examples
  • make render
  • make e2e

Copy link
Member

@haarchri haarchri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add for testing a crossplane render different between go-tpl and kcl

Makefile Outdated Show resolved Hide resolved
@kaessert
Copy link
Collaborator Author

@haarchri

6c6
<     render.crossplane.io/composition-path: apis/gotpl/composition.yaml
---
>     render.crossplane.io/composition-path: apis/kcl/composition.yaml
8c8
<   name: configuration-aws-network-gotpl
---
>   name: configuration-aws-network-kcl
9a10,12
>   compositionSelector:
>     matchLabels:
>       function: kcl
33a37,40
>   privateSubnetIds: []
>   publicSubnetIds: []
>   securityGroupIds: []
>   subnetIds: []
40c47
<   generateName: configuration-aws-network-gotpl-
---
>   generateName: configuration-aws-network-kcl-
42c49
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
49c56
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
57,58d63
<   providerConfigRef:
<     name: <no value>
65c70
<   generateName: configuration-aws-network-gotpl-
---
>   generateName: configuration-aws-network-kcl-
67c72
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
74c79
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
84,85d88
<   providerConfigRef:
<     name: <no value>
92c95
<   generateName: configuration-aws-network-gotpl-
---
>   generateName: configuration-aws-network-kcl-
94c97
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
101c104
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
112,113d114
<   providerConfigRef:
<     name: <no value>
120c121
<   generateName: configuration-aws-network-gotpl-
---
>   generateName: configuration-aws-network-kcl-
122c123
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
129c130
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
137,138d137
<   providerConfigRef:
<     name: <no value>
144,145c143,144
<     crossplane.io/composition-resource-name: rta-us-west-2a-private
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: rta-us-west-2a-192-168-0-0-18-public
>   generateName: configuration-aws-network-kcl-
147c146
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
154c153
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
165c164
<         access: private
---
>         access: public
167,168d165
<   providerConfigRef:
<     name: <no value>
174,175c171,172
<     crossplane.io/composition-resource-name: rta-us-west-2a-public
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: rta-us-west-2a-192-168-128-0-18-private
>   generateName: configuration-aws-network-kcl-
177c174
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
184c181
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
195c192
<         access: public
---
>         access: private
197,198d193
<   providerConfigRef:
<     name: <no value>
204,205c199,200
<     crossplane.io/composition-resource-name: rta-us-west-2b-private
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: rta-us-west-2b-192-168-192-0-18-private
>   generateName: configuration-aws-network-kcl-
207c202
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
214c209
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
227,228d221
<   providerConfigRef:
<     name: <no value>
234,235c227,228
<     crossplane.io/composition-resource-name: rta-us-west-2b-public
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: rta-us-west-2b-192-168-64-0-18-public
>   generateName: configuration-aws-network-kcl-
237c230
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
244c237
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
257,258d249
<   providerConfigRef:
<     name: <no value>
265c256
<   generateName: configuration-aws-network-gotpl-
---
>   generateName: configuration-aws-network-kcl-
267c258
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
274c265
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
284,285d274
<   providerConfigRef:
<     name: <no value>
291,292c280,281
<     crossplane.io/composition-resource-name: sgrm
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: sgr-mysql
>   generateName: configuration-aws-network-kcl-
294c283
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
301c290
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
316,317d304
<   providerConfigRef:
<     name: <no value>
323,324c310,311
<     crossplane.io/composition-resource-name: sgrp
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: sgr-postgres
>   generateName: configuration-aws-network-kcl-
326c313
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
333c320
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
348,349d334
<   providerConfigRef:
<     name: <no value>
355,356c340,341
<     crossplane.io/composition-resource-name: subnet-us-west-2a-private
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: subnet-us-west-2a-192-168-0-0-18-public
>   generateName: configuration-aws-network-kcl-
358,359c343,344
<     access: private
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     access: public
>     crossplane.io/composite: configuration-aws-network-kcl
367c352
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
373c358,359
<     cidrBlock: 192.168.128.0/18
---
>     cidrBlock: 192.168.0.0/18
>     mapPublicIpOnLaunch: true
376c362,363
<       kubernetes.io/role/internal-elb: "1"
---
>       kubernetes.io/role/elb: "1"
>       networks.aws.platform.upbound.io/network-id: configuration-aws-network
379,380d365
<   providerConfigRef:
<     name: <no value>
386,387c371,372
<     crossplane.io/composition-resource-name: subnet-us-west-2a-public
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: subnet-us-west-2a-192-168-128-0-18-private
>   generateName: configuration-aws-network-kcl-
389,390c374,375
<     access: public
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     access: private
>     crossplane.io/composite: configuration-aws-network-kcl
398c383
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
404,405c389
<     cidrBlock: 192.168.0.0/18
<     mapPublicIpOnLaunch: true
---
>     cidrBlock: 192.168.128.0/18
408,409c392
<       kubernetes.io/role/elb: "1"
<       networks.aws.platform.upbound.io/network-id: configuration-aws-network
---
>       kubernetes.io/role/internal-elb: "1"
412,413d394
<   providerConfigRef:
<     name: <no value>
419,420c400,401
<     crossplane.io/composition-resource-name: subnet-us-west-2b-private
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: subnet-us-west-2b-192-168-192-0-18-private
>   generateName: configuration-aws-network-kcl-
423c404
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
431c412
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
443,444d423
<   providerConfigRef:
<     name: <no value>
450,451c429,430
<     crossplane.io/composition-resource-name: subnet-us-west-2b-public
<   generateName: configuration-aws-network-gotpl-
---
>     crossplane.io/composition-resource-name: subnet-us-west-2b-192-168-64-0-18-public
>   generateName: configuration-aws-network-kcl-
454c433
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
462c441
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
476,477d454
<   providerConfigRef:
<     name: <no value>
484c461
<   generateName: configuration-aws-network-gotpl-
---
>   generateName: configuration-aws-network-kcl-
486c463
<     crossplane.io/composite: configuration-aws-network-gotpl
---
>     crossplane.io/composite: configuration-aws-network-kcl
493c470
<     name: configuration-aws-network-gotpl
---
>     name: configuration-aws-network-kcl
503,505c480
<       Name: configuration-aws-network-gotpl
<   providerConfigRef:
<     name: <no value>
---
>       Name: configuration-aws-network-kcl

@kaessert kaessert marked this pull request as ready for review October 24, 2024 12:59
.gitmodules Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
apis/kcl/generate.k Outdated Show resolved Hide resolved
apis/kcl/main.k Show resolved Hide resolved
Signed-off-by: Tobias Kässer <[email protected]>
@kaessert
Copy link
Collaborator Author

/test-examples

Copy link
Member

@ytsarev ytsarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10:14:10 [ OK ] Generated kcl composition
10:14:14 [ .. ] Testing a67f9 composition
no test files
10:14:15 [ OK ] Success testing ".cache/render/a67f9.yaml"!
10:14:15 [ .. ] Testing 21a9b composition
no test files
10:14:15 [ OK ] Success testing ".cache/render/21a9b.yaml"!

it looks like there are no tests around

Copy link
Member

@ytsarev ytsarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 make e2e
10:43:41 [ .. ] installing up v0.34.0
10:43:46 [ OK ] installing up v0.34.0
10:43:46 [ .. ] Generating kcl composition
10:43:47 [ OK ] Generated kcl composition
10:43:48 [ .. ] Building package configuration-aws-network-v0.18.0-3.g9695329.xpkg for linux_arm64
up: error: xpkg.buildCmd.Run(): failed to build package: failed to parse package: {path:/Users/xnull/upbound/configuration-aws-network/.cache/render/21a9b.yaml position:4096}: no kind "XNetwork" is registered for version "aws.platform.upbound.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
10:43:49 [FAIL]
make[3]: *** [build/makelib/xpkg.mk:102: xpkg.build.configuration-aws-network] Error 1
make[2]: *** [build/makelib/common.mk:337: do.build.artifacts.linux_arm64] Error 2
make[1]: *** [build/makelib/common.mk:347: build.all] Error 2
make: *** [build/makelib/common.mk:353: build] Error 2

running make e2e after running render.test looks like it needs some patch exclusions

Makefile Show resolved Hide resolved
@ytsarev
Copy link
Member

ytsarev commented Nov 1, 2024

diff --git a/Makefile b/Makefile
index 9d3ecae..60602fc 100644
--- a/Makefile
+++ b/Makefile
@@ -61,7 +61,7 @@ CROSSPLANE_CLI_VERSION = v1.17.1
 # ====================================================================================
 # Setup XPKG
 XPKG_DIR = $(shell pwd)
-XPKG_IGNORE = .github/workflows/*.yaml,.github/workflows/*.yml,examples/*.yaml,.work/uptest-datasource.yaml
+XPKG_IGNORE = .github/workflows/*.yaml,.github/workflows/*.yml,examples/*.yaml,.work/uptest-datasource.yaml,.cache/render/*
 XPKG_REG_ORGS ?= xpkg.upbound.io/upbound
 # NOTE(hasheddan): skip promoting on xpkg.upbound.io as channel tags are
 # inferred.

solved the cache render exclusion ( can't comment inline in github as it was a stable line, so have to use old school diff :) )

Signed-off-by: Tobias Kässer <[email protected]>
@kaessert
Copy link
Collaborator Author

kaessert commented Nov 1, 2024

Addressed all the comments, thanks for the feedback!

@kaessert
Copy link
Collaborator Author

kaessert commented Nov 1, 2024

/test-examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants