diff --git a/bind/docs/dynamic-client.md b/bind/docs/dynamic-client.md new file mode 100644 index 0000000..716ff4d --- /dev/null +++ b/bind/docs/dynamic-client.md @@ -0,0 +1,20 @@ +# Dynamic Client + +Klutch Bind uses client-go's `dynamic` client, a dynamic client is a kubernetes client that does not +have an associated type. Klutch-bind uses it in the Konnector to sync arbitrary resources between +clusters. The resources to be synced are configured at runtime by the APIs that the user has bound, +so they cannot be pre-compiled. + +Instead of working on objects of a struct, it takes and returns `map[string]interface{}`. The string +key is the field name, and the interface is the value of the field. For example: `obj["spec"]` will +return the spec, which will be another `map[string]interface{}`. Because the client does not have an +associated type, it needs to be parameterized with the `GroupVersionKind` for operations. + +Inside the Konnector, klutch-bind automatically configures and starts new controllers for each +resource to be synchronized based on dynamic client-go clients. To learn more about how controllers +are constructed using client-go you can check out the following resources: + +- [kubernetes sample controller using + client-go](https://github.com/kubernetes/sample-controller/blob/master/docs/controller-client-go.md) +- [client-go dynamic](https://github.com/kubernetes/client-go/tree/master/examples/dynamic-create-update-delete-deployment) +- [kubecon talk about client-go controllers](https://www.youtube.com/watch?v=_BuqPMlXfpE) diff --git a/crossplane-api/Makefile b/crossplane-api/Makefile index ec212a6..387badd 100644 --- a/crossplane-api/Makefile +++ b/crossplane-api/Makefile @@ -6,9 +6,13 @@ providerconfig: ifdef postgresInstanceName @export PG_SERVICE_INSTANCE_NAME=$$postgresInstanceName; \ if [[ $$GET_BROKER_IP == "true" ]]; then \ - export PG_SERVICEBROKER_IP=$$(ssh aws-s1-inception ". /var/vcap/store/jumpbox/home/a9s/bosh/envs/dsf2;bosh -d $$PG_SERVICE_INSTANCE_NAME instances" | grep "broker/" | sed 's/\t/ /g' | tr -s " " | cut -d " " -f4); \ + if [[ $$PG_SERVICE_INSTANCE_NAME == "" ]]; then \ + echo "ERROR: postgresInstanceName must not be empty!"; \ + exit 1; \ + fi; \ + export PG_SERVICEBROKER_IP=$$(ssh aws-s1-inception ". /var/vcap/store/jumpbox/home/a9s/bosh/envs/dsf2;bosh -d $$PG_SERVICE_INSTANCE_NAME instances" --json | yq -p=json '.Tables.0.Rows.[] | select ( .instance == "broker/*") | .ips'); \ export PG_SERVICEBROKER_HOST="http://$$PG_SERVICEBROKER_IP:3000"; \ - export PG_BACKUP_MANAGER_IP=$$(ssh aws-s1-inception ". /var/vcap/store/jumpbox/home/a9s/bosh/envs/dsf2;bosh -d $$PG_SERVICE_INSTANCE_NAME instances" | grep "backup-manager/" | sed 's/\t/ /g' | tr -s " " | cut -d " " -f4); \ + export PG_BACKUP_MANAGER_IP=$$(ssh aws-s1-inception ". /var/vcap/store/jumpbox/home/a9s/bosh/envs/dsf2;bosh -d $$PG_SERVICE_INSTANCE_NAME instances" --json | yq -p=json '.Tables.0.Rows.[] | select ( .instance == "backup-manager/*") | .ips'); \ export PG_BACKUP_MANAGER_HOST="http://$$PG_BACKUP_MANAGER_IP:3000"; \ echo "Backup Manager IP: $$PG_BACKUP_MANAGER_IP"; \ echo "Service Broker IP: $$PG_SERVICEBROKER_IP"; \ diff --git a/crossplane-api/README.md b/crossplane-api/README.md index a4e34a2..83786cc 100644 --- a/crossplane-api/README.md +++ b/crossplane-api/README.md @@ -308,6 +308,21 @@ Crossplane won't be able to manage RBAC dynamically. As a result, Compositions will not be able to configure the provider-anynines managed resources due to authorization issues. +### Install Crossplane Functions + +Additionally, we install composition functions. Composition functions (or simply “functions”) are Crossplane extensions that template Crossplane resources. Crossplane uses these functions to determine which resources to create when a composite resource (XR) is created. To verify that the composition functions are correctly installed, use the following command: + +```bash +kubectl get function +``` + +Expected output: + +```text +NAME INSTALLED HEALTHY PACKAGE AGE +function-patch-and-transform True True xpkg.upbound.io/crossplane-contrib/function-patch-and-transform:v0.1.4 +``` + #### Install ProviderConfig for provider-anynines To configure the provider, based on your development environment, make sure to @@ -394,10 +409,10 @@ to refer to a valid service and plan. | postgresql-single-nano | 1 | 3Gi | 2 | 1 Gi | | postgresql-single-small | 1 | 10Gi | 2 | 2 Gi | | postgresql-single-medium | 1 | 50Gi | 2 | 4 Gi | -| postgresql-single-large | 1 | 200Gi | 4 | 16 Gi | -| postgresql-cluster-small | 3 | 10Gi | 2 | 2 Gi | -| postgresql-cluster-medium | 3 | 50Gi | 2 | 4 Gi | -| postgresql-cluster-large | 3 | 200Gi | 4 | 16 Gi | +| postgresql-single-big | 1 | 200Gi | 4 | 16 Gi | +| postgresql-replicas-small | 3 | 10Gi | 2 | 2 Gi | +| postgresql-replicas-medium | 3 | 50Gi | 2 | 4 Gi | +| postgresql-replicas-big | 3 | 200Gi | 4 | 16 Gi | ```bash kubectl apply -f ./crossplane-api/examples/a8s/postgresql-claim.yaml @@ -560,23 +575,23 @@ field in [definition.yaml](https://github.com/anynines/klutchio/blob/main/crossp Within this field you can see a list of supported Plans: ```yaml - plans: &pgPlans ["postgresql-cluster-small", - "postgresql-cluster-medium", "postgresql-cluster-large", + plans: &pgPlans ["postgresql-replicas-small", + "postgresql-replicas-medium", "postgresql-replicas-big", "postgresql-single-nano","postgresql-single-small", - "postgresql-single-medium", "postgresql-single-large"] + "postgresql-single-medium", "postgresql-single-big"] ``` 3. Update the "plans" list with the new Plan to be supported. - For example, suppose the new plan "postgresql-single-extralarge" is + For example, suppose the new plan "postgresql-single-huge" is introduced, so the list will be updated to: ```yaml - plans: &pgPlans ["postgresql-cluster-small", - "postgresql-cluster-medium", "postgresql-cluster-large", + plans: &pgPlans ["postgresql-replicas-small", + "postgresql-replicas-medium", "postgresql-replicas-big", "postgresql-single-nano","postgresql-single-small", - "postgresql-single-medium", "postgresql-single-large", - "postgresql-single-extralarge"] + "postgresql-single-medium", "postgresql-single-big", + "postgresql-single-huge"] ``` 4. Update the validation rules. @@ -586,7 +601,7 @@ Within this field you can see a list of supported Plans: [definition.yaml](https://github.com/anynines/klutchio/blob/main/crossplane-api/api/common/postgresql_definition.yaml#L30) file under the x-kubernetes-validations.rule field. - Continuing the example with the "postgresql-single-extralarge", the + Continuing the example with the "postgresql-single-huge", the validation in this case should be updated with the following rules that prohibit the transition from extralarge to smaller dataservice instances. @@ -600,13 +615,13 @@ Within this field you can see a list of supported Plans: field in the [composition file](https://github.com/anynines/klutchio/blob/main/crossplane-api/api/a8s/postgresql/composition.yaml) should also be updated. - For the "postgresql-single-extralarge" example, we could add something + For the "postgresql-single-huge" example, we could add something similar to: ```yaml - volumeSizeExtraLarge: &volumeSizeExtraLarge "1000Gi" - CPUExtraLarge: &CPUExtraLarge "8" - MemoryExtraLarge: &MemoryExtraLarge "32Gi" + volumeSizeHuge: &volumeSizeHuge "1000Gi" + CPUHuge: &CPUHuge "8" + MemoryHuge: &MemoryHuge "32Gi" ``` 6. Finally, the [maps](https://github.com/anynines/klutchio/blob/main/crossplane-api/api/a8s/postgresql/composition.yaml#L53) @@ -614,7 +629,7 @@ Within this field you can see a list of supported Plans: [composition file](https://github.com/anynines/klutchio/blob/main/crossplane-api/api/a8s/postgresql/composition.yaml) should also be updated. - For our favorite "postgresql-single-extralarge" example this could mean + For our favorite "postgresql-single-huge" example this could mean adding to the maps something like: ```yaml @@ -624,8 +639,8 @@ Within this field you can see a list of supported Plans: nano: *volumeSizeNano small: *volumeSizeSmall medium: *volumeSizeMedium - large: *volumeSizeLarge - extralarge: *volumeSizeExtraLarge + big: *volumeSizeLarge + huge: *volumeSizeHuge ... - type: map @@ -633,8 +648,8 @@ Within this field you can see a list of supported Plans: nano: *CPUNano small: *CPUSmall medium: *CPUMedium - large: *CPULarge - extralarge: *CPUExtraLarge + big: *CPULarge + huge: *CPUHuge ... - type: map @@ -642,8 +657,8 @@ Within this field you can see a list of supported Plans: nano: *MemoryNano small: *MemorySmall medium: *MemoryMedium - large: *MemoryLarge - extralarge: *MemoryExtraLarge + big: *MemoryLarge + huge: *MemoryHuge ... ``` diff --git a/crossplane-api/api/a8s/backup/composition.yaml b/crossplane-api/api/a8s/backup/composition.yaml index a1a8851..8a212d7 100644 --- a/crossplane-api/api/a8s/backup/composition.yaml +++ b/crossplane-api/api/a8s/backup/composition.yaml @@ -6,53 +6,60 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XBackup - resources: - - name: a8s-backup - base: - apiVersion: kubernetes.crossplane.io/v1alpha1 - kind: Object - spec: - forProvider: - manifest: - apiVersion: backups.anynines.com/v1beta3 - kind: Backup - providerConfigRef: - name: kubernetes-provider - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.serviceInstanceType - toFieldPath: spec.forProvider.manifest.spec.serviceInstance.apiGroup - transforms: - - type: map - map: - postgresql: postgresql.anynines.com - - fromFieldPath: spec.serviceInstanceType - toFieldPath: spec.forProvider.manifest.spec.serviceInstance.kind - transforms: - - type: map - map: - postgresql: PostgreSQL - - fromFieldPath: spec.instanceRef - toFieldPath: spec.forProvider.manifest.spec.serviceInstance.name - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.backupID - toFieldPath: status.managed.backupID - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.conditions - toFieldPath: status.managed.conditions - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.lastObservationTime - toFieldPath: status.managed.lastObservationTime - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.podUsedNamespacedName - toFieldPath: status.managed.podUsedNamespacedName - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.podUsedUID - toFieldPath: status.managed.podUsedUID - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.retries - toFieldPath: status.managed.retries - + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a8s-backup + base: + apiVersion: kubernetes.crossplane.io/v1alpha1 + kind: Object + spec: + forProvider: + manifest: + apiVersion: backups.anynines.com/v1beta3 + kind: Backup + providerConfigRef: + name: kubernetes-provider + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.serviceInstanceType + toFieldPath: spec.forProvider.manifest.spec.serviceInstance.apiGroup + transforms: + - type: map + map: + postgresql: postgresql.anynines.com + - fromFieldPath: spec.serviceInstanceType + toFieldPath: spec.forProvider.manifest.spec.serviceInstance.kind + transforms: + - type: map + map: + postgresql: PostgreSQL + - fromFieldPath: spec.instanceRef + toFieldPath: spec.forProvider.manifest.spec.serviceInstance.name + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.backupID + toFieldPath: status.managed.backupID + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.conditions + toFieldPath: status.managed.conditions + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.lastObservationTime + toFieldPath: status.managed.lastObservationTime + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.podUsedNamespacedName + toFieldPath: status.managed.podUsedNamespacedName + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.podUsedUID + toFieldPath: status.managed.podUsedUID + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.retries + toFieldPath: status.managed.retries diff --git a/crossplane-api/api/a8s/postgresql/composition.yaml b/crossplane-api/api/a8s/postgresql/composition.yaml index 513f4b3..d2fe75b 100644 --- a/crossplane-api/api/a8s/postgresql/composition.yaml +++ b/crossplane-api/api/a8s/postgresql/composition.yaml @@ -6,187 +6,195 @@ metadata: volumeSizeNano: &volumeSizeNano "3Gi" volumeSizeSmall: &volumeSizeSmall "10Gi" volumeSizeMedium: &volumeSizeMedium "50Gi" - volumeSizeLarge: &volumeSizeLarge "100Gi" + volumeSizeBig: &volumeSizeBig "100Gi" CPUNano: &CPUNano "2" CPUSmall: &CPUSmall "2" CPUMedium: &CPUMedium "2" - CPULarge: &CPULarge "4" + CPUBig: &CPUBig "4" MemoryNano: &MemoryNano "1Gi" MemorySmall: &MemorySmall "2Gi" MemoryMedium: &MemoryMedium "4Gi" - MemoryLarge: &MemoryLarge "16Gi" + MemoryBig: &MemoryBig "16Gi" spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XPostgresqlInstance - resources: - - name: a8s-postgresql - base: - apiVersion: kubernetes.crossplane.io/v1alpha1 - kind: Object - spec: - forProvider: - manifest: - apiVersion: postgresql.anynines.com/v1beta3 - kind: Postgresql + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a8s-postgresql + base: + apiVersion: kubernetes.crossplane.io/v1alpha1 + kind: Object spec: - expose: "LoadBalancer" - providerConfigRef: - name: kubernetes-provider - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.service - toFieldPath: spec.forProvider.manifest.spec.version - transforms: - # If the value of the service is a9s-postgresql13, the value of the - # 'version' field will be 13 - - type: string - string: - type: TrimPrefix - trim: 'a9s-postgresql' - - type: convert - convert: - toType: int - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.manifest.spec.volumeSize - transforms: - # If the value of the plan is postgresql-single-small, the value of - # the 'volumeSize' field will be 10Gi - - type: string - string: - type: Regexp - regexp: - match: '\b(\w+)$' - - type: map - map: - nano: *volumeSizeNano - small: *volumeSizeSmall - medium: *volumeSizeMedium - large: *volumeSizeLarge - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.manifest.spec.resources.requests.cpu - transforms: - - type: string - string: - type: Regexp - regexp: - match: '\b(\w+)$' - - type: map - map: - nano: *CPUNano - small: *CPUSmall - medium: *CPUMedium - large: *CPULarge - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.manifest.spec.resources.limits.cpu - transforms: - - type: string - string: - type: Regexp - regexp: - match: '\b(\w+)$' - - type: map - map: - nano: *CPUNano - small: *CPUSmall - medium: *CPUMedium - large: *CPULarge - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.manifest.spec.resources.requests.memory - transforms: - - type: string - string: - type: Regexp - regexp: - match: '\b(\w+)$' - - type: map - map: - nano: *MemoryNano - small: *MemorySmall - medium: *MemoryMedium - large: *MemoryLarge - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.manifest.spec.resources.limits.memory - transforms: - - type: string - string: - type: Regexp - regexp: - match: '\b(\w+)$' - - type: map - map: - nano: *MemoryNano - small: *MemorySmall - medium: *MemoryMedium - large: *MemoryLarge - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.manifest.spec.replicas - transforms: - # If the value of the plan is postgresql-single-small, the value of - # the 'replica' field will be 1 - - type: string - string: - type: Regexp - regexp: - match: '-(.*?)-' - - type: map - map: - -single-: "1" - -replica-: "3" - - type: convert - convert: - toType: int - - fromFieldPath: spec.expose - toFieldPath: spec.forProvider.manifest.spec.expose + forProvider: + manifest: + apiVersion: postgresql.anynines.com/v1beta3 + kind: Postgresql + spec: + expose: "LoadBalancer" + providerConfigRef: + name: kubernetes-provider + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.service + toFieldPath: spec.forProvider.manifest.spec.version + transforms: + # If the value of the service is a9s-postgresql13, the value of the + # 'version' field will be 13 + - type: string + string: + type: TrimPrefix + trim: "a9s-postgresql" + - type: convert + convert: + toType: int + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.manifest.spec.volumeSize + transforms: + # If the value of the plan is postgresql-single-small, the value of + # the 'volumeSize' field will be 10Gi + - type: string + string: + type: Regexp + regexp: + match: '\b(\w+)$' + - type: map + map: + nano: *volumeSizeNano + small: *volumeSizeSmall + medium: *volumeSizeMedium + big: *volumeSizeBig + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.manifest.spec.resources.requests.cpu + transforms: + - type: string + string: + type: Regexp + regexp: + match: '\b(\w+)$' + - type: map + map: + nano: *CPUNano + small: *CPUSmall + medium: *CPUMedium + big: *CPUBig + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.manifest.spec.resources.limits.cpu + transforms: + - type: string + string: + type: Regexp + regexp: + match: '\b(\w+)$' + - type: map + map: + nano: *CPUNano + small: *CPUSmall + medium: *CPUMedium + big: *CPUBig + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.manifest.spec.resources.requests.memory + transforms: + - type: string + string: + type: Regexp + regexp: + match: '\b(\w+)$' + - type: map + map: + nano: *MemoryNano + small: *MemorySmall + medium: *MemoryMedium + big: *MemoryBig + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.manifest.spec.resources.limits.memory + transforms: + - type: string + string: + type: Regexp + regexp: + match: '\b(\w+)$' + - type: map + map: + nano: *MemoryNano + small: *MemorySmall + medium: *MemoryMedium + big: *MemoryBig + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.manifest.spec.replicas + transforms: + # If the value of the plan is postgresql-single-small, the value of + # the 'replica' field will be 1 + - type: string + string: + type: Regexp + regexp: + match: "-(.*?)-" + - type: map + map: + -single-: "1" + -replica-: "3" + - type: convert + convert: + toType: int + - fromFieldPath: spec.expose + toFieldPath: spec.forProvider.manifest.spec.expose - - fromFieldPath: spec.parameters.maxConnections - toFieldPath: spec.forProvider.manifest.spec.parameters.maxConnections - - fromFieldPath: spec.parameters.tempFileLimit - toFieldPath: spec.forProvider.manifest.spec.parameters.tempFileLimitKiloBytes - - fromFieldPath: spec.parameters.trackIoTiming - toFieldPath: spec.forProvider.manifest.spec.parameters.trackIOTiming - - fromFieldPath: spec.parameters.archiveTimeout - toFieldPath: spec.forProvider.manifest.spec.parameters.archiveTimeoutSeconds - - fromFieldPath: spec.parameters.statementTimeout - toFieldPath: spec.forProvider.manifest.spec.parameters.statementTimeoutMillis - - fromFieldPath: spec.parameters.walWriterDelay - toFieldPath: spec.forProvider.manifest.spec.parameters.walWriterDelayMillis - - fromFieldPath: spec.parameters.maxLocksPerTransaction - toFieldPath: spec.forProvider.manifest.spec.parameters.maxLocksPerTransaction - - fromFieldPath: spec.parameters.maxReplicationSlots - toFieldPath: spec.forProvider.manifest.spec.parameters.maxReplicationSlots - - fromFieldPath: spec.parameters.maxWalSenders - toFieldPath: spec.forProvider.manifest.spec.parameters.maxWALSenders - - fromFieldPath: spec.parameters.synchronousCommit - toFieldPath: spec.forProvider.manifest.spec.parameters.synchronousCommit - - fromFieldPath: spec.parameters.sslCiphers - toFieldPath: spec.forProvider.manifest.spec.parameters.sslCiphers - - fromFieldPath: spec.parameters.sslMinProtocolVersion - toFieldPath: spec.forProvider.manifest.spec.parameters.sslMinProtocolVersion - - fromFieldPath: spec.parameters.clientMinMessages - toFieldPath: spec.forProvider.manifest.spec.parameters.clientMinMessages - transforms: &toLowercase - - type: string - string: - type: Convert - convert: ToLower - - fromFieldPath: spec.parameters.logMinMessages - toFieldPath: spec.forProvider.manifest.spec.parameters.logMinMessages - transforms: *toLowercase - - fromFieldPath: spec.parameters.logMinErrorStatement - toFieldPath: spec.forProvider.manifest.spec.parameters.logMinErrorStatement - transforms: *toLowercase - - fromFieldPath: spec.parameters.logStatement - toFieldPath: spec.forProvider.manifest.spec.parameters.logStatement - - fromFieldPath: spec.parameters.logErrorVerbosity - toFieldPath: spec.forProvider.manifest.spec.parameters.logErrorVerbosity + - fromFieldPath: spec.parameters.maxConnections + toFieldPath: spec.forProvider.manifest.spec.parameters.maxConnections + - fromFieldPath: spec.parameters.tempFileLimit + toFieldPath: spec.forProvider.manifest.spec.parameters.tempFileLimitKiloBytes + - fromFieldPath: spec.parameters.trackIoTiming + toFieldPath: spec.forProvider.manifest.spec.parameters.trackIOTiming + - fromFieldPath: spec.parameters.archiveTimeout + toFieldPath: spec.forProvider.manifest.spec.parameters.archiveTimeoutSeconds + - fromFieldPath: spec.parameters.statementTimeout + toFieldPath: spec.forProvider.manifest.spec.parameters.statementTimeoutMillis + - fromFieldPath: spec.parameters.walWriterDelay + toFieldPath: spec.forProvider.manifest.spec.parameters.walWriterDelayMillis + - fromFieldPath: spec.parameters.maxLocksPerTransaction + toFieldPath: spec.forProvider.manifest.spec.parameters.maxLocksPerTransaction + - fromFieldPath: spec.parameters.maxReplicationSlots + toFieldPath: spec.forProvider.manifest.spec.parameters.maxReplicationSlots + - fromFieldPath: spec.parameters.maxWalSenders + toFieldPath: spec.forProvider.manifest.spec.parameters.maxWALSenders + - fromFieldPath: spec.parameters.synchronousCommit + toFieldPath: spec.forProvider.manifest.spec.parameters.synchronousCommit + - fromFieldPath: spec.parameters.sslCiphers + toFieldPath: spec.forProvider.manifest.spec.parameters.sslCiphers + - fromFieldPath: spec.parameters.sslMinProtocolVersion + toFieldPath: spec.forProvider.manifest.spec.parameters.sslMinProtocolVersion + - fromFieldPath: spec.parameters.clientMinMessages + toFieldPath: spec.forProvider.manifest.spec.parameters.clientMinMessages + transforms: &toLowercase + - type: string + string: + type: Convert + convert: ToLower + - fromFieldPath: spec.parameters.logMinMessages + toFieldPath: spec.forProvider.manifest.spec.parameters.logMinMessages + transforms: *toLowercase + - fromFieldPath: spec.parameters.logMinErrorStatement + toFieldPath: spec.forProvider.manifest.spec.parameters.logMinErrorStatement + transforms: *toLowercase + - fromFieldPath: spec.parameters.logStatement + toFieldPath: spec.forProvider.manifest.spec.parameters.logStatement + - fromFieldPath: spec.parameters.logErrorVerbosity + toFieldPath: spec.forProvider.manifest.spec.parameters.logErrorVerbosity - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.clusterStatus - toFieldPath: status.managed.clusterStatus - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.readyReplicas - toFieldPath: status.managed.readyReplicas + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.clusterStatus + toFieldPath: status.managed.clusterStatus + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.readyReplicas + toFieldPath: status.managed.readyReplicas diff --git a/crossplane-api/api/a8s/restore/composition.yaml b/crossplane-api/api/a8s/restore/composition.yaml index 856ec96..f46ee26 100644 --- a/crossplane-api/api/a8s/restore/composition.yaml +++ b/crossplane-api/api/a8s/restore/composition.yaml @@ -6,54 +6,62 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XRestore - resources: - - name: a8s-restore - base: - apiVersion: kubernetes.crossplane.io/v1alpha1 - kind: Object - spec: - forProvider: - manifest: - apiVersion: backups.anynines.com/v1beta3 - kind: Restore - providerConfigRef: - name: kubernetes-provider - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.serviceInstanceType - toFieldPath: spec.forProvider.manifest.spec.serviceInstance.apiGroup - transforms: - - type: map - map: - postgresql: postgresql.anynines.com - - fromFieldPath: spec.serviceInstanceType - toFieldPath: spec.forProvider.manifest.spec.serviceInstance.kind - transforms: - - type: map - map: - postgresql: PostgreSQL - - fromFieldPath: spec.instanceRef - toFieldPath: spec.forProvider.manifest.spec.serviceInstance.name - - fromFieldPath: spec.backupRef - toFieldPath: spec.forProvider.manifest.spec.backupName - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.conditions - toFieldPath: status.managed.conditions - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.lastObservationTime - toFieldPath: status.managed.lastObservationTime - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.podToPoll.ip - toFieldPath: status.managed.podToPoll.ip - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.podToPoll.namespacedName - toFieldPath: status.managed.podToPoll.namespacedName - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.podToPoll.uid - toFieldPath: status.managed.podToPoll.uid - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.restoreID - toFieldPath: status.managed.restoreID \ No newline at end of file + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a8s-restore + base: + apiVersion: kubernetes.crossplane.io/v1alpha1 + kind: Object + spec: + forProvider: + manifest: + apiVersion: backups.anynines.com/v1beta3 + kind: Restore + providerConfigRef: + name: kubernetes-provider + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.serviceInstanceType + toFieldPath: spec.forProvider.manifest.spec.serviceInstance.apiGroup + transforms: + - type: map + map: + postgresql: postgresql.anynines.com + - fromFieldPath: spec.serviceInstanceType + toFieldPath: spec.forProvider.manifest.spec.serviceInstance.kind + transforms: + - type: map + map: + postgresql: PostgreSQL + - fromFieldPath: spec.instanceRef + toFieldPath: spec.forProvider.manifest.spec.serviceInstance.name + - fromFieldPath: spec.backupRef + toFieldPath: spec.forProvider.manifest.spec.backupName + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.conditions + toFieldPath: status.managed.conditions + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.lastObservationTime + toFieldPath: status.managed.lastObservationTime + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.podToPoll.ip + toFieldPath: status.managed.podToPoll.ip + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.podToPoll.namespacedName + toFieldPath: status.managed.podToPoll.namespacedName + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.podToPoll.uid + toFieldPath: status.managed.podToPoll.uid + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.restoreID + toFieldPath: status.managed.restoreID diff --git a/crossplane-api/api/a8s/servicebinding/composition.yaml b/crossplane-api/api/a8s/servicebinding/composition.yaml index 459feb3..10557df 100644 --- a/crossplane-api/api/a8s/servicebinding/composition.yaml +++ b/crossplane-api/api/a8s/servicebinding/composition.yaml @@ -6,45 +6,53 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XServiceBinding - resources: - - name: a8s-servicebinding - base: - apiVersion: kubernetes.crossplane.io/v1alpha1 - kind: Object - spec: - forProvider: - manifest: - apiVersion: servicebindings.anynines.com/v1beta3 - kind: ServiceBinding - providerConfigRef: - name: kubernetes-provider - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.serviceInstanceType - toFieldPath: spec.forProvider.manifest.spec.instance.apiVersion - transforms: - - type: map - map: - postgresql: postgresql.anynines.com/v1beta3 - - fromFieldPath: spec.serviceInstanceType - toFieldPath: spec.forProvider.manifest.spec.instance.kind - transforms: - - type: map - map: - postgresql: Postgresql - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.spec.instance.namespace - - fromFieldPath: spec.instanceRef - toFieldPath: spec.forProvider.manifest.spec.instance.name - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.implemented - toFieldPath: status.managed.implemented - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.secret.name - toFieldPath: status.managed.secret.name - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.manifest.status.secret.namespace - toFieldPath: status.managed.secret.namespace + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a8s-servicebinding + base: + apiVersion: kubernetes.crossplane.io/v1alpha1 + kind: Object + spec: + forProvider: + manifest: + apiVersion: servicebindings.anynines.com/v1beta3 + kind: ServiceBinding + providerConfigRef: + name: kubernetes-provider + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.serviceInstanceType + toFieldPath: spec.forProvider.manifest.spec.instance.apiVersion + transforms: + - type: map + map: + postgresql: postgresql.anynines.com/v1beta3 + - fromFieldPath: spec.serviceInstanceType + toFieldPath: spec.forProvider.manifest.spec.instance.kind + transforms: + - type: map + map: + postgresql: Postgresql + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.spec.instance.namespace + - fromFieldPath: spec.instanceRef + toFieldPath: spec.forProvider.manifest.spec.instance.name + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.implemented + toFieldPath: status.managed.implemented + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.secret.name + toFieldPath: status.managed.secret.name + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.manifest.status.secret.namespace + toFieldPath: status.managed.secret.namespace diff --git a/crossplane-api/api/a9s/backup/composition.yaml b/crossplane-api/api/a9s/backup/composition.yaml index 1d5522d..41337a2 100644 --- a/crossplane-api/api/a9s/backup/composition.yaml +++ b/crossplane-api/api/a9s/backup/composition.yaml @@ -6,42 +6,51 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XBackup - resources: - - name: a9s-backup - base: - apiVersion: dataservices.anynines.com/v1 - kind: Backup - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.instanceRef - toFieldPath: spec.forProvider.instanceName - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.downloadable - toFieldPath: status.managed.downloadable - - fromFieldPath: spec.serviceInstanceType - toFieldPath: spec.providerConfigRef.name - transforms: - - type: string - string: - fmt: "%s-backup-manager" - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.finished_at - toFieldPath: status.managed.finished_at - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.id - toFieldPath: status.managed.id - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.size - toFieldPath: status.managed.size - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.status - toFieldPath: status.managed.status - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.triggered_at - toFieldPath: status.managed.triggered_at - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-backup + base: + apiVersion: dataservices.anynines.com/v1 + kind: Backup + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.instanceRef + toFieldPath: spec.forProvider.instanceName + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.downloadable + toFieldPath: status.managed.downloadable + - fromFieldPath: spec.serviceInstanceType + toFieldPath: spec.providerConfigRef.name + transforms: + - type: string + string: + type: Format + fmt: "%s-backup-manager" + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.finished_at + toFieldPath: status.managed.finished_at + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.id + toFieldPath: status.managed.id + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.size + toFieldPath: status.managed.size + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.status + toFieldPath: status.managed.status + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.triggered_at + toFieldPath: status.managed.triggered_at + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/a9s/logme2/composition.yaml b/crossplane-api/api/a9s/logme2/composition.yaml index c8e7dac..e533568 100644 --- a/crossplane-api/api/a9s/logme2/composition.yaml +++ b/crossplane-api/api/a9s/logme2/composition.yaml @@ -6,50 +6,58 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XLogme2Instance - resources: - - name: a9s-logme2 - base: - apiVersion: dataservices.anynines.com/v1 - kind: ServiceInstance - spec: - forProvider: - # acceptsIncomplete indicates if the service broker can fulfill a - # request asynchronously. Since the anynines-provider controller - # reconciles the resources asynchronously, if 'acceptsIncomplete' is - # not specified by the user, it will default to 'true'. - acceptsIncomplete: true - # OrganizationGUID is the platform GUID for the organization under - # which the service is to be provisioned. This value is specific to - # Cloud Foundry. - organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 - # SpaceGUID is the identifier for the project space within the - # platform organization. This value is specific to Cloud Foundry. - spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf - providerConfigRef: - name: logme2-service-broker - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.service - toFieldPath: spec.forProvider.serviceName - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.planName - - fromFieldPath: spec.acceptsIncomplete - toFieldPath: spec.forProvider.acceptsIncomplete - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.createdAt - toFieldPath: status.managed.createdAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.provisionedAt - toFieldPath: status.managed.provisionedAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.state - toFieldPath: status.managed.state - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.updatedAt - toFieldPath: status.managed.updatedAt - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-logme2 + base: + apiVersion: dataservices.anynines.com/v1 + kind: ServiceInstance + spec: + forProvider: + # acceptsIncomplete indicates if the service broker can fulfill a + # request asynchronously. Since the anynines-provider controller + # reconciles the resources asynchronously, if 'acceptsIncomplete' is + # not specified by the user, it will default to 'true'. + acceptsIncomplete: true + # OrganizationGUID is the platform GUID for the organization under + # which the service is to be provisioned. This value is specific to + # Cloud Foundry. + organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 + # SpaceGUID is the identifier for the project space within the + # platform organization. This value is specific to Cloud Foundry. + spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf + providerConfigRef: + name: logme2-service-broker + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.service + toFieldPath: spec.forProvider.serviceName + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.planName + - fromFieldPath: spec.acceptsIncomplete + toFieldPath: spec.forProvider.acceptsIncomplete + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.createdAt + toFieldPath: status.managed.createdAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.provisionedAt + toFieldPath: status.managed.provisionedAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.state + toFieldPath: status.managed.state + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.updatedAt + toFieldPath: status.managed.updatedAt + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/a9s/mariadb/composition.yaml b/crossplane-api/api/a9s/mariadb/composition.yaml index b3f5732..8f62853 100644 --- a/crossplane-api/api/a9s/mariadb/composition.yaml +++ b/crossplane-api/api/a9s/mariadb/composition.yaml @@ -6,50 +6,58 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XMariadbInstance - resources: - - name: a9s-mariadb - base: - apiVersion: dataservices.anynines.com/v1 - kind: ServiceInstance - spec: - forProvider: - # acceptsIncomplete indicates if the service broker can fulfill a - # request asynchronously. Since the anynines-provider controller - # reconciles the resources asynchronously, if 'acceptsIncomplete' is - # not specified by the user, it will default to 'true'. - acceptsIncomplete: true - # OrganizationGUID is the platform GUID for the organization under - # which the service is to be provisioned. This value is specific to - # Cloud Foundry. - organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 - # SpaceGUID is the identifier for the project space within the - # platform organization. This value is specific to Cloud Foundry. - spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf - providerConfigRef: - name: mariadb-service-broker - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.service - toFieldPath: spec.forProvider.serviceName - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.planName - - fromFieldPath: spec.acceptsIncomplete - toFieldPath: spec.forProvider.acceptsIncomplete - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.createdAt - toFieldPath: status.managed.createdAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.provisionedAt - toFieldPath: status.managed.provisionedAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.state - toFieldPath: status.managed.state - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.updatedAt - toFieldPath: status.managed.updatedAt - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions \ No newline at end of file + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-mariadb + base: + apiVersion: dataservices.anynines.com/v1 + kind: ServiceInstance + spec: + forProvider: + # acceptsIncomplete indicates if the service broker can fulfill a + # request asynchronously. Since the anynines-provider controller + # reconciles the resources asynchronously, if 'acceptsIncomplete' is + # not specified by the user, it will default to 'true'. + acceptsIncomplete: true + # OrganizationGUID is the platform GUID for the organization under + # which the service is to be provisioned. This value is specific to + # Cloud Foundry. + organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 + # SpaceGUID is the identifier for the project space within the + # platform organization. This value is specific to Cloud Foundry. + spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf + providerConfigRef: + name: mariadb-service-broker + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.service + toFieldPath: spec.forProvider.serviceName + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.planName + - fromFieldPath: spec.acceptsIncomplete + toFieldPath: spec.forProvider.acceptsIncomplete + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.createdAt + toFieldPath: status.managed.createdAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.provisionedAt + toFieldPath: status.managed.provisionedAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.state + toFieldPath: status.managed.state + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.updatedAt + toFieldPath: status.managed.updatedAt + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/a9s/messaging/composition.yaml b/crossplane-api/api/a9s/messaging/composition.yaml index 1a7827a..6483c97 100644 --- a/crossplane-api/api/a9s/messaging/composition.yaml +++ b/crossplane-api/api/a9s/messaging/composition.yaml @@ -6,50 +6,58 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XMessagingInstance - resources: - - name: a9s-messaging - base: - apiVersion: dataservices.anynines.com/v1 - kind: ServiceInstance - spec: - forProvider: - # acceptsIncomplete indicates if the service broker can fulfill a - # request asynchronously. Since the anynines-provider controller - # reconciles the resources asynchronously, if 'acceptsIncomplete' is - # not specified by the user, it will default to 'true'. - acceptsIncomplete: true - # OrganizationGUID is the platform GUID for the organization under - # which the service is to be provisioned. This value is specific to - # Cloud Foundry. - organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 - # SpaceGUID is the identifier for the project space within the - # platform organization. This value is specific to Cloud Foundry. - spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf - providerConfigRef: - name: messaging-service-broker - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.service - toFieldPath: spec.forProvider.serviceName - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.planName - - fromFieldPath: spec.acceptsIncomplete - toFieldPath: spec.forProvider.acceptsIncomplete - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.createdAt - toFieldPath: status.managed.createdAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.provisionedAt - toFieldPath: status.managed.provisionedAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.state - toFieldPath: status.managed.state - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.updatedAt - toFieldPath: status.managed.updatedAt - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-messaging + base: + apiVersion: dataservices.anynines.com/v1 + kind: ServiceInstance + spec: + forProvider: + # acceptsIncomplete indicates if the service broker can fulfill a + # request asynchronously. Since the anynines-provider controller + # reconciles the resources asynchronously, if 'acceptsIncomplete' is + # not specified by the user, it will default to 'true'. + acceptsIncomplete: true + # OrganizationGUID is the platform GUID for the organization under + # which the service is to be provisioned. This value is specific to + # Cloud Foundry. + organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 + # SpaceGUID is the identifier for the project space within the + # platform organization. This value is specific to Cloud Foundry. + spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf + providerConfigRef: + name: messaging-service-broker + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.service + toFieldPath: spec.forProvider.serviceName + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.planName + - fromFieldPath: spec.acceptsIncomplete + toFieldPath: spec.forProvider.acceptsIncomplete + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.createdAt + toFieldPath: status.managed.createdAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.provisionedAt + toFieldPath: status.managed.provisionedAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.state + toFieldPath: status.managed.state + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.updatedAt + toFieldPath: status.managed.updatedAt + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/a9s/mongodb/composition.yaml b/crossplane-api/api/a9s/mongodb/composition.yaml index 6514b57..9e96900 100644 --- a/crossplane-api/api/a9s/mongodb/composition.yaml +++ b/crossplane-api/api/a9s/mongodb/composition.yaml @@ -6,50 +6,58 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XMongodbInstance - resources: - - name: a9s-mongodb - base: - apiVersion: dataservices.anynines.com/v1 - kind: ServiceInstance - spec: - forProvider: - # acceptsIncomplete indicates if the service broker can fulfill a - # request asynchronously. Since the anynines-provider controller - # reconciles the resources asynchronously, if 'acceptsIncomplete' is - # not specified by the user, it will default to 'true'. - acceptsIncomplete: true - # OrganizationGUID is the platform GUID for the organization under - # which the service is to be provisioned. This value is specific to - # Cloud Foundry. - organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 - # SpaceGUID is the identifier for the project space within the - # platform organization. This value is specific to Cloud Foundry. - spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf - providerConfigRef: - name: mongodb-service-broker - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.service - toFieldPath: spec.forProvider.serviceName - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.planName - - fromFieldPath: spec.acceptsIncomplete - toFieldPath: spec.forProvider.acceptsIncomplete - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.createdAt - toFieldPath: status.managed.createdAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.provisionedAt - toFieldPath: status.managed.provisionedAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.state - toFieldPath: status.managed.state - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.updatedAt - toFieldPath: status.managed.updatedAt - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-mongodb + base: + apiVersion: dataservices.anynines.com/v1 + kind: ServiceInstance + spec: + forProvider: + # acceptsIncomplete indicates if the service broker can fulfill a + # request asynchronously. Since the anynines-provider controller + # reconciles the resources asynchronously, if 'acceptsIncomplete' is + # not specified by the user, it will default to 'true'. + acceptsIncomplete: true + # OrganizationGUID is the platform GUID for the organization under + # which the service is to be provisioned. This value is specific to + # Cloud Foundry. + organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 + # SpaceGUID is the identifier for the project space within the + # platform organization. This value is specific to Cloud Foundry. + spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf + providerConfigRef: + name: mongodb-service-broker + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.service + toFieldPath: spec.forProvider.serviceName + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.planName + - fromFieldPath: spec.acceptsIncomplete + toFieldPath: spec.forProvider.acceptsIncomplete + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.createdAt + toFieldPath: status.managed.createdAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.provisionedAt + toFieldPath: status.managed.provisionedAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.state + toFieldPath: status.managed.state + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.updatedAt + toFieldPath: status.managed.updatedAt + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/a9s/postgresql/composition.yaml b/crossplane-api/api/a9s/postgresql/composition.yaml index 7dedf1f..bd9d0b7 100644 --- a/crossplane-api/api/a9s/postgresql/composition.yaml +++ b/crossplane-api/api/a9s/postgresql/composition.yaml @@ -6,94 +6,102 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XPostgresqlInstance - resources: - - name: a9s-postgresql - base: - apiVersion: dataservices.anynines.com/v1 - kind: ServiceInstance - spec: - forProvider: - # acceptsIncomplete indicates if the service broker can fulfill a - # request asynchronously. Since the anynines-provider controller - # reconciles the resources asynchronously, if 'acceptsIncomplete' is - # not specified by the user, it will default to 'true'. - acceptsIncomplete: true - # OrganizationGUID is the platform GUID for the organization under - # which the service is to be provisioned. This value is specific to - # Cloud Foundry. - organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 - # SpaceGUID is the identifier for the project space within the - # platform organization. This value is specific to Cloud Foundry. - spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf - providerConfigRef: - name: postgresql-service-broker - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.service - toFieldPath: spec.forProvider.serviceName - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.planName - - fromFieldPath: spec.acceptsIncomplete - toFieldPath: spec.forProvider.acceptsIncomplete + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-postgresql + base: + apiVersion: dataservices.anynines.com/v1 + kind: ServiceInstance + spec: + forProvider: + # acceptsIncomplete indicates if the service broker can fulfill a + # request asynchronously. Since the anynines-provider controller + # reconciles the resources asynchronously, if 'acceptsIncomplete' is + # not specified by the user, it will default to 'true'. + acceptsIncomplete: true + # OrganizationGUID is the platform GUID for the organization under + # which the service is to be provisioned. This value is specific to + # Cloud Foundry. + organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 + # SpaceGUID is the identifier for the project space within the + # platform organization. This value is specific to Cloud Foundry. + spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf + providerConfigRef: + name: postgresql-service-broker + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.service + toFieldPath: spec.forProvider.serviceName + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.planName + - fromFieldPath: spec.acceptsIncomplete + toFieldPath: spec.forProvider.acceptsIncomplete - - fromFieldPath: spec.parameters.dataChecksums - toFieldPath: spec.forProvider.parameters.dataChecksums - - fromFieldPath: spec.parameters.maxConnections - toFieldPath: spec.forProvider.parameters.maxConnections - - fromFieldPath: spec.parameters.effectiveCacheSize - toFieldPath: spec.forProvider.parameters.effectiveCacheSize - - fromFieldPath: spec.parameters.workMem - toFieldPath: spec.forProvider.parameters.workMem - - fromFieldPath: spec.parameters.maintenanceWorkMem - toFieldPath: spec.forProvider.parameters.maintenanceWorkMem - - fromFieldPath: spec.parameters.tempFileLimit - toFieldPath: spec.forProvider.parameters.tempFileLimit - - fromFieldPath: spec.parameters.trackIoTiming - toFieldPath: spec.forProvider.parameters.trackIoTiming - - fromFieldPath: spec.parameters.archiveTimeout - toFieldPath: spec.forProvider.parameters.archiveTimeout - - fromFieldPath: spec.parameters.statementTimeout - toFieldPath: spec.forProvider.parameters.statementTimeout - - fromFieldPath: spec.parameters.idleInTransactionSessionTimeout - toFieldPath: spec.forProvider.parameters.idleInTransactionSessionTimeout - - fromFieldPath: spec.parameters.rolePrivileges - toFieldPath: spec.forProvider.parameters.rolePrivileges - - fromFieldPath: spec.parameters.walLevelLogical - toFieldPath: spec.forProvider.parameters.walLevelLogical - - fromFieldPath: spec.parameters.walWriterDelay - toFieldPath: spec.forProvider.parameters.walWriterDelay - - fromFieldPath: spec.parameters.maxReplicationSlots - toFieldPath: spec.forProvider.parameters.maxReplicationSlots - - fromFieldPath: spec.parameters.maxWalSenders - toFieldPath: spec.forProvider.parameters.maxWalSenders - - fromFieldPath: spec.parameters.synchronousCommit - toFieldPath: spec.forProvider.parameters.synchronousCommit - - fromFieldPath: spec.parameters.clientMinMessages - toFieldPath: spec.forProvider.parameters.clientMinMessages - - fromFieldPath: spec.parameters.logMinMessages - toFieldPath: spec.forProvider.parameters.pgLogMinMessages - - fromFieldPath: spec.parameters.logMinErrorStatement - toFieldPath: spec.forProvider.parameters.pgLogMinErrorStatement - - fromFieldPath: spec.parameters.logStatement - toFieldPath: spec.forProvider.parameters.logStatement - - fromFieldPath: spec.parameters.logErrorVerbosity - toFieldPath: spec.forProvider.parameters.logErrorVerbosity + - fromFieldPath: spec.parameters.dataChecksums + toFieldPath: spec.forProvider.parameters.dataChecksums + - fromFieldPath: spec.parameters.maxConnections + toFieldPath: spec.forProvider.parameters.maxConnections + - fromFieldPath: spec.parameters.effectiveCacheSize + toFieldPath: spec.forProvider.parameters.effectiveCacheSize + - fromFieldPath: spec.parameters.workMem + toFieldPath: spec.forProvider.parameters.workMem + - fromFieldPath: spec.parameters.maintenanceWorkMem + toFieldPath: spec.forProvider.parameters.maintenanceWorkMem + - fromFieldPath: spec.parameters.tempFileLimit + toFieldPath: spec.forProvider.parameters.tempFileLimit + - fromFieldPath: spec.parameters.trackIoTiming + toFieldPath: spec.forProvider.parameters.trackIoTiming + - fromFieldPath: spec.parameters.archiveTimeout + toFieldPath: spec.forProvider.parameters.archiveTimeout + - fromFieldPath: spec.parameters.statementTimeout + toFieldPath: spec.forProvider.parameters.statementTimeout + - fromFieldPath: spec.parameters.idleInTransactionSessionTimeout + toFieldPath: spec.forProvider.parameters.idleInTransactionSessionTimeout + - fromFieldPath: spec.parameters.rolePrivileges + toFieldPath: spec.forProvider.parameters.rolePrivileges + - fromFieldPath: spec.parameters.walLevelLogical + toFieldPath: spec.forProvider.parameters.walLevelLogical + - fromFieldPath: spec.parameters.walWriterDelay + toFieldPath: spec.forProvider.parameters.walWriterDelay + - fromFieldPath: spec.parameters.maxReplicationSlots + toFieldPath: spec.forProvider.parameters.maxReplicationSlots + - fromFieldPath: spec.parameters.maxWalSenders + toFieldPath: spec.forProvider.parameters.maxWalSenders + - fromFieldPath: spec.parameters.synchronousCommit + toFieldPath: spec.forProvider.parameters.synchronousCommit + - fromFieldPath: spec.parameters.clientMinMessages + toFieldPath: spec.forProvider.parameters.clientMinMessages + - fromFieldPath: spec.parameters.logMinMessages + toFieldPath: spec.forProvider.parameters.pgLogMinMessages + - fromFieldPath: spec.parameters.logMinErrorStatement + toFieldPath: spec.forProvider.parameters.pgLogMinErrorStatement + - fromFieldPath: spec.parameters.logStatement + toFieldPath: spec.forProvider.parameters.logStatement + - fromFieldPath: spec.parameters.logErrorVerbosity + toFieldPath: spec.forProvider.parameters.logErrorVerbosity - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.createdAt - toFieldPath: status.managed.createdAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.provisionedAt - toFieldPath: status.managed.provisionedAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.state - toFieldPath: status.managed.state - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.updatedAt - toFieldPath: status.managed.updatedAt - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.createdAt + toFieldPath: status.managed.createdAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.provisionedAt + toFieldPath: status.managed.provisionedAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.state + toFieldPath: status.managed.state + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.updatedAt + toFieldPath: status.managed.updatedAt + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/a9s/prometheus/composition.yaml b/crossplane-api/api/a9s/prometheus/composition.yaml index a3c89da..724d2ab 100644 --- a/crossplane-api/api/a9s/prometheus/composition.yaml +++ b/crossplane-api/api/a9s/prometheus/composition.yaml @@ -6,50 +6,58 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XPrometheusInstance - resources: - - name: a9s-prometheus - base: - apiVersion: dataservices.anynines.com/v1 - kind: ServiceInstance - spec: - forProvider: - # acceptsIncomplete indicates if the service broker can fulfill a - # request asynchronously. Since the anynines-provider controller - # reconciles the resources asynchronously, if 'acceptsIncomplete' is - # not specified by the user, it will default to 'true'. - acceptsIncomplete: true - # OrganizationGUID is the platform GUID for the organization under - # which the service is to be provisioned. This value is specific to - # Cloud Foundry. - organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 - # SpaceGUID is the identifier for the project space within the - # platform organization. This value is specific to Cloud Foundry. - spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf - providerConfigRef: - name: prometheus-service-broker - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.service - toFieldPath: spec.forProvider.serviceName - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.planName - - fromFieldPath: spec.acceptsIncomplete - toFieldPath: spec.forProvider.acceptsIncomplete - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.createdAt - toFieldPath: status.managed.createdAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.provisionedAt - toFieldPath: status.managed.provisionedAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.state - toFieldPath: status.managed.state - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.updatedAt - toFieldPath: status.managed.updatedAt - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-prometheus + base: + apiVersion: dataservices.anynines.com/v1 + kind: ServiceInstance + spec: + forProvider: + # acceptsIncomplete indicates if the service broker can fulfill a + # request asynchronously. Since the anynines-provider controller + # reconciles the resources asynchronously, if 'acceptsIncomplete' is + # not specified by the user, it will default to 'true'. + acceptsIncomplete: true + # OrganizationGUID is the platform GUID for the organization under + # which the service is to be provisioned. This value is specific to + # Cloud Foundry. + organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 + # SpaceGUID is the identifier for the project space within the + # platform organization. This value is specific to Cloud Foundry. + spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf + providerConfigRef: + name: prometheus-service-broker + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.service + toFieldPath: spec.forProvider.serviceName + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.planName + - fromFieldPath: spec.acceptsIncomplete + toFieldPath: spec.forProvider.acceptsIncomplete + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.createdAt + toFieldPath: status.managed.createdAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.provisionedAt + toFieldPath: status.managed.provisionedAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.state + toFieldPath: status.managed.state + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.updatedAt + toFieldPath: status.managed.updatedAt + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/a9s/restore/composition.yaml b/crossplane-api/api/a9s/restore/composition.yaml index 1c45437..bd26fa2 100644 --- a/crossplane-api/api/a9s/restore/composition.yaml +++ b/crossplane-api/api/a9s/restore/composition.yaml @@ -6,36 +6,45 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XRestore - resources: - - name: a9s-restore - base: - apiVersion: dataservices.anynines.com/v1 - kind: Restore - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.backupRef - toFieldPath: spec.forProvider.backupName - - fromFieldPath: spec.serviceInstanceType - toFieldPath: spec.providerConfigRef.name - transforms: - - type: string - string: - fmt: "%s-backup-manager" - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.finishedAt - toFieldPath: status.managed.finishedAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.restoreId - toFieldPath: status.managed.restoreId - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.state - toFieldPath: status.managed.state - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.triggeredAt - toFieldPath: status.managed.triggeredAt - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions \ No newline at end of file + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-restore + base: + apiVersion: dataservices.anynines.com/v1 + kind: Restore + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.backupRef + toFieldPath: spec.forProvider.backupName + - fromFieldPath: spec.serviceInstanceType + toFieldPath: spec.providerConfigRef.name + transforms: + - type: string + string: + type: Format + fmt: "%s-backup-manager" + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.finishedAt + toFieldPath: status.managed.finishedAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.restoreId + toFieldPath: status.managed.restoreId + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.state + toFieldPath: status.managed.state + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.triggeredAt + toFieldPath: status.managed.triggeredAt + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/a9s/search/composition.yaml b/crossplane-api/api/a9s/search/composition.yaml index ebb9c51..aed3028 100644 --- a/crossplane-api/api/a9s/search/composition.yaml +++ b/crossplane-api/api/a9s/search/composition.yaml @@ -6,50 +6,58 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XSearchInstance - resources: - - name: a9s-search - base: - apiVersion: dataservices.anynines.com/v1 - kind: ServiceInstance - spec: - forProvider: - # acceptsIncomplete indicates if the service broker can fulfill a - # request asynchronously. Since the anynines-provider controller - # reconciles the resources asynchronously, if 'acceptsIncomplete' is - # not specified by the user, it will default to 'true'. - acceptsIncomplete: true - # OrganizationGUID is the platform GUID for the organization under - # which the service is to be provisioned. This value is specific to - # Cloud Foundry. - organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 - # SpaceGUID is the identifier for the project space within the - # platform organization. This value is specific to Cloud Foundry. - spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf - providerConfigRef: - name: search-service-broker - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.service - toFieldPath: spec.forProvider.serviceName - - fromFieldPath: spec.plan - toFieldPath: spec.forProvider.planName - - fromFieldPath: spec.acceptsIncomplete - toFieldPath: spec.forProvider.acceptsIncomplete - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.createdAt - toFieldPath: status.managed.createdAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.provisionedAt - toFieldPath: status.managed.provisionedAt - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.state - toFieldPath: status.managed.state - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.updatedAt - toFieldPath: status.managed.updatedAt - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-search + base: + apiVersion: dataservices.anynines.com/v1 + kind: ServiceInstance + spec: + forProvider: + # acceptsIncomplete indicates if the service broker can fulfill a + # request asynchronously. Since the anynines-provider controller + # reconciles the resources asynchronously, if 'acceptsIncomplete' is + # not specified by the user, it will default to 'true'. + acceptsIncomplete: true + # OrganizationGUID is the platform GUID for the organization under + # which the service is to be provisioned. This value is specific to + # Cloud Foundry. + organizationGuid: a1d46b5c-b639-4f43-85c7-e9a0e5f01f75 + # SpaceGUID is the identifier for the project space within the + # platform organization. This value is specific to Cloud Foundry. + spaceGuid: 1bf71cf3-9017-4846-bffc-b9b31872bfaf + providerConfigRef: + name: search-service-broker + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.service + toFieldPath: spec.forProvider.serviceName + - fromFieldPath: spec.plan + toFieldPath: spec.forProvider.planName + - fromFieldPath: spec.acceptsIncomplete + toFieldPath: spec.forProvider.acceptsIncomplete + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.createdAt + toFieldPath: status.managed.createdAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.provisionedAt + toFieldPath: status.managed.provisionedAt + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.state + toFieldPath: status.managed.state + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.updatedAt + toFieldPath: status.managed.updatedAt + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/a9s/servicebinding/composition.yaml b/crossplane-api/api/a9s/servicebinding/composition.yaml index 3b8637b..daa5663 100644 --- a/crossplane-api/api/a9s/servicebinding/composition.yaml +++ b/crossplane-api/api/a9s/servicebinding/composition.yaml @@ -6,45 +6,55 @@ spec: compositeTypeRef: apiVersion: anynines.com/v1 kind: XServiceBinding - resources: - - name: a9s-servicebinding - base: - apiVersion: dataservices.anynines.com/v1 - kind: ServiceBinding - spec: - forProvider: - # acceptsIncomplete indicates if the service broker can fulfill a - # request asynchronously. Since the anynines-provider controller - # reconciles the resources asynchronously, if 'acceptsIncomplete' is - # not specified by the user, it will default to 'true'. - acceptsIncomplete: true - patches: - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.forProvider.manifest.metadata.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.forProvider.manifest.metadata.name - - fromFieldPath: spec.instanceRef - toFieldPath: spec.forProvider.instanceName - - fromFieldPath: spec.serviceInstanceType - toFieldPath: spec.providerConfigRef.name - transforms: - - type: string - string: - fmt: "%s-service-broker" - - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] - toFieldPath: spec.writeConnectionSecretToRef.namespace - - fromFieldPath: metadata.labels[crossplane.io/claim-name] - toFieldPath: spec.writeConnectionSecretToRef.name - transforms: - - type: string - string: - fmt: "%s-creds" - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.serviceBindingID - toFieldPath: status.managed.serviceBindingID - - type: ToCompositeFieldPath - fromFieldPath: status.atProvider.state - toFieldPath: status.managed.state - - type: ToCompositeFieldPath - fromFieldPath: status.conditions - toFieldPath: status.managed.conditions + mode: Pipeline + pipeline: + - step: patch-and-transform + functionRef: + name: function-patch-and-transform + input: + apiVersion: pt.fn.crossplane.io/v1beta1 + kind: Resources + resources: + - name: a9s-servicebinding + base: + apiVersion: dataservices.anynines.com/v1 + kind: ServiceBinding + spec: + forProvider: + # acceptsIncomplete indicates if the service broker can fulfill a + # request asynchronously. Since the anynines-provider controller + # reconciles the resources asynchronously, if 'acceptsIncomplete' is + # not specified by the user, it will default to 'true'. + acceptsIncomplete: true + patches: + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.forProvider.manifest.metadata.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.forProvider.manifest.metadata.name + - fromFieldPath: spec.instanceRef + toFieldPath: spec.forProvider.instanceName + - fromFieldPath: spec.serviceInstanceType + toFieldPath: spec.providerConfigRef.name + transforms: + - type: string + string: + type: Format + fmt: "%s-service-broker" + - fromFieldPath: metadata.labels[crossplane.io/claim-namespace] + toFieldPath: spec.writeConnectionSecretToRef.namespace + - fromFieldPath: metadata.labels[crossplane.io/claim-name] + toFieldPath: spec.writeConnectionSecretToRef.name + transforms: + - type: string + string: + type: Format + fmt: "%s-creds" + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.serviceBindingID + toFieldPath: status.managed.serviceBindingID + - type: ToCompositeFieldPath + fromFieldPath: status.atProvider.state + toFieldPath: status.managed.state + - type: ToCompositeFieldPath + fromFieldPath: status.conditions + toFieldPath: status.managed.conditions diff --git a/crossplane-api/api/common/postgresql_definition.yaml b/crossplane-api/api/common/postgresql_definition.yaml index ae182a6..09964a9 100644 --- a/crossplane-api/api/common/postgresql_definition.yaml +++ b/crossplane-api/api/common/postgresql_definition.yaml @@ -14,293 +14,338 @@ spec: name: a8s-postgresql defaultCompositeDeletePolicy: Foreground versions: - - name: v1 - served: true - referenceable: true - schema: - openAPIV3Schema: - supported: - - expose: &expose ["Internal", "LoadBalancer"] - # Technically all of these are supported by postgres: - # ["true", "yes", "on", "1", "false", "no", "off", "0"] - # Our postgresql operator only supports "on"/"off" though: - - postgresBoolean: &postgresBoolean ["on", "off"] - properties: - spec: - x-kubernetes-validations: - # Validation for postgresql services. - - rule: "(self.compositionRef.name == 'a9s-postgresql' && - (self.service == 'a9s-postgresql13' || self.service == 'a9s-postgresql15')) - || (self.compositionRef.name == 'a8s-postgresql' && - (self.service == 'a9s-postgresql13' || self.service == 'a9s-postgresql14'))" - message: "Unsupported service used for postgresql" - # Validation for postgresql plans. - - rule: "(self.compositionRef.name == 'a9s-postgresql' && - (self.plan == 'postgresql-single-nano' || self.plan == 'postgresql-single-nano-bionic' || - self.plan == 'postgresql-single-nano-ssl' || self.plan == 'postgresql-single-nano-ssl-bionic' || - self.plan == 'postgresql-single-small' || self.plan == 'postgresql-single-small-bionic' || - self.plan == 'postgresql-single-small-ssl' || self.plan == 'postgresql-single-small-ssl-bionic' || - self.plan == 'postgresql-single-medium' || self.plan == 'postgresql-single-medium-bionic' || - self.plan == 'postgresql-single-medium-ssl' || self.plan == 'postgresql-single-medium-ssl-bionic' || - self.plan == 'postgresql-replica-small' || self.plan == 'postgresql-replica-small-bionic' || - self.plan == 'postgresql-replica-small-ssl' || self.plan == 'postgresql-replica-small-ssl-bionic' || - self.plan == 'postgresql-replica-medium' || self.plan == 'postgresql-replica-medium-bionic' || - self.plan == 'postgresql-replica-medium-ssl' || self.plan == 'postgresql-replica-medium-ssl-bionic')) || - (self.compositionRef.name == 'a8s-postgresql' && - (self.plan == 'postgresql-replica-nano' || self.plan == 'postgresql-replica-small'|| - self.plan == 'postgresql-replica-medium' || self.plan == 'postgresql-replica-large' || - self.plan == 'postgresql-single-nano' || self.plan == 'postgresql-single-small'|| - self.plan == 'postgresql-single-medium' || self.plan == 'postgresql-single-large'))" - message: "Unsupported plan used for postgresql" + - name: v1 + served: true + referenceable: true + schema: + openAPIV3Schema: + supported: + - expose: &expose ["Internal", "LoadBalancer"] + # Technically all of these are supported by postgres: + # ["true", "yes", "on", "1", "false", "no", "off", "0"] + # Our postgresql operator only supports "on"/"off" though: + - postgresBoolean: &postgresBoolean ["on", "off"] + properties: + spec: + x-kubernetes-validations: + # Validation for postgresql services. + - rule: "(self.compositionRef.name == 'a9s-postgresql' && + (self.service == 'a9s-postgresql13' || self.service == 'a9s-postgresql15')) + || (self.compositionRef.name == 'a8s-postgresql' && + (self.service == 'a9s-postgresql13' || self.service == 'a9s-postgresql14'))" + message: "Unsupported service used for postgresql" + # Validation for postgresql plans. + - rule: "(self.compositionRef.name == 'a9s-postgresql' && + (self.plan == 'postgresql-single-nano' || self.plan == 'postgresql-single-nano-bionic' || + self.plan == 'postgresql-single-nano-ssl' || self.plan == 'postgresql-single-nano-ssl-bionic' || + self.plan == 'postgresql-single-small' || self.plan == 'postgresql-single-small-bionic' || + self.plan == 'postgresql-single-small-ssl' || self.plan == 'postgresql-single-small-ssl-bionic' || + self.plan == 'postgresql-single-big' || self.plan == 'postgresql-single-big-bionic' || + self.plan == 'postgresql-single-big-ssl' || self.plan == 'postgresql-single-big-ssl-bionic' || + self.plan == 'postgresql-replica-small' || self.plan == 'postgresql-replica-small-bionic' || + self.plan == 'postgresql-replica-small-ssl' || self.plan == 'postgresql-replica-small-ssl-bionic' || + self.plan == 'postgresql-replica-big' || self.plan == 'postgresql-replica-big-bionic' || + self.plan == 'postgresql-replica-big-ssl' || self.plan == 'postgresql-replica-big-ssl-bionic' )) || + (self.compositionRef.name == 'a8s-postgresql' && + (self.plan == 'postgresql-replica-nano' || self.plan == 'postgresql-replica-small'|| + self.plan == 'postgresql-replica-medium' || self.plan == 'postgresql-replica-big' || + self.plan == 'postgresql-single-nano' || self.plan == 'postgresql-single-small'|| + self.plan == 'postgresql-single-medium' || self.plan == 'postgresql-single-big'))" + message: "Unsupported plan used for postgresql" - # Validation for parameters ONLY supported by a8s - - rule: "!(has(self.parameters) && has(self.parameters.maxLocksPerTransaction)) || - self.compositionRef.name == 'a8s-postgresql'" - message: "parameters.maxLocksPerTransaction is not supported for a9s-postgresql" - - rule: "!(has(self.parameters) && has(self.parameters.sslCiphers)) || - self.compositionRef.name == 'a8s-postgresql'" - message: "parameters.sslCiphers is not supported for a9s-postgresql" - - rule: "!(has(self.parameters) && has(self.parameters.sslMinProtocolVersion)) || - self.compositionRef.name == 'a8s-postgresql'" - message: "parameters.sslMinProtocolVersion is not supported for a9s-postgresql" + # Validation for parameters ONLY supported by a8s + - rule: + "!(has(self.parameters) && has(self.parameters.maxLocksPerTransaction)) || + self.compositionRef.name == 'a8s-postgresql'" + message: "parameters.maxLocksPerTransaction is not supported for a9s-postgresql" + - rule: + "!(has(self.parameters) && has(self.parameters.sslCiphers)) || + self.compositionRef.name == 'a8s-postgresql'" + message: "parameters.sslCiphers is not supported for a9s-postgresql" + - rule: + "!(has(self.parameters) && has(self.parameters.sslMinProtocolVersion)) || + self.compositionRef.name == 'a8s-postgresql'" + message: "parameters.sslMinProtocolVersion is not supported for a9s-postgresql" - # Validation for parameters ONLY supported by a9s - - rule: "!(has(self.parameters) && has(self.parameters.dataChecksums)) || - self.compositionRef.name == 'a9s-postgresql'" - message: "parameters.dataChecksums is not supported for a8s-postgresql" - - rule: "!(has(self.parameters) && has(self.parameters.effectiveCacheSize)) || - self.compositionRef.name == 'a9s-postgresql'" - message: "parameters.effectiveCacheSize is not supported for a8s-postgresql" - - rule: "!(has(self.parameters) && has(self.parameters.workMem)) || - self.compositionRef.name == 'a9s-postgresql'" - message: "parameters.workMem is not supported for a8s-postgresql" - - rule: "!(has(self.parameters) && has(self.parameters.maintenanceWorkMem)) || - self.compositionRef.name == 'a9s-postgresql'" - message: "parameters.maintenanceWorkMem is not supported for a8s-postgresql" - - rule: "!(has(self.parameters) && has(self.parameters.idleInTransactionSessionTimeout)) || - self.compositionRef.name == 'a9s-postgresql'" - message: "parameters.idleInTransactionSessionTimeout is not supported for a8s-postgresql" - - rule: "!(has(self.parameters) && has(self.parameters.rolePrivileges)) || - self.compositionRef.name == 'a9s-postgresql'" - message: "parameters.rolePrivileges is not supported for a8s-postgresql" - - rule: "!(has(self.parameters) && has(self.parameters.walLevelLogical)) || - self.compositionRef.name == 'a9s-postgresql'" - message: "parameters.walLevelLogical is not supported for a8s-postgresql" + # Validation for parameters ONLY supported by a9s + - rule: + "!(has(self.parameters) && has(self.parameters.dataChecksums)) || + self.compositionRef.name == 'a9s-postgresql'" + message: "parameters.dataChecksums is not supported for a8s-postgresql" + - rule: + "!(has(self.parameters) && has(self.parameters.effectiveCacheSize)) || + self.compositionRef.name == 'a9s-postgresql'" + message: "parameters.effectiveCacheSize is not supported for a8s-postgresql" + - rule: + "!(has(self.parameters) && has(self.parameters.workMem)) || + self.compositionRef.name == 'a9s-postgresql'" + message: "parameters.workMem is not supported for a8s-postgresql" + - rule: + "!(has(self.parameters) && has(self.parameters.maintenanceWorkMem)) || + self.compositionRef.name == 'a9s-postgresql'" + message: "parameters.maintenanceWorkMem is not supported for a8s-postgresql" + - rule: + "!(has(self.parameters) && has(self.parameters.idleInTransactionSessionTimeout)) || + self.compositionRef.name == 'a9s-postgresql'" + message: "parameters.idleInTransactionSessionTimeout is not supported for a8s-postgresql" + - rule: + "!(has(self.parameters) && has(self.parameters.rolePrivileges)) || + self.compositionRef.name == 'a9s-postgresql'" + message: "parameters.rolePrivileges is not supported for a8s-postgresql" + - rule: + "!(has(self.parameters) && has(self.parameters.walLevelLogical)) || + self.compositionRef.name == 'a9s-postgresql'" + message: "parameters.walLevelLogical is not supported for a8s-postgresql" - properties: - acceptsIncomplete: - type: boolean - service: - x-kubernetes-validations: - # Validation to check that service can't be updated. - - rule: "self == oldSelf" - message: "Service is an immutable field" - description: Service specifies the type and version of the Data - Service Instance (e.g. a9s-postgresql13). There is a list of - supported services and supported plans for each service. - type: string - plan: - description: Plan specifies the service plan. There are options - for single or clustered Data Service Instances and options for - different underlying computing resources. - type: string - x-kubernetes-validations: - # Validate that only upgrades from smaller to larger DS instance - # sizes are allowed. - - rule: "!(self.contains('small') && oldSelf.contains('medium')) && - !(self.contains('small') && oldSelf.contains('large')) && - !(self.contains('medium') && oldSelf.contains('large'))" - message: "Transition from bigger to smaller plan size is not - supported." - # We must use separate rules to avoid reaching the rule complexity limit - - rule: "!(self.contains('nano') && oldSelf.contains('small')) && - !(self.contains('nano') && oldSelf.contains('medium'))&& - !(self.contains('nano') && oldSelf.contains('large'))" - message: "Transition from bigger to smaller plan size is not - supported." - # Validation for plan migrations - - rule: "oldSelf.contains('ssl') == self.contains('ssl')" - message: "Plan migrations not possible from Non-SSL to SSL and - SSL to Non-SSL" - - rule: "oldSelf.contains('bionic') == self.contains('bionic')" - message: "Plan migrations not possible from Non-Bionic to Bionic and - Bionic to Non-Bionic" - # Validation for plan migration from single to replicas - - rule: "!(self.contains('-single-') && oldSelf.contains('-replica-'))" - message: "Migration from clustered to single Data Service - Instance is not supported." - expose: - description: Expose specifies where (and how) the instances can - be accessed from. There are currently 2 options supported. - 'Internal', this option makes the instances accessible only - within the K8s cluster. 'LoadBalancer', this option exposes - the instances outside the K8s cluster they are running in, - using a load balancer. - type: string - enum: *expose + properties: + acceptsIncomplete: + type: boolean + service: + x-kubernetes-validations: + # Validation to check that service can't be updated. + - rule: "self == oldSelf" + message: "Service is an immutable field" + description: + Service specifies the type and version of the Data + Service Instance (e.g. a9s-postgresql13). There is a list of + supported services and supported plans for each service. + type: string + plan: + description: + Plan specifies the service plan. There are options + for single or clustered Data Service Instances and options for + different underlying computing resources. + type: string + x-kubernetes-validations: + # Validate that only upgrades from smaller to larger DS instance + # sizes are allowed. + - rule: + "!(self.contains('small') && oldSelf.contains('medium')) && + !(self.contains('small') && oldSelf.contains('big')) && + !(self.contains('medium') && oldSelf.contains('big'))" + message: + "Transition from bigger to smaller plan size is not + supported." + # We must use separate rules to avoid reaching the rule complexity limit + - rule: + "!(self.contains('nano') && oldSelf.contains('small')) && + !(self.contains('nano') && oldSelf.contains('medium'))&& + !(self.contains('nano') && oldSelf.contains('big'))" + message: + "Transition from bigger to smaller plan size is not + supported." + # Validation for plan migrations + - rule: "oldSelf.contains('ssl') == self.contains('ssl')" + message: + "Plan migrations not possible from Non-SSL to SSL and + SSL to Non-SSL" + - rule: "oldSelf.contains('bionic') == self.contains('bionic')" + message: + "Plan migrations not possible from Non-Bionic to Bionic and + Bionic to Non-Bionic" + # Validation for plan migration from single to replicas + - rule: "!(self.contains('-single-') && oldSelf.contains('-replica-'))" + message: "Migration from clustered to single Data Service + Instance is not supported." + expose: + description: + Expose specifies where (and how) the instances can + be accessed from. There are currently 2 options supported. + 'Internal', this option makes the instances accessible only + within the K8s cluster. 'LoadBalancer', this option exposes + the instances outside the K8s cluster they are running in, + using a load balancer. + type: string + enum: *expose - # PostgreSQL configuration parameters - parameters: - type: object - properties: - dataChecksums: # only a9s - description: | - Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. - type: string - enum: ["enabled", "disabled"] - maxConnections: - description: Determines the maximum number of concurrent connections to the database server. - type: number - effectiveCacheSize: # only a9s - description: | - Sets the planner's assumption about the effective size of the disk cache that is available to a single query. - type: string - ## `sharedBuffers` IS NOT SUPPORTED CURRENTLY, BECAUSE: - ## - a8s does not support setting this as a string (e.g. "300MB") - ## - when set to an integer, a8s passes it on to postgresql, - ## which interprets the value as a multiple of the block size - ## (usually 8KB, but may vary) - ## - a9s on the other hand interprets an integer as a multiple of 1MB. - ## - # sharedBuffers: - # description: | - # Sets the amount of memory the database server uses for shared memory buffers. - # type: string - # pattern: "^[1-9]\\d*[MG]B$" - workMem: # only a9s - description: | - Specifies the amount of memory to be used by internal sort operations and hash tables before writing to temporary disk files. - type: string - maintenanceWorkMem: # only a9s - description: | - Specifies the maximum amount of memory to be used by maintenance operations, such as VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY. - type: string - tempFileLimit: - description: | - Specifies the maximum amount of disk space that a process can use for temporary files, such as sort and hash temporary files, or the storage file for a held cursor. - type: integer - x-kubernetes-validations: - - rule: "self == -1 || self > 0" - message: "Must be either -1 (no limit) or a limit specified in kilobytes" - trackIoTiming: - description: | - Enables timing of database I/O calls. - type: string - enum: *postgresBoolean - archiveTimeout: - description: | - Enforces the server to switch to a new WAL segment file periodically. + # PostgreSQL configuration parameters + parameters: + type: object + properties: + dataChecksums: # only a9s + description: | + Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. + type: string + enum: ["enabled", "disabled"] + maxConnections: + description: Determines the maximum number of concurrent connections to the database server. + type: number + effectiveCacheSize: # only a9s + description: | + Sets the planner's assumption about the effective size of the disk cache that is available to a single query. + type: string + ## `sharedBuffers` IS NOT SUPPORTED CURRENTLY, BECAUSE: + ## - a8s does not support setting this as a string (e.g. "300MB") + ## - when set to an integer, a8s passes it on to postgresql, + ## which interprets the value as a multiple of the block size + ## (usually 8KB, but may vary) + ## - a9s on the other hand interprets an integer as a multiple of 1MB. + ## + # sharedBuffers: + # description: | + # Sets the amount of memory the database server uses for shared memory buffers. + # type: string + # pattern: "^[1-9]\\d*[MG]B$" + workMem: # only a9s + description: | + Specifies the amount of memory to be used by internal sort operations and hash tables before writing to temporary disk files. + type: string + maintenanceWorkMem: # only a9s + description: | + Specifies the maximum amount of memory to be used by maintenance operations, such as VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY. + type: string + tempFileLimit: + description: | + Specifies the maximum amount of disk space that a process can use for temporary files, such as sort and hash temporary files, or the storage file for a held cursor. + type: integer + x-kubernetes-validations: + - rule: "self == -1 || self > 0" + message: "Must be either -1 (no limit) or a limit specified in kilobytes" + trackIoTiming: + description: | + Enables timing of database I/O calls. + type: string + enum: *postgresBoolean + archiveTimeout: + description: | + Enforces the server to switch to a new WAL segment file periodically. - The value is interpreted as seconds. - type: integer - statementTimeout: - description: | - Abort any statement that takes more than the specified amount of time. + The value is interpreted as seconds. + type: integer + statementTimeout: + description: | + Abort any statement that takes more than the specified amount of time. - The value is interpreted as milliseconds. - A value of zero (the default) disables the timeout. - type: integer - idleInTransactionSessionTimeout: # only a9s - description: | - Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds. - type: integer - x-kubernetes-validations: - - rule: "self >= 0" - message: "Must be greater than or equal to 0" - rolePrivileges: # only a9s - description: | - Configures default privileges for the credentials. - type: array - items: - type: string - enum: ["CREATEDB", "CREATEROLE", "REPLICATION"] - walLevelLogical: # only a9s - description: | - Configures wal_level. + The value is interpreted as milliseconds. + A value of zero (the default) disables the timeout. + type: integer + idleInTransactionSessionTimeout: # only a9s + description: | + Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds. + type: integer + x-kubernetes-validations: + - rule: "self >= 0" + message: "Must be greater than or equal to 0" + rolePrivileges: # only a9s + description: | + Configures default privileges for the credentials. + type: array + items: + type: string + enum: ["CREATEDB", "CREATEROLE", "REPLICATION"] + walLevelLogical: # only a9s + description: | + Configures wal_level. - This parameter receives a boolean, where true configures the wal_level as logical and false fallback to the default configuration. - type: boolean - walWriterDelay: - description: | - Configures how often the WAL writer flushes WAL. + This parameter receives a boolean, where true configures the wal_level as logical and false fallback to the default configuration. + type: boolean + walWriterDelay: + description: | + Configures how often the WAL writer flushes WAL. - The value is interpreted as milliseconds. - type: integer - x-kubernetes-validations: - - rule: "self > 0" - message: "Must be greater than 0" - maxLocksPerTransaction: # only a8s - description: | - Sets the maximum number of locks per transaction. - type: integer - x-kubernetes-validations: - - rule: "self >= 10" - message: "Must be greater than or equal to 10" - maxReplicationSlots: - description: | - Configures the maximum amount of replication slots. - type: integer - x-kubernetes-validations: - - rule: "self >= 0" - message: "Must be greater than or equal to 0" - maxWalSenders: - description: | - Configures the maximum amount of WAL sender fore each node of the service instance. - type: integer - x-kubernetes-validations: - - rule: "self >= 0" - message: "Must be greater than or equal to 0" - synchronousCommit: - description: | - Configures synchronous_commit. + The value is interpreted as milliseconds. + type: integer + x-kubernetes-validations: + - rule: "self > 0" + message: "Must be greater than 0" + maxLocksPerTransaction: # only a8s + description: | + Sets the maximum number of locks per transaction. + type: integer + x-kubernetes-validations: + - rule: "self >= 10" + message: "Must be greater than or equal to 10" + maxReplicationSlots: + description: | + Configures the maximum amount of replication slots. + type: integer + x-kubernetes-validations: + - rule: "self >= 0" + message: "Must be greater than or equal to 0" + maxWalSenders: + description: | + Configures the maximum amount of WAL sender fore each node of the service instance. + type: integer + x-kubernetes-validations: + - rule: "self >= 0" + message: "Must be greater than or equal to 0" + synchronousCommit: + description: | + Configures synchronous_commit. - This value specifies how much WAL processing must complete before the database server returns a 'success' indication to the client. - type: string - enum: ["on", "off", "local", "remote_write", "remote_apply"] - sslCiphers: # only a8s - description: | - Specify the allowed SSL ciphers - type: string - sslMinProtocolVersion: # only a8s - description: | - Sets the minimum SSL/TLS protocol version to use - type: string - enum: ["TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"] - clientMinMessages: - description: | - Controls which message levels are sent to the client. - type: string - # Must be all lowercase for a8s, all uppercase for a9s. - # The postgresql documentation uses upper case as well, so that's what we'll use here: - enum: ["DEBUG5", "DEBUG4", "DEBUG3", "DEBUG2", "DEBUG1", "LOG", "NOTICE", "WARNING", "ERROR"] - logMinMessages: # prefixed with pg_ in a9s - description: | - Controls which message levels are written to the server log. - type: string - # Must be all lowercase for a8s, all uppercase for a9s. - # The postgresql documentation uses upper case as well, so that's what we'll use here: - enum: &logLevels ["DEBUG5", "DEBUG4", "DEBUG3", "DEBUG2", "DEBUG1", "INFO", "NOTICE", "WARNING", "ERROR", "LOG", "FATAL", "PANIC"] - logMinErrorStatement: # prefixed with pg_ in a9s - description: | - Controls which SQL statements that cause an error condition are recorded in the server log. - type: string - enum: *logLevels - logStatement: - description: | - Controls which SQL statements are logged. - type: string - enum: ["none", "ddl", "mod", "all"] - logErrorVerbosity: - description: | - Controls the amount of detail written in the server log for each message that is logged. - type: string - enum: ["DEFAULT", "VERBOSE", "TERSE"] - required: - - service - - plan - status: - type: object - properties: - managed: - type: object - x-kubernetes-preserve-unknown-fields: true + This value specifies how much WAL processing must complete before the database server returns a 'success' indication to the client. + type: string + enum: + ["on", "off", "local", "remote_write", "remote_apply"] + sslCiphers: # only a8s + description: | + Specify the allowed SSL ciphers + type: string + sslMinProtocolVersion: # only a8s + description: | + Sets the minimum SSL/TLS protocol version to use + type: string + enum: ["TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"] + clientMinMessages: + description: | + Controls which message levels are sent to the client. + type: string + # Must be all lowercase for a8s, all uppercase for a9s. + # The postgresql documentation uses upper case as well, so that's what we'll use here: + enum: + [ + "DEBUG5", + "DEBUG4", + "DEBUG3", + "DEBUG2", + "DEBUG1", + "LOG", + "NOTICE", + "WARNING", + "ERROR", + ] + logMinMessages: # prefixed with pg_ in a9s + description: | + Controls which message levels are written to the server log. + type: string + # Must be all lowercase for a8s, all uppercase for a9s. + # The postgresql documentation uses upper case as well, so that's what we'll use here: + enum: + &logLevels [ + "DEBUG5", + "DEBUG4", + "DEBUG3", + "DEBUG2", + "DEBUG1", + "INFO", + "NOTICE", + "WARNING", + "ERROR", + "LOG", + "FATAL", + "PANIC", + ] + logMinErrorStatement: # prefixed with pg_ in a9s + description: | + Controls which SQL statements that cause an error condition are recorded in the server log. + type: string + enum: *logLevels + logStatement: + description: | + Controls which SQL statements are logged. + type: string + enum: ["none", "ddl", "mod", "all"] + logErrorVerbosity: + description: | + Controls the amount of detail written in the server log for each message that is logged. + type: string + enum: ["DEFAULT", "VERBOSE", "TERSE"] + required: + - service + - plan + status: + type: object + properties: + managed: + type: object + x-kubernetes-preserve-unknown-fields: true diff --git a/crossplane-api/deploy/functions/function-patch-and-transform.yaml b/crossplane-api/deploy/functions/function-patch-and-transform.yaml new file mode 100644 index 0000000..d7f5ec9 --- /dev/null +++ b/crossplane-api/deploy/functions/function-patch-and-transform.yaml @@ -0,0 +1,6 @@ +apiVersion: pkg.crossplane.io/v1 +kind: Function +metadata: + name: function-patch-and-transform +spec: + package: xpkg.upbound.io/crossplane-contrib/function-patch-and-transform:v0.1.4 diff --git a/crossplane-api/deploy/kustomization.yaml b/crossplane-api/deploy/kustomization.yaml index e6fcd16..895e926 100644 --- a/crossplane-api/deploy/kustomization.yaml +++ b/crossplane-api/deploy/kustomization.yaml @@ -9,4 +9,7 @@ resources: - provider-anynines.yaml # Install anynines-configuration package - - config-pkg-anynines.yaml \ No newline at end of file + - config-pkg-anynines.yaml + + # Install composition functions + - functions/function-patch-and-transform.yaml diff --git a/provider-anynines/Makefile b/provider-anynines/Makefile index 2e32c77..282adc8 100644 --- a/provider-anynines/Makefile +++ b/provider-anynines/Makefile @@ -9,6 +9,7 @@ BUILDX_NAME := provider-builder PLATFORMS ?= linux_amd64 linux_arm64 -include build/makelib/common.mk +-include ci/common.mk # ==================================================================================== # Setup Output @@ -41,6 +42,7 @@ KIND_NODE_IMAGE_TAG ?= v1.23.4 DOCKER_REGISTRY ?= crossplane IMAGES = $(PROJECT_NAME) -include build/makelib/imagelight.mk +-include ci/imagelight.mk fallthrough: submodules @echo Initial setup complete. Running make again . . . @@ -88,7 +90,7 @@ dev: $(KIND) $(KUBECTL) @$(KIND) create cluster --name=$(PROJECT_NAME)-dev @$(KUBECTL) cluster-info --context kind-$(PROJECT_NAME)-dev @$(INFO) Installing Crossplane CRDs - @$(KUBECTL) apply -k https://github.com/crossplane/crossplane//cluster?ref=master + @$(KUBECTL) apply --server-side -k https://github.com/crossplane/crossplane//cluster?ref=master @$(INFO) Installing Provider anynines CRDs @$(KUBECTL) apply -R -f package/crds @$(INFO) Starting Provider anynines controllers @@ -138,6 +140,7 @@ provider.addtype: $(GOMPLATE) @[ "${provider}" ] || ( echo "argument \"provider\" is not set"; exit 1 ) @[ "${group}" ] || ( echo "argument \"group\" is not set"; exit 1 ) @[ "${kind}" ] || ( echo "argument \"kind\" is not set"; exit 1 ) + @PROVIDER=$(provider) GROUP=$(group) KIND=$(kind) APIVERSION=$(apiversion) PROJECT_REPO=$(PROJECT_REPO) ./hack/helpers/addtype.sh define CROSSPLANE_MAKE_HELP Crossplane Targets: diff --git a/provider-anynines/ci/Dockerfile b/provider-anynines/ci/Dockerfile index 97dd5c5..d585cac 100644 --- a/provider-anynines/ci/Dockerfile +++ b/provider-anynines/ci/Dockerfile @@ -1,4 +1,4 @@ FROM docker COPY --from=docker/buildx-bin:latest /buildx /usr/libexec/docker/cli-plugins/docker-buildx -RUN apk update && apk add bash make go git nodejs npm curl yq +RUN apk update && apk add bash make go git nodejs npm curl yq kubectl envsubst diff --git a/provider-anynines/ci/common.mk b/provider-anynines/ci/common.mk new file mode 100644 index 0000000..0a6bec4 --- /dev/null +++ b/provider-anynines/ci/common.mk @@ -0,0 +1,27 @@ +# Common Targets - Buildx and Test workflow + +# build releasable artifacts. this will run for each platform being built +buildx.artifacts.platform: ; @: + +# build releasable artifacts. this will run once regardless of platform +buildx.artifacts: ; @: + +do.buildx.artifacts.%: + @$(MAKE) buildx.artifacts.platform PLATFORM=$* +do.buildx.artifacts: $(foreach p,$(PLATFORMS), do.buildx.artifacts.$(p)) + +# helper targets for building multiple platforms +do.buildx.platform.%: + @$(MAKE) build.check.platform PLATFORM=$* + @$(MAKE) build.code.platform PLATFORM=$* +do.buildx.platform: $(foreach p,$(PLATFORMS), do.buildx.platform.$(p)) + +buildx.all: + @$(MAKE) build.init + @$(MAKE) build.check + @$(MAKE) build.code + @$(MAKE) do.build.platform + @$(MAKE) build.artifacts + @$(MAKE) do.buildx.artifacts + @$(MAKE) buildx.merge + @$(MAKE) build.done diff --git a/provider-anynines/ci/imagelight.mk b/provider-anynines/ci/imagelight.mk new file mode 100644 index 0000000..fc76218 --- /dev/null +++ b/provider-anynines/ci/imagelight.mk @@ -0,0 +1,24 @@ +# Options + +# ==================================================================================== +# Common Targets + +do.buildx.image.%: + @$(MAKE) -C $(IMAGE_DIR)/$* IMAGE_PLATFORMS=$(IMAGE_PLATFORM) IMAGE=$(BUILD_REGISTRY)/$*-$(ARCH) img.buildx +do.buildx.images: $(foreach i,$(IMAGES), do.buildx.image.$(i)) +do.skipx.images: + @$(OK) Skipping image build for unsupported platform $(IMAGE_PLATFORM) + +buildx.merge: + @docker buildx create \ + --name=$(BUILDER_NAME) \ + $(BUILDX_CREATE_FLAGS) || echo "Builder $(BUILDER_NAME) already exists" + docker buildx imagetools create -t $(ECR_REPO)/$(PROJECT_NAME)-controller:$(IMAGETAG) $(ECR_REPO)/$(PROJECT_NAME)-controller:$(IMAGETAG)-$(word 1, $(IMAGE_ARCHS)) $(ECR_REPO)/$(PROJECT_NAME)-controller:$(IMAGETAG)-$(word 2, $(IMAGE_ARCHS)) + $(INFO) Image: $(ECR_REPO)/$(PROJECT_NAME)-controller:$(IMAGETAG) manifest list pushed to ECR; + @$(OK) docker buildx merge complete $(IMAGE) + +ifneq ($(filter $(IMAGE_PLATFORM),$(IMAGE_PLATFORMS_LIST)),) +buildx.artifacts.platform: do.buildx.images +else +buildx.artifacts.platform: do.skipx.images +endif diff --git a/provider-anynines/cluster/images/provider-anynines/Makefile b/provider-anynines/cluster/images/provider-anynines/Makefile index 895f0f7..daa6752 100755 --- a/provider-anynines/cluster/images/provider-anynines/Makefile +++ b/provider-anynines/cluster/images/provider-anynines/Makefile @@ -1,12 +1,22 @@ # ==================================================================================== # Setup Project +PROJECT_NAME := provider-anynines +ECR_ACCOUNT := public.ecr.aws/w5n9a2g2 +ECR_FOLDER_PATH := klutch +ECR_REPO := $(ECR_ACCOUNT)/$(ECR_FOLDER_PATH) +PLATFORMS := linux_amd64 linux_arm64 + include ../../../build/makelib/common.mk include ../../../build/makelib/imagelight.mk +include ../../../ci/common.mk +include ../../../ci/imagelight.mk # ==================================================================================== # Options - +DOCKER_REGISTRY ?= crossplane +IMAGE = $(BUILD_REGISTRY)/provider-anynines-$(ARCH) +OSBASEIMAGE = scratch BUILDER_NAME ?= provider-anynines-buildx-builder # ==================================================================================== @@ -38,12 +48,17 @@ img.promote: img.buildx: @$(INFO) docker buildx build $(IMAGE) $(BUILDX_CREATE_FLAGS) @cp Dockerfile $(IMAGE_TEMP_DIR) || $(FAIL) - @cp $(OUTPUT_DIR)/bin/$(OS)_$(ARCH)/provider $(IMAGE_TEMP_DIR) || $(FAIL) + @cp -R $(ROOT_DIR)/package $(IMAGE_TEMP_DIR) || $(FAIL) + @cp -R $(OUTPUT_DIR)/bin $(IMAGE_TEMP_DIR) || $(FAIL) @cd $(IMAGE_TEMP_DIR) && $(SED_CMD) 's|BASEIMAGE|$(OSBASEIMAGE)|g' Dockerfile || $(FAIL) + @cd $(IMAGE_TEMP_DIR) && $(SED_CMD) 's|VERSION|$(VERSION)|g' package/crossplane.yaml || $(FAIL) + @cd $(IMAGE_TEMP_DIR) && $(SED_CMD) 's|DOCKER_REGISTRY|$(DOCKER_REGISTRY)|g' package/crossplane.yaml || $(FAIL) + @cd $(IMAGE_TEMP_DIR) && find package -type f -name '*.yaml' -exec cat {} >> 'package.yaml' \; -exec printf '\n---\n' \; || $(FAIL) @docker buildx create \ --name=$(BUILDER_NAME) \ - $(BUILDX_CREATE_FLAGS) || echo "Builder $(BUILDER_NAME) already exists" - @docker buildx build -o type=image --builder=$(BUILDER_NAME) \ - --platform=linux/$(ARCH) -t $(IMAGE) \ + $(BUILDX_CREATE_FLAGS) || echo "Builder $(BUILDER_NAME) already exists" + docker buildx build -o type=image --builder=$(BUILDER_NAME) \ + --platform=linux/$(ARCH) \ + --push -t $(ECR_REPO)/$(PROJECT_NAME)-controller:$(IMAGETAG)-$(ARCH) \ $(IMAGE_TEMP_DIR) || $(FAIL) @$(OK) docker buildx build $(IMAGE) diff --git a/provider-anynines/internal/controller/confighealth/confighealth.go b/provider-anynines/internal/controller/confighealth/confighealth.go index 107fb49..9726ed2 100644 --- a/provider-anynines/internal/controller/confighealth/confighealth.go +++ b/provider-anynines/internal/controller/confighealth/confighealth.go @@ -85,7 +85,7 @@ type reconciler struct { } func (r reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) { - ctx, cancel := context.WithTimeout(ctx, healthCheckTimeout) + timeoutContext, cancel := context.WithTimeout(ctx, healthCheckTimeout) defer cancel() var pc v1.ProviderConfig @@ -104,10 +104,13 @@ func (r reconciler) Reconcile(ctx context.Context, req reconcile.Request) (recon if isCheckNeeded(&pc, now) { log := r.log.WithValues("request", req) log.Debug("Performing Check") - updated := r.getUpdatedProviderConfig(ctx, &pc, now) + // by passing a dedicated context, we put a limit on how long the check is allowed to take + // FIXME the a9s client should handle contexts correctly, it currently ignores them + updated := r.getUpdatedProviderConfig(timeoutContext, &pc, now) status := updated.Status.Health.LastStatus log.Debug("Check complete", "status", status) + // use parent context in case timeoutContext has exceeded its deadline if err := r.kube.Status().Patch(ctx, updated, k8sclient.MergeFrom(&pc)); err != nil { return ctrl.Result{}, err } diff --git a/test/e2e/postgresql/manifests/claim-upgrade-plan.yaml b/test/e2e/postgresql/manifests/claim-upgrade-plan.yaml index 1204dae..9577982 100644 --- a/test/e2e/postgresql/manifests/claim-upgrade-plan.yaml +++ b/test/e2e/postgresql/manifests/claim-upgrade-plan.yaml @@ -5,6 +5,6 @@ metadata: namespace: pg-lifecycle spec: service: a9s-postgresql13 - plan: postgresql-replica-medium + plan: postgresql-replica-big compositionRef: name: a9s-postgresql diff --git a/test/e2e/postgresql/manifests/claim-upgrade-service-not-allowed.yaml b/test/e2e/postgresql/manifests/claim-upgrade-service-not-allowed.yaml index b561563..db5477b 100644 --- a/test/e2e/postgresql/manifests/claim-upgrade-service-not-allowed.yaml +++ b/test/e2e/postgresql/manifests/claim-upgrade-service-not-allowed.yaml @@ -5,6 +5,6 @@ metadata: namespace: pg-lifecycle spec: service: a9s-postgresql15 - plan: postgresql-replica-medium + plan: postgresql-replica-big compositionRef: name: a9s-postgresql diff --git a/test/validations/postgresql/create-invalid-a9s-with-wrong-plan.yaml b/test/validations/postgresql/create-invalid-a9s-with-wrong-plan.yaml index d51fb95..b0bc399 100644 --- a/test/validations/postgresql/create-invalid-a9s-with-wrong-plan.yaml +++ b/test/validations/postgresql/create-invalid-a9s-with-wrong-plan.yaml @@ -5,6 +5,6 @@ metadata: spec: service: a9s-postgresql15 # only supported in a8s - plan: postgresql-single-large + plan: postgresql-single-medium compositionRef: name: a9s-postgresql diff --git a/test/validations/postgresql/create-valid-a8s.yaml b/test/validations/postgresql/create-valid-a8s.yaml index f4541cf..a68097a 100644 --- a/test/validations/postgresql/create-valid-a8s.yaml +++ b/test/validations/postgresql/create-valid-a8s.yaml @@ -44,7 +44,7 @@ metadata: name: sample-pg-cluster spec: service: a9s-postgresql13 - plan: postgresql-single-large + plan: postgresql-single-big compositionRef: name: a8s-postgresql --- @@ -74,7 +74,7 @@ metadata: name: sample-pg-cluster spec: service: a9s-postgresql13 - plan: postgresql-replica-large + plan: postgresql-replica-big compositionRef: name: a8s-postgresql --- @@ -84,7 +84,7 @@ metadata: name: sample-pg-cluster spec: service: a9s-postgresql13 - plan: postgresql-replica-large + plan: postgresql-replica-big parameters: maxConnections: 250 compositionRef: @@ -96,7 +96,7 @@ metadata: name: sample-pg-cluster spec: service: a9s-postgresql13 - plan: postgresql-replica-large + plan: postgresql-replica-big parameters: maxConnections: 120 tempFileLimit: 1024 @@ -118,4 +118,3 @@ spec: maxLocksPerTransaction: 128 compositionRef: name: a8s-postgresql - diff --git a/test/validations/postgresql/update-a8s-plan-replica-large.yaml b/test/validations/postgresql/update-a8s-plan-replica-large.yaml index c8aa621..078670e 100644 --- a/test/validations/postgresql/update-a8s-plan-replica-large.yaml +++ b/test/validations/postgresql/update-a8s-plan-replica-large.yaml @@ -6,17 +6,17 @@ base: name: update-a8s-plan-replica-large spec: service: a9s-postgresql13 - plan: postgresql-replica-large + plan: postgresql-replica-big compositionRef: name: a8s-postgresql invalid_patches: -# from larger to smaller instances -- spec: { plan: postgresql-replica-nano } -- spec: { plan: postgresql-replica-small } -- spec: { plan: postgresql-replica-medium } -# from replica to single instances -- spec: { plan: postgresql-single-nano } -- spec: { plan: postgresql-single-small } -- spec: { plan: postgresql-single-medium } -- spec: { plan: postgresql-single-large } + # from larger to smaller instances + - spec: { plan: postgresql-replica-nano } + - spec: { plan: postgresql-replica-small } + - spec: { plan: postgresql-replica-medium } + # from replica to single instances + - spec: { plan: postgresql-single-nano } + - spec: { plan: postgresql-single-small } + - spec: { plan: postgresql-single-medium } + - spec: { plan: postgresql-single-big } diff --git a/test/validations/postgresql/update-a8s-plan-replica-medium.yaml b/test/validations/postgresql/update-a8s-plan-replica-medium.yaml index fcef623..693be9a 100644 --- a/test/validations/postgresql/update-a8s-plan-replica-medium.yaml +++ b/test/validations/postgresql/update-a8s-plan-replica-medium.yaml @@ -11,15 +11,15 @@ base: name: a8s-postgresql valid_patches: -# from smaller to larger single instances -- spec: { plan: postgresql-replica-large } + # from smaller to larger single instances + - spec: { plan: postgresql-replica-big } invalid_patches: -# from larger to smaller instances -- spec: { plan: postgresql-replica-nano } -- spec: { plan: postgresql-replica-small } -# from replica to single instances -- spec: { plan: postgresql-single-nano } -- spec: { plan: postgresql-single-small } -- spec: { plan: postgresql-single-medium } -- spec: { plan: postgresql-single-large } + # from larger to smaller instances + - spec: { plan: postgresql-replica-nano } + - spec: { plan: postgresql-replica-small } + # from replica to single instances + - spec: { plan: postgresql-single-nano } + - spec: { plan: postgresql-single-small } + - spec: { plan: postgresql-single-medium } + - spec: { plan: postgresql-single-big } diff --git a/test/validations/postgresql/update-a8s-plan-replica-nano.yaml b/test/validations/postgresql/update-a8s-plan-replica-nano.yaml index bdf9f13..ab66722 100644 --- a/test/validations/postgresql/update-a8s-plan-replica-nano.yaml +++ b/test/validations/postgresql/update-a8s-plan-replica-nano.yaml @@ -11,14 +11,14 @@ base: name: a8s-postgresql valid_patches: -# from smaller to larger single instances -- spec: { plan: postgresql-replica-small } -- spec: { plan: postgresql-replica-medium } -- spec: { plan: postgresql-replica-large } + # from smaller to larger single instances + - spec: { plan: postgresql-replica-small } + - spec: { plan: postgresql-replica-medium } + - spec: { plan: postgresql-replica-big } invalid_patches: -# from replica to single instances -- spec: { plan: postgresql-single-nano } -- spec: { plan: postgresql-single-small } -- spec: { plan: postgresql-single-medium } -- spec: { plan: postgresql-single-large } + # from replica to single instances + - spec: { plan: postgresql-single-nano } + - spec: { plan: postgresql-single-small } + - spec: { plan: postgresql-single-medium } + - spec: { plan: postgresql-single-big } diff --git a/test/validations/postgresql/update-a8s-plan-replica-small.yaml b/test/validations/postgresql/update-a8s-plan-replica-small.yaml index 476822c..2760473 100644 --- a/test/validations/postgresql/update-a8s-plan-replica-small.yaml +++ b/test/validations/postgresql/update-a8s-plan-replica-small.yaml @@ -11,15 +11,15 @@ base: name: a8s-postgresql valid_patches: -# from smaller to larger single instances -- spec: { plan: postgresql-replica-medium } -- spec: { plan: postgresql-replica-large } + # from smaller to larger single instances + - spec: { plan: postgresql-replica-medium } + - spec: { plan: postgresql-replica-big } invalid_patches: -# from larger to smaller instances -- spec: { plan: postgresql-replica-nano } -# from replica to single instances -- spec: { plan: postgresql-single-nano } -- spec: { plan: postgresql-single-small } -- spec: { plan: postgresql-single-medium } -- spec: { plan: postgresql-single-large } + # from larger to smaller instances + - spec: { plan: postgresql-replica-nano } + # from replica to single instances + - spec: { plan: postgresql-single-nano } + - spec: { plan: postgresql-single-small } + - spec: { plan: postgresql-single-medium } + - spec: { plan: postgresql-single-big } diff --git a/test/validations/postgresql/update-a8s-plan-single-large.yaml b/test/validations/postgresql/update-a8s-plan-single-large.yaml index c9e821e..be75a44 100644 --- a/test/validations/postgresql/update-a8s-plan-single-large.yaml +++ b/test/validations/postgresql/update-a8s-plan-single-large.yaml @@ -6,20 +6,20 @@ base: name: update-a8s-plan-single-large spec: service: a9s-postgresql13 - plan: postgresql-single-large + plan: postgresql-single-big compositionRef: name: a8s-postgresql valid_patches: -# from single to replica instances -- spec: { plan: postgresql-replica-large } + # from single to replica instances + - spec: { plan: postgresql-replica-big } invalid_patches: -# from larger to smaller instances -- spec: { plan: postgresql-single-nano } -- spec: { plan: postgresql-single-small } -- spec: { plan: postgresql-single-medium } -# from larger to smaller replica instances -- spec: { plan: postgresql-replica-nano } -- spec: { plan: postgresql-replica-small } -- spec: { plan: postgresql-replica-medium } + # from larger to smaller instances + - spec: { plan: postgresql-single-nano } + - spec: { plan: postgresql-single-small } + - spec: { plan: postgresql-single-medium } + # from larger to smaller replica instances + - spec: { plan: postgresql-replica-nano } + - spec: { plan: postgresql-replica-small } + - spec: { plan: postgresql-replica-medium } diff --git a/test/validations/postgresql/update-a8s-plan-single-medium.yaml b/test/validations/postgresql/update-a8s-plan-single-medium.yaml index 54e5032..2c0c4b3 100644 --- a/test/validations/postgresql/update-a8s-plan-single-medium.yaml +++ b/test/validations/postgresql/update-a8s-plan-single-medium.yaml @@ -11,16 +11,16 @@ base: name: a8s-postgresql valid_patches: -# from smaller to larger single instances -- spec: { plan: postgresql-single-large } -# from single to replica instances -- spec: { plan: postgresql-replica-medium } -- spec: { plan: postgresql-replica-large } + # from smaller to larger single instances + - spec: { plan: postgresql-single-big } + # from single to replica instances + - spec: { plan: postgresql-replica-medium } + - spec: { plan: postgresql-replica-big } invalid_patches: -# from larger to smaller instances -- spec: { plan: postgresql-single-nano } -- spec: { plan: postgresql-single-small } -# from larger to smaller replica instances -- spec: { plan: postgresql-replica-nano } -- spec: { plan: postgresql-replica-small } + # from larger to smaller instances + - spec: { plan: postgresql-single-nano } + - spec: { plan: postgresql-single-small } + # from larger to smaller replica instances + - spec: { plan: postgresql-replica-nano } + - spec: { plan: postgresql-replica-small } diff --git a/test/validations/postgresql/update-a8s-plan-single-nano.yaml b/test/validations/postgresql/update-a8s-plan-single-nano.yaml index 5fffe12..455413a 100644 --- a/test/validations/postgresql/update-a8s-plan-single-nano.yaml +++ b/test/validations/postgresql/update-a8s-plan-single-nano.yaml @@ -11,11 +11,11 @@ base: name: a8s-postgresql valid_patches: -# from smaller to larger single instances -- spec: { plan: postgresql-single-small } -- spec: { plan: postgresql-single-medium } -- spec: { plan: postgresql-single-large } -# from single to replica instances -- spec: { plan: postgresql-replica-small } -- spec: { plan: postgresql-replica-medium } -- spec: { plan: postgresql-replica-large } + # from smaller to larger single instances + - spec: { plan: postgresql-single-small } + - spec: { plan: postgresql-single-medium } + - spec: { plan: postgresql-single-big } + # from single to replica instances + - spec: { plan: postgresql-replica-small } + - spec: { plan: postgresql-replica-medium } + - spec: { plan: postgresql-replica-big } diff --git a/test/validations/postgresql/update-a8s-plan-single-small.yaml b/test/validations/postgresql/update-a8s-plan-single-small.yaml index e9448f9..a5e78c8 100644 --- a/test/validations/postgresql/update-a8s-plan-single-small.yaml +++ b/test/validations/postgresql/update-a8s-plan-single-small.yaml @@ -11,16 +11,16 @@ base: name: a8s-postgresql valid_patches: -# from smaller to larger single instances -- spec: { plan: postgresql-single-medium } -- spec: { plan: postgresql-single-large } -# from single to replica instances -- spec: { plan: postgresql-replica-small } -- spec: { plan: postgresql-replica-medium } -- spec: { plan: postgresql-replica-large } + # from smaller to larger single instances + - spec: { plan: postgresql-single-medium } + - spec: { plan: postgresql-single-big } + # from single to replica instances + - spec: { plan: postgresql-replica-small } + - spec: { plan: postgresql-replica-medium } + - spec: { plan: postgresql-replica-big } invalid_patches: -# from larger to smaller instances -- spec: { plan: postgresql-single-nano } -# from larger to smaller replica instances -- spec: { plan: postgresql-replica-nano } + # from larger to smaller instances + - spec: { plan: postgresql-single-nano } + # from larger to smaller replica instances + - spec: { plan: postgresql-replica-nano } diff --git a/test/validations/postgresql/update-a8s-service.yaml b/test/validations/postgresql/update-a8s-service.yaml index d5b9c43..c30c69f 100644 --- a/test/validations/postgresql/update-a8s-service.yaml +++ b/test/validations/postgresql/update-a8s-service.yaml @@ -11,11 +11,11 @@ base: name: a8s-postgresql invalid_patches: -- spec: - # Change to a different service - service: a9s-postgresql14 + - spec: + # Change to a different service + service: a9s-postgresql14 valid_patches: -- spec: - # No change - service: a9s-postgresql13 + - spec: + # No change + service: a9s-postgresql13 diff --git a/test/validations/postgresql/update-a9s-plan-single-big.yaml b/test/validations/postgresql/update-a9s-plan-single-big.yaml new file mode 100644 index 0000000..be2c714 --- /dev/null +++ b/test/validations/postgresql/update-a9s-plan-single-big.yaml @@ -0,0 +1,30 @@ +base: + apiVersion: anynines.com/v1 + kind: PostgresqlInstance + metadata: + # This must be UNIQUE among the `update-*` tests! + name: update-a9s-plan-single-big + spec: + service: a9s-postgresql13 + plan: postgresql-single-big + compositionRef: + name: a9s-postgresql + +valid_patches: + # from single to replica instances + - spec: { plan: postgresql-replica-big } + +invalid_patches: + # from larger to smaller single instances + - spec: { plan: postgresql-single-nano } + - spec: { plan: postgresql-single-small } + # from larger to smaller replica instances + - spec: { plan: postgresql-replica-small } + # from non-ssl to ssl + - spec: { plan: postgresql-single-nano-ssl } + - spec: { plan: postgresql-single-small-ssl } + - spec: { plan: postgresql-single-big-ssl } + # from non-bionic to bionic + - spec: { plan: postgresql-single-nano-bionic } + - spec: { plan: postgresql-single-small-bionic } + - spec: { plan: postgresql-single-big-bionic } diff --git a/test/validations/postgresql/update-a9s-plan-single-medium.yaml b/test/validations/postgresql/update-a9s-plan-single-medium.yaml deleted file mode 100644 index d8efb2c..0000000 --- a/test/validations/postgresql/update-a9s-plan-single-medium.yaml +++ /dev/null @@ -1,30 +0,0 @@ -base: - apiVersion: anynines.com/v1 - kind: PostgresqlInstance - metadata: - # This must be UNIQUE among the `update-*` tests! - name: update-a9s-plan-single-medium - spec: - service: a9s-postgresql13 - plan: postgresql-single-medium - compositionRef: - name: a9s-postgresql - -valid_patches: -# from single to replica instances -- spec: { plan: postgresql-replica-medium } - -invalid_patches: -# from larger to smaller single instances -- spec: { plan: postgresql-single-nano } -- spec: { plan: postgresql-single-small } -# from larger to smaller replica instances -- spec: { plan: postgresql-replica-small } -# from non-ssl to ssl -- spec: { plan: postgresql-single-nano-ssl } -- spec: { plan: postgresql-single-small-ssl } -- spec: { plan: postgresql-single-medium-ssl } -# from non-bionic to bionic -- spec: { plan: postgresql-single-nano-bionic } -- spec: { plan: postgresql-single-small-bionic } -- spec: { plan: postgresql-single-medium-bionic } diff --git a/test/validations/postgresql/update-a9s-plan-single-nano-ssl.yaml b/test/validations/postgresql/update-a9s-plan-single-nano-ssl.yaml index 59e9d54..b6728dc 100644 --- a/test/validations/postgresql/update-a9s-plan-single-nano-ssl.yaml +++ b/test/validations/postgresql/update-a9s-plan-single-nano-ssl.yaml @@ -11,19 +11,19 @@ base: name: a9s-postgresql valid_patches: -# from smaller to larger single instances -- spec: { plan: postgresql-single-small-ssl } -- spec: { plan: postgresql-single-medium-ssl } -# from single to replica instances -- spec: { plan: postgresql-replica-small-ssl } -- spec: { plan: postgresql-replica-medium-ssl } + # from smaller to larger single instances + - spec: { plan: postgresql-single-small-ssl } + - spec: { plan: postgresql-single-big-ssl } + # from single to replica instances + - spec: { plan: postgresql-replica-small-ssl } + - spec: { plan: postgresql-replica-big-ssl } invalid_patches: -# from ssl to non-ssl -- spec: { plan: postgresql-single-nano } -- spec: { plan: postgresql-single-small } -- spec: { plan: postgresql-single-medium } -# from non-bionic to bionic -- spec: { plan: postgresql-single-nano-ssl-bionic } -- spec: { plan: postgresql-single-small-ssl-bionic } -- spec: { plan: postgresql-single-medium-ssl-bionic } + # from ssl to non-ssl + - spec: { plan: postgresql-single-nano } + - spec: { plan: postgresql-single-small } + - spec: { plan: postgresql-single-big } + # from non-bionic to bionic + - spec: { plan: postgresql-single-nano-ssl-bionic } + - spec: { plan: postgresql-single-small-ssl-bionic } + - spec: { plan: postgresql-single-big-ssl-bionic } diff --git a/test/validations/postgresql/update-a9s-plan-single-nano.yaml b/test/validations/postgresql/update-a9s-plan-single-nano.yaml index b728717..167d15e 100644 --- a/test/validations/postgresql/update-a9s-plan-single-nano.yaml +++ b/test/validations/postgresql/update-a9s-plan-single-nano.yaml @@ -11,19 +11,19 @@ base: name: a9s-postgresql valid_patches: -# from smaller to larger single instances -- spec: { plan: postgresql-single-small } -- spec: { plan: postgresql-single-medium } -# from single to replica instances -- spec: { plan: postgresql-replica-small } -- spec: { plan: postgresql-replica-medium } + # from smaller to larger single instances + - spec: { plan: postgresql-single-small } + - spec: { plan: postgresql-single-big } + # from single to replica instances + - spec: { plan: postgresql-replica-small } + - spec: { plan: postgresql-replica-big } invalid_patches: -# from non-ssl to ssl -- spec: { plan: postgresql-single-nano-ssl } -- spec: { plan: postgresql-single-small-ssl } -- spec: { plan: postgresql-single-medium-ssl } -# from non-bionic to bionic -- spec: { plan: postgresql-single-nano-bionic } -- spec: { plan: postgresql-single-small-bionic } -- spec: { plan: postgresql-single-medium-bionic } + # from non-ssl to ssl + - spec: { plan: postgresql-single-nano-ssl } + - spec: { plan: postgresql-single-small-ssl } + - spec: { plan: postgresql-single-big-ssl } + # from non-bionic to bionic + - spec: { plan: postgresql-single-nano-bionic } + - spec: { plan: postgresql-single-small-bionic } + - spec: { plan: postgresql-single-big-bionic } diff --git a/test/validations/postgresql/update-a9s-plan-single-small.yaml b/test/validations/postgresql/update-a9s-plan-single-small.yaml index 8e25801..83dafc2 100644 --- a/test/validations/postgresql/update-a9s-plan-single-small.yaml +++ b/test/validations/postgresql/update-a9s-plan-single-small.yaml @@ -11,20 +11,20 @@ base: name: a9s-postgresql valid_patches: -# from smaller to larger single instances -- spec: { plan: postgresql-single-medium } -# from single to replica instances -- spec: { plan: postgresql-replica-small } -- spec: { plan: postgresql-replica-medium } + # from smaller to larger single instances + - spec: { plan: postgresql-single-big } + # from single to replica instances + - spec: { plan: postgresql-replica-small } + - spec: { plan: postgresql-replica-big } invalid_patches: -# from larger to smaller single instances -- spec: { plan: postgresql-single-nano } -# from non-ssl to ssl -- spec: { plan: postgresql-single-nano-ssl } -- spec: { plan: postgresql-single-small-ssl } -- spec: { plan: postgresql-single-medium-ssl } -# from non-bionic to bionic -- spec: { plan: postgresql-single-nano-bionic } -- spec: { plan: postgresql-single-small-bionic } -- spec: { plan: postgresql-single-medium-bionic } + # from larger to smaller single instances + - spec: { plan: postgresql-single-nano } + # from non-ssl to ssl + - spec: { plan: postgresql-single-nano-ssl } + - spec: { plan: postgresql-single-small-ssl } + - spec: { plan: postgresql-single-big-ssl } + # from non-bionic to bionic + - spec: { plan: postgresql-single-nano-bionic } + - spec: { plan: postgresql-single-small-bionic } + - spec: { plan: postgresql-single-big-bionic } diff --git a/test/validations/postgresql/update-a9s-service.yaml b/test/validations/postgresql/update-a9s-service.yaml index 786d77e..a2d83a0 100644 --- a/test/validations/postgresql/update-a9s-service.yaml +++ b/test/validations/postgresql/update-a9s-service.yaml @@ -11,11 +11,11 @@ base: name: a9s-postgresql invalid_patches: -- spec: - # Change to a different service - service: a9s-postgresql15 + - spec: + # Change to a different service + service: a9s-postgresql15 valid_patches: -- spec: - # No change - service: a9s-postgresql13 + - spec: + # No change + service: a9s-postgresql13