mirror of
https://github.com/paralus/paralus.git
synced 2026-05-08 09:27:02 +00:00
changes to support cluster proxy config
This commit is contained in:
@@ -119,12 +119,6 @@ func (s *clusterService) Create(ctx context.Context, cluster *infrav3.Cluster) (
|
||||
return &infrav3.Cluster{}, err
|
||||
}
|
||||
|
||||
/*reqAuth, err := c.requestAuth(r, ctx, ps)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusUnauthorized)
|
||||
returnrequestAuth
|
||||
}*/
|
||||
|
||||
if cluster.Metadata.Name == "" {
|
||||
return &infrav3.Cluster{}, fmt.Errorf("invalid cluster data, name is missing")
|
||||
}
|
||||
@@ -237,6 +231,11 @@ func (s *clusterService) Create(ctx context.Context, cluster *infrav3.Cluster) (
|
||||
|
||||
cluster.Spec.ClusterData.Health = infrav3.Health_EDGE_IGNORE
|
||||
|
||||
if cluster.Spec.Params != nil {
|
||||
prmssByts, _ := json.Marshal(cluster.Spec.Params)
|
||||
edb.Extra = json.RawMessage(prmssByts)
|
||||
}
|
||||
|
||||
tx, err := s.db.BeginTx(ctx, &sql.TxOptions{})
|
||||
if err != nil {
|
||||
return &infrav3.Cluster{}, err
|
||||
@@ -435,6 +434,10 @@ func (s *clusterService) prepareClusterResponse(ctx context.Context, clstr *infr
|
||||
if c.ProxyConfig != nil {
|
||||
json.Unmarshal(c.ProxyConfig, &proxy)
|
||||
}
|
||||
var params infrav3.ProvisionParams
|
||||
if c.Extra != nil {
|
||||
json.Unmarshal(c.Extra, ¶ms)
|
||||
}
|
||||
var pcs []*infrav3.ProjectCluster
|
||||
if len(projects) > 0 {
|
||||
pcs = make([]*infrav3.ProjectCluster, len(projects)-1)
|
||||
@@ -454,6 +457,7 @@ func (s *clusterService) prepareClusterResponse(ctx context.Context, clstr *infr
|
||||
OverrideSelector: c.OverrideSelector,
|
||||
ShareMode: infrav3.ClusterShareMode(sm),
|
||||
ProxyConfig: &proxy,
|
||||
Params: ¶ms,
|
||||
ClusterData: &infrav3.ClusterData{
|
||||
ClusterBlueprint: c.BlueprintRef,
|
||||
Projects: pcs,
|
||||
@@ -558,6 +562,11 @@ func (s *clusterService) Update(ctx context.Context, cluster *infrav3.Cluster) (
|
||||
cdb.ProxyConfig = json.RawMessage(pcfgsByts)
|
||||
}
|
||||
|
||||
if cluster.Spec.Params != nil {
|
||||
prmsByts, _ := json.Marshal(cluster.Spec.Params)
|
||||
cdb.Extra = json.RawMessage(prmsByts)
|
||||
}
|
||||
|
||||
if cluster.Spec.ClusterData != nil {
|
||||
cdb.BlueprintRef = cluster.Spec.ClusterData.ClusterBlueprint
|
||||
if cluster.Spec.ClusterData.ClusterStatus != nil {
|
||||
|
||||
Reference in New Issue
Block a user