Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions hack/deploy/searchlight.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,5 @@ for crd in "${crds[@]}"; do
$ONESSL wait-until-ready crd ${crd}.monitoring.appscode.com || { echo "$crd crd failed to be ready"; exit 1; }
done

echo "creating built-in plugins"
${SCRIPT_LOCATION}hack/deploy/plugins.yaml| kubectl apply -f -

echo
echo "Successfully installed Searchlight in $SEARCHLIGHT_NAMESPACE namespace!"
5 changes: 5 additions & 0 deletions pkg/operator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ func (op *Operator) Run(stopCh <-chan struct{}) error {
op.gcIncidents()
go op.RunWatchers(stopCh)

// Create build-in SearchlighPlugin
if err := op.createBuiltinSearchlightPlugin(); err != nil {
return err
}

m := pat.New()
m.Get("/metrics", promhttp.Handler())
http.Handle("/", m)
Expand Down
30 changes: 30 additions & 0 deletions pkg/operator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,33 @@ func (op *Operator) executeCommand(pod *core.Pod, podExecOptions *core.PodExecOp

return execOut.String(), nil
}

func (op *Operator) createBuiltinSearchlightPlugin() error {
plugins := []*api.SearchlightPlugin{
plugin.GetComponentStatusPlugin(),
plugin.GetJsonPathPlugin(),
plugin.GetNodeExistsPlugin(),
plugin.GetPodExistsPlugin(),
plugin.GetEventPlugin(),
plugin.GetCACertPlugin(),
plugin.GetCertPlugin(),
plugin.GetNodeStatusPlugin(),
plugin.GetNodeVolumePlugin(),
plugin.GetPodStatusPlugin(),
plugin.GetPodVolumePlugin(),
plugin.GetPodExecPlugin(),
}

var errs []error
for _, p := range plugins {
_, _, err := util.CreateOrPatchSearchlightPlugin(op.extClient.MonitoringV1alpha1(), p.ObjectMeta, func(sp *api.SearchlightPlugin) *api.SearchlightPlugin {
sp.Spec = p.Spec
return sp
})
if err != nil {
errs = append(errs, err)
}
}

return utilerrors.NewAggregate(errs)
}