Skip to content

Commit a8659fe

Browse files
authored
Add ValidatingAdmissionWebhook for Stash CRDs (#299)
* Add ValidatingAdmissionWebhook for Stash CRDs ref: https://github.com/openshift/kubernetes-namespace-reservation * Add admission installer * Update docs
1 parent c3e177c commit a8659fe

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

root.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@ package cmds
33
import (
44
"flag"
55
"log"
6+
"os"
67
"strings"
78

89
"github.com/appscode/go/log/golog"
910
v "github.com/appscode/go/version"
1011
"github.com/appscode/kutil/tools/analytics"
1112
"github.com/appscode/stash/client/scheme"
13+
"github.com/appscode/stash/pkg/admission/plugin/recovery"
14+
"github.com/appscode/stash/pkg/admission/plugin/restic"
1215
"github.com/appscode/stash/pkg/util"
1316
"github.com/jpillora/go-ogle-analytics"
17+
"github.com/openshift/generic-admission-server/pkg/cmd/server"
1418
"github.com/spf13/cobra"
1519
"github.com/spf13/pflag"
20+
genericapiserver "k8s.io/apiserver/pkg/server"
1621
clientsetscheme "k8s.io/client-go/kubernetes/scheme"
1722
)
1823

@@ -52,5 +57,11 @@ func NewRootCmd() *cobra.Command {
5257
rootCmd.AddCommand(NewCmdBackup())
5358
rootCmd.AddCommand(NewCmdRecover())
5459
rootCmd.AddCommand(NewCmdCheck())
60+
61+
stopCh := genericapiserver.SetupSignalHandler()
62+
cmd := server.NewCommandStartAdmissionServer(os.Stdout, os.Stderr, stopCh, &restic.AdmissionHook{}, &recovery.AdmissionHook{})
63+
cmd.Use = "admission-webhook"
64+
rootCmd.AddCommand(cmd)
65+
5566
return rootCmd
5667
}

0 commit comments

Comments
 (0)