names

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package names implements name generator

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NameGenerator

type NameGenerator interface {
	GenerateName(ctx context.Context, cd resource.Object) error
}

A NameGenerator finds a free/available name for a resource with a specified metadata.generateName value. The name is temporary available, but might be taken by the time the resource is created.

func NewNameGenerator

func NewNameGenerator(c client.Client) NameGenerator

NewNameGenerator returns a new NameGenerator.

type NameGeneratorFn

type NameGeneratorFn func(ctx context.Context, cd resource.Object) error

A NameGeneratorFn is a function that satisfies NameGenerator.

func (NameGeneratorFn) GenerateName

func (fn NameGeneratorFn) GenerateName(ctx context.Context, cd resource.Object) error

GenerateName generates a name using the same algorithm as the API server, and verifies temporary name availability. It does not submit the resource to the API server and hence it does not fall over validation errors.

Jump to

Keyboard shortcuts

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