Skip to content

Commit

Permalink
Filter annotation for ksvc
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce-Huang <[email protected]>
  • Loading branch information
Bryce-huang committed Sep 19, 2023
1 parent 8970586 commit 88b59b5
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion pkg/core/serving/knative/servingrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,26 @@ func (r *servingRun) createService(s *openfunction.Serving, cm map[string]string
containerConcurrency = &c
}
}
ksvcAnnotations := make(map[string]string)
for key, value := range s.Spec.Annotations {
if !strings.HasPrefix(key, "autoscaling.knative.dev") {
ksvcAnnotations[key] = value
}
if strings.HasPrefix(key, "features.knative.dev") {
delete(annotations, key)
}
if strings.HasPrefix(key, "queue.sidecar.serving.knative.dev") {
delete(annotations, key)
}
if strings.HasPrefix(key, "networking.knative.dev") {
delete(annotations, key)
}
if strings.HasPrefix(key, "serving.knative.dev") {
delete(annotations, key)
}

}

service := kservingv1.Service{
TypeMeta: metav1.TypeMeta{
APIVersion: "serving.knative.dev/v1",
Expand All @@ -365,7 +385,7 @@ func (r *servingRun) createService(s *openfunction.Serving, cm map[string]string
Labels: map[string]string{
common.ServingLabel: s.Name,
},
Annotations: s.Spec.Annotations,
Annotations: ksvcAnnotations,
},
Spec: kservingv1.ServiceSpec{
ConfigurationSpec: kservingv1.ConfigurationSpec{
Expand Down

0 comments on commit 88b59b5

Please sign in to comment.