Documentation ¶
Index ¶
- Constants
- func GetGHClient(ghToken string) *github.Client
- func IsEnvReady(ephEnvUrl string) bool
- type PRDetails
- type PREphemeralEnvControllerReconciler
- func (r *PREphemeralEnvControllerReconciler) CreateFluxHelmRelease(ctx context.Context, prDetails PRDetails) error
- func (r *PREphemeralEnvControllerReconciler) DeleteFluxHelmRelease(ctx context.Context, helmReleases map[int]fluxhelmrelease.HelmRelease, ...) error
- func (r *PREphemeralEnvControllerReconciler) GetActivePullRequests() ([]PRDetails, error)
- func (r *PREphemeralEnvControllerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *PREphemeralEnvControllerReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *PREphemeralEnvControllerReconciler) UpdateFluxHelmRelease(ctx context.Context, helmRel fluxhelmrelease.HelmRelease, prDetail PRDetails) error
- func (r *PREphemeralEnvControllerReconciler) UpdatePRStatus(context context.Context, prNumber int, prSHA string, status string, ...) error
Constants ¶
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 IsEnvReady ¶
Types ¶
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 ¶
func (r *PREphemeralEnvControllerReconciler) DeleteFluxHelmRelease(ctx context.Context, helmReleases map[int]fluxhelmrelease.HelmRelease, prDetails map[int]PRDetails, prController *prcontrollerephemeralenviov1alpha1.PREphemeralEnvController) error
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 ¶
func (r *PREphemeralEnvControllerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
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.