util

package
v0.0.0-...-e9c822e Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrUpdateBinding

func AddOrUpdateBinding(existingBindings []*cloudresourcemanager.Binding, requiredBindings []string, serviceAccount string, memberType IamMemberType) ([]*cloudresourcemanager.Binding, bool)

AddOrUpdateBinding checks if a binding from a map of bindings whose keys are the binding.Role exists in a list and if so it appends any new members to that binding. If the required binding does not exist it creates a new binding for the role it returns a []*cloudresourcemanager.Binding that contains all the previous bindings and the new ones if no new bindings are required it returns false TODO(MJ): add tests

func Contains

func Contains(list []string, strToSearch string) bool

Contains returns true if a list contains a string.

func Filter

func Filter(list []string, strToFilter string) (newList []string)

Filter filters a list for a string.

func GetGCPCredentialsFromSecret

func GetGCPCredentialsFromSecret(kubeClient client.Client, namespace, name string) ([]byte, error)

GetGCPCredentialsFromSecret extracts the gcp credentials from a secret. return value is a bytearray

func GetSecret

func GetSecret(kubeClient client.Client, secretName, namespace string) (*corev1.Secret, error)

GetSecret returns a secret based on a secretName and namespace.

func InArray

func InArray(needle interface{}, haystack interface{}) (exists bool, index int)

InArray checks if a needle exists inside of the haystack

func NewGCPSecretCR

func NewGCPSecretCR(creds string, namespacedNamed kubetypes.NamespacedName) *corev1.Secret

NewGCPSecretCR returns a Secret CR formatted for GCP for use in projectreference controller.

func RemoveOrUpdateBinding

func RemoveOrUpdateBinding(existingBindings []*cloudresourcemanager.Binding, serviceAccountEmail string, memberType IamMemberType) ([]*cloudresourcemanager.Binding, bool)

func SecretExists

func SecretExists(kubeClient client.Client, secretName, namespace string) bool

SecretExists returns a boolean to the caller based on the secretName and namespace args.

Types

type IamMemberType

type IamMemberType int

IamMemberType represents different type of IAM members.

const (
	ServiceAccount IamMemberType = iota
	GoogleGroup
)

type OperationResult

type OperationResult struct {
	RequeueDelay   time.Duration
	RequeueRequest bool
	CancelRequest  bool
}

func ContinueOperationResult

func ContinueOperationResult() OperationResult

func ContinueProcessing

func ContinueProcessing() (result OperationResult, err error)

func Requeue

func Requeue() (result OperationResult, err error)

func RequeueAfter

func RequeueAfter(delay time.Duration, errIn error) (result OperationResult, err error)

func RequeueOnErrorOrContinue

func RequeueOnErrorOrContinue(errIn error) (result OperationResult, err error)

func RequeueOnErrorOrStop

func RequeueOnErrorOrStop(errIn error) (result OperationResult, err error)

func RequeueWithError

func RequeueWithError(errIn error) (result OperationResult, err error)

func StopOperationResult

func StopOperationResult() OperationResult

func StopProcessing

func StopProcessing() (result OperationResult, err error)

func (OperationResult) RequeueOrCancel

func (r OperationResult) RequeueOrCancel() bool

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
condition
Package condition is a generated GoMock package.
Package condition is a generated GoMock package.
gcpclient
Package gcpclient is a generated GoMock package.
Package gcpclient is a generated GoMock package.
projectclaim
Package projectclaim is a generated GoMock package.
Package projectclaim is a generated GoMock package.

Jump to

Keyboard shortcuts

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