11import { CYPRESS_SAFE_RESOURCE_REVISION } from '../blueprint.utils' ;
22
3- export function clusterProvDigitalOceanSingleResponse ( clusterName : string , cloudCredName : string , machinePoolId : string ) :object {
3+ const namespace = 'fleet-default' ;
4+
5+ /**
6+ * Linked with clusterProvDigitalOceanSingleResponse
7+ */
8+ export function clusterMgmtDigitalOceanSingleResponse ( clusterName : string ) : object {
9+ return {
10+ type : 'collection' ,
11+ links : { self : 'https://localhost:8005/v1/management.cattle.io.clusters' } ,
12+ actions : { } ,
13+ resourceType : 'management.cattle.io.cluster' ,
14+ revision : CYPRESS_SAFE_RESOURCE_REVISION ,
15+ count : 1 ,
16+ data : [ {
17+ id : `${ clusterName } ` ,
18+ type : 'management.cattle.io.cluster' ,
19+ links : {
20+ log : `https://localhost:8005/v1/management.cattle.io.clusters/${ clusterName } ?link=log` ,
21+ patch : 'blocked' ,
22+ projects : `https://localhost:8005/v1/management.cattle.io.clusters/${ clusterName } ?link=projects` ,
23+ remove : 'blocked' ,
24+ schemas : `https://localhost:8005/v1/management.cattle.io.clusters/${ clusterName } ?link=schemas` ,
25+ self : `https://localhost:8005/v1/management.cattle.io.clusters/${ clusterName } ` ,
26+ shell : `wss://localhost/v3/clusters/${ clusterName } ?shell=true` ,
27+ subscribe : `https://localhost:8005/v1/management.cattle.io.clusters/${ clusterName } ?link=subscribe` ,
28+ update : 'blocked' ,
29+ view : `https://localhost:8005/v1/management.cattle.io.clusters/${ clusterName } `
30+ } ,
31+ action : { } ,
32+ apiVersion : 'management.cattle.io/v3' ,
33+ kind : 'Cluster' ,
34+ metadata : {
35+ annotations : { } ,
36+ creationTimestamp : '2024-01-05T14:44:50Z' ,
37+ name : `${ clusterName } ` ,
38+ labels : { } ,
39+ relationships : [ {
40+ toId : `${ namespace } /${ clusterName } ` ,
41+ toType : 'provisioning.cattle.io.cluster' ,
42+ rel : 'applies' ,
43+ state : 'active' ,
44+ message : 'Resource is current'
45+ } ] ,
46+ resourceVersion : CYPRESS_SAFE_RESOURCE_REVISION ,
47+ state : {
48+ error : false ,
49+ message : '' ,
50+ name : 'Active' ,
51+ transitioning : false
52+ } ,
53+ uid : '7623f2b5-1003-49c9-a21d-6cae3622a3bc' ,
54+ } ,
55+ spec : { displayName : `${ clusterName } ` } ,
56+ status : {
57+ driver : 'digitalocean' ,
58+ info : {
59+ arch : 'amd64' ,
60+ kubernetesVersion : 'v1.35.3+rke2r3' ,
61+ machineProvider : 'Digitalocean' ,
62+ nodeCount : 2 ,
63+ provisioningClusterRef : {
64+ apiVersion : 'provisioning.cattle.io/v1' ,
65+ kind : 'Cluster' ,
66+ name : `${ clusterName } ` ,
67+ namespace : `${ namespace } `
68+ }
69+ }
70+ } ,
71+ } ] ,
72+ } ;
73+ }
74+
75+ /**
76+ * Linked with clusterMgmtDigitalOceanSingleResponse
77+ */
78+ export function clusterProvDigitalOceanSingleResponse ( clusterName : string , cloudCredName : string , machinePoolId : string ) : object {
479 return {
80+ id : `${ namespace } /${ clusterName } ` ,
581 type : 'collection' ,
682 links : { self : 'https://localhost:8005/v1/provisioning.cattle.io.clusters' } ,
783 createTypes : { 'provisioning.cattle.io.cluster' : 'https://localhost:8005/v1/provisioning.cattle.io.clusters' } ,
884 actions : { } ,
985 resourceType : 'provisioning.cattle.io.cluster' ,
1086 revision : CYPRESS_SAFE_RESOURCE_REVISION ,
11- count : 9 ,
87+ count : 1 ,
1288 data : [
1389 {
14- id : `fleet-default /${ clusterName } ` ,
90+ id : `${ namespace } /${ clusterName } ` ,
1591 type : 'provisioning.cattle.io.cluster' ,
1692 links : {
17- remove : `https://localhost:8005/v1/provisioning.cattle.io.clusters/fleet-default /${ clusterName } ` ,
18- self : `https://localhost:8005/v1/provisioning.cattle.io.clusters/fleet-default /${ clusterName } ` ,
19- update : `https://localhost:8005/v1/provisioning.cattle.io.clusters/fleet-default /${ clusterName } ` ,
20- view : `https://localhost:8005/apis/provisioning.cattle.io/v1/namespaces/fleet-default /clusters/${ clusterName } `
93+ remove : `https://localhost:8005/v1/provisioning.cattle.io.clusters/${ namespace } /${ clusterName } ` ,
94+ self : `https://localhost:8005/v1/provisioning.cattle.io.clusters/${ namespace } /${ clusterName } ` ,
95+ update : `https://localhost:8005/v1/provisioning.cattle.io.clusters/${ namespace } /${ clusterName } ` ,
96+ view : `https://localhost:8005/apis/provisioning.cattle.io/v1/namespaces/${ namespace } /clusters/${ clusterName } `
2197 } ,
2298 apiVersion : 'provisioning.cattle.io/v1' ,
2399 kind : 'Cluster' ,
@@ -36,111 +112,111 @@ export function clusterProvDigitalOceanSingleResponse(clusterName: string, cloud
36112 ] ,
37113 generation : 3 ,
38114 name : `${ clusterName } ` ,
39- namespace : 'fleet-default' ,
115+ namespace : ` ${ namespace } ` ,
40116 relationships : [
41117 {
42- toId : `fleet-default /r-cluster-${ clusterName } -view-p-lnjgz-creator-proje-67ac2` ,
118+ toId : `${ namespace } /r-cluster-${ clusterName } -view-p-lnjgz-creator-proje-67ac2` ,
43119 toType : 'rbac.authorization.k8s.io.rolebinding' ,
44120 rel : 'owner' ,
45121 state : 'active' ,
46122 message : 'Resource is current'
47123 } ,
48124 {
49- toId : `fleet-default /crt-${ clusterName } -nodes-manage` ,
125+ toId : `${ namespace } /crt-${ clusterName } -nodes-manage` ,
50126 toType : 'rbac.authorization.k8s.io.role' ,
51127 rel : 'owner' ,
52128 state : 'active' ,
53129 message : 'Resource is current'
54130 } ,
55131 {
56- toId : `fleet-default /crt-${ clusterName } -cluster-owner` ,
132+ toId : `${ namespace } /crt-${ clusterName } -cluster-owner` ,
57133 toType : 'rbac.authorization.k8s.io.role' ,
58134 rel : 'owner' ,
59135 state : 'active' ,
60136 message : 'Resource is current'
61137 } ,
62138 {
63- toId : `fleet-default /${ clusterName } -managed-system-upgrad-53adc` ,
139+ toId : `${ namespace } /${ clusterName } -managed-system-upgrad-53adc` ,
64140 toType : 'management.cattle.io.managedchart' ,
65141 rel : 'owner' ,
66142 state : 'waitapplied'
67143 } ,
68144 {
69- toId : `fleet-default /r-cluster-${ clusterName } -view` ,
145+ toId : `${ namespace } /r-cluster-${ clusterName } -view` ,
70146 toType : 'rbac.authorization.k8s.io.role' ,
71147 rel : 'owner' ,
72148 state : 'active' ,
73149 message : 'Resource is current'
74150 } ,
75151 {
76- toId : `fleet-default /crt-${ clusterName } -nodes-view` ,
152+ toId : `${ namespace } /crt-${ clusterName } -nodes-view` ,
77153 toType : 'rbac.authorization.k8s.io.role' ,
78154 rel : 'owner' ,
79155 state : 'active' ,
80156 message : 'Resource is current'
81157 } ,
82158 {
83- toId : `fleet-default /crt-${ clusterName } -cluster-admin` ,
159+ toId : `${ namespace } /crt-${ clusterName } -cluster-admin` ,
84160 toType : 'rbac.authorization.k8s.io.role' ,
85161 rel : 'owner' ,
86162 state : 'active' ,
87163 message : 'Resource is current'
88164 } ,
89165 {
90- toId : `fleet-default /nc-${ clusterName } -pool1-${ machinePoolId } ` ,
166+ toId : `${ namespace } /nc-${ clusterName } -pool1-${ machinePoolId } ` ,
91167 toType : 'rke-machine-config.cattle.io.digitaloceanconfig' ,
92168 rel : 'owner' ,
93169 state : 'active' ,
94170 message : 'Resource is current'
95171 } ,
96172 {
97- toId : ' c-m-fbr46mrq/c-m-fbr46mrq-fleet-default- owner' ,
173+ toId : ` c-m-fbr46mrq/c-m-fbr46mrq-${ namespace } - owner` ,
98174 toType : 'management.cattle.io.clusterroletemplatebinding' ,
99175 rel : 'applies' ,
100176 state : 'active' ,
101177 message : 'Resource is current'
102178 } ,
103179 {
104- toId : `fleet-default /${ clusterName } ` ,
180+ toId : `${ namespace } /${ clusterName } ` ,
105181 toType : 'cluster.x-k8s.io.cluster' ,
106182 rel : 'owner' ,
107183 state : 'provisioned'
108184 } ,
109185 {
110- toId : `fleet-default /${ clusterName } ` ,
186+ toId : `${ namespace } /${ clusterName } ` ,
111187 toType : 'fleet.cattle.io.cluster' ,
112188 rel : 'applies' ,
113189 state : 'waitcheckin'
114190 } ,
115191 {
116- toId : 'c-m-fbr46mrq' ,
192+ toId : ` ${ clusterName } ` ,
117193 toType : 'management.cattle.io.cluster' ,
118194 rel : 'applies' ,
119195 state : 'active' ,
120196 message : 'Resource is Ready'
121197 } ,
122198 {
123- toId : `fleet-default /crt-${ clusterName } -cluster-member` ,
199+ toId : `${ namespace } /crt-${ clusterName } -cluster-member` ,
124200 toType : 'rbac.authorization.k8s.io.role' ,
125201 rel : 'owner' ,
126202 state : 'active' ,
127203 message : 'Resource is current'
128204 } ,
129205 {
130- toId : `fleet-default /${ clusterName } -managed-system-agent` ,
206+ toId : `${ namespace } /${ clusterName } -managed-system-agent` ,
131207 toType : 'fleet.cattle.io.bundle' ,
132208 rel : 'owner' ,
133209 state : 'waitapplied'
134210 } ,
135211 {
136- toId : `fleet-default /r-cluster-${ clusterName } -view-p-d27qf-creator-proje-e42dc` ,
212+ toId : `${ namespace } /r-cluster-${ clusterName } -view-p-d27qf-creator-proje-e42dc` ,
137213 toType : 'rbac.authorization.k8s.io.rolebinding' ,
138214 rel : 'owner' ,
139215 state : 'active' ,
140216 message : 'Resource is current'
141217 } ,
142218 {
143- toId : `fleet-default /${ clusterName } -kubeconfig` ,
219+ toId : `${ namespace } /${ clusterName } -kubeconfig` ,
144220 toType : 'secret' ,
145221 rel : 'owner' ,
146222 state : 'active' ,
@@ -228,7 +304,7 @@ export function clusterProvDigitalOceanSingleResponse(clusterName: string, cloud
228304 status : {
229305 agentDeployed : true ,
230306 clientSecretName : `${ clusterName } -kubeconfig` ,
231- clusterName : 'c-m-fbr46mrq' ,
307+ clusterName : ` ${ clusterName } ` ,
232308 conditions : [
233309 {
234310 error : false ,
0 commit comments