controllers

package
v0.0.0-...-a659037 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FLUX_HELM_RELEASE_PREFIX    = "relpr-"
	FLUX_POLL_INTERVAL          = 5 * time.Minute
	FLUX_SOURCE_KIND            = "GitRepository"
	FLUX_SOURCE_REPO_NAME_SPACE = "flux-system"
)

Variables

This section is empty.

Functions

func GetGHClient

func GetGHClient(ghToken string) *github.Client

func IsEnvReady

func IsEnvReady(ephEnvUrl string) bool

Types

type PRDetails

type PRDetails struct {
	Number         int
	MergeCommitSHA string
	HeadSHA        string
	State          string
	ClosedAt       time.Time
}

type PREphemeralEnvControllerReconciler

type PREphemeralEnvControllerReconciler struct {
	client.Client
	Scheme              *runtime.Scheme
	Record              record.EventRecorder
	GHPRRepo            prcontrollerephemeralenviov1alpha1.GithubPRRepository
	GHPATToken          string
	EnvCreationHelmRepo prcontrollerephemeralenviov1alpha1.EnvCreationHelmRepo
}

PREphemeralEnvControllerReconciler reconciles a PREphemeralEnvController object

func (*PREphemeralEnvControllerReconciler) CreateFluxHelmRelease

func (r *PREphemeralEnvControllerReconciler) CreateFluxHelmRelease(ctx context.Context, prDetails PRDetails) error

Creates a Flux HelmRelease for the PR, the resource is created in the namespace specified in the CRD

func (*PREphemeralEnvControllerReconciler) DeleteFluxHelmRelease

The function deletes FLUX HelmReleases for which PRs are no longer open. It is passed a list of Flux

func (*PREphemeralEnvControllerReconciler) GetActivePullRequests

func (r *PREphemeralEnvControllerReconciler) GetActivePullRequests() ([]PRDetails, error)

func (*PREphemeralEnvControllerReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the PREphemeralEnvController object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.12.2/pkg/reconcile

func (*PREphemeralEnvControllerReconciler) SetupWithManager

func (r *PREphemeralEnvControllerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*PREphemeralEnvControllerReconciler) UpdateFluxHelmRelease

func (r *PREphemeralEnvControllerReconciler) UpdateFluxHelmRelease(ctx context.Context, helmRel fluxhelmrelease.HelmRelease, prDetail PRDetails) error

Updates a Flux HelmRelease for the PR, this is called when new commit is pushed to the PR. The Flux Helm release is updated and results in the commit SHA being updated in the HelmRelease values.

func (*PREphemeralEnvControllerReconciler) UpdatePRStatus

func (r *PREphemeralEnvControllerReconciler) UpdatePRStatus(context context.Context, prNumber int, prSHA string, status string, description string) error

Jump to

Keyboard shortcuts

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