Skip to content

Commit

Permalink
[TEP-0137] Rename customrun package to notifications
Browse files Browse the repository at this point in the history
The pkg/reconciler/customrun package contains a controller that
today sends cloudevents for CustomRuns. In the context of TEP-0137,
this controller will be repurposed to send events for all resources,
so the current name does not make sense anymore.

Renaming the package to "notifications", because the "events" and
"cloudevents" names are already used elsewhere and we don't want
a mass API rename for this. We might consolidate the code further
as a follow-up. The new name is also more future-proof, as the
controller may in future handle other kinds of non-cloudevents
type of notifications.

When renaming I realised that the customrun controller was being
started as part of the main controller as well as an independent
one. This PR fixes that bug as well.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
  • Loading branch information
afrittoli committed Jun 28, 2023
1 parent 1caa5e0 commit 8e274a7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

"github.com/tektoncd/pipeline/pkg/apis/pipeline"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"github.com/tektoncd/pipeline/pkg/reconciler/customrun"
"github.com/tektoncd/pipeline/pkg/reconciler/pipelinerun"
"github.com/tektoncd/pipeline/pkg/reconciler/resolutionrequest"
"github.com/tektoncd/pipeline/pkg/reconciler/taskrun"
Expand Down Expand Up @@ -131,7 +130,6 @@ func main() {
taskrun.NewController(opts, clock.RealClock{}, tpTaskrun),
pipelinerun.NewController(opts, clock.RealClock{}, tpPipelineRun),
resolutionrequest.NewController(clock.RealClock{}),
customrun.NewController(),
)

// Cleanly shutdown and flush telemetry when the application exits.
Expand Down
4 changes: 2 additions & 2 deletions cmd/events/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"net/http"
"os"

"github.com/tektoncd/pipeline/pkg/reconciler/customrun"
"github.com/tektoncd/pipeline/pkg/reconciler/notifications"
"knative.dev/pkg/injection/sharedmain"
)

Expand All @@ -47,7 +47,7 @@ func main() {
}()

// start the events controller
sharedmain.Main(eventsControllerName, customrun.NewController())
sharedmain.Main(eventsControllerName, notifications.NewController())
}

func handler(w http.ResponseWriter, r *http.Request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package customrun
package notifications

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package customrun
package notifications

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package customrun_test
package notifications_test

import (
"context"
Expand All @@ -25,8 +25,8 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/tektoncd/pipeline/pkg/apis/config"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
customrun "github.com/tektoncd/pipeline/pkg/reconciler/customrun"
"github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent"
"github.com/tektoncd/pipeline/pkg/reconciler/notifications"
ttesting "github.com/tektoncd/pipeline/pkg/reconciler/testing"
"github.com/tektoncd/pipeline/test"
"github.com/tektoncd/pipeline/test/names"
Expand All @@ -52,7 +52,7 @@ func initializeCustomRunControllerAssets(t *testing.T, d test.Data) (test.Assets
test.EnsureConfigurationConfigMapsExist(&d)
c, informers := test.SeedTestData(t, ctx, d)
configMapWatcher := cminformer.NewInformedWatcher(c.Kube, system.Namespace())
ctl := customrun.NewController()(ctx, configMapWatcher)
ctl := notifications.NewController()(ctx, configMapWatcher)
if err := configMapWatcher.Start(ctx.Done()); err != nil {
t.Fatalf("error starting configmap watcher: %v", err)
}
Expand Down

0 comments on commit 8e274a7

Please sign in to comment.