generators

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BundleAdditionalResourcesGenerator

func BundleAdditionalResourcesGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

BundleAdditionalResourcesGenerator generates resources for the additional resources included in the bundle. If the bundle resource is namespace scoped, its namespace will be set to the value of opts.InstallNamespace.

func BundleCRDGenerator

func BundleCRDGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

BundleCRDGenerator generates CustomResourceDefinition resources from the registry+v1 bundle. If the CRD is referenced by any conversion webhook defined in the bundle's cluster service version spec, the CRD is modified by the CertificateProvider in opts to add any annotations or modifications necessary for certificate injection.

func BundleCSVClusterPermissionsGenerator

func BundleCSVClusterPermissionsGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

BundleCSVClusterPermissionsGenerator generates ClusterRoles and ClusterRoleBindings based on the bundle's cluster service version clusterPermission spec. If the bundle is being installed in AllNamespaces mode (opts.TargetNamespaces = [”]), the CSV's permission spec will be promoted to ClusterRole and ClusterRoleBinding resources. To keep parity with OLMv0, these will also include an extra rule to get, list, watch namespaces (see https://github.com/operator-framework/operator-lifecycle-manager/blob/dfd0b2bea85038d3c0d65348bc812d297f16b8d2/pkg/controller/operators/olm/operatorgroup.go#L539)

func BundleCSVDeploymentGenerator

func BundleCSVDeploymentGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

BundleCSVDeploymentGenerator generates all deployments defined in rv1's cluster service version (CSV). The generated resource aim to have parity with OLMv0 generated Deployment resources: - olm.targetNamespaces annotation is set with the opts.TargetNamespace value - the deployment spec's revision history limit is set to 1 - merges csv annotations to the deployment template's annotations

func BundleCSVPermissionsGenerator

func BundleCSVPermissionsGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

BundleCSVPermissionsGenerator generates the Roles and RoleBindings based on bundle's cluster service version permission spec. If the bundle is being installed in AllNamespaces mode (opts.TargetNamespaces = [”]) no resources will be generated as these permissions will be promoted to ClusterRole/Bunding(s)

func BundleCSVServiceAccountGenerator

func BundleCSVServiceAccountGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

BundleCSVServiceAccountGenerator generates ServiceAccount resources based on the bundle's cluster service version permission and clusterPermission spec. One ServiceAccount resource is created / referenced service account (i.e. if multiple permissions reference the same service account, only one resource will be generated). If a clusterPermission, or permission, references an empty (”) service account, this is considered to be the namespace 'default' service account. A resource for the namespace 'default' service account is not generated.

func BundleMutatingWebhookResourceGenerator

func BundleMutatingWebhookResourceGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

BundleMutatingWebhookResourceGenerator generates MutatingAdmissionWebhookConfiguration resources based on the bundle's cluster service version spec. The resource is modified by the CertificateProvider in opts to add any annotations or modifications necessary for certificate injection.

func BundleValidatingWebhookResourceGenerator

func BundleValidatingWebhookResourceGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

BundleValidatingWebhookResourceGenerator generates ValidatingAdmissionWebhookConfiguration resources based on the bundle's cluster service version spec. The resource is modified by the CertificateProvider in opts to add any annotations or modifications necessary for certificate injection.

func BundleWebhookServiceResourceGenerator

func BundleWebhookServiceResourceGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

BundleWebhookServiceResourceGenerator generates Service resources based that support the webhooks defined in the bundle's cluster service version spec. The resource is modified by the CertificateProvider in opts to add any annotations or modifications necessary for certificate injection.

func CertProviderResourceGenerator

func CertProviderResourceGenerator(rv1 *bundle.RegistryV1, opts render.Options) ([]client.Object, error)

CertProviderResourceGenerator generates any resources necessary for the CertificateProvider in opts to function correctly, e.g. Issuer or Certificate resources.

func CreateClusterRoleBindingResource

func CreateClusterRoleBindingResource(name string, opts ...ResourceCreatorOption) *rbacv1.ClusterRoleBinding

CreateClusterRoleBindingResource creates a ClusterRoleBinding resource with name 'name' and applying any ClusterRoleBinding related options in opts

func CreateClusterRoleResource

func CreateClusterRoleResource(name string, opts ...ResourceCreatorOption) *rbacv1.ClusterRole

CreateClusterRoleResource creates a ClusterRole resource with name 'name' and applying any ClusterRole related options in opts

func CreateDeploymentResource

func CreateDeploymentResource(name string, namespace string, opts ...ResourceCreatorOption) *appsv1.Deployment

CreateDeploymentResource creates a Deployment resource with name 'name', namespace 'namespace', and applying any Deployment related options in opts

func CreateMutatingWebhookConfigurationResource

func CreateMutatingWebhookConfigurationResource(name string, namespace string, opts ...ResourceCreatorOption) *admissionregistrationv1.MutatingWebhookConfiguration

CreateMutatingWebhookConfigurationResource creates a MutatingWebhookConfiguration resource with name 'name', namespace 'namespace', and applying any MutatingWebhookConfiguration related options in opts

func CreateRoleBindingResource

func CreateRoleBindingResource(name string, namespace string, opts ...ResourceCreatorOption) *rbacv1.RoleBinding

CreateRoleBindingResource creates a RoleBinding resource with name 'name', namespace 'namespace', and applying any RoleBinding related options in opts

func CreateRoleResource

func CreateRoleResource(name string, namespace string, opts ...ResourceCreatorOption) *rbacv1.Role

CreateRoleResource creates a Role resource with name 'name' and namespace 'namespace' and applying any Role related options in opts

func CreateServiceAccountResource

func CreateServiceAccountResource(name string, namespace string, opts ...ResourceCreatorOption) *corev1.ServiceAccount

CreateServiceAccountResource creates a ServiceAccount resource with name 'name', namespace 'namespace', and applying any ServiceAccount related options in opts

func CreateServiceResource

func CreateServiceResource(name string, namespace string, opts ...ResourceCreatorOption) *corev1.Service

CreateServiceResource creates a Service resource with name 'name', namespace 'namespace', and applying any Service related options in opts

func CreateValidatingWebhookConfigurationResource

func CreateValidatingWebhookConfigurationResource(name string, namespace string, opts ...ResourceCreatorOption) *admissionregistrationv1.ValidatingWebhookConfiguration

CreateValidatingWebhookConfigurationResource creates a ValidatingWebhookConfiguration resource with name 'name', namespace 'namespace', and applying any ValidatingWebhookConfiguration related options in opts

func WithDeploymentSpec

func WithDeploymentSpec(depSpec appsv1.DeploymentSpec) func(client.Object)

WithDeploymentSpec applies a DeploymentSpec to Deployment resources

func WithLabels

func WithLabels(labels map[string]string) func(client.Object)

WithLabels applies labels to the metadata of any resource

func WithMutatingWebhooks

func WithMutatingWebhooks(webhooks ...admissionregistrationv1.MutatingWebhook) func(client.Object)

WithMutatingWebhooks applies mutating webhooks to a MutatingWebhookConfiguration resource

func WithRoleRef

func WithRoleRef(roleRef rbacv1.RoleRef) func(client.Object)

WithRoleRef applies rbac RoleRef to ClusterRoleBinding and RoleBinding resources

func WithRules

func WithRules(rules ...rbacv1.PolicyRule) func(client.Object)

WithRules applies rbac PolicyRules to Role and ClusterRole resources

func WithServiceSpec

func WithServiceSpec(serviceSpec corev1.ServiceSpec) func(client.Object)

WithServiceSpec applies a service spec to a Service resource

func WithSubjects

func WithSubjects(subjects ...rbacv1.Subject) func(client.Object)

WithSubjects applies rbac subjects to ClusterRoleBinding and RoleBinding resources

func WithValidatingWebhooks

func WithValidatingWebhooks(webhooks ...admissionregistrationv1.ValidatingWebhook) func(client.Object)

WithValidatingWebhooks applies validating webhooks to a ValidatingWebhookConfiguration resource

Types

type ResourceCreatorOption

type ResourceCreatorOption = func(client.Object)

type ResourceCreatorOptions

type ResourceCreatorOptions []ResourceCreatorOption

func (ResourceCreatorOptions) ApplyTo

Jump to

Keyboard shortcuts

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