-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Move validation of autoscaling.knative.dev/metric to RevisionTemplateSpec #5412
Move validation of autoscaling.knative.dev/metric to RevisionTemplateSpec #5412
Conversation
…to RevisionTemplateSpec
"knative.dev/serving/pkg/apis/serving" | ||
) | ||
|
||
func (pa *PodAutoscaler) Validate(ctx context.Context) *apis.FieldError { | ||
errs := serving.ValidateObjectMetadata(pa.GetObjectMeta()).ViaField("metadata") | ||
errs = errs.Also(pa.validateMetric()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we might still want to keep this around, for backward compatibility for existing services that have already been created before this and had invalid metric annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing services means?
Even if service created that service won't be created successfully
// Leave other classes of PodAutoscaler alone. | ||
return nil | ||
} | ||
return apis.ErrInvalidValue(metric, MetricAnnotationKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this is unreachable now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No its not unreachable
When MetricAnnotationKey
is invalid for class HPA and KPA it will execute that line
The following is the coverage report on pkg/.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: savitaashture, vagababov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
Proposed Changes
autoscaling.knative.dev/metric
annotation validation from PodAutoscaler to RevisionTemplateSpecActual:
Create service with Invalid value of
autoscaling.knative.dev/metric
annotation gives error message in the revision statusExpected:
service create/update should fail with invalid
autoscaling.knative.dev/metric
annotation