• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

KusionStack / karpor / 45751559720
66%

Build:
DEFAULT BRANCH: main
Ran 26 Nov 2026 03:53AM UTC
Jobs 1
Files 69
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

26 Nov 2026 03:51AM UTC coverage: 66.276% (+0.2%) from 66.082%
45751559720

push

github

web-flow
fix(syncer): use the discovered Kind instead of trimming the plural name (#871)

## What type of PR is this?

/kind bug

## What this PR does / why we need it:

The syncer derived the Kind of a sync rule by dropping the last letter
of its plural resource name (`resource[0:len(resource)-1]`). That only
works for names that are the Kind plus an `s`. For `ingresses`,
`storageclasses` or `networkpolicies` it produced `ingresse`,
`storageclasse` and `networkpolicie`, and `endpoints` became `endpoint`,
so the Elasticsearch `kind` term used by the purger (and by `genUnObj`
when a resource is deleted from the cluster) matched nothing. Deleted
resources of those types were never purged and kept showing up in
search.

**Fix.** When it creates a syncer, `singleClusterSyncManager` now
resolves the real Kind through API discovery
(`ServerResourcesForGroupVersion`) and hands it to the syncer, which
uses it for the purge query and for `genUnObj`.
`utils.ResourceKind(resource, kind)` returns the discovered Kind and
falls back to the old trimming when discovery cannot resolve it, so
behaviour for `pods`, `services`, etc. is unchanged. `NewESPurger`,
`NewESImporter` and `NewESListerGetter` take the kind as an extra
argument. The `kind` field is a keyword with the `lowercase` normalizer,
so passing `Ingress` matches the stored documents.

**Tests.** `Test_singleClusterSyncManager_resourceKind` (fake discovery
client: `ingresses`, `networkpolicies`, `endpoints`, `pods`, a
subresource entry, and unknown resources/groups), `TestResourceKind`,
and two new `Test_genUnObj` cases (`Ingress`, `Endpoints`). On `main`,
`genUnObj` for `ingresses` yields kind `ingresse`; with the change `go
test ./pkg/syncer/...` passes. The queries were not run against a live
Elasticsearch or cluster.

## Which issue(s) this PR fixes:

None.

This change was prepared with the assistance of an AI coding agent
(Claude).

34 of 36 new or added lines in 6 files covered. (94.44%)

4583 of 6915 relevant lines covered (66.28%)

0.73 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
0.0
0.0% pkg/syncer/utils/purger.go
Jobs
ID Job ID Ran Files Coverage
1 45751559720.1 26 Nov 2026 03:53AM UTC 69
66.28
GitHub Action Run
Source Files on build 45751559720
  • Tree
  • List 69
  • Changed 5
  • Source Changed 0
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 6c022c70 on github
  • Prev Build on main (#42742650943)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc