Skip to content

Commit

Permalink
chore: remove CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Sep 10, 2024
1 parent b4bdf6d commit 204ae9b
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 287 deletions.
51 changes: 0 additions & 51 deletions api/v1/notification_silence.go

This file was deleted.

127 changes: 0 additions & 127 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ func launchKopper(ctx context.Context) {
logger.Fatalf("Unable to create controller for Playbook: %v", err)
}

if err = kopper.SetupReconciler(ctx, mgr,
db.PersistNotificationSilenceFromCRD,
db.DeleteNotificationSilence,
"notificationsilence.mission-control.flanksource.com",
); err != nil {
logger.Fatalf("Unable to create controller for Notification silence: %v", err)
}

if err = kopper.SetupReconciler(ctx, mgr,
db.PersistNotificationFromCRD,
db.DeleteNotification,
Expand Down

This file was deleted.

29 changes: 0 additions & 29 deletions db/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,8 @@ import (
"github.com/flanksource/incident-commander/api"
v1 "github.com/flanksource/incident-commander/api/v1"
"github.com/google/uuid"
"gorm.io/gorm"
)

func PersistNotificationSilenceFromCRD(ctx context.Context, obj *v1.NotificationSilence) error {
uid, err := uuid.Parse(string(obj.GetUID()))
if err != nil {
return err
}

dbObj := models.NotificationSilence{
ID: uid,
Namespace: obj.Namespace,
From: obj.Spec.From.Time,
Until: obj.Spec.Until.Time,
Source: models.SourceCRD,
Recursive: obj.Spec.Recursive,
NotificationSilenceResource: models.NotificationSilenceResource{
ConfigID: obj.Spec.ConfigID,
ComponentID: obj.Spec.ComponentID,
CheckID: obj.Spec.CheckID,
CanaryID: obj.Spec.CanaryID,
},
}

return ctx.DB().Save(&dbObj).Error
}

func DeleteNotificationSilence(ctx context.Context, id string) error {
return ctx.DB().Model(&models.NotificationSilence{}).Where("id = ?", id).UpdateColumn("deleted_at", gorm.Expr("NOW()")).Error
}

func PersistNotificationFromCRD(ctx context.Context, obj *v1.Notification) error {
uid, err := uuid.Parse(string(obj.GetUID()))
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/containrrr/shoutrrr v0.8.0
github.com/fergusstrange/embedded-postgres v1.25.0 // indirect
github.com/flanksource/commons v1.29.10
github.com/flanksource/duty v1.0.631
github.com/flanksource/duty v1.0.633
github.com/flanksource/gomplate/v3 v3.24.30
github.com/flanksource/kopper v1.0.9
github.com/gomarkdown/markdown v0.0.0-20240419095408-642f0ee99ae2
Expand Down Expand Up @@ -44,6 +44,7 @@ require (
require (
github.com/MicahParks/keyfunc/v2 v2.1.0
github.com/RussellLuo/slidingwindow v0.0.0-20200528002341-535bb99d338b
github.com/WinterYukky/gorm-extra-clause-plugin v0.2.0
github.com/aws/aws-sdk-go-v2 v1.30.4
github.com/aws/aws-sdk-go-v2/config v1.27.29
github.com/aws/aws-sdk-go-v2/credentials v1.17.29
Expand Down Expand Up @@ -88,7 +89,6 @@ require (
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/RaveNoX/go-jsonmerge v1.0.0 // indirect
github.com/Snawoot/go-http-digest-auth-client v1.1.3 // indirect
github.com/WinterYukky/gorm-extra-clause-plugin v0.2.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
Expand Down Expand Up @@ -359,6 +359,6 @@ require (

// replace github.com/flanksource/commons => /Users/moshe/go/src/github.com/flanksource/commons

replace github.com/flanksource/duty => ../duty
// replace github.com/flanksource/duty => ../duty

// replace github.com/flanksource/gomplate/v3 => /Users/moshe/go/src/github.com/flanksource/gomplate
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,8 @@ github.com/flanksource/artifacts v1.0.14 h1:Vv70bccsae0MwGaf/uSPp34J5V1/PyKfct9z
github.com/flanksource/artifacts v1.0.14/go.mod h1:qHVCnQu5k50aWNJ5UhpcAKEl7pAzqUrFFKGSm147G70=
github.com/flanksource/commons v1.29.10 h1:T/S95Pl8kASEFvQjQ7fJjTUqeVdhxQXg1vfkULTYFJQ=
github.com/flanksource/commons v1.29.10/go.mod h1:iTbrXOSp3Spv570Nly97D/U9cQjLZoVlmWCXqWzsvRU=
github.com/flanksource/duty v1.0.633 h1:bCReCvc6H7BV5Nr3gnhzOUhoD9FcF6fJyjRYctb3s8I=
github.com/flanksource/duty v1.0.633/go.mod h1:Oj9zIX94CR2U+nmnt97gNLMrsBWILyIhIBeJynIIgqE=
github.com/flanksource/gomplate/v3 v3.20.4/go.mod h1:27BNWhzzSjDed1z8YShO6W+z6G9oZXuxfNFGd/iGSdc=
github.com/flanksource/gomplate/v3 v3.24.30 h1:6Y25KnAMX4iCuEXe1C8d1kB2PdV+zD1ZulZrv6DV14Q=
github.com/flanksource/gomplate/v3 v3.24.30/go.mod h1:/lAM7+fkcCCfghCAjzdCqwgWxN5Ow8Sk6nkdFPjejCE=
Expand Down

0 comments on commit 204ae9b

Please sign in to comment.