Skip to content

Commit

Permalink
Merge pull request #3 from upbound/feature/p-t-function
Browse files Browse the repository at this point in the history
feat(function): switch to function, add renovate, bump providers
  • Loading branch information
haarchri authored Jan 3, 2024
2 parents da8b628 + 90cac9c commit 8e7c61a
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 91 deletions.
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}}}",
}
],
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/.idea

*.xpkg
kubeconfig
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PLATFORMS ?= linux_amd64

UP_VERSION = v0.21.0
UP_CHANNEL = stable
UPTEST_VERSION = v0.6.1
UPTEST_VERSION = v0.9.0

-include build/makelib/k8s_tools.mk
# ====================================================================================
Expand Down Expand Up @@ -63,7 +63,7 @@ build.init: $(UP)
# - UPTEST_DATASOURCE_PATH (optional), see https://github.com/upbound/uptest#injecting-dynamic-values-and-datasource
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
@$(INFO) running automated tests
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e examples/mariadb-claim.yaml,examples/postgres-claim.yaml,examples/network.yaml --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=test/setup.sh --default-timeout=2400 || $(FAIL)
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e examples/mariadb-claim.yaml,examples/postgres-claim.yaml,examples/network.yaml --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=test/setup.sh --default-timeout=2400 || $(FAIL)
@$(OK) running automated tests

# This target requires the following environment variables to be set:
Expand Down
197 changes: 111 additions & 86 deletions apis/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,89 +9,114 @@ spec:
compositeTypeRef:
apiVersion: aws.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.region
resources:
- name: compositeSQLInstanceDbSubnetGroup
base:
apiVersion: rds.aws.upbound.io/v1beta1
kind: SubnetGroup
spec:
forProvider:
description: An excellent formation of subnetworks.
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- type: PatchSet
patchSetName: region
- fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.subnetIdSelector.matchLabels[networks.aws.platform.upbound.io/network-id]
- name: RDSInstanceSmall
base:
apiVersion: rds.aws.upbound.io/v1beta1
kind: Instance
spec:
forProvider:
dbSubnetGroupNameSelector:
matchControllerRef: true
instanceClass: db.t3.micro
username: masteruser
skipFinalSnapshot: true
publiclyAccessible: false
dbName: upbound
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- type: PatchSet
patchSetName: region
- fromFieldPath: metadata.uid
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- type: string
string:
fmt: "%s-sql"
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- fromFieldPath: spec.parameters.engine
toFieldPath: spec.forProvider.engine
- fromFieldPath: spec.parameters.engineVersion
toFieldPath: spec.forProvider.engineVersion
- fromFieldPath: spec.parameters.storageGB
toFieldPath: spec.forProvider.allocatedStorage
- fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.vpcSecurityGroupIdSelector.matchLabels[networks.aws.platform.upbound.io/network-id]
- fromFieldPath: spec.parameters.autoGeneratePassword
toFieldPath: spec.forProvider.autoGeneratePassword
- fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.passwordSecretRef.namespace
- fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.passwordSecretRef.name
- fromFieldPath: spec.parameters.passwordSecretRef.key
toFieldPath: spec.forProvider.passwordSecretRef.key
connectionDetails:
- fromFieldPath: status.atProvider.endpoint
name: endpoint
- fromFieldPath: status.atProvider.address
name: host
- fromFieldPath: spec.forProvider.username
name: username
- fromConnectionSecretKey: attribute.password
name: password
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.region
resources:
- name: compositeSQLInstanceDbSubnetGroup
base:
apiVersion: rds.aws.upbound.io/v1beta1
kind: SubnetGroup
spec:
forProvider:
description: An excellent formation of subnetworks.
patches:
- patchSetName: providerConfigRef
type: PatchSet
- patchSetName: deletionPolicy
type: PatchSet
- patchSetName: region
type: PatchSet
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.subnetIdSelector.matchLabels[networks.aws.platform.upbound.io/network-id]

- name: RDSInstanceSmall
base:
apiVersion: rds.aws.upbound.io/v1beta1
kind: Instance
spec:
forProvider:
dbName: upbound
dbSubnetGroupNameSelector:
matchControllerRef: true
instanceClass: db.t3.micro
publiclyAccessible: false
skipFinalSnapshot: true
username: masteruser
connectionDetails:
- type: FromFieldPath
fromFieldPath: status.atProvider.endpoint
name: endpoint
- type: FromFieldPath
fromFieldPath: status.atProvider.address
name: host
- type: FromFieldPath
fromFieldPath: spec.forProvider.username
name: username
- type: FromConnectionSecretKey
fromConnectionSecretKey: attribute.password
name: password
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- type: PatchSet
patchSetName: region
- type: FromCompositeFieldPath
fromFieldPath: metadata.uid
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- type: string
string:
fmt: '%s-sql'
type: Format
- type: FromCompositeFieldPath
fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.engine
toFieldPath: spec.forProvider.engine
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.engineVersion
toFieldPath: spec.forProvider.engineVersion
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.storageGB
toFieldPath: spec.forProvider.allocatedStorage
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkRef.id
toFieldPath: spec.forProvider.vpcSecurityGroupIdSelector.matchLabels[networks.aws.platform.upbound.io/network-id]
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.autoGeneratePassword
toFieldPath: spec.forProvider.autoGeneratePassword
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.passwordSecretRef.namespace
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.passwordSecretRef.name
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.key
toFieldPath: spec.forProvider.passwordSecretRef.key
8 changes: 5 additions & 3 deletions crossplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ metadata:
meta.crossplane.io/license: Apache-2.0
spec:
crossplane:
version: ">=v1.12.1-0"
version: ">=v1.14.1-0"
dependsOn:
- provider: xpkg.upbound.io/upbound/provider-aws-rds
version: ">=v0.42.0"
# renovate: datasource=github-releases depName=upbound/provider-aws
version: "v0.47.0"
- configuration: xpkg.upbound.io/upbound/configuration-aws-network
version: ">=v0.1.0"
# renovate: datasource=github-releases depName=upbound/configuration-aws-network
version: "v0.6.0"

0 comments on commit 8e7c61a

Please sign in to comment.