Skip to content

Commit 8deb54c

Browse files
authored
[SANDBOX-1370] remove the rest of the unused ns template tiers (codeready-toolchain#1177)
1 parent 8f7d449 commit 8deb54c

File tree

3 files changed

+3
-161
lines changed

3 files changed

+3
-161
lines changed

test/e2e/parallel/nstemplatetier_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ func TestTierTemplates(t *testing.T) {
265265
allTiers := &toolchainv1alpha1.TierTemplateList{}
266266
err = hostAwait.Client.List(context.TODO(), allTiers, client.InNamespace(hostAwait.Namespace), notCreatedByE2e)
267267
require.NoError(t, err)
268-
// We have 23 tier templates (base: 3, base1ns: 2, base1nsnoidling: 2, base1ns6didler: 3, baselarge: 3, test: 3, appstudio: 3, appstudiolarge: 3, appstudio-env: 3, intelmedium: 2, intellarge: 2, intelxlarge: 2)
268+
// We have 19 tier templates (base: 3, base1ns: 2, base1nsnoidling: 2, base1ns6didler: 3, appstudio: 3, appstudiolarge: 3, appstudio-env: 3)
269269
// But we cannot verify the exact number of tiers, because during the operator update it may happen that more TierTemplates are created
270-
assert.GreaterOrEqual(t, len(allTiers.Items), 33)
270+
assert.GreaterOrEqual(t, len(allTiers.Items), 38)
271271
}
272272

273273
func TestFeatureToggles(t *testing.T) {

testsupport/tiers/checks.go

Lines changed: 0 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ const (
3232
base1ns = "base1ns"
3333
base1ns6didler = "base1ns6didler"
3434
base1nsnoidling = "base1nsnoidling"
35-
baselarge = "baselarge"
36-
testTier = "test"
37-
intelMedium = "intelmedium"
38-
intelLarge = "intellarge"
39-
intelXLarge = "intelxlarge"
4035

4136
// common CPU limits
4237
baseCPULimit = "40000m"
@@ -61,22 +56,12 @@ func NewChecksForTier(tier *toolchainv1alpha1.NSTemplateTier) (TierChecks, error
6156
return &base1nsnoidlingTierChecks{base1nsTierChecks{tierName: base1nsnoidling}}, nil
6257
case base1ns6didler:
6358
return &base1ns6didlerTierChecks{base1nsTierChecks{tierName: base1ns6didler}}, nil
64-
case baselarge:
65-
return &baselargeTierChecks{baseTierChecks{tierName: baselarge}}, nil
6659
case appstudio:
6760
return &appstudioTierChecks{tierName: appstudio}, nil
6861
case appstudiolarge:
6962
return &appstudiolargeTierChecks{appstudioTierChecks{tierName: appstudiolarge}}, nil
7063
case appstudioEnv:
7164
return &appstudioEnvTierChecks{tierName: appstudioEnv}, nil
72-
case testTier:
73-
return &testTierChecks{tierName: testTier}, nil
74-
case intelMedium:
75-
return &intelMediumTierChecks{tierName: intelMedium}, nil
76-
case intelLarge:
77-
return &intelLargeTierChecks{intelMediumTierChecks{tierName: intelLarge}}, nil
78-
case intelXLarge:
79-
return &intelXLargeTierChecks{intelLargeTierChecks{intelMediumTierChecks{tierName: intelXLarge}}}, nil
8065
default:
8166
return nil, fmt.Errorf("no assertion implementation found for %s", tier.Name)
8267
}
@@ -315,25 +300,6 @@ func (a *base1ns6didlerTierChecks) GetClusterObjectChecks() []clusterObjectsChec
315300
idlers(518400, "dev"))
316301
}
317302

318-
type baselargeTierChecks struct {
319-
baseTierChecks
320-
}
321-
322-
func (a *baselargeTierChecks) GetClusterObjectChecks() []clusterObjectsCheck {
323-
return clusterObjectsChecks(
324-
clusterResourceQuotaCompute(baseCPULimit, "6000m", "32Gi", "60Gi"),
325-
clusterResourceQuotaDeployments(),
326-
clusterResourceQuotaReplicas(),
327-
clusterResourceQuotaRoutes(),
328-
clusterResourceQuotaJobs(),
329-
clusterResourceQuotaServicesNoLoadBalancers(),
330-
clusterResourceQuotaBuildConfig(),
331-
clusterResourceQuotaSecrets(),
332-
clusterResourceQuotaConfigMap(),
333-
numberOfClusterResourceQuotas(9),
334-
idlers(43200, "dev", "stage"))
335-
}
336-
337303
// toolchainLabelsWaitCriterion create a slice of LabelWaitCriterion containing all the required toolchain labels and values.
338304
func toolchainLabelsWaitCriterion(userName string) []wait.LabelWaitCriterion {
339305
var labelsWaitCriterion []wait.LabelWaitCriterion
@@ -362,30 +328,6 @@ func commonNetworkPolicyChecks() []namespaceObjectsCheck {
362328
}
363329
}
364330

365-
// testTierChecks checks only that the "test" tier exists and has correct template references.
366-
// It does not check the test tier resources
367-
type testTierChecks struct {
368-
tierName string
369-
}
370-
371-
func (a *testTierChecks) GetNamespaceObjectChecks(_ string) []namespaceObjectsCheck {
372-
return []namespaceObjectsCheck{}
373-
}
374-
375-
func (a *testTierChecks) GetSpaceRoleChecks(_ map[string][]string) ([]spaceRoleObjectsCheck, error) {
376-
return []spaceRoleObjectsCheck{}, nil
377-
}
378-
379-
func (a *testTierChecks) GetExpectedTemplateRefs(t *testing.T, hostAwait *wait.HostAwaitility) TemplateRefs {
380-
templateRefs := GetTemplateRefs(t, hostAwait, a.tierName)
381-
verifyNsTypes(t, a.tierName, templateRefs, "dev")
382-
return templateRefs
383-
}
384-
385-
func (a *testTierChecks) GetClusterObjectChecks() []clusterObjectsCheck {
386-
return []clusterObjectsCheck{}
387-
}
388-
389331
type appstudioTierChecks struct {
390332
tierName string
391333
}
@@ -591,106 +533,6 @@ func (a *appstudioEnvTierChecks) GetClusterObjectChecks() []clusterObjectsCheck
591533
idlers(0, "env"))
592534
}
593535

594-
type intelMediumTierChecks struct {
595-
tierName string
596-
}
597-
598-
func (a *intelMediumTierChecks) GetNamespaceObjectChecks(_ string) []namespaceObjectsCheck {
599-
checks := []namespaceObjectsCheck{
600-
resourceQuotaComputeDeploy("8", "16Gi", "8", "16Gi"),
601-
resourceQuotaComputeBuild("8", "16Gi", "8", "16Gi"),
602-
resourceQuotaStorage("15Gi", "50Gi", "15Gi", "5"),
603-
limitRange("1", "1000Mi", "10m", "64Mi"),
604-
numberOfLimitRanges(1),
605-
execPodsRole(),
606-
crtadminPodsRoleBinding(),
607-
crtadminViewRoleBinding(),
608-
}
609-
checks = append(checks, commonNetworkPolicyChecks()...)
610-
checks = append(checks, networkPolicyAllowFromCRW(), networkPolicyAllowFromVirtualizationNamespaces(), networkPolicyAllowFromRedHatODSNamespaceToMariaDB(), networkPolicyAllowFromRedHatODSNamespaceToModelMesh(), numberOfNetworkPolicies(10))
611-
return checks
612-
}
613-
614-
func (a *intelMediumTierChecks) GetSpaceRoleChecks(spaceRoles map[string][]string) ([]spaceRoleObjectsCheck, error) {
615-
checks := []spaceRoleObjectsCheck{}
616-
roles := 0
617-
rolebindings := 0
618-
for role, usernames := range spaceRoles {
619-
switch role {
620-
case "admin":
621-
checks = append(checks, rbacEditRole())
622-
roles++
623-
for _, userName := range usernames {
624-
checks = append(checks,
625-
rbacEditRoleBinding(userName),
626-
userEditRoleBinding(userName),
627-
)
628-
rolebindings += 2
629-
}
630-
default:
631-
return nil, fmt.Errorf("unexpected template name: '%s'", role)
632-
}
633-
}
634-
// also count the roles, rolebindings
635-
checks = append(checks,
636-
numberOfToolchainRoles(roles+1), // +1 for `exec-pods`
637-
numberOfToolchainRoleBindings(rolebindings+2), // +2 for `crtadmin-pods` and `crtadmin-view`
638-
)
639-
return checks, nil
640-
}
641-
642-
func (a *intelMediumTierChecks) GetExpectedTemplateRefs(t *testing.T, hostAwait *wait.HostAwaitility) TemplateRefs {
643-
templateRefs := GetTemplateRefs(t, hostAwait, a.tierName)
644-
verifyNsTypes(t, a.tierName, templateRefs, "dev")
645-
return templateRefs
646-
}
647-
648-
func (a *intelMediumTierChecks) GetClusterObjectChecks() []clusterObjectsCheck {
649-
return clusterObjectsChecks(
650-
clusterResourceQuotaDeployments(),
651-
clusterResourceQuotaReplicas(),
652-
clusterResourceQuotaRoutes(),
653-
clusterResourceQuotaJobs(),
654-
clusterResourceQuotaServicesNoLoadBalancers(),
655-
clusterResourceQuotaBuildConfig(),
656-
clusterResourceQuotaSecrets(),
657-
clusterResourceQuotaConfigMap(),
658-
numberOfClusterResourceQuotas(8),
659-
idlers(172800, "dev"))
660-
}
661-
662-
type intelLargeTierChecks struct {
663-
intelMediumTierChecks
664-
}
665-
666-
func (a *intelLargeTierChecks) GetNamespaceObjectChecks(_ string) []namespaceObjectsCheck {
667-
return getNamespaceObjectChecksForIntelLarge("32Gi")
668-
}
669-
670-
type intelXLargeTierChecks struct {
671-
intelLargeTierChecks
672-
}
673-
674-
func (a *intelXLargeTierChecks) GetNamespaceObjectChecks(_ string) []namespaceObjectsCheck {
675-
return getNamespaceObjectChecksForIntelLarge("64Gi")
676-
}
677-
678-
func getNamespaceObjectChecksForIntelLarge(memoryLimit string) []namespaceObjectsCheck {
679-
checks := []namespaceObjectsCheck{
680-
resourceQuotaComputeDeploy("16", memoryLimit, "16", memoryLimit),
681-
resourceQuotaComputeBuild("16", memoryLimit, "16", memoryLimit),
682-
resourceQuotaStorage("15Gi", "100Gi", "15Gi", "5"),
683-
limitRange("1", "1000Mi", "10m", "64Mi"),
684-
numberOfLimitRanges(1),
685-
execPodsRole(),
686-
crtadminPodsRoleBinding(),
687-
crtadminViewRoleBinding(),
688-
}
689-
checks = append(checks, commonNetworkPolicyChecks()...)
690-
checks = append(checks, networkPolicyAllowFromCRW(), networkPolicyAllowFromVirtualizationNamespaces(), networkPolicyAllowFromRedHatODSNamespaceToMariaDB(), networkPolicyAllowFromRedHatODSNamespaceToModelMesh(), numberOfNetworkPolicies(10))
691-
return checks
692-
}
693-
694536
// verifyNsTypes checks that there's a namespace.TemplateRef that begins with `<tier>-<type>` for each given templateRef (and no more, no less)
695537
func verifyNsTypes(t *testing.T, tier string, templateRefs TemplateRefs, expectedNSTypes ...string) {
696538
require.Len(t, templateRefs.Namespaces, len(expectedNSTypes))

testsupport/wait/host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import (
5050
)
5151

5252
var (
53-
BundledNSTemplateTiers []string = []string{"baselarge", "test", "base1ns", "base1nsnoidling", "base1ns6didler", "intelmedium", "intellarge", "intelxlarge", "base"}
53+
BundledNSTemplateTiers []string = []string{"base1ns", "base1nsnoidling", "base1ns6didler", "base"}
5454
CustomNSTemplateTiers []string = []string{"appstudio", "appstudiolarge", "appstudio-env"}
5555
AllE2eNSTemplateTiers []string = append(BundledNSTemplateTiers, CustomNSTemplateTiers...)
5656
)

0 commit comments

Comments
 (0)