@@ -27,6 +27,36 @@ func TestDefaultDetector_Detect(t *testing.T) {
2727 kubeContext : "KIND-test" ,
2828 want : ClusterTypeKind ,
2929 },
30+ {
31+ name : "crc cluster with admin context" ,
32+ kubeContext : "crc-admin" ,
33+ want : ClusterTypeCRC ,
34+ },
35+ {
36+ name : "crc cluster with api prefix" ,
37+ kubeContext : "api-crc-testing:6443" ,
38+ want : ClusterTypeCRC ,
39+ },
40+ {
41+ name : "crc cluster with uppercase" ,
42+ kubeContext : "CRC-admin" ,
43+ want : ClusterTypeCRC ,
44+ },
45+ {
46+ name : "crc cluster bare name" ,
47+ kubeContext : "crc" ,
48+ want : ClusterTypeCRC ,
49+ },
50+ {
51+ name : "not crc - incidental substring" ,
52+ kubeContext : "acrc-cluster" ,
53+ want : ClusterTypeUnknown ,
54+ },
55+ {
56+ name : "not crc - encrypted in name" ,
57+ kubeContext : "my-encrypted-cluster" ,
58+ want : ClusterTypeUnknown ,
59+ },
3060 }
3161
3262 detector := & defaultDetector {}
@@ -108,6 +138,17 @@ func TestDefaultApplicator_Apply(t *testing.T) {
108138 wantPortForward : true ,
109139 wantChanged : true ,
110140 },
141+ {
142+ name : "crc cluster" ,
143+ clusterType : ClusterTypeCRC ,
144+ resources : "default" ,
145+ exposure : "loadbalancer" ,
146+ portForwardEnabled : false ,
147+ wantResources : "small" ,
148+ wantExposure : "none" ,
149+ wantPortForward : true ,
150+ wantChanged : true ,
151+ },
111152 }
112153
113154 applicator := & defaultApplicator {}
@@ -158,6 +199,16 @@ func TestManager_ApplyConvenienceDefaults(t *testing.T) {
158199 wantExposure : "none" ,
159200 wantPortForward : true ,
160201 },
202+ {
203+ name : "crc cluster detection and defaults" ,
204+ kubeContext : "crc-admin" ,
205+ resources : "default" ,
206+ exposure : "loadbalancer" ,
207+ portForwardEnabled : false ,
208+ wantResources : "small" ,
209+ wantExposure : "none" ,
210+ wantPortForward : true ,
211+ },
161212 {
162213 name : "gke cluster no changes" ,
163214 kubeContext : "gke_project_zone_cluster" ,
@@ -203,6 +254,7 @@ func TestClusterType_String(t *testing.T) {
203254 {ClusterTypeKind , "kind" },
204255 {ClusterTypeMinikube , "minikube" },
205256 {ClusterTypeK3s , "k3s" },
257+ {ClusterTypeCRC , "crc" },
206258 {ClusterTypeUnknown , "unknown" },
207259 }
208260
0 commit comments