UCS Microservice Additional Features#
Horizontal Pod Autoscaler (HPA) support#
HPA is a nice feature in Kubernetes that allows for workloads to dynamically scale up and down based on resource useage, such as memory or CPU, or custom resources.
A UCS Microservice definition allows for setting these HPA requirements. In the manifest.py, the user can set the hpa
parameter of the ucf.k8s.app.deployment
built-in component. Below is an example of setting memory and cpu target utilization values for an example echo server (note that several manifest components have been omitted for brevity). Specifically, the HPA setings on indicate that pods should be scaled up and down accordingly between a minimum of 1 pod and a maximum of 4, based on CPU resource utilization and memory utilization thresholds. The threshold defined for each is a percentage (75% in this example) of the corresponding target value defined within the pod resource requests.
type: msapplication
specVersion: 2.5.0
name: ucf.svc.echo
chartName: echo-server
description: Echo server example
version: 0.0.1
displayName: "Echo Server"
nSpectId: NSPECT-0000-0000
ingress-endpoints:
- name: http-api
description: Short description of http-api ingress endpoint
scheme: http
data-flow: in-out # Or in or out
#params:
#stringToEcho: someString
#> type: string
#> enum_values: someString, someOtherString
#> description: String to echo in init container
---
spec:
- name: echo-deployment
type: ucf.k8s.app.deployment
parameters:
apptype: stateless
hpa:
maxReplicas: 4
minReplicates: 1 # default if not specified
cpu:
averageUtilization: 75
memory:
averageUtilization: 75
- name: "echo-container"
type: ucf.k8s.container
parameters:
image:
repository: ealen/echo-server
tag: "0.9.2"
ports:
- containerPort: 80
name: http
- containerPort: 8002
name: metrics
resources:
limits:
cpu: "0.5"
memory: "500Mi"
- name: echo-service
type: ucf.k8s.service
parameters:
fullNameOverride: true
ports:
- port: 3000
name: http-api
targetPort: 80
See the Kubernetes HPA documentation for more information about HPA.
Tagging a UCS Microservice#
As of version 2.10.0, there is a new command ucf_ms_builder_cli service tag
:
usage: ucf_ms_builder_cli service tag [-h] -u URI -n NEW_VERSION
Retag a microservice in a given team as a new version. Associated Helm Charts will also be tagged
options:
-h, --help show this help message and exit
-u URI, --uri URI The NGC URI of the existing version of the microservice to tag, specified as <org>/<team>/<name>:<version>
-n NEW_VERSION, --new-version NEW_VERSION
The new version of the microservice to create
A common use case is to retag a version that was a release candidate (RC) to a non-RC version, for example:
ucf_ms_builder_cli service tag --uri "eevaigoeixww/staging/ucf.svc.tika:0.0.2-rc1" --new-version "0.0.2"
Note that the resource name (ucf.svc.tika in this case), can also be specified in NGC format where the ‘.’ is replaced by an underscore, so passing ‘eevaigoeixww/staging/ucf_svc_tika’ to the –uri argument would also be acceptable.
This command will also add some JSON metadata to the NGC resource in the customAttributes field, which can be viewed using the NGC CLI:
ngc registry resource info eevaigoeixww/staging/ucf_svc_tika:0.0.2 --org eevaigoeixww --format_type json
{
"createdByUser": "69vle3sf391vsrbmddhegf7j7h",
"createdDate": "2025-02-20T21:55:14.544Z",
"customMetrics": [
{
"attributes": [
{
"key": "tagged_from_version",
"value": "0.0.2-rc1"
},
{
"key": "created_from",
"value": "UCS Tools 2.10.0-rc8"
}
],
"name": "ucs_tools"
}
],
"status": "UPLOAD_COMPLETE",
"totalFileCount": 5,
"totalSizeInBytes": 5717,
"versionId": "0.0.2"
}
customMetrics is a list of objects, and UCS Tools will add an object with the “name” property set to “ucs_tools”, whose attributes will include:
tagged_from_version: The version of the UCS MS that was used for the source tag
created_from: The version of the tools that was used to tag the UCS MS.