Skip to content

Commit

Permalink
feat: add more objects to cache
Browse files Browse the repository at this point in the history
Signed-off-by: Leandro Mendes <[email protected]>
  • Loading branch information
theflockers committed Jan 29, 2025
1 parent d3a0f26 commit 8079023
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,19 @@ func main() {
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Cache: cache.Options{
ByObject: map[client.Object]cache.ByObject{
// we want to cache PipelineRuns only created by this operator.
&tektonv1.PipelineRun{}: cache.ByObject{
Label: labels.SelectorFromSet(labels.Set{metadata.ServiceNameLabel: metadata.ServiceName}),
},
// also cache other watched objects, but no filter is required.
&appstudiov1alpha1.Release{}: {},
&appstudiov1alpha1.ReleasePlan{}: {},
&appstudiov1alpha1.ReleasePlanAdmission{}: {},
// objects that the operator does not watch, but are used by it.
&appstudiov1alpha1.ReleaseServiceConfig{}: {},
&applicationapiv1alpha1.Snapshot{}: {},
&applicationapiv1alpha1.Component{}: {},
&applicationapiv1alpha1.Application{}: {},
},
},

Check warning on line 124 in main.go

View check run for this annotation

Codecov / codecov/patch

main.go#L108-L124

Added lines #L108 - L124 were not covered by tests
HealthProbeBindAddress: probeAddr,
Expand Down
4 changes: 2 additions & 2 deletions metadata/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import "fmt"

// Common constants
const (
// rhtapDomain is the prefix of the application label
// RhtapDomain is the prefix of the application label
RhtapDomain = "appstudio.openshift.io"

// MaxLabelLength is the maximum allowed characters in a label value
Expand Down Expand Up @@ -51,7 +51,7 @@ var (
AutomatedLabel = fmt.Sprintf("release.%s/automated", RhtapDomain)

// ServiceNameLabel is the label used to specify the service associated with an object
ServiceNameLabel = fmt.Sprintf("%s/%s", rhtapDomain, "service")
ServiceNameLabel = fmt.Sprintf("%s/%s", RhtapDomain, "service")

// ReleasePlanAdmissionLabel is the ReleasePlan label for the name of the ReleasePlanAdmission to use
ReleasePlanAdmissionLabel = fmt.Sprintf("release.%s/releasePlanAdmission", RhtapDomain)
Expand Down

0 comments on commit 8079023

Please sign in to comment.