[
https://issues.apache.org/jira/browse/FLINK-36109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884612#comment-17884612
]
Mate Czagany commented on FLINK-36109:
--------------------------------------
Seems to me like filtering by any fields except `metadata.name` and
`metadata.namespace` will not work in most Kubernetes releases. We can add more
selectable fields in Kubernetes 1.31 only, and even there it's behind a feature
gate, and currently in beta [1] [2]. So most users won't be able to filter by
any spec or status fields.
What we can do is add the following labels and populate them on the first
reconciliation of a FlinkStateSnapshot resource:
{code:java}
snapshot.type: checkpoint/savepoint
snapshot.trigger-type: upgrade/manual/periodic
snapshot.state: same as status.state
job-reference.kind: FlinkDeployment/FlinkSessionJob
job-reference.name: job name {code}
It feels a bit anti-pattern to duplicate these values to the labels, but there
is no other supported way filtering right now. The KEP linked is still under
development, but I think we should start using `selectableFields` as soon as
it's GA.{{{}{}}}
{{}}
[~gyfora] do you think we should add these labels{{{}{}}}?
[1]
[https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#crd-selectable-fields]
[2]
[https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/4358-custom-resource-field-selectors/README.md]
> Improve FlinkStateSnapshot resource labels for efficient filtering
> ------------------------------------------------------------------
>
> Key: FLINK-36109
> URL: https://issues.apache.org/jira/browse/FLINK-36109
> Project: Flink
> Issue Type: Sub-task
> Components: Kubernetes Operator
> Reporter: Gyula Fora
> Priority: Critical
> Fix For: kubernetes-operator-1.10.0
>
>
> The new FlinkStateSnapshot CRs currently have the following label only:
> ```
> snapshot.type: XY
> ```
> We need to investigate if we can efficiently filter based on snapshot
> resource type (savepoint/checkpoint), target job etc. I am not sure if we can
> do this based on the spec directly or we need labels for it.
> Also we should probably rename the snapshot.type label to trigger.type to be
> more straightforward.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)