/
exotic_nats.go
43 lines (35 loc) · 1.09 KB
/
exotic_nats.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package installer
import (
"context"
"errors"
"go.uber.org/zap"
"github.com/argoproj/argo-events/pkg/apis/eventbus/v1alpha1"
)
// exoticNATSInstaller is an inalleration implementation of exotic nats config.
type exoticNATSInstaller struct {
eventBus *v1alpha1.EventBus
logger *zap.SugaredLogger
}
// NewExoticNATSInstaller return a new exoticNATSInstaller
func NewExoticNATSInstaller(eventBus *v1alpha1.EventBus, logger *zap.SugaredLogger) Installer {
return &exoticNATSInstaller{
eventBus: eventBus,
logger: logger.Named("exotic-nats"),
}
}
func (i *exoticNATSInstaller) Install(ctx context.Context) (*v1alpha1.BusConfig, error) {
natsObj := i.eventBus.Spec.NATS
if natsObj == nil || natsObj.Exotic == nil {
return nil, errors.New("invalid request")
}
i.eventBus.Status.MarkDeployed("Skipped", "Skip deployment because of using exotic config.")
i.logger.Info("use exotic config")
busConfig := &v1alpha1.BusConfig{
NATS: natsObj.Exotic,
}
return busConfig, nil
}
func (i *exoticNATSInstaller) Uninstall(ctx context.Context) error {
i.logger.Info("nothing to uninstall")
return nil
}