@@ -31,6 +31,8 @@ import (
3131 "sigs.k8s.io/controller-runtime/pkg/client"
3232 "sigs.k8s.io/controller-runtime/pkg/manager"
3333 "sigs.k8s.io/yaml"
34+
35+ capikops "k8s.io/kops/clusterapi/controlplane/kops/api/v1beta1"
3436)
3537
3638// NewClusterReconciler is the constructor for an ClusterReconciler
@@ -163,7 +165,7 @@ func (s *clusterScope) applyGCPCluster(ctx context.Context, kube client.Client)
163165 return nil
164166}
165167
166- func (s * clusterScope ) findSystemEndpoints (ctx context.Context ) ([]map [ string ] any , error ) {
168+ func (s * clusterScope ) findSystemEndpoints (ctx context.Context ) ([]capikops. SystemEndpoint , error ) {
167169 cluster := s .Cluster
168170
169171 clusterInternal := & kops.Cluster {}
@@ -183,38 +185,38 @@ func (s *clusterScope) findSystemEndpoints(ctx context.Context) ([]map[string]an
183185 return nil , fmt .Errorf ("error getting ingress status: %v" , err )
184186 }
185187
186- var targets []map [ string ] any
188+ var targets []capikops. SystemEndpoint
187189
188190 for _ , ingress := range ingresses {
189- target := make ( map [ string ] any )
191+ var target capikops. SystemEndpoint
190192 if ingress .Hostname != "" {
191- target [ "host" ] = ingress .Hostname
193+ target . Endpoint = ingress .Hostname
192194 }
193195 if ingress .IP != "" {
194- target [ "host" ] = ingress .IP
196+ target . Endpoint = ingress .IP
195197 }
196- target [ "type" ] = "kops-controller"
198+ target . Type = capikops . SystemEndpointTypeKopsController
197199 if ingress .InternalEndpoint {
198- target [ "scope" ] = "internal"
200+ target . Scope = capikops . SystemEndpointScopeInternal
199201 } else {
200- target [ "scope" ] = "global"
202+ target . Scope = capikops . SystemEndpointScopeExternal
201203 }
202204 targets = append (targets , target )
203205 }
204206
205207 for _ , ingress := range ingresses {
206- target := make ( map [ string ] any )
208+ var target capikops. SystemEndpoint
207209 if ingress .Hostname != "" {
208- target [ "host" ] = ingress .Hostname
210+ target . Endpoint = ingress .Hostname
209211 }
210212 if ingress .IP != "" {
211- target [ "host" ] = ingress .IP
213+ target . Endpoint = ingress .IP
212214 }
213- target [ "type" ] = "kube-apiserver"
215+ target . Type = capikops . SystemEndpointTypeKubeAPIServer
214216 if ingress .InternalEndpoint {
215- target [ "scope" ] = "internal"
217+ target . Scope = capikops . SystemEndpointScopeInternal
216218 } else {
217- target [ "scope" ] = "global"
219+ target . Scope = capikops . SystemEndpointScopeExternal
218220 }
219221 targets = append (targets , target )
220222 }
@@ -234,17 +236,17 @@ func (s *clusterScope) createKopsControlPlane(ctx context.Context, kube client.C
234236 // TODO: cloud-provider-gcp should not assume cluster name is a valid prefix
235237 name := gce .SafeClusterName (s .Cluster .GetName ())
236238
237- status := map [ string ] any {}
239+ status := capikops. KopsControlPlaneStatus {}
238240
239241 systemEndpoints , err := s .findSystemEndpoints (ctx )
240242 if err != nil {
241243 return err
242244 }
243- status [ "systemEndpoints" ] = systemEndpoints
245+ status . SystemEndpoints = systemEndpoints
244246
245- status [ "initialization" ] = map [ string ] any {
246- " controlPlaneInitialized" : true ,
247- }
247+ status . Initialization = capikops. KopsControlPlaneInitializationStatus {}
248+ controlPlaneInitialized := true
249+ status . Initialization . ControlPlaneInitialized = & controlPlaneInitialized
248250
249251 // Create secret
250252 {
0 commit comments