in internal/node/hybrid/configenricher.go [56:89]
func (hnp *HybridNodeProvider) ensureClusterDetails(ctx context.Context) error {
cluster, err := hnp.getCluster(ctx)
if err != nil {
return err
}
if cluster.Status != types.ClusterStatusActive {
return errors.New("eks cluster is not active")
}
if cluster.RemoteNetworkConfig == nil {
return errors.New("eks cluster does not have remoteNetworkConfig enabled, which is required for Hybrid Nodes")
}
if hnp.nodeConfig.Spec.Cluster.APIServerEndpoint == "" {
hnp.nodeConfig.Spec.Cluster.APIServerEndpoint = *cluster.Endpoint
}
if hnp.nodeConfig.Spec.Cluster.CertificateAuthority == nil {
// CertificateAuthority from describeCluster api call returns base64 encoded data as a string
// Decoding the string to byte array ensures the proper data format when writing to file
decoded, err := base64.StdEncoding.DecodeString(*cluster.CertificateAuthority.Data)
if err != nil {
return err
}
hnp.nodeConfig.Spec.Cluster.CertificateAuthority = decoded
}
if hnp.nodeConfig.Spec.Cluster.CIDR == "" {
hnp.nodeConfig.Spec.Cluster.CIDR = *cluster.KubernetesNetworkConfig.ServiceIpv4Cidr
}
return nil
}