netgroup-polito / CrownLabs

Kubernetes-based Remote Laboratories
https://crownlabs.polito.it
Apache License 2.0
107 stars 42 forks source link

Handle tenant.LastLogin validation on the tenantwh #827

Closed QcFe closed 1 year ago

QcFe commented 1 year ago

Description

This PR adds validation logic to the validating webhook for the tenant resource (handled by the tenant operator), depends on #821.

How Has This Been Tested?

kingmakerbot commented 1 year ago

Hi @QcFe. Thanks for your PR.

I am @kingmakerbot. You can interact with me issuing a slash command in the first line of a comment. Currently, I understand the following commands:

Make sure this PR appears in the CrownLabs changelog, adding one of the following labels:

kingmakerbot commented 1 year ago

The generated files in the operators/ folder appear to be out-of-date.

Please, ensure you are using the correct version of controller-gen and re-run:

make generate
make manifests
Here it is an excerpt of the diff: ```diff diff --git a/operators/api/v1alpha2/zz_generated.deepcopy.go b/operators/api/v1alpha2/zz_generated.deepcopy.go index bd072fd..08c7f00 100644 --- a/operators/api/v1alpha2/zz_generated.deepcopy.go +++ b/operators/api/v1alpha2/zz_generated.deepcopy.go @@ -507,6 +507,7 @@ func (in *TenantResourceQuota) DeepCopy() *TenantResourceQuota { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TenantSpec) DeepCopyInto(out *TenantSpec) { *out = *in + in.LastLogin.DeepCopyInto(&out.LastLogin) if in.Workspaces != nil { in, out := &in.Workspaces, &out.Workspaces *out = make([]TenantWorkspaceEntry, len(*in)) diff --git a/operators/deploy/crds/crownlabs.polito.it_tenants.yaml b/operators/deploy/crds/crownlabs.polito.it_tenants.yaml index cc68c86..f4c93f0 100644 --- a/operators/deploy/crds/crownlabs.polito.it_tenants.yaml +++ b/operators/deploy/crds/crownlabs.polito.it_tenants.yaml @@ -71,6 +71,10 @@ spec: firstName: description: The first name of the Tenant. type: string + lastLogin: + description: The last login timestamp. + format: date-time + type: string lastName: description: The last name of the Tenant. type: string @@ -141,6 +145,7 @@ spec: required: - email - firstName + - lastLogin - lastName type: object status: @@ -204,7 +209,8 @@ spec: ready: description: Whether all subscriptions and resource creations succeeded or an error occurred. In case of errors, the other status fields - provide additional information about which problem occurred. + provide additional information about which problem occurred. Will + be set to true even when personal workspace is intentionally deleted. type: boolean sandboxNamespace: description: The namespace that can be freely used by the Tenant to ```
kingmakerbot commented 1 year ago

The generated files in the operators/ folder appear to be out-of-date.

Please, ensure you are using the correct version of controller-gen and re-run:

make generate
make manifests
Here it is an excerpt of the diff: ```diff diff --git a/operators/api/v1alpha2/zz_generated.deepcopy.go b/operators/api/v1alpha2/zz_generated.deepcopy.go index bd072fd..08c7f00 100644 --- a/operators/api/v1alpha2/zz_generated.deepcopy.go +++ b/operators/api/v1alpha2/zz_generated.deepcopy.go @@ -507,6 +507,7 @@ func (in *TenantResourceQuota) DeepCopy() *TenantResourceQuota { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TenantSpec) DeepCopyInto(out *TenantSpec) { *out = *in + in.LastLogin.DeepCopyInto(&out.LastLogin) if in.Workspaces != nil { in, out := &in.Workspaces, &out.Workspaces *out = make([]TenantWorkspaceEntry, len(*in)) ```
kingmakerbot commented 1 year ago

The generated files in the operators/ folder appear to be out-of-date.

Please, ensure you are using the correct version of controller-gen and re-run:

make generate
make manifests
Here it is an excerpt of the diff: ```diff diff --git a/operators/api/v1alpha2/zz_generated.deepcopy.go b/operators/api/v1alpha2/zz_generated.deepcopy.go index bd072fd..08c7f00 100644 --- a/operators/api/v1alpha2/zz_generated.deepcopy.go +++ b/operators/api/v1alpha2/zz_generated.deepcopy.go @@ -507,6 +507,7 @@ func (in *TenantResourceQuota) DeepCopy() *TenantResourceQuota { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TenantSpec) DeepCopyInto(out *TenantSpec) { *out = *in + in.LastLogin.DeepCopyInto(&out.LastLogin) if in.Workspaces != nil { in, out := &in.Workspaces, &out.Workspaces *out = make([]TenantWorkspaceEntry, len(*in)) ```