app

package
v4.2.712+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROBE_TYPE_READINESS = "readiness"
	PROBE_TYPE_LIVENESS  = "liveness"
)

Variables

View Source
var (
	ProbeCmd = &cobra.Command{
		Use:   "probe",
		Short: "probe alameda admission-controller server",
		Long:  "",
		RunE: func(cmd *cobra.Command, args []string) error {
			flag.Parse()

			initConfig()
			initLog()

			if !config.Enable {
				os.Exit(0)
			}
			startProbing()
			return nil
		},
	}
)
View Source
var RootCmd = &cobra.Command{
	Use:              "admission-controller",
	Short:            "alameda admission-controller",
	Long:             "",
	TraverseChildren: true,
}
View Source
var (
	RunCmd = &cobra.Command{
		Use:              "run",
		Short:            "start alameda admission-controller server",
		Long:             "",
		TraverseChildren: true,
		RunE: func(cmd *cobra.Command, args []string) error {

			flag.Parse()

			initConfig()
			initLog()
			initThirdPartyClient()

			if !config.Enable {
				scope.Warn("admission-controller is not enabled, os exit with 0")
				os.Exit(0)
			}

			if err := initOwnerReferenceOfControllerOwningAdmissionController(); err != nil {
				panic(err)
			}

			if err := prepareRequirements(); err != nil {
				panic(err)
			}
			if err := setupRequirements(); err != nil {
				panic(err)
			}

			admissionController, err := server.NewAdmissionControllerWithConfig(
				server.Config{
					Enable: config.Enable,
				},
				sigsK8SClient,
				datahubServiceClient,
				getJSONPatchValidationFunction(),
				clusterID)
			if err != nil {
				panic(err.Error())
			}

			mux := http.NewServeMux()
			registerHandlerFunc(mux, admissionController)

			server := newHTTPServer(*config, mux)
			if err := server.ListenAndServeTLS("", ""); err != nil {
				panic(err.Error())
			}

			return nil
		},
	}
)
View Source
var (
	VersionCmd = &cobra.Command{
		Use:   "version",
		Short: "Display the alameda admission-controller version",
		Long:  "",
		Run: func(cmd *cobra.Command, args []string) {
			app.PrintSoftwareVer()
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL