Skip to content

Commit 269276d

Browse files
Updated knative service to use max-scale, min-scale and target-utilization-percentage annotations
1 parent 67aa4d3 commit 269276d

7 files changed

Lines changed: 25 additions & 19 deletions

File tree

frontend/packages/dev-console/src/components/edit-application/__tests__/edit-application-utils.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ describe('getServerlessData', () => {
181181
template: {
182182
metadata: {
183183
annotations: {
184-
'autoscaling.knative.dev/maxScale': '2',
184+
'autoscaling.knative.dev/max-scale': '2',
185185
'autoscaling.knative.dev/window': '60s',
186186
'autoscaling.knative.dev/target': '100',
187-
'autoscaling.knative.dev/targetUtilizationPercentage': '70',
188-
'autoscaling.knative.dev/minScale': '1',
187+
'autoscaling.knative.dev/target-utilization-percentage': '70',
188+
'autoscaling.knative.dev/min-scale': '1',
189189
},
190190
},
191191
spec: {

frontend/packages/knative-plugin/integration-tests/features/serverless/create-knative-service-from-deployment-or-deployment-config.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Feature: Create Knative service from existing Deployment/Deployment Config workl
7070
And user clicks on save button
7171
And user right clicks on the knative service workoad "nodejs-ex-git1-sev" in Topology page
7272
And user selects option "Edit Service" from context options
73-
Then user is able to see value of "autoscaling.knative.dev/targetUtilizationPercentage" as "4"
73+
Then user is able to see value of "autoscaling.knative.dev/target-utilization-percentage" as "4"
7474

7575

7676
@regression @broken-test
@@ -86,5 +86,5 @@ Feature: Create Knative service from existing Deployment/Deployment Config workl
8686
And user clicks on Create button in Make Serverless form
8787
And user right clicks on the knative service workoad "nodejs-ex-git2-sev" in Topology page
8888
And user selects option "Edit Service" from context options
89-
Then user is able to see the value of "autoscaling.knative.dev/maxScale" and "autoscaling.knative.dev/minScale" as "6" and "3" percent respectively
89+
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
9090
And user is able to see "3" Pods running in Resources tab of sidebar for knative workload "nodejs-ex-git2-sev"

frontend/packages/knative-plugin/integration-tests/features/serverless/create-knative-workload.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Feature: Create a workload of 'knative Service' type resource
108108
And user clicks Create button on Add page
109109
And user clicks on the Knative Service workload "dancer-ex-git"
110110
And user clicks on name KSVC "dancer-ex-git"
111-
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
111+
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
112112

113113

114114
@regression @manual

frontend/packages/knative-plugin/src/const.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export const FLAG_CAMEL_KAMELETS = 'FLAG_CAMEL_KAMELETS';
2222
export const CAMEL_K_PROVIDER_ANNOTATION = `${CAMEL_APIGROUP}/provider`;
2323
export const CAMEL_K_TYPE_LABEL = `${CAMEL_APIGROUP}/kamelet.type`;
2424
export const KNATIVE_AUTOSCALING_APIGROUP = 'autoscaling.knative.dev';
25-
export const KNATIVE_MINSCALE_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/minScale`;
26-
export const KNATIVE_MAXSCALE_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/maxScale`;
25+
export const KNATIVE_MINSCALE_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/min-scale`;
26+
export const KNATIVE_MAXSCALE_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/max-scale`;
2727
export const KNATIVE_CONCURRENCYTARGET_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/target`;
28-
export const KNATIVE_CONCURRENCYUTILIZATION_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/targetUtilizationPercentage`;
28+
export const KNATIVE_CONCURRENCYUTILIZATION_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/target-utilization-percentage`;
2929
export const KNATIVE_AUTOSCALEWINDOW_ANNOTATION = `${KNATIVE_AUTOSCALING_APIGROUP}/window`;
3030
export const SERVERLESS_FUNCTION_LABEL_DEPRECATED = 'boson.dev/function'; // TODO: remove deprecated label for serverless function
3131
export const SERVERLESS_FUNCTION_LABEL = 'function.knative.dev';

frontend/packages/knative-plugin/src/utils/__tests__/create-knative-utils.spec.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Create knative Utils', () => {
2727
8080,
2828
);
2929
});
30-
it('expect to have minSccale, maxScale, target and containerConcurrency defined', () => {
30+
it('expect to have min-scale, max-scale, target and containerConcurrency defined', () => {
3131
defaultData.route.unknownTargetPort = '8080';
3232
const knDeploymentResource: K8sResourceKind = getKnativeServiceDepResource(
3333
defaultData,
@@ -37,22 +37,28 @@ describe('Create knative Utils', () => {
3737
knDeploymentResource.spec.template.metadata.annotations['autoscaling.knative.dev/target'],
3838
).toBe('1');
3939
expect(
40-
knDeploymentResource.spec.template.metadata.annotations['autoscaling.knative.dev/minScale'],
40+
knDeploymentResource.spec.template.metadata.annotations[
41+
'autoscaling.knative.dev/min-scale'
42+
],
4143
).toBe('1');
4244
expect(
43-
knDeploymentResource.spec.template.metadata.annotations['autoscaling.knative.dev/maxScale'],
45+
knDeploymentResource.spec.template.metadata.annotations[
46+
'autoscaling.knative.dev/max-scale'
47+
],
4448
).toBe('5');
4549
expect(knDeploymentResource.spec.template.spec.containerConcurrency).toBe(1);
4650
});
47-
it('expect not to have minScale defined', () => {
51+
it('expect not to have min-scale defined', () => {
4852
defaultData.serverless.scaling.minpods = 0;
4953
defaultData.route.unknownTargetPort = '8080';
5054
const knDeploymentResource: K8sResourceKind = getKnativeServiceDepResource(
5155
defaultData,
5256
'imgStream',
5357
);
5458
expect(
55-
knDeploymentResource.spec.template.metadata.annotations['autoscaling.knative.dev/minScale'],
59+
knDeploymentResource.spec.template.metadata.annotations[
60+
'autoscaling.knative.dev/min-scale'
61+
],
5662
).toBeUndefined();
5763
});
5864

frontend/packages/knative-plugin/src/utils/__tests__/knatify-utils.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ describe('knatify-utils', () => {
2626
metadata: {
2727
...ksvcData.spec.template.metadata,
2828
annotations: {
29-
'autoscaling.knative.dev/minScale': '1',
30-
'autoscaling.knative.dev/maxScale': '3',
29+
'autoscaling.knative.dev/min-scale': '1',
30+
'autoscaling.knative.dev/max-scale': '3',
3131
},
3232
},
3333
},

frontend/packages/knative-plugin/src/utils/create-knative-utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ export const getKnativeServiceDepResource = (
131131
...(concurrencytarget && {
132132
'autoscaling.knative.dev/target': `${concurrencytarget}`,
133133
}),
134-
...(minpods && { 'autoscaling.knative.dev/minScale': `${minpods}` }),
135-
...(maxpods && { 'autoscaling.knative.dev/maxScale': `${maxpods}` }),
134+
...(minpods && { 'autoscaling.knative.dev/min-scale': `${minpods}` }),
135+
...(maxpods && { 'autoscaling.knative.dev/max-scale': `${maxpods}` }),
136136
...(autoscalewindow && {
137137
'autoscaling.knative.dev/window': `${autoscalewindow}${autoscalewindowUnit}`,
138138
}),
139139
...(concurrencyutilization && {
140-
'autoscaling.knative.dev/targetUtilizationPercentage': `${concurrencyutilization}`,
140+
'autoscaling.knative.dev/target-utilization-percentage': `${concurrencyutilization}`,
141141
}),
142142
},
143143
},

0 commit comments

Comments
 (0)