diff --git a/api/v1alpha1/environment_types.go b/api/v1alpha1/environment_types.go index 1dd7d8c6..2bf0ca6b 100644 --- a/api/v1alpha1/environment_types.go +++ b/api/v1alpha1/environment_types.go @@ -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"` diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 7f9fc26f..ccf76512 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -549,11 +549,6 @@ func (in *EnvironmentRequestStatus) DeepCopy() *EnvironmentRequestStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EnvironmentSpec) DeepCopyInto(out *EnvironmentSpec) { *out = *in - if in.Releaser != nil { - in, out := &in.Releaser, &out.Releaser - *out = new(Image) - **out = **in - } if in.Tests != nil { in, out := &in.Tests, &out.Tests *out = make([]Test, len(*in)) diff --git a/config/crd/bases/etos.eiffel-community.github.io_environments.yaml b/config/crd/bases/etos.eiffel-community.github.io_environments.yaml index edce2735..e9b9a409 100644 --- a/config/crd/bases/etos.eiffel-community.github.io_environments.yaml +++ b/config/crd/bases/etos.eiffel-community.github.io_environments.yaml @@ -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 diff --git a/internal/controller/environment_controller.go b/internal/controller/environment_controller.go index 9af1d7a9..cdb45004 100644 --- a/internal/controller/environment_controller.go +++ b/internal/controller/environment_controller.go @@ -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) if err := ctrl.SetControllerReference(environment, releaser, r.Scheme); err != nil { return err } @@ -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) @@ -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"),