Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create tiertemplaterevision for each tiertemplate #1103

Merged
merged 82 commits into from
Jan 23, 2025

Conversation

mfrancisc
Copy link
Contributor

@mfrancisc mfrancisc commented Nov 12, 2024

This PR introduces creation of TierTemplateRevision CRs for each TierTemplate, as soon as this is merged we should not see any TTR, we will start seeing those in host namespace only when we populate TierTemplate.Spec.TemplateObjects field.

With the current logic the TTRs are created only when there is a new TierTemplate ( thus one per TierTemplate ) with the TierTemplate.Spec.TemplateObjects field populated. The TTRs are not used yet, thus they will not guide the creation/update/deletion of user namespace content.

In follow up PRs we will introduce comparison between TierTemplate and TierTemplateRevision and usage of TierTemplateRevisions for driving space provisioning.

Jira: https://issues.redhat.com/browse/KUBESAW-146
Paired with: codeready-toolchain/toolchain-e2e#1061

test/nstemplatetier/assertion.go Outdated Show resolved Hide resolved
@MatousJobanek
Copy link
Contributor

from the TTR resource:

ObjectMeta: (v1.ObjectMeta) &ObjectMeta{Name:ttr,GenerateName:,Namespace:toolchain-host-15114753,SelfLink:,UID:c11220e5-e326-4ac2-a5a9-9aaea92cbe50,ResourceVersion:62162,Generation:1,CreationTimestamp:2025-01-15 12:03:13 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{producer: toolchain-e2e,},Annotations:map[string]string{},OwnerReferences:[]OwnerReference{},Finalizers:[],ManagedFields:[]ManagedFieldsEntry{ManagedFieldsEntry{Manager:Go-http-client,Operation:Update,APIVersion:toolchain.dev.openshift.com/v1alpha1,Time:2025-01-15 12:03:13 +0000 UTC,FieldsType:FieldsV1,FieldsV1:{"f:metadata":{"f:labels":{".":{},"f:producer":{}}},"f:spec":{".":{},"f:clusterResources":{".":{},"f:templateRef":{}},"f:namespaces":{},"f:parameters":{".":{},"k:{\"name\":\"DEPLOYMENT_QUOTA\"}":{".":{},"f:name":{},"f:value":{}}},"f:spaceRoles":{}}},Subresource:,},},},

it doesn't look like the delete would be actually called for this DeletionTimestamp:<nil>

@mfrancisc
Copy link
Contributor Author

it doesn't look like the delete would be actually called for this DeletionTimestamp:

@MatousJobanek thanks for pointing this out. I'm looking at it, seems like the cleanup is buggy ? But most of the time works 🤔

@mfrancisc
Copy link
Contributor Author

it doesn't look like the delete would be actually called for this DeletionTimestamp:

It's strange because that is actually the custom NSTemplateTier I create here with cleanup https://github.com/codeready-toolchain/toolchain-e2e/pull/1061/files#diff-d1f261f3430b9095a3c1639d087ee7fdb0c4a33756c21552ed0a53095c7d9326R412

and the deletion should be triggered here https://github.com/codeready-toolchain/toolchain-e2e/pull/1061/files#diff-9f3717e8440a5df617b514735733d446cd593f05131365e355488105d9f0aa91R115

@mfrancisc
Copy link
Contributor Author

mfrancisc commented Jan 16, 2025

this one looks more like infra/rgsvc glitch :

  signup_request.go:352: 
        	Error Trace:	/tmp/toolchain-e2e/testsupport/signup_request.go:352
        	            				/tmp/toolchain-e2e/testsupport/signup_request.go:244
        	            				/tmp/toolchain-e2e/testsupport/user_setup.go:43
        	            				/tmp/toolchain-e2e/testsupport/user_setup.go:50
        	            				/tmp/toolchain-e2e/test/e2e/parallel/e2e_test.go:70
        	Error:      	Not equal: 
        	            	expected: 202
        	            	actual  : 502
        	Test:       	TestE2EFlow
        	Messages:   	unexpected response status with body: <html><body><h1>502 Bad Gateway</h1>
        	            	The server returned an invalid or incomplete response.

/retest

Copy link
Contributor

@metlos metlos left a comment

Choose a reason for hiding this comment

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

some additional comments.

@mfrancisc mfrancisc requested a review from metlos January 17, 2025 07:20
@mfrancisc
Copy link
Contributor Author

/retest

infra

@mfrancisc
Copy link
Contributor Author

I'm confused 😕

It failed again with NSTemplateTier not being deleted after the tests:

clean.go:169: 
        	Error Trace:	/tmp/toolchain-e2e/testsupport/cleanup/clean.go:169
        	            				/usr/local/go/src/sync/once.go:74
        	            				/usr/local/go/src/sync/once.go:65
        	            				/tmp/toolchain-e2e/testsupport/cleanup/clean.go:92
        	            				/tmp/toolchain-e2e/testsupport/cleanup/clean.go:76
        	            				/usr/local/go/src/runtime/asm_amd64.s:1598
        	Error:      	Received unexpected error:
        	            	context deadline exceeded
        	Test:       	TestTierTemplateRevision
        	Messages:   	The object still exists after the time out expired: (*v1alpha1.NSTemplateTier)(0xc0011f2300)({
        	            	 TypeMeta: (v1.TypeMeta) &TypeMeta{Kind:,APIVersion:,},
        	            	 ObjectMeta: (v1.ObjectMeta) &ObjectMeta{Name:ttr,GenerateName:,Namespace:toolchain-host-20105331,SelfLink:,UID:8ed926ee-d5b5-4973-aee1-c39b9451a6cd,ResourceVersion:61815,Generation:1,CreationTimestamp:2025-01-20 11:08:51 +0000 UTC,DeletionTimestamp:<nil>,DeletionGracePeriodSeconds:nil,Labels:map[string]string{producer: toolchain-e2e,},Annotations:map[string]string{},OwnerReferences:[]OwnerReference{},Finalizers:[],ManagedFields:[]ManagedFieldsEntry{ManagedFieldsEntry{Manager:Go-http-client,Operation:Update,APIVersion:toolchain.dev.openshift.com/v1alpha1,Time:2025-01-20 11:08:51 +0000 UTC,FieldsType:FieldsV1,FieldsV1:{"f:metadata":{"f:labels":{".":{},"f:producer":{}}},"f:spec":{".":{},"f:clusterResources":{".":{},"f:templateRef":{}},"f:namespaces":{},"f:parameters":{".":{},"k:{\"name\":\"DEPLOYMENT_QUOTA\"}":{".":{},"f:name":{},"f:value":{}}},"f:spaceRoles":{}}},Subresource:,},},},
        	            	 Spec: (v1alpha1.NSTemplateTierSpec) {
        	            	  Namespaces: ([]v1alpha1.NSTemplateTierNamespace) (len=1 cap=1) {
        	            	   (v1alpha1.NSTemplateTierNamespace) {
        	            	    TemplateRef: (string) (len=34) "ttrfrombase1ns-dev-d3c2c60-d3c2c60"
        	            	   }
        	            	  },
        	            	  ClusterResources: (*v1alpha1.NSTemplateTierClusterResources)(0xc000a8e4e0)({
        	            	   TemplateRef: (string) (len=47) "ttrfrombase1ns-clusterresources-5b0d541-5b0d541"
        	            	  }),
        	            	  SpaceRoles: (map[string]v1alpha1.NSTemplateTierSpaceRole) (len=1) {
        	            	   (string) (len=5) "admin": (v1alpha1.NSTemplateTierSpaceRole) {
        	            	    TemplateRef: (string) (len=36) "ttrfrombase1ns-admin-88b275d-88b275d"
        	            	   }
        	            	  },
        	            	  SpaceRequestConfig: (*v1alpha1.SpaceRequestConfig)(<nil>),
        	            	  Parameters: ([]v1alpha1.Parameter) (len=1 cap=1) {
        	            	   (v1alpha1.Parameter) {
        	            	    Name: (string) (len=16) "DEPLOYMENT_QUOTA",
        	            	    Value: (string) (len=2) "60"
        	            	   }
        	            	  }
        	            	 },
        	            	 Status: (v1alpha1.NSTemplateTierStatus) {
        	            	  Conditions: ([]v1alpha1.Condition) <nil>,
        	            	  Revisions: (map[string]string) <nil>
        	            	 }
        	            	})

but from the logs it does seem that the deletion was triggered:

clean.go:114: deleting NSTemplateTier: ttr ...

@mfrancisc
Copy link
Contributor Author

/retest

updated e2e

@mfrancisc
Copy link
Contributor Author

/retest

Copy link

openshift-ci bot commented Jan 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fbm3307, MatousJobanek, metlos, mfrancisc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [MatousJobanek,fbm3307,metlos,mfrancisc]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mfrancisc mfrancisc merged commit a1bcf67 into codeready-toolchain:master Jan 23, 2025
12 of 13 checks passed
@mfrancisc mfrancisc deleted the createttr branch January 23, 2025 06:21
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 91.59292% with 19 lines in your changes missing coverage. Please review.

Project coverage is 79.64%. Comparing base (8d4a501) to head (311a835).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ollers/nstemplatetier/nstemplatetier_controller.go 84.55% 14 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1103      +/-   ##
==========================================
+ Coverage   79.10%   79.64%   +0.54%     
==========================================
  Files          78       79       +1     
  Lines        7830     8043     +213     
==========================================
+ Hits         6194     6406     +212     
+ Misses       1456     1452       -4     
- Partials      180      185       +5     
Files with missing lines Coverage Δ
test/nstemplatetier/assertion.go 100.00% <100.00%> (ø)
test/nstemplatetier/nstemplatetier.go 74.49% <100.00%> (+11.76%) ⬆️
test/tiertemplaterevision/assertion.go 100.00% <100.00%> (ø)
...ollers/nstemplatetier/nstemplatetier_controller.go 83.09% <84.55%> (+25.95%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants