Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions configuration-ignore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@
- group: policy\.linkerd\.io
kind: httproute
version: v1
- description: |
Incorrectly named when imported - this is actually from https://github.com/mysql/mysql-operator - https://github.com/mysql/mysql-operator/blob/d478c51e56b903df410fc9ac37ef13f0e4178c07/helm/mysql-operator/crds/crd.yaml#L8
items:
- group: mysql\.presslabs\.org
kind: mysqlbackup
version: v2
9 changes: 7 additions & 2 deletions configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,12 @@
kind: helm
name: datawire
repository: https://getambassador.io
- kind: git
name: datawire-edge-stack
repository: https://github.com/datawire/edge-stack
searchPaths:
- charts/edge-stack/crds
versionPrefix: chart-v
- kind: git
kustomizationPaths:
- config/crd
Expand Down Expand Up @@ -721,7 +727,7 @@
name: intents-operator
repository: https://github.com/otterize/intents-operator
searchPaths:
- /src/operator/otterizecrds
- src/operator/otterizecrds
versionPrefix: v
- entries:
- base
Expand Down Expand Up @@ -1207,7 +1213,6 @@
repository: https://opensource.zalando.com/postgres-operator/charts/postgres-operator
- entries:
- db-operator
- mysql-operator
- wp-operator
kind: helm
name: presslabs
Expand Down
33 changes: 28 additions & 5 deletions internal/generator/realmClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ func (realm *realmClient) ListOciTags(uri string) ([]string, error) {
}

path := strings.Trim(u.Path, "/")
request := fmt.Sprintf("%s://%s/v2/%s/tags/list", scheme, u.Host, path)
return realm.listOciTags(request, "")
return realm.listOciTags(fmt.Sprintf("%s://%s", scheme, u.Host), fmt.Sprintf("/v2/%s/tags/list", path), "")
}

func (realm *realmClient) listOciTags(request, token string) ([]string, error) {
func (realm *realmClient) listOciTags(host, path, token string) ([]string, error) {
request := fmt.Sprintf("%s%s", host, path)
req, err := http.NewRequest(http.MethodGet, request, nil)
if err != nil {
return nil, err
Expand All @@ -79,7 +79,7 @@ func (realm *realmClient) listOciTags(request, token string) ([]string, error) {
return nil, err
}

return realm.listOciTags(request, *token)
return realm.listOciTags(host, path, *token)
}

bytes, err := realm.read(resp)
Expand All @@ -93,7 +93,12 @@ func (realm *realmClient) listOciTags(request, token string) ([]string, error) {
return nil, err
}

return r.Tags, nil
tags, err := realm.next(resp.Header, host, token)
if err != nil {
return nil, err
}

return append(r.Tags, tags...), nil
}

func (realm *realmClient) fetchToken(req string) (*string, error) {
Expand Down Expand Up @@ -157,3 +162,21 @@ func (*realmClient) parseChallenge(challenge string) (map[string]string, error)

return cfg, nil
}

func (realm *realmClient) next(header http.Header, host, token string) ([]string, error) {
result := make([]string, 0)
links := header.Get("link")

for link := range strings.SplitSeq(links, ",") {
if len(link) == 0 || !strings.Contains(strings.ToLower(link), `; rel="next"`) {
continue
}

req := strings.SplitN(link, ";", 2)[0]
path := strings.Trim(req, "<>")

return realm.listOciTags(host, path, token)
}

return result, nil
}