Skip to content

Commit

Permalink
Merge pull request #13534 from lokanandaprabhu/feature/OCPBUGS-27469
Browse files Browse the repository at this point in the history
OCPBUGS-27469: "Deploy Image" with "Serverless Deployment", Scaling "Min Pods"/"Max Pods" should set "autoscaling.knative.dev/min-scale"/max-scale not minScale/maxScale
  • Loading branch information
openshift-merge-bot[bot] committed Mar 6, 2024
2 parents b3a6cdc + 269276d commit 13aeba4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ describe('getServerlessData', () => {
template: {
metadata: {
annotations: {
'autoscaling.knative.dev/maxScale': '2',
'autoscaling.knative.dev/max-scale': '2',
'autoscaling.knative.dev/window': '60s',
'autoscaling.knative.dev/target': '100',
'autoscaling.knative.dev/targetUtilizationPercentage': '70',
'autoscaling.knative.dev/minScale': '1',
'autoscaling.knative.dev/target-utilization-percentage': '70',
'autoscaling.knative.dev/min-scale': '1',
},
},
spec: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Feature: Create Knative service from existing Deployment/Deployment Config workl
And user clicks on save button
And user right clicks on the knative service workoad "nodejs-ex-git1-sev" in Topology page
And user selects option "Edit Service" from context options
Then user is able to see value of "autoscaling.knative.dev/targetUtilizationPercentage" as "4"
Then user is able to see value of "autoscaling.knative.dev/target-utilization-percentage" as "4"


@regression @broken-test
Expand All @@ -86,5 +86,5 @@ Feature: Create Knative service from existing Deployment/Deployment Config workl
And user clicks on Create button in Make Serverless form
And user right clicks on the knative service workoad "nodejs-ex-git2-sev" in Topology page
And user selects option "Edit Service" from context options
Then user is able to see the value of "autoscaling.knative.dev/maxScale" and "autoscaling.knative.dev/minScale" as "6" and "3" percent respectively
Then user is able to see the value of "autoscaling.knative.dev/max-scale" and "autoscaling.knative.dev/min-scale" as "6" and "3" percent respectively
And user is able to see "3" Pods running in Resources tab of sidebar for knative workload "nodejs-ex-git2-sev"
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Feature: Create a workload of 'knative Service' type resource
And user clicks Create button on Add page
And user clicks on the Knative Service workload "dancer-ex-git"
And user clicks on name KSVC "dancer-ex-git"
Then user will see value of autoscaling.knative.dev/maxScale, autoscaling.knative.dev/minScale, autoscaling.knative.dev/target, autoscaling.knative.dev/targetUtilizationPercentage, autoscaling.knative.dev/window under annotation and containerConcurrency under spec as under spec 5, 1, 3, 70, 9s and 15 respectively
Then user will see value of autoscaling.knative.dev/max-scale, autoscaling.knative.dev/min-scale, autoscaling.knative.dev/target, autoscaling.knative.dev/target-utilization-percentage, autoscaling.knative.dev/window under annotation and containerConcurrency under spec as under spec 5, 1, 3, 70, 9s and 15 respectively


@regression @manual
Expand Down
6 changes: 3 additions & 3 deletions frontend/packages/knative-plugin/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export const FLAG_CAMEL_KAMELETS = 'FLAG_CAMEL_KAMELETS';
export const CAMEL_K_PROVIDER_ANNOTATION = `${CAMEL_APIGROUP}/provider`;
export const CAMEL_K_TYPE_LABEL = `${CAMEL_APIGROUP}/kamelet.type`;
export const KNATIVE_AUTOSCALING_APIGROUP = 'autoscaling.knative.dev';
export const KNATIVE_MINSCALE_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/minScale`;
export const KNATIVE_MAXSCALE_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/maxScale`;
export const KNATIVE_MINSCALE_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/min-scale`;
export const KNATIVE_MAXSCALE_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/max-scale`;
export const KNATIVE_CONCURRENCYTARGET_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/target`;
export const KNATIVE_CONCURRENCYUTILIZATION_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/targetUtilizationPercentage`;
export const KNATIVE_CONCURRENCYUTILIZATION_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/target-utilization-percentage`;
export const KNATIVE_AUTOSCALEWINDOW_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/window`;
export const SERVERLESS_FUNCTION_LABEL_DEPRECATED = 'boson.dev/function'; // TODO: remove deprecated label for serverless function
export const SERVERLESS_FUNCTION_LABEL = 'function.knative.dev';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Create knative Utils', () => {
8080,
);
});
it('expect to have minSccale, maxScale, target and containerConcurrency defined', () => {
it('expect to have min-scale, max-scale, target and containerConcurrency defined', () => {
defaultData.route.unknownTargetPort = '8080';
const knDeploymentResource: K8sResourceKind = getKnativeServiceDepResource(
defaultData,
Expand All @@ -37,22 +37,28 @@ describe('Create knative Utils', () => {
knDeploymentResource.spec.template.metadata.annotations['autoscaling.knative.dev/target'],
).toBe('1');
expect(
knDeploymentResource.spec.template.metadata.annotations['autoscaling.knative.dev/minScale'],
knDeploymentResource.spec.template.metadata.annotations[
'autoscaling.knative.dev/min-scale'
],
).toBe('1');
expect(
knDeploymentResource.spec.template.metadata.annotations['autoscaling.knative.dev/maxScale'],
knDeploymentResource.spec.template.metadata.annotations[
'autoscaling.knative.dev/max-scale'
],
).toBe('5');
expect(knDeploymentResource.spec.template.spec.containerConcurrency).toBe(1);
});
it('expect not to have minScale defined', () => {
it('expect not to have min-scale defined', () => {
defaultData.serverless.scaling.minpods = 0;
defaultData.route.unknownTargetPort = '8080';
const knDeploymentResource: K8sResourceKind = getKnativeServiceDepResource(
defaultData,
'imgStream',
);
expect(
knDeploymentResource.spec.template.metadata.annotations['autoscaling.knative.dev/minScale'],
knDeploymentResource.spec.template.metadata.annotations[
'autoscaling.knative.dev/min-scale'
],
).toBeUndefined();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ describe('knatify-utils', () => {
metadata: {
...ksvcData.spec.template.metadata,
annotations: {
'autoscaling.knative.dev/minScale': '1',
'autoscaling.knative.dev/maxScale': '3',
'autoscaling.knative.dev/min-scale': '1',
'autoscaling.knative.dev/max-scale': '3',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ export const getKnativeServiceDepResource = (
...(concurrencytarget && {
'autoscaling.knative.dev/target': `${concurrencytarget}`,
}),
...(minpods && { 'autoscaling.knative.dev/minScale': `${minpods}` }),
...(maxpods && { 'autoscaling.knative.dev/maxScale': `${maxpods}` }),
...(minpods && { 'autoscaling.knative.dev/min-scale': `${minpods}` }),
...(maxpods && { 'autoscaling.knative.dev/max-scale': `${maxpods}` }),
...(autoscalewindow && {
'autoscaling.knative.dev/window': `${autoscalewindow}${autoscalewindowUnit}`,
}),
...(concurrencyutilization && {
'autoscaling.knative.dev/targetUtilizationPercentage': `${concurrencyutilization}`,
'autoscaling.knative.dev/target-utilization-percentage': `${concurrencyutilization}`,
}),
},
},
Expand Down

0 comments on commit 13aeba4

Please sign in to comment.