Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions api/v1alpha1/environment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ type EnvironmentSpec struct {
// +kubebuilder:validation:Pattern="^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
Context string `json:"context"`

// +optional
Releaser *Image `json:"releaser,omitempty"`

Priority int `json:"priority"`
Tests []Test `json:"recipes"`
TestRunner string `json:"test_runner"`
Expand Down
5 changes: 0 additions & 5 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,6 @@ spec:
- testCase
type: object
type: array
releaser:
description: Image configuration.
properties:
image:
type: string
imagePullPolicy:
default: IfNotPresent
description: PullPolicy describes a policy for if/when to pull
a container image
type: string
required:
- image
type: object
sub_suite_id:
pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
type: string
Expand Down
21 changes: 8 additions & 13 deletions internal/controller/environment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,12 @@ func (r *EnvironmentReconciler) reconcileReleaser(ctx context.Context, releasers
if releasers.empty() && !environment.ObjectMeta.DeletionTimestamp.IsZero() {
if controllerutil.ContainsFinalizer(environment, releaseFinalizer) {
logger.Info("Environment is being deleted, release it")
var image *etosv1alpha1.Image
if environment.Spec.Releaser != nil {
image = environment.Spec.Releaser
} else {
environmentRequest, err := r.environmentRequest(ctx, environment)
if err != nil {
return err
}
image = environmentRequest.Spec.Image
environmentRequest, err := r.environmentRequest(ctx, environment)
if err != nil {
return err
}
releaser := r.releaseJob(environment, *image)
releaser := r.releaseJob(environment, environmentRequest)
fmt.Println(releaser)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why println? Log?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a revert.

if err := ctrl.SetControllerReference(environment, releaser, r.Scheme); err != nil {
return err
}
Expand Down Expand Up @@ -241,7 +236,7 @@ func (r *EnvironmentReconciler) environmentRequest(ctx context.Context, environm
}

// releaseJob is the job definition for an environment releaser.
func (r EnvironmentReconciler) releaseJob(environment *etosv1alpha1.Environment, image etosv1alpha1.Image) *batchv1.Job {
func (r EnvironmentReconciler) releaseJob(environment *etosv1alpha1.Environment, environmentRequest *etosv1alpha1.EnvironmentRequest) *batchv1.Job {
id := environment.Labels["etos.eiffel-community.github.io/id"]
cluster := environment.Labels["etos.eiffel-community.github.io/cluster"]
ttl := int32(300)
Expand Down Expand Up @@ -274,8 +269,8 @@ func (r EnvironmentReconciler) releaseJob(environment *etosv1alpha1.Environment,
Containers: []corev1.Container{
{
Name: environment.Name,
Image: image.Image,
ImagePullPolicy: image.ImagePullPolicy,
Image: environmentRequest.Spec.Image.Image,
ImagePullPolicy: environmentRequest.Spec.ImagePullPolicy,
Resources: corev1.ResourceRequirements{
Limits: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("256Mi"),
Expand Down