feat(console): use securesign Rekor URL instead of the public Rekor instance - #2149
feat(console): use securesign Rekor URL instead of the public Rekor instance#2149fghanmi wants to merge 1 commit into
Conversation
PR Summary by Qodoconsole: configure UI to use SecureSign Rekor URL (replace public default)
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2149 +/- ##
==========================================
- Coverage 57.12% 57.08% -0.05%
==========================================
Files 286 286
Lines 16129 16139 +10
==========================================
- Hits 9214 9213 -1
- Misses 5970 5980 +10
- Partials 945 946 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@fghanmi can you try to rebase pr agains main. It could resolve problems in failing tests |
8d96340 to
a1a513b
Compare
| Ingress Ingress `json:"ingress,omitempty"` | ||
| // Rekor service configuration | ||
| //+optional | ||
| Rekor RekorService `json:"rekor,omitempty"` |
There was a problem hiding this comment.
There is a new v1.ServiceReference object to handle dependencies between services. Can you please use it. @bouskaJ can provide more info/examples.
| apiURL := kubernetes.FindEnvByNameOrCreate(container, "CONSOLE_API_URL") | ||
| apiURL.Value = fmt.Sprintf("%s://%s:%d", scheme, apiHost, actions.ApiPort) | ||
|
|
||
| if instance.Spec.UI.Rekor.URL != "" { |
There was a problem hiding this comment.
Both spec.ui.rekor and spec.api.tuf use ServiceReference which accepts .ref or .url (mutually exclusive). Only .url is read by the controllers — .ref is silently ignored:
internal/controller/console/actions/ui/deployment.go:120— reads.URLonlyinternal/controller/console/actions/api/deployment.go:50— reads.URLonly
A user setting .ref gets no error and no effect. The controller must resolve .ref by looking up the referenced CR's service URL.
There was a problem hiding this comment.
@bouskaJ do you have some existing example/helper function to resolve url from ServiceReference.ref? I expect that there will have to be some logic to wait untill these services has know their ingress url.
There was a problem hiding this comment.
yes, Does the Console supposed to consume public or internal URL? @fghanmi
There was a problem hiding this comment.
Ideally, it should consumes public URL, but in "can" also use internal URL
There was a problem hiding this comment.
which means, could we use similar resolver on both TUF and rekor, just wondering
func init() {
serviceresolver.Register(
func(obj *rhtasv1.Tuf) (string, error) {
return obj.GetServiceURL(), nil
})
}
There was a problem hiding this comment.
I added this commit 11d5d6a
Just an idea. It was tested fine.
There was a problem hiding this comment.
We may use public address - the resolver for public address will be present once #2126 is merged.
There was a problem hiding this comment.
@fghanmi you may rebase and use it like this https://github.com/securesign/secure-sign-operator/blob/main/internal/controller/tuf/utils/service_urls.go#L59
| apiURL.Value = fmt.Sprintf("%s://%s:%d", scheme, apiHost, actions.ApiPort) | ||
|
|
||
| if instance.Spec.UI.Rekor.URL != "" { | ||
| rekorURL := kubernetes.FindEnvByNameOrCreate(container, "NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN") |
There was a problem hiding this comment.
When spec.ui.rekor.url is set, NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN is added to the container. When the URL is later cleared or removed, the if block is skipped and no cleanup runs — the stale env var persists on the existing Deployment.
Example: User sets spec.ui.rekor.url: https://rekor.internal.corp → env var is created. Later they remove the field to switch back to the default public Rekor. The operator skips the if block but the old env var stays, so the UI keeps pointing at rekor.internal.corp — which may no longer exist.
Fix: Add an else branch with kubernetes.RemoveEnvVarByName(container, "NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN") — same pattern used for SSL_CERT_DIR and SIGNER_PASSWORD elsewhere in the codebase.
…nstance Signed-off-by: Firas Ghanmi <fghanmi@redhat.com>
No description provided.