convert

package
v0.0.0-...-83429da Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRole

func BuildRole(ctx context.Context, manifestStr string, opt BuildRoleOptions) ([]runtime.Object, error)

BuildRole parses the manifest and generates Role/ClusterRole objects for manipulating them.

func ResourceFromKind

func ResourceFromKind(kind string) string

ResourceFromKind returns the resource name for the given kind. Because we don't require a cluster, it assumes the kind -> resource mapping follows normal conventions.

func ToYAML

func ToYAML(objects []runtime.Object) ([]byte, error)

ToYAML convert objects to a YAML multidoc string

Types

type BuildRoleOptions

type BuildRoleOptions struct {
	Name               string
	Namespace          string
	ServiceAccountName string
	Supervisory        bool

	// CRD is the name of the CRD to generate permissions for.
	CRD string

	// LimitResourceNames specifies that RBAC permissions should restrict to resource names in the manifest.
	LimitResourceNames bool

	// LimitNamespaces specifies that RBAC permissions should restrict to resource names in the manifest.
	LimitNamespaces bool

	// Format specifies the format we should write in (yaml or kubebuilder)
	Format string
}

type KubebuilderConverter

type KubebuilderConverter struct {
	// Rules holds the generated kubebuilder rules
	Rules []string
}

KubebuilderConverter converts Role/Cluster objects to kubebuilder directives. These can then be copied and pasted into the code.

func (*KubebuilderConverter) VisitObjects

func (c *KubebuilderConverter) VisitObjects(objects []runtime.Object) error

VisitObjects iterates over the provided Role/ClusterRule objects, generating equivalent kubebuilder statements.

Jump to

Keyboard shortcuts

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