diff --git a/api/v1alpha1/environment_types.go b/api/v1alpha1/environment_types.go index 2bf0ca6b..ff7caed1 100644 --- a/api/v1alpha1/environment_types.go +++ b/api/v1alpha1/environment_types.go @@ -62,6 +62,7 @@ type EnvironmentStatus struct { // Environment is the Schema for the environments API // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Active\")].status" // +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type==\"Active\")].reason" +// +kubebuilder:printcolumn:name="Description",type="string",JSONPath=".status.conditions[?(@.type==\"Active\")].message" type Environment struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` 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 e9b9a409..d03e3b1c 100644 --- a/config/crd/bases/etos.eiffel-community.github.io_environments.yaml +++ b/config/crd/bases/etos.eiffel-community.github.io_environments.yaml @@ -21,6 +21,9 @@ spec: - jsonPath: .status.conditions[?(@.type=="Active")].reason name: Reason type: string + - jsonPath: .status.conditions[?(@.type=="Active")].message + name: Description + type: string name: v1alpha1 schema: openAPIV3Schema: diff --git a/internal/controller/environment_controller.go b/internal/controller/environment_controller.go index cdb45004..2fdc1cb6 100644 --- a/internal/controller/environment_controller.go +++ b/internal/controller/environment_controller.go @@ -281,8 +281,16 @@ func (r EnvironmentReconciler) releaseJob(environment *etosv1alpha1.Environment, corev1.ResourceCPU: resource.MustParse("100m"), }, }, - Command: []string{"python", "-u", "-m", "environment_provider.environment"}, - Args: []string{environment.Name}, + Env: []corev1.EnvVar{ + { + Name: "REQUEST", + Value: environmentRequest.Name, + }, + { + Name: "ENVIRONMENT", + Value: environment.Name, + }, + }, }, }, }, diff --git a/internal/etos/etos.go b/internal/etos/etos.go index 91ffc4fb..9a94cced 100644 --- a/internal/etos/etos.go +++ b/internal/etos/etos.go @@ -516,6 +516,24 @@ func (r *ETOSDeployment) role(name types.NamespacedName, labelName string) *rbac "create", "get", "list", "watch", "delete", }, }, + { + APIGroups: []string{"batch"}, + Resources: []string{ + "jobs", + }, + Verbs: []string{ + "create", "get", "list", "watch", "delete", + }, + }, + { + APIGroups: []string{""}, + Resources: []string{ + "pods", + }, + Verbs: []string{ + "get", "list", "watch", + }, + }, }, } }