Skip to content

Commit

Permalink
Update pg e2e test with latest service plans
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulhaseeb3 committed Jan 9, 2025
1 parent 79fd9ca commit 5bc1534
Show file tree
Hide file tree
Showing 23 changed files with 536 additions and 488 deletions.
8 changes: 6 additions & 2 deletions crossplane-api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"; \
Expand Down
48 changes: 24 additions & 24 deletions crossplane-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,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
Expand Down Expand Up @@ -575,23 +575,23 @@ field in [definition.yaml](https://github.com/anynines/klutch/blob/5afcaefaad082
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.
Expand All @@ -601,7 +601,7 @@ Within this field you can see a list of supported Plans:
[definition.yaml](https://github.com/anynines/klutch/blob/5afcaefaad082059177dbce1f267ffc7339bf62c/crossplane-api/api/a8s/postgresql/definition.yaml#L53)
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.

Expand All @@ -615,21 +615,21 @@ Within this field you can see a list of supported Plans:
field in the [composition file](https://github.com/anynines/klutch/blob/5afcaefaad082059177dbce1f267ffc7339bf62c/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/klutch/blob/5afcaefaad082059177dbce1f267ffc7339bf62c/crossplane-api/api/a8s/postgresql/composition.yaml#L50)
used for patching the disk, cpu and memory resources in the
[composition file](https://github.com/anynines/klutch/blob/5afcaefaad082059177dbce1f267ffc7339bf62c/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
Expand All @@ -639,26 +639,26 @@ 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
map:
nano: *CPUNano
small: *CPUSmall
medium: *CPUMedium
large: *CPULarge
extralarge: *CPUExtraLarge
big: *CPULarge
huge: *CPUHuge
...
- type: map
map:
nano: *MemoryNano
small: *MemorySmall
medium: *MemoryMedium
large: *MemoryLarge
extralarge: *MemoryExtraLarge
big: *MemoryLarge
huge: *MemoryHuge
...
```

Expand Down
16 changes: 8 additions & 8 deletions crossplane-api/api/a8s/postgresql/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ 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
Expand Down Expand Up @@ -73,7 +73,7 @@ spec:
nano: *volumeSizeNano
small: *volumeSizeSmall
medium: *volumeSizeMedium
large: *volumeSizeLarge
big: *volumeSizeBig
- fromFieldPath: spec.plan
toFieldPath: spec.forProvider.manifest.spec.resources.requests.cpu
transforms:
Expand All @@ -87,7 +87,7 @@ spec:
nano: *CPUNano
small: *CPUSmall
medium: *CPUMedium
large: *CPULarge
big: *CPUBig
- fromFieldPath: spec.plan
toFieldPath: spec.forProvider.manifest.spec.resources.limits.cpu
transforms:
Expand All @@ -101,7 +101,7 @@ spec:
nano: *CPUNano
small: *CPUSmall
medium: *CPUMedium
large: *CPULarge
big: *CPUBig
- fromFieldPath: spec.plan
toFieldPath: spec.forProvider.manifest.spec.resources.requests.memory
transforms:
Expand All @@ -115,7 +115,7 @@ spec:
nano: *MemoryNano
small: *MemorySmall
medium: *MemoryMedium
large: *MemoryLarge
big: *MemoryBig
- fromFieldPath: spec.plan
toFieldPath: spec.forProvider.manifest.spec.resources.limits.memory
transforms:
Expand All @@ -129,7 +129,7 @@ spec:
nano: *MemoryNano
small: *MemorySmall
medium: *MemoryMedium
large: *MemoryLarge
big: *MemoryBig
- fromFieldPath: spec.plan
toFieldPath: spec.forProvider.manifest.spec.replicas
transforms:
Expand Down
Loading

0 comments on commit 5bc1534

Please sign in to comment.