Skip to content

Conversation

cesnietor
Copy link
Collaborator

Since the Tenant's zones is an array, a PUT operation was done where
all zone elements on the Tenant are replaced by the defined ones on the request.

Api to update zones is done on:
PUT /namespaces/{namespace}/tenants/{tenant}/zones

Payload can be E.g.:

{
    "zones": [
        {
            "name": "zone-0",
            "servers": 2,
            "volumes_per_server": 2,
            "volume_configuration": {
                "storage_class_name": "standard",
                "size": 1073741824
            },
            "resources": {
                "requests": {
                    "memory": 3221225472
                }
            },
            "tolerations": [
                                {
                    "effect": "NoExecute",
                    "key": "node.kubernetes.io/not-ready",
                    "operator": "Exists",
                    "tolerationSeconds": {
                        "seconds": 300
                    }
                },
                {
                    "effect": "NoExecute",
                    "key": "node.kubernetes.io/unreachable",
                    "operator": "Exists",
                    "tolerationSeconds": {
                        "seconds": 300
                    }
                },
            ],
            "affinity": {
                "podAntiAffinity": {
                    "requiredDuringSchedulingIgnoredDuringExecution": [
                        {
                            "topologyKey": "kubernetes.io/hostname",
                            "labelSelector": {
                                    "matchExpressions": [
                                        {
                                            "key": "v1.min.io/tenant",
                                            "operator": "In",
                                            "values": ["minio-tenant-1"]
                                        },
                                        {
                                            "key": "v1.min.io/zone",
                                            "operator": "In",
                                            "values": ["zone-0"]
                                        }
                                    ]
                            }
                        }
                    ]
                }   
            }
        }
    ]
}

Response will be in the format of models.Tenant (the one gotten on /namespaces/{namespace}/tenants/{tenant})

@cesnietor cesnietor self-assigned this Aug 25, 2020
bexsoft
bexsoft previously approved these changes Aug 26, 2020
Alevsk
Alevsk previously approved these changes Aug 26, 2020
swagger.yml Outdated
zones:
type: array
items:
$ref: "#/definitions/zone"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a blocker but its a good practice to have an empty line at the end of the file because of file processing https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Since the Tenant's zones is an array, a PUT operation was done where
all zone elements on the Tenant are replaced by the defined ones on the request.
@cesnietor cesnietor dismissed stale reviews from Alevsk and bexsoft via 7a5feb0 August 26, 2020 16:42
@cesnietor cesnietor requested review from Alevsk and bexsoft August 26, 2020 16:42
}

// set the zones if they are provided
var newZoneArray []operator.Zone
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implies that if the put operation is missing a zone it would be deleted from the array right? Wouldn't it be better to only update the zones named in the request array?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, there can be multiple zones with the same name

// set the zones if they are provided
var newZoneArray []operator.Zone
for _, zone := range zonesReq {
zone, err := parseTenantZoneRequest(zone, minInst.Spec.Metadata.Annotations)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseTenantZoneRequest would allow to change fields that shouldn't be changed after zone creation, such as PVC storage Class or size, number of servers, etc, we should be careful not to change them since that could break havok on the tenant, can we just grab the fields that are safe to change? like memory, node selector, affinity and tolerations?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it is possible to have two zones with the same name, it would be difficult to modify the correct one, also it would make it messy in the sense that we would need to loop to find which to edit.

@cesnietor cesnietor requested a review from dvaldivia August 26, 2020 20:42
@dvaldivia dvaldivia merged commit 412ac0a into minio:master Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants