util

package
v0.0.0-...-d212fee Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNewArgoCDInstance

func CreateNewArgoCDInstance(ctx context.Context, namespace *corev1.Namespace, user db.ClusterUser, k8sclient client.Client,
	log logr.Logger, dbQueries db.AllDatabaseQueries) error

func CreateWebHook

func CreateWebHook(personalAccessToken string, authorUsername string, authorName string, repoName string, hookURL string) error

Parameters:

personalAccessToken : This points to the personal access token (PAT) assigned from the GitHub with the repo access atleast
authorUsername 		: The author git username (a/c to the PAT)
authorName 			: The author full name registered (a/c to the PAT)
repoName 			: The repository name on which the hook will be defined
hookURL 			: This points to the payloadURL on which github will POST request

func WaitForServerUp

func WaitForServerUp(serverURL string) error

Types

type ClientAction

type ClientAction string
const (
	Get          ClientAction = "Get"
	List         ClientAction = "List"
	Create       ClientAction = "Create"
	Delete       ClientAction = "Delete"
	Update       ClientAction = "Update"
	Patch        ClientAction = "Patch"
	DeleteAllOf  ClientAction = "DeleteAllOf"
	Status       ClientAction = "Status"
	StatusUpdate ClientAction = "StatusUpdate"
	StatusPatch  ClientAction = "StatusPatch"
	Scheme       ClientAction = "Scheme"
	RESTMapper   ClientAction = "RESTMapper"
)

type ListEventReceiver

type ListEventReceiver struct {
	Events []ProxyClientEvent
}

ListEventReceiver is a simple event receiver implementation that logs all events to a slice.

func (*ListEventReceiver) ReceiveEvent

func (li *ListEventReceiver) ReceiveEvent(event ProxyClientEvent)

type ProxyClient

type ProxyClient struct {
	InnerClient client.Client
	Informer    ProxyClientEventReceiver
}

ProxyClient is a simple utility function/struct that maybe used to write unit tests that mock the K8s go client. ProxyClient wraps an existing client.Client, and calls a listener based on the result of the call. This allows the test to verify custom conditions, or that particular calls were made. (Yes there are other Go modules that do this, as well).

func (*ProxyClient) Create

func (pc *ProxyClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

Create saves the object obj in the Kubernetes cluster.

func (*ProxyClient) Delete

func (pc *ProxyClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

Delete deletes the given obj from Kubernetes cluster.

func (*ProxyClient) DeleteAllOf

func (pc *ProxyClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

DeleteAllOf deletes all objects of the given type matching the given options.

func (*ProxyClient) Get

func (pc *ProxyClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error

Get retrieves an obj for the given object key from the Kubernetes Cluster. obj must be a struct pointer so that obj can be updated with the response returned by the Server.

func (*ProxyClient) List

func (pc *ProxyClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

List retrieves list of objects for a given namespace and list options. On a successful call, Items field in the list will be populated with the result returned from the server.

func (*ProxyClient) Patch

func (pc *ProxyClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

Patch patches the given obj in the Kubernetes cluster. obj must be a struct pointer so that obj can be updated with the content returned by the Server.

func (*ProxyClient) RESTMapper

func (pc *ProxyClient) RESTMapper() meta.RESTMapper

RESTMapper returns the rest this client is using.

func (*ProxyClient) Scheme

func (pc *ProxyClient) Scheme() *runtime.Scheme

Scheme returns the scheme this client is using.

func (*ProxyClient) Status

func (pc *ProxyClient) Status() client.StatusWriter

StatusWriter knows how to update status subresource of a Kubernetes object.

func (*ProxyClient) Update

func (pc *ProxyClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

Update updates the given obj in the Kubernetes cluster. obj must be a struct pointer so that obj can be updated with the content returned by the Server.

type ProxyClientEvent

type ProxyClientEvent struct {
	Action   ClientAction
	Ctx      context.Context
	Key      *client.ObjectKey
	Obj      *client.Object
	Patch    *client.Patch
	List     *client.ObjectList
	Options  *ProxyClientEventOptions
	ErrorRes error
	ExitTime time.Time
}

func (ProxyClientEvent) ObjectTypeOf

func (event ProxyClientEvent) ObjectTypeOf() string

func (ProxyClientEvent) String

func (event ProxyClientEvent) String() string

String returns a simple string representation of the event

type ProxyClientEventOptions

type ProxyClientEventOptions struct {
	List        []client.ListOption
	Create      []client.CreateOption
	Delete      []client.DeleteOption
	Update      []client.UpdateOption
	Patch       []client.PatchOption
	DeleteAllOf []client.DeleteAllOfOption
	Get         []client.GetOption
}

type ProxyClientEventReceiver

type ProxyClientEventReceiver interface {
	ReceiveEvent(event ProxyClientEvent)
}

type ProxyClientStatusWrapper

type ProxyClientStatusWrapper struct {
	// contains filtered or unexported fields
}

func (*ProxyClientStatusWrapper) Patch

func (pcsw *ProxyClientStatusWrapper) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

Patch patches the given object's subresource. obj must be a struct pointer so that obj can be updated with the content returned by the Server.

func (*ProxyClientStatusWrapper) Update

Update updates the fields corresponding to the status subresource for the given obj. obj must be a struct pointer so that obj can be updated with the content returned by the Server.

type TokenSource

type TokenSource struct {
	AccessToken string
}

func (*TokenSource) Token

func (t *TokenSource) Token() (*oauth2.Token, error)

Jump to

Keyboard shortcuts

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