resource

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControllerDir     = "controller"
	WebhookDir        = "webhook"
	NamespaceDir      = "namespace"
	RBACDir           = "rbac"
	ControllerSuffix  = "controller"
	PodSuffix         = "pod"
	NamespaceSuffix   = "namespace"
	BindingSuffix     = "binding"
	RoleSuffix        = "role"
	RoleBindingSuffix = "role-binding"
	WebhookSuffix     = "webhook"
	ServiceSuffix     = "svc"
	CertSuffix        = "serving-cert"
	CertPathSuffix    = "serving-certs"
	CertInjectionKey  = "cert-manager.io/inject-ca-from"
)
View Source
const (
	MutatingWebhookConfigurationKind   = "MutatingWebhookConfiguration"
	ValidatingWebhookConfigurationKind = "ValidatingWebhookConfiguration"
)
View Source
const (
	ClusterRoleBindingKind = "ClusterRoleBinding"
)
View Source
const (
	ClusterRoleKind = "ClusterRole"
)
View Source
const (
	DeploymentKind = "Deployment"
)
View Source
const (
	NamespaceKind = "Namespace"
)
View Source
const (
	RoleBindingKind = "RoleBinding"
)
View Source
const (
	RoleKind = "Role"
)
View Source
const (
	ServiceAccountKind = "ServiceAccount"
)
View Source
const (
	ServiceKind = "Service"
)
View Source
const (
	StatefullSetKind = "StatefulSet"
)

Variables

This section is empty.

Functions

func GetMutatingWebhookName

func GetMutatingWebhookName(crdSingular, crdGroup string) string

func GetValidatingWebhookName

func GetValidatingWebhookName(crdSingular, crdGroup string) string

Types

type Resource

type Resource struct {
	//Prefix    string
	Kind             string
	ResourceNameKind ResourceNameKind // used to define the name of the
	//PathNameKind NameKind // used to define the name of the path in the package
	PackageName string // name of the package/provider name
	PodName     string // name of the deployment/statefulset
	Name        string // name of the resource
	Namespace   string
	TargetDir   string
	SubDir      string
}

func (*Resource) BuildVolume added in v0.0.4

func (rn *Resource) BuildVolume(certificate bool) corev1.Volume

func (*Resource) BuildVolumeMount added in v0.0.4

func (rn *Resource) BuildVolumeMount(certificate bool) corev1.VolumeMount

func (*Resource) GetCertificateAnnotation

func (rn *Resource) GetCertificateAnnotation() map[string]string

func (*Resource) GetCertificateName

func (rn *Resource) GetCertificateName() string

func (*Resource) GetDnsName

func (rn *Resource) GetDnsName(x ...string) string

func (*Resource) GetFileName

func (rn *Resource) GetFileName(kind string, suffixes ...string) string

func (*Resource) GetK8sLabels added in v0.0.9

func (rn *Resource) GetK8sLabels() map[string]string

func (*Resource) GetLabelKey

func (rn *Resource) GetLabelKey() string

func (*Resource) GetMutatingWebhookName

func (rn *Resource) GetMutatingWebhookName() string

func (*Resource) GetNameSpace

func (rn *Resource) GetNameSpace() string

func (*Resource) GetPackagePodName added in v0.0.4

func (rn *Resource) GetPackagePodName() string

func (*Resource) GetRelativeFilePath added in v0.0.4

func (rn *Resource) GetRelativeFilePath(kind string, suffixes ...string) string

func (*Resource) GetResourceName

func (rn *Resource) GetResourceName() string

func (*Resource) GetRoleBindingName

func (rn *Resource) GetRoleBindingName() string

func (*Resource) GetRoleName

func (rn *Resource) GetRoleName() string

func (*Resource) GetServiceAccountName added in v0.0.4

func (rn *Resource) GetServiceAccountName() string
func (rn *Resource) GetFilePath(kind string, suffixes ...string) string {
	//fmt.Println("GetFilePath", rn.Kind, kptgenv1alpha1.FnConfigKind, rn.PackageName, rn.PodName, rn.Name)
	if rn.Kind == kptgenv1alpha1.FnConfigKind {
		return filepath.Join(rn.TargetDir, rn.PodName, rn.SubDir, strcase.KebabCase(rn.GetFileName(kind, suffixes...))+".yaml")
	}
	return filepath.Join(rn.TargetDir, rn.SubDir, strcase.KebabCase(rn.GetFileName(kind, suffixes...))+".yaml")
}

func (*Resource) GetServiceName

func (rn *Resource) GetServiceName() string

func (*Resource) GetValidatingWebhookName

func (rn *Resource) GetValidatingWebhookName() string

func (*Resource) RenderCertificate

func (rn *Resource) RenderCertificate(cfg, obj interface{}) (*yaml.RNode, error)

func (*Resource) RenderClusterRole

func (rn *Resource) RenderClusterRole(rules []rbacv1.PolicyRule, obj interface{}, roleName string) (*yaml.RNode, error)

func (*Resource) RenderClusterRoleBinding

func (rn *Resource) RenderClusterRoleBinding() (*yaml.RNode, error)

func (*Resource) RenderDeployment

func (rn *Resource) RenderDeployment(fc *kptgenv1alpha1.PodSpec) (*yaml.RNode, error)

func (*Resource) RenderMutatingWebhook

func (rn *Resource) RenderMutatingWebhook(cfg, obj interface{}) (*yaml.RNode, error)

crdObjects fn.KubeObjects

func (*Resource) RenderNamespace added in v0.0.4

func (rn *Resource) RenderNamespace() (*yaml.RNode, error)

func (*Resource) RenderProviderStatefulSet

func (rn *Resource) RenderProviderStatefulSet(fc *kptgenv1alpha1.PodSpec) (*yaml.RNode, error)

func (*Resource) RenderRole

func (rn *Resource) RenderRole(rules []rbacv1.PolicyRule, obj interface{}, roleName string) (*yaml.RNode, error)

func (*Resource) RenderRoleBinding

func (rn *Resource) RenderRoleBinding() (*yaml.RNode, error)

func (*Resource) RenderService

func (rn *Resource) RenderService(cfg, obj interface{}) (*yaml.RNode, error)

func (*Resource) RenderServiceAccount

func (rn *Resource) RenderServiceAccount(fc *kptgenv1alpha1.PodSpec) (*yaml.RNode, error)

func (*Resource) RenderValidatingWebhook

func (rn *Resource) RenderValidatingWebhook(cfg, obj interface{}) (*yaml.RNode, error)

func (*Resource) UpdateDeployment added in v0.0.4

func (rn *Resource) UpdateDeployment(fnCfgName string, fnCfg kptgenv1alpha1.Config, node *yaml.RNode) (*yaml.RNode, error)

func (*Resource) UpdateStatefulSet added in v0.0.4

func (rn *Resource) UpdateStatefulSet(fnCfgName string, fnCfg kptgenv1alpha1.Config, node *yaml.RNode) (*yaml.RNode, error)

type ResourceNameKind added in v0.0.4

type ResourceNameKind string
const (
	NameKindFull            ResourceNameKind = "packagePodResource"
	NameKindPackageResource ResourceNameKind = "packageResource"
	NameKindPackagePod      ResourceNameKind = "packagePod"
	NameKindResource        ResourceNameKind = "resource"
	NameKindKindResource    ResourceNameKind = "kindResource"
	NameKindKind            ResourceNameKind = "kind"
)

Jump to

Keyboard shortcuts

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