Skip to content

Commit

Permalink
feat(caas): backport from caas
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Haar <[email protected]>
  • Loading branch information
haarchri committed Oct 17, 2023
1 parent 0c65232 commit 458adc9
Show file tree
Hide file tree
Showing 10 changed files with 707 additions and 709 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ build.init: $(UP)

# This target requires the following environment variables to be set:
# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat azure.json)
# - To ensure the proper functioning of the end-to-end test resource pre-deletion hook, it is crucial to arrange your resources appropriately.
# You can check the basic implementation here: https://github.com/upbound/uptest/blob/main/internal/templates/01-delete.yaml.tmpl.
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
@$(INFO) running automated tests
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e examples/postgres-claim.yaml,examples/mariadb-claim.yaml,examples/app-claim.yaml,examples/cluster-claim.yaml --setup-script=test/setup.sh --default-timeout=2400 || $(FAIL)
Expand Down
152 changes: 76 additions & 76 deletions apis/app/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,80 +10,80 @@ spec:
apiVersion: azure.platformref.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
- 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

- name: usageXEksByXApp
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
of:
apiVersion: azure.platformref.upbound.io/v1alpha1
kind: XAKS
by:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
resourceSelector:
matchControllerRef: true
patches:
- fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.of.resourceSelector.matchLabels[xaks.azure.platformref.upbound.io/cluster-id]
- name: usageXEksByXApp
base:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
of:
apiVersion: azure.platformref.upbound.io/v1alpha1
kind: XAKS
by:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
resourceSelector:
matchControllerRef: true
patches:
- fromFieldPath: spec.parameters.providerConfigName
toFieldPath: spec.of.resourceSelector.matchLabels[xaks.azure.platformref.upbound.io/cluster-id]
208 changes: 104 additions & 104 deletions apis/cluster/aks/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,108 +9,108 @@ spec:
apiVersion: azure.platformref.upbound.io/v1alpha1
kind: XAKS
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
- 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: kubernetes-cluster
base:
apiVersion: containerservice.azure.upbound.io/v1beta1
kind: KubernetesCluster
spec:
forProvider:
defaultNodePool:
- name: default
identity:
- type: "SystemAssigned"
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- type: PatchSet
patchSetName: region
- fromFieldPath: spec.parameters.version
toFieldPath: spec.forProvider.kubernetesVersion
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-aks"
- fromFieldPath: spec.parameters.id
toFieldPath: spec.forProvider.resourceGroupNameSelector.matchLabels[azure.platformref.upbound.io/network-id]
- fromFieldPath: spec.parameters.id
toFieldPath: spec.forProvider.defaultNodePool[0].vnetSubnetIdSelector.matchLabels[azure.platformref.upbound.io/network-id]
- fromFieldPath: spec.parameters.id
toFieldPath: spec.forProvider.dnsPrefix
- fromFieldPath: spec.parameters.nodes.instanceType
toFieldPath: spec.forProvider.defaultNodePool[0].vmSize
- fromFieldPath: spec.parameters.nodes.count
toFieldPath: spec.forProvider.defaultNodePool[0].nodeCount
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- fromFieldPath: metadata.uid
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- type: string
string:
fmt: "%s-akscluster"
connectionDetails:
- fromConnectionSecretKey: kubeconfig
- name: providerConfig-helm
base:
apiVersion: helm.crossplane.io/v1beta1
kind: ProviderConfig
spec:
credentials:
source: Secret
secretRef:
key: kubeconfig
patches:
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.name
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.credentials.secretRef.namespace
- fromFieldPath: metadata.uid
toFieldPath: spec.credentials.secretRef.name
transforms:
- type: string
string:
fmt: "%s-akscluster"
readinessChecks:
- type: None
- name: providerConfig-kubernetes
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: ProviderConfig
spec:
credentials:
source: Secret
secretRef:
key: kubeconfig
patches:
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.name
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.credentials.secretRef.namespace
- fromFieldPath: metadata.uid
toFieldPath: spec.credentials.secretRef.name
transforms:
- type: string
string:
fmt: "%s-akscluster"
readinessChecks:
- type: None
- name: kubernetes-cluster
base:
apiVersion: containerservice.azure.upbound.io/v1beta1
kind: KubernetesCluster
spec:
forProvider:
defaultNodePool:
- name: default
identity:
- type: "SystemAssigned"
patches:
- type: PatchSet
patchSetName: providerConfigRef
- type: PatchSet
patchSetName: deletionPolicy
- type: PatchSet
patchSetName: region
- fromFieldPath: spec.parameters.version
toFieldPath: spec.forProvider.kubernetesVersion
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-aks"
- fromFieldPath: spec.parameters.id
toFieldPath: spec.forProvider.resourceGroupNameSelector.matchLabels[azure.platformref.upbound.io/network-id]
- fromFieldPath: spec.parameters.id
toFieldPath: spec.forProvider.defaultNodePool[0].vnetSubnetIdSelector.matchLabels[azure.platformref.upbound.io/network-id]
- fromFieldPath: spec.parameters.id
toFieldPath: spec.forProvider.dnsPrefix
- fromFieldPath: spec.parameters.nodes.instanceType
toFieldPath: spec.forProvider.defaultNodePool[0].vmSize
- fromFieldPath: spec.parameters.nodes.count
toFieldPath: spec.forProvider.defaultNodePool[0].nodeCount
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- fromFieldPath: metadata.uid
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- type: string
string:
fmt: "%s-akscluster"
connectionDetails:
- fromConnectionSecretKey: kubeconfig
- name: providerConfig-helm
base:
apiVersion: helm.crossplane.io/v1beta1
kind: ProviderConfig
spec:
credentials:
source: Secret
secretRef:
key: kubeconfig
patches:
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.name
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.credentials.secretRef.namespace
- fromFieldPath: metadata.uid
toFieldPath: spec.credentials.secretRef.name
transforms:
- type: string
string:
fmt: "%s-akscluster"
readinessChecks:
- type: None
- name: providerConfig-kubernetes
base:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: ProviderConfig
spec:
credentials:
source: Secret
secretRef:
key: kubeconfig
patches:
- fromFieldPath: spec.parameters.id
toFieldPath: metadata.name
- fromFieldPath: spec.writeConnectionSecretToRef.namespace
toFieldPath: spec.credentials.secretRef.namespace
- fromFieldPath: metadata.uid
toFieldPath: spec.credentials.secretRef.name
transforms:
- type: string
string:
fmt: "%s-akscluster"
readinessChecks:
- type: None
Loading

0 comments on commit 458adc9

Please sign in to comment.