Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: resource workload configuration support #259

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shreddedbacon
Copy link
Member

@shreddedbacon shreddedbacon commented Nov 8, 2023

This is a WIP for being able to template basic resource workload implementations (HPA/PDB) and eventually resources per service overrides (requests/limits).

Currently the requests/limits overrides are ignored in the templating stage as these are currently done in an odd way that requires a bit more work to override (mainly that service templates are still done in helm, so can't benefit from the way the build-deploy-tool generates values)

The way to consume this currently is to set a LAGOON_FEATURE_FLAG_WORKLOAD_RESOURCES envvar, which is a base64 encoded JSON value.

The structure of which looks something like this, which is a map[string]structure where the string = the parameter name which is to be consumed, and the structure is the data payload contained within which can define the hpa, pdb, and eventually resources, that should be applied to any services that match the servicetype and request the workload resources by name

{
    "nginx-php-performance": {
        "serviceType": "nginx-php-persistent",
        "hpa": {
            "spec": {
                "minReplicas": 8,
                "maxReplicas": 16,
                "metrics": [
                    {
                        "type": "Resource",
                        "resource": {
                            "name": "cpu",
                            "target": {
                                "type": "Utilization",
                                "averageUtilization": 3000
                            }
                        }
                    }
                ]
            }
        },
        "pdb": {
            "spec": {
                "minAvailable": 2
            }
        }
    }
}

Currently, a user needs to specify the workloadresource to consume using a label in docker-compose.yml like so, and the build will fail if the requested workloadresource is not for the requested service-type that the workloadresource is defined for

    labels:
      lagoon.type: nginx-php-persistent
      lagoon.workloadresource: nginx-php-performance

It is also possible to specify workloadresource assignment via an envvar override type similarly to how dbaas and service type overrides work(but as a feature flag for now), where it is serviceName:workloadResource. This allows for updates to workload resources without requiring the docker-compose file to be modified. API wins out over docker-compose defined workload resources too.

LAGOON_FEATURE_FLAG_WORKLOAD_RESOURCE_TYPES=nginx:nginx-php-performance

@shreddedbacon shreddedbacon force-pushed the resource-workloads branch 5 times, most recently from 6a8b2e2 to 7371187 Compare November 9, 2023 00:53
@shreddedbacon shreddedbacon changed the title feat: initial work on resource workload support feat: resource workload configuration support Nov 9, 2023
@shreddedbacon shreddedbacon force-pushed the resource-workloads branch 2 times, most recently from 77b8f22 to 2c2e9ba Compare November 9, 2023 02:31
@shreddedbacon shreddedbacon force-pushed the resource-workloads branch 4 times, most recently from ae6847d to 6844177 Compare January 7, 2024 23:34
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.

1 participant