apiserver-builder

module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: Apache-2.0

README

README

Example usage:

  1. define a custom apiserver name if you dont want to use the default one
  2. identify your openapi defintions you generated
  3. Add your resources with the respective storage provider
if err := builder.APIServer.
    WithServerName("your-custom-apiserver").
    WithOpenAPIDefinitions("Config", "v1alpha1", <generated openapi-definition>).
    WithResourceAndHandler(<api-resource>, <storageprovider>).
    WithoutEtcd().
    Execute(ctx); err != nil {
    log.Info("cannot start customer-apiserver")
}

e.g.

if err := builder.APIServer.
    WithServerName("config-server").
    WithOpenAPIDefinitions("Config", "v1alpha1", configopenapi.GetOpenAPIDefinitions).
    WithResourceAndHandler(&config.Config{}, configStorageProvider).
    WithResourceAndHandler(&configv1alpha1.Config{}, configStorageProvider).
    WithResourceAndHandler(&config.ConfigSet{}, configSetStorageProvider).
    WithResourceAndHandler(&configv1alpha1.ConfigSet{}, configSetStorageProvider).
    WithResourceAndHandler(&config.UnManagedConfig{}, unmanagedConfigStorageProvider).
    WithResourceAndHandler(&configv1alpha1.UnManagedConfig{}, unmanagedConfigStorageProvider).
    WithResourceAndHandler(&config.RunningConfig{}, runningConfigStorageProvider).
    WithResourceAndHandler(&configv1alpha1.RunningConfig{}, runningConfigStorageProvider).
    WithoutEtcd().
    Execute(ctx); err != nil {
    log.Info("cannot start config-server")
}

Directories

Path Synopsis
pkg
builder/resource/resourcerest
Package resourcerest defines interfaces for resource REST implementations.
Package resourcerest defines interfaces for resource REST implementations.
builder/resource/resourcestrategy
Package resourcestrategy defines interfaces for customizing how resources are converted and stored.
Package resourcestrategy defines interfaces for customizing how resources are converted and stored.
util/context
Package context is a set of utilities for managing contexts.
Package context is a set of utilities for managing contexts.
util/loopback
Package loopback is a set of utilities for apiserver loopback connections.
Package loopback is a set of utilities for apiserver loopback connections.

Jump to

Keyboard shortcuts

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