-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move compositions to configuration packages
- Loading branch information
Showing
110 changed files
with
14,767 additions
and
46,308 deletions.
There are no files selected for viewing
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,52 @@ | ||
name: Build | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
inputs: | ||
channel: | ||
description: release channel | ||
required: true | ||
default: stable | ||
version: | ||
description: release version | ||
required: true | ||
default: current | ||
|
||
#env: | ||
# DOCKER_USR: ${{ secrets.DOCKER_USR }} | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: setup Crossplane cli | ||
uses: crossplane-contrib/xpkg-action@master | ||
with: | ||
channel: ${{ github.event.inputs.channel }} | ||
version: ${{ github.event.inputs.version }} | ||
command: -h | ||
|
||
- name: Build xpkg | ||
run: make output | ||
env: | ||
CROSSPLANE: './crossplane' | ||
|
||
# - name: Login to Docker | ||
# uses: docker/login-action@v3 | ||
# if: env.DOCKER_USR != '' | ||
# with: | ||
# registry: registry.upbound.io | ||
# username: ${{ secrets.DOCKER_USR }} | ||
# password: ${{ secrets.DOCKER_PSW }} | ||
|
||
# - name: Push xpkg | ||
# uses: crossplane-contrib/xpkg-action@master | ||
# with: | ||
# command: push configuration -f test/xpkg-action-test/xpkg-action-test.xpkg registry.upbound.io/crossplane-test/xpkg-action-test:v0.0.1 |
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
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 |
---|---|---|
@@ -1,22 +1,21 @@ | ||
local namespaced = import './namespaced.libsonnet'; | ||
local crossplane = import 'github.com/jsonnet-libs/crossplane-libsonnet/crossplane/1.14/main.libsonnet'; | ||
|
||
local helpers = import 'github.com/crdsonnet/crdsonnet/crdsonnet/helpers.libsonnet'; | ||
local crdsonnet = import 'github.com/crdsonnet/crdsonnet/crdsonnet/main.libsonnet'; | ||
local configuration(key, version) = | ||
local conf = crossplane.pkg.v1.configuration; | ||
conf.new(key) | ||
+ conf.spec.withPackage('xpkg.upbound.io/grafana/' + key + ':' + version); | ||
|
||
std.foldl( | ||
function(acc, def) | ||
local group = helpers.getGroupKey(def.definition.spec.group, 'grafana.crossplane.io'); | ||
local version = 'v1alpha1'; | ||
local kind = helpers.camelCaseKind(crdsonnet.xrd.getKind(def.definition)); | ||
local groups = | ||
std.set( | ||
std.map( | ||
function(def) | ||
def.definition.spec.group, | ||
namespaced | ||
) | ||
); | ||
|
||
acc + { | ||
[group]+: { | ||
[version]+: { | ||
[kind]+: | ||
def, | ||
}, | ||
}, | ||
}, | ||
namespaced, | ||
{} | ||
) | ||
function(configurationVersion) { | ||
[group]: configuration(group, configurationVersion) | ||
for group in groups | ||
} |
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,8 @@ | ||
local crossplane = import 'github.com/jsonnet-libs/crossplane-libsonnet/crossplane/1.14/main.libsonnet'; | ||
|
||
local configuration(key) = | ||
local conf = crossplane.pkg.v1.configuration; | ||
conf.new(key) | ||
+ conf.spec.withPackage('xpkg.upbound.io/grafana/' + key); | ||
|
||
{} |
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,34 @@ | ||
local crossplane = import 'github.com/jsonnet-libs/crossplane-libsonnet/crossplane/1.14/main.libsonnet'; | ||
local namespaced = import 'namespaced.libsonnet'; | ||
|
||
local package(key) = | ||
local metaConf = crossplane.meta.v1.configuration; | ||
metaConf.new(key) | ||
+ metaConf.metadata.withAnnotations({ | ||
'meta.crossplane.io/maintainer': 'Grafana', | ||
'meta.crossplane.io/source': 'github.com/grafana/grafana-crossplane-libsonnet', | ||
'meta.crossplane.io/license': 'Apache-2.0', | ||
'meta.crossplane.io/description': 'This configuration provides Compositions that map 1:1 to the managed resources with the only goal is to provide a namespaced resource of the same managed resource.', | ||
}) | ||
+ metaConf.spec.crossplane.withVersion('>=v1.17') | ||
+ metaConf.spec.withDependsOn( | ||
metaConf.spec.dependsOn.withProvider('xpkg.upbound.io/grafana/provider-grafana') | ||
+ metaConf.spec.dependsOn.withVersion('>=v0.21.0') | ||
); | ||
|
||
local manifest(value) = std.manifestYamlDoc(value, true, false); | ||
|
||
std.foldl( | ||
function(acc, item) | ||
local group = item.definition.spec.group; | ||
local kind = item.definition.spec.claimNames.kind; | ||
acc | ||
+ { | ||
[group + '/package.yaml']: manifest(package(group)), | ||
[group + '/Composition-' + kind + '.yaml']: manifest(item.composition), | ||
[group + '/CompositeResourceDefinition-' + kind + '.yaml']: manifest(item.composition), | ||
}, | ||
namespaced, | ||
{} | ||
) | ||
|
Oops, something went wrong.