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 4608852 + a58bd10 commit 3ad0668
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 66 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}}}",
}
],
}
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 @@ -60,7 +60,7 @@ build.init: $(UP)

uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
@$(INFO) running automated tests
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e examples/app-claim.yaml --setup-script=test/setup.sh --default-timeout=2400 || $(FAIL)
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e examples/app-claim.yaml --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
139 changes: 78 additions & 61 deletions apis/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,81 @@ spec:
compositeTypeRef:
apiVersion: platform.upbound.io/v1alpha1
kind: XApp
resources:
- name: helmRelease
base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
rollbackLimit: 3
forProvider:
namespace: ghost
chart:
name: ghost
repository: https://charts.bitnami.com/bitnami
version: "19.3.10"
values:
persistence:
enabled: false
mysql:
enabled: false
externalDatabase:
database: upbound
port: 3306
ghostHost: upboundrocks.cloud
ghostBlogTitle: Upbound Rocks!
set:
- name: externalDatabase.host
valueFrom:
secretKeyRef:
key: host
- name: externalDatabase.user
valueFrom:
secretKeyRef:
key: username
- name: externalDatabase.password
valueFrom:
secretKeyRef:
key: password
patches:
# All Helm releases derive their labels and annotations from the XR.
- fromFieldPath: metadata.labels
toFieldPath: metadata.labels
- fromFieldPath: metadata.annotations
toFieldPath: metadata.annotations
# All Helm releases derive the ProviderConfig to use from the XR.
- fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.providerConfigRef.name
- fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.deletionPolicy
- fromFieldPath: spec.parameters.helm.chart.version
toFieldPath: spec.forProvider.chart.version
- fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.set[0].valueFrom.secretKeyRef.namespace
- fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.set[0].valueFrom.secretKeyRef.name
- fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.set[1].valueFrom.secretKeyRef.namespace
- fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.set[1].valueFrom.secretKeyRef.name
- fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.set[2].valueFrom.secretKeyRef.namespace
- fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.set[2].valueFrom.secretKeyRef.name
mode: Pipeline
pipeline:
- step: patch-and-transform
functionRef:
name: upbound-function-patch-and-transform
input:
apiVersion: pt.fn.crossplane.io/v1beta1
kind: Resources
resources:
- name: helmRelease
base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
forProvider:
chart:
name: ghost
repository: https://charts.bitnami.com/bitnami
version: 19.3.10
namespace: ghost
set:
- name: externalDatabase.host
valueFrom:
secretKeyRef:
key: host
- name: externalDatabase.user
valueFrom:
secretKeyRef:
key: username
- name: externalDatabase.password
valueFrom:
secretKeyRef:
key: password
values:
externalDatabase:
database: upbound
port: 3306
ghostBlogTitle: Upbound Rocks!
ghostHost: upboundrocks.cloud
mysql:
enabled: false
persistence:
enabled: false
rollbackLimit: 3
patches:
- type: FromCompositeFieldPath
fromFieldPath: metadata.labels
toFieldPath: metadata.labels
- type: FromCompositeFieldPath
fromFieldPath: metadata.annotations
toFieldPath: metadata.annotations
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.providerConfigRef.name
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.deletionPolicy
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.helm.chart.version
toFieldPath: spec.forProvider.chart.version
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.set[0].valueFrom.secretKeyRef.namespace
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.set[0].valueFrom.secretKeyRef.name
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.set[1].valueFrom.secretKeyRef.namespace
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.set[1].valueFrom.secretKeyRef.name
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.namespace
toFieldPath: spec.forProvider.set[2].valueFrom.secretKeyRef.namespace
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.passwordSecretRef.name
toFieldPath: spec.forProvider.set[2].valueFrom.secretKeyRef.name
8 changes: 6 additions & 2 deletions crossplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +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/crossplane-contrib/provider-helm
version: ">=v0.15.0"
# renovate: datasource=github-releases depName=crossplane-contrib/provider-helm
version: "v0.16.0"
- function: xpkg.upbound.io/upbound/function-patch-and-transform
# renovate: datasource=github-releases depName=upbound/function-patch-and-transform
version: "v0.2.1"
2 changes: 1 addition & 1 deletion examples/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ kind: Configuration
metadata:
name: configuration-app
spec:
package: xpkg.upbound.io/upbound/configuration-app:v0.1.0
package: xpkg.upbound.io/upbound/configuration-app:v0.2.0

0 comments on commit 3ad0668

Please sign in to comment.