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

feat(function): switch to function, add renovate, bump providers #5

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
"helpers:pinGitHubActionDigests",
":semanticCommits"
],
"rebaseWhen": "conflicted",
"prConcurrentLimit": 5,
"baseBranches": ["main"],
"labels": ["automated"],
"customManagers": [
{
"customType": "regex",
"description": "Bump up version in the Makefile",
"fileMatch": ["^Makefile$"],
"matchStrings": [
"UP_VERSION = (?<currentValue>.*?)\\n"
],
"datasourceTemplate": "github-releases",
"depNameTemplate": "upbound/up",
}, {
"customType": "regex",
"description": "Bump uptest version in the Makefile",
"fileMatch": ["^Makefile$"],
"matchStrings": [
"UPTEST_VERSION = (?<currentValue>.*?)\\n"
],
"datasourceTemplate": "github-releases",
"depNameTemplate": "upbound/uptest",
}, {
"customType": "regex",
"description": "Bump providers/functions/configurations in crossplane.yaml",
"fileMatch": ["crossplane.yaml"],
"matchStrings": [
"#\\s*renovate:\\s*datasource=(?<datasource>[^\\s]+)\\s+depName=(?<depName>[^\\s]+)\\s*\\n\\s*version:\\s*\"(?<currentValue>[^\"]+)\""
],
"datasourceTemplate": "{{{datasource}}}",
"depNameTemplate": "{{{depName}}}",
}
],
}
6 changes: 3 additions & 3 deletions .github/workflows/yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: yamllint
uses: reviewdog/action-yamllint@v1
uses: reviewdog/action-yamllint@v1.9.0
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review # Change reporter.
reporter: github-pr-review
filter_mode: nofilter
yamllint_flags: 'apis/'
fail_on_error: true
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,13 @@ uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat azure.json)
e2e: build controlplane.up local.xpkg.deploy.configuration.$(PROJECT_NAME) uptest

.PHONY: uptest e2e
render:
crossplane beta render examples/mariadb-claim.yaml apis/mariadb/composition.yaml examples/function/function.yaml -r
crossplane beta render examples/postgres-claim.yaml apis/postgresql/composition.yaml examples/function/function.yaml -r

yamllint:
@$(INFO) running yamllint
@yamllint ./apis || $(FAIL)
@$(OK) running yamllint

.PHONY: uptest e2e render yamllint
282 changes: 154 additions & 128 deletions apis/mariadb/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,131 +10,157 @@ spec:
compositeTypeRef:
apiVersion: azure.platform.upbound.io/v1alpha1
kind: XSQLInstance
patchSets:
- name: providerConfigRef
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.providerConfigRef.name
- name: deletionPolicy
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.deletionPolicy
- name: region
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.region
toFieldPath: spec.forProvider.location
resources:
- name: mariadlserver
base:
apiVersion: dbformariadb.azure.upbound.io/v1beta1
kind: Server
spec:
forProvider:
version: "10.3"
administratorLogin: xp-admin
skuName: GP_Gen5_2
storageMb: 5120
sslEnforcementEnabled: false
sslMinimalTlsVersionEnforced: TLSEnforcementDisabled
identity:
- type: SystemAssigned
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- type: PatchSet
patchSetName: region
- fromFieldPath: spec.parameters.networkRef.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-mariadb"
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- fromFieldPath: metadata.uid
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- type: string
string:
fmt: "%s-mariadb"
- fromFieldPath: spec.parameters.storageGB
toFieldPath: spec.forProvider.storageMb
transforms:
- type: math
math:
multiply: 1024
- fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.resourceGroupNameSelector.matchLabels[azure.platform.upbound.io/network-id]
- fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.administratorLoginPasswordSecretRef.namespace
- fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.administratorLoginPasswordSecretRef.name
- fromFieldPath: spec.parameters.passwordSecretRef.key
toFieldPath: spec.forProvider.administratorLoginPasswordSecretRef.key
connectionDetails:
- type: FromFieldPath
name: host
fromFieldPath: status.atProvider.fqdn
- type: FromConnectionSecretKey
name: username
fromConnectionSecretKey: username
- type: FromConnectionSecretKey
name: password
fromConnectionSecretKey: password
- type: FromConnectionSecretKey
name: port
fromConnectionSecretKey: port
- name: vnetrule
base:
apiVersion: dbformariadb.azure.upbound.io/v1beta1
kind: VirtualNetworkRule
spec:
forProvider:
serverNameSelector:
matchControllerRef: true
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- fromFieldPath: spec.parameters.networkRef.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-sn-rule"
- fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.subnetIdSelector.matchLabels[azure.platform.upbound.io/network-id]
- fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.resourceGroupNameSelector.matchLabels[azure.platform.upbound.io/network-id]
- name: database
base:
apiVersion: dbformariadb.azure.upbound.io/v1beta1
kind: Database
spec:
forProvider:
charset: utf8
collation: utf8_general_ci
serverNameSelector:
matchControllerRef: true
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- fromFieldPath: spec.parameters.networkRef.id
toFieldPath: metadata.name
transforms:
- type: match
match:
patterns:
- type: regexp
regexp: '.*'
result: upbound
- fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.resourceGroupNameSelector.matchLabels[azure.platform.upbound.io/network-id]
mode: Pipeline
pipeline:
- step: patch-and-transform
functionRef:
name: upbound-function-patch-and-transform
input:
apiVersion: pt.fn.crossplane.io/v1beta1
kind: Resources
patchSets:
- name: providerConfigRef
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.providerConfigRef.name
- name: deletionPolicy
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.deletionPolicy
- name: region
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.region
toFieldPath: spec.forProvider.location
resources:
- name: mariadlserver
base:
apiVersion: dbformariadb.azure.upbound.io/v1beta1
kind: Server
spec:
forProvider:
administratorLogin: xp-admin
skuName: GP_Gen5_2
sslEnforcementEnabled: false
sslMinimalTlsVersionEnforced: TLSEnforcementDisabled
storageMb: 5120
version: "10.3"
connectionDetails:
- type: FromFieldPath
fromFieldPath: status.atProvider.fqdn
name: host
- type: FromConnectionSecretKey
fromConnectionSecretKey: username
name: username
- type: FromConnectionSecretKey
fromConnectionSecretKey: password
name: password
- type: FromConnectionSecretKey
fromConnectionSecretKey: port
name: port
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- type: PatchSet
patchSetName: region
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkRef.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: '%s-mariadb'
type: Format
- type: FromCompositeFieldPath
fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- type: FromCompositeFieldPath
fromFieldPath: metadata.uid
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- type: string
string:
fmt: '%s-mariadb'
type: Format
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.storageGB
toFieldPath: spec.forProvider.storageMb
transforms:
- type: math
math:
multiply: 1024
type: Multiply
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.resourceGroupNameSelector.matchLabels[azure.platform.upbound.io/network-id]
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.administratorLoginPasswordSecretRef.namespace
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.administratorLoginPasswordSecretRef.name
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.key
toFieldPath: spec.forProvider.administratorLoginPasswordSecretRef.key

- name: vnetrule
base:
apiVersion: dbformariadb.azure.upbound.io/v1beta1
kind: VirtualNetworkRule
spec:
forProvider:
serverNameSelector:
matchControllerRef: true
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkRef.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: '%s-sn-rule'
type: Format
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.subnetIdSelector.matchLabels[azure.platform.upbound.io/network-id]
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.resourceGroupNameSelector.matchLabels[azure.platform.upbound.io/network-id]

- name: database
base:
apiVersion: dbformariadb.azure.upbound.io/v1beta1
kind: Database
spec:
forProvider:
charset: utf8
collation: utf8_general_ci
serverNameSelector:
matchControllerRef: true
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkRef.id
toFieldPath: metadata.name
transforms:
- type: match
match:
fallbackValue: null
patterns:
- regexp: .*
result: upbound
type: regexp
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.resourceGroupNameSelector.matchLabels[azure.platform.upbound.io/network-id]
Loading