Skip to content

Commit

Permalink
Merge pull request #133 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 8798d12 + 9cbf13a commit 2a7f666
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 141 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 @@ -65,7 +65,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/app-claim.yaml,examples/mariadb-claim.yaml,examples/cluster-claim.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/app-claim.yaml,examples/mariadb-claim.yaml,examples/cluster-claim.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
301 changes: 169 additions & 132 deletions apis/cluster/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,141 +7,178 @@ spec:
compositeTypeRef:
apiVersion: aws.platformref.upbound.io/v1alpha1
kind: XCluster
resources:
- name: XNetwork
base:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XNetwork
patches:
- fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.id
- fromFieldPath: spec.parameters.region
toFieldPath: spec.parameters.region
- fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.parameters.providerConfigName
- fromFieldPath: spec.parameters.networkSelector
toFieldPath: spec.compositionSelector.matchLabels[type]
- type: ToCompositeFieldPath
fromFieldPath: status.subnetIds
toFieldPath: status.subnetIds
policy:
fromFieldPath: Required
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: XNetwork
base:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XNetwork
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.id
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.region
toFieldPath: spec.parameters.region
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.parameters.providerConfigName
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.networkSelector
toFieldPath: spec.compositionSelector.matchLabels[type]
- type: ToCompositeFieldPath
fromFieldPath: status.subnetIds
policy:
fromFieldPath: Required
toFieldPath: status.subnetIds

- name: XEKS
base:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
connectionDetails:
- fromConnectionSecretKey: kubeconfig
patches:
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.labels[xeks.aws.platform.upbound.io/cluster-id]
- fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.id
- fromFieldPath: spec.parameters.region
toFieldPath: spec.parameters.region
- fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.parameters.providerConfigName
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.annotations[crossplane.io/external-name]
- fromFieldPath: metadata.uid
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- type: string
string:
fmt: "%s-eks"
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- fromFieldPath: spec.parameters.version
toFieldPath: spec.parameters.version
- fromFieldPath: spec.parameters.nodes.count
toFieldPath: spec.parameters.nodes.count
- fromFieldPath: spec.parameters.nodes.instanceType
toFieldPath: spec.parameters.nodes.instanceType
- fromFieldPath: spec.parameters.iam.roleArn
toFieldPath: spec.parameters.iam.roleArn
- fromFieldPath: spec.parameters.iam.userArn
toFieldPath: spec.parameters.iam.userArn
- name: XEKS
base:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
connectionDetails:
- type: FromConnectionSecretKey
fromConnectionSecretKey: kubeconfig
name: kubeconfig
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.id
toFieldPath: metadata.labels[xeks.aws.platform.upbound.io/cluster-id]
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.id
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.region
toFieldPath: spec.parameters.region
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.parameters.providerConfigName
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.id
toFieldPath: metadata.annotations[crossplane.io/external-name]
- type: FromCompositeFieldPath
fromFieldPath: metadata.uid
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- type: string
string:
fmt: '%s-eks'
type: Format
- type: FromCompositeFieldPath
fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.version
toFieldPath: spec.parameters.version
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.nodes.count
toFieldPath: spec.parameters.nodes.count
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.nodes.instanceType
toFieldPath: spec.parameters.nodes.instanceType
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.iam.roleArn
toFieldPath: spec.parameters.iam.roleArn
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.iam.userArn
toFieldPath: spec.parameters.iam.userArn

- name: XOss
base:
apiVersion: observe.platform.upbound.io/v1alpha1
kind: XOss
patches:
- fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.id
- fromFieldPath: spec.parameters.operators.prometheus.version
toFieldPath: spec.parameters.operators.prometheus.version
- name: XOss
base:
apiVersion: observe.platform.upbound.io/v1alpha1
kind: XOss
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.id
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.prometheus.version
toFieldPath: spec.parameters.operators.prometheus.version

- name: XFlux
base:
apiVersion: gitops.platform.upbound.io/v1alpha1
kind: XFlux
patches:
- fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.providerConfigName
- fromFieldPath: spec.parameters.operators.flux.version
toFieldPath: spec.parameters.operators.flux.version
- fromFieldPath: spec.parameters.operators.flux-sync.version
toFieldPath: spec.parameters.operators.flux-sync.version
- fromFieldPath: spec.parameters.gitops
toFieldPath: spec.parameters.source
- name: XFlux
base:
apiVersion: gitops.platform.upbound.io/v1alpha1
kind: XFlux
patches:
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.deletionPolicy
toFieldPath: spec.parameters.deletionPolicy
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.id
toFieldPath: spec.parameters.providerConfigName
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.flux.version
toFieldPath: spec.parameters.operators.flux.version
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.operators.flux-sync.version
toFieldPath: spec.parameters.operators.flux-sync.version
- type: FromCompositeFieldPath
fromFieldPath: spec.parameters.gitops
toFieldPath: spec.parameters.source

- name: usageXEksByXFlux
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
of:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
resourceSelector:
matchControllerRef: true
by:
apiVersion: gitops.platform.upbound.io/v1alpha1
kind: XFlux
resourceSelector:
matchControllerRef: true
- name: usageXEksByXFlux
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
by:
apiVersion: gitops.platform.upbound.io/v1alpha1
kind: XFlux
resourceSelector:
matchControllerRef: true
of:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
resourceSelector:
matchControllerRef: true

- name: usageXEksByXOss
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
of:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
resourceSelector:
matchControllerRef: true
by:
apiVersion: observe.platform.upbound.io/v1alpha1
kind: XOss
resourceSelector:
matchControllerRef: true
- name: usageXEksByXOss
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
by:
apiVersion: observe.platform.upbound.io/v1alpha1
kind: XOss
resourceSelector:
matchControllerRef: true
of:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
resourceSelector:
matchControllerRef: true

- name: usageXEksByArbitraryLabeledRelease
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
of:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
resourceSelector:
matchControllerRef: true
by:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
resourceSelector:
matchLabels:
platform.upbound.io/deletion-ordering: enabled
readinessChecks:
- type: None
- name: usageXEksByArbitraryLabeledRelease
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
by:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
resourceSelector:
matchLabels:
platform.upbound.io/deletion-ordering: enabled
of:
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XEKS
resourceSelector:
matchControllerRef: true
readinessChecks:
- type: None
Loading

0 comments on commit 2a7f666

Please sign in to comment.