Skip to content

Commit

Permalink
+++
Browse files Browse the repository at this point in the history
  • Loading branch information
yalosev committed Sep 18, 2024
1 parent 77117e5 commit a7af73a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 71 deletions.
4 changes: 2 additions & 2 deletions pkg/hook/binding_context/binding_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
log "github.com/sirupsen/logrus"
v1 "k8s.io/api/admission/v1"
v12 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apixv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"

. "github.com/flant/shell-operator/pkg/hook/types"
. "github.com/flant/shell-operator/pkg/kube_events_manager/types"
Expand All @@ -29,7 +29,7 @@ type BindingContext struct {
Objects []ObjectAndFilterResult
Snapshots map[string][]ObjectAndFilterResult
AdmissionReview *v1.AdmissionReview
ConversionReview *v12.ConversionReview
ConversionReview *apixv1.ConversionReview
FromVersion string
ToVersion string
}
Expand Down
10 changes: 0 additions & 10 deletions pkg/hook/controller/conversion_bindings_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ type ConversionBindingToWebhookLink struct {
Group string
}

//// ScheduleBindingsController handles schedule bindings for one hook.
// type ConversionBindingsController interface {
// WithBindings([]ConversionConfig)
// WithWebhookManager(manager *conversion.WebhookManager)
// EnableConversionBindings()
// DisableConversionBindings()
// CanHandleEvent(event conversion.Event, rule conversion.Rule) bool
// HandleEvent(event conversion.Event, rule conversion.Rule) BindingExecutionInfo
//}

// ConversionBindingsController holds validating bindings from one hook.
type ConversionBindingsController struct {
// crdName -> conversionRule id -> link
Expand Down
37 changes: 0 additions & 37 deletions pkg/hook/controller/hook_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,43 +35,6 @@ type BindingExecutionInfo struct {
// методом KubernetesSnapshots можно достать все кубовые объекты, чтобы добавить
// их в какой-то свой binding context

// type HookController interface {
// InitKubernetesBindings([]OnKubernetesEventConfig, kube_events_manager.KubeEventsManager)
// InitScheduleBindings([]ScheduleConfig, schedule_manager.ScheduleManager)
// InitAdmissionBindings([]ValidatingConfig, []MutatingConfig, *admission.WebhookManager)
// InitConversionBindings([]ConversionConfig, *conversion.WebhookManager)
//
// CanHandleKubeEvent(kubeEvent KubeEvent) bool
// CanHandleScheduleEvent(crontab string) bool
// CanHandleAdmissionEvent(event AdmissionEvent) bool
// CanHandleConversionEvent(event conversion.Event, rule conversion.Rule) bool
//
// // These method should call an underlying *Binding*Controller to get binding context
// // and then add Snapshots to binding context
// HandleEnableKubernetesBindings(createTasksFn func(BindingExecutionInfo)) error
// HandleKubeEvent(event KubeEvent, createTasksFn func(BindingExecutionInfo))
// HandleScheduleEvent(crontab string, createTasksFn func(BindingExecutionInfo))
// HandleAdmissionEvent(event AdmissionEvent, createTasksFn func(BindingExecutionInfo))
// HandleConversionEvent(event conversion.Event, rule conversion.Rule, createTasksFn func(BindingExecutionInfo))
//
// UnlockKubernetesEvents()
// UnlockKubernetesEventsFor(monitorID string)
// StopMonitors()
// UpdateMonitor(monitorId string, kind, apiVersion string) error
//
// EnableScheduleBindings()
// DisableScheduleBindings()
//
// EnableAdmissionBindings()
//
// EnableConversionBindings()
//
// KubernetesSnapshots() map[string][]ObjectAndFilterResult
// UpdateSnapshots([]BindingContext) []BindingContext
// SnapshotsInfo() []string
// SnapshotsDump() map[string]interface{}
//}

func NewHookController() *HookController {
return &HookController{}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/shell-operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func (op *ShellOperator) conversionEventHandler(crdName string, request *v1.Conv
logEntry := log.WithFields(utils.LabelsToLogFields(logLabels))

sourceVersions := conversion.ExtractAPIVersions(request.Objects)
logEntry.Infof("Handle '%s' event for crd/%s: %d objects with version %v", string(KubernetesConversion), crdName, len(request.Objects), sourceVersions)
logEntry.Infof("Handle '%s' event for crd/%s: %d objects with versions %v", string(KubernetesConversion), crdName, len(request.Objects), sourceVersions)

done := false
for _, srcVer := range sourceVersions {
Expand Down
21 changes: 0 additions & 21 deletions pkg/webhook/conversion/event.go

This file was deleted.

0 comments on commit a7af73a

Please sign in to comment.