@@ -65,6 +65,7 @@ type ClusterBean struct {
6565 Id int `json:"id" validate:"number"`
6666 ClusterName string `json:"cluster_name,omitempty" validate:"required"`
6767 ServerUrl string `json:"server_url,omitempty" validate:"url,required"`
68+ ProxyUrl string `json:"proxyUrl,omitempty" validate:"omitempty,url"`
6869 PrometheusUrl string `json:"prometheus_url,omitempty" validate:"validate-non-empty-url"`
6970 Active bool `json:"active"`
7071 Config map [string ]string `json:"config,omitempty"`
@@ -87,6 +88,7 @@ func GetClusterBean(model repository.Cluster) ClusterBean {
8788 bean .Id = model .Id
8889 bean .ClusterName = model .ClusterName
8990 bean .ServerUrl = model .ServerUrl
91+ bean .ProxyUrl = model .ProxyUrl
9092 bean .PrometheusUrl = model .PrometheusEndpoint
9193 bean .AgentInstallationStage = model .AgentInstallationStage
9294 bean .Active = model .Active
@@ -120,8 +122,9 @@ type PrometheusAuth struct {
120122func (bean ClusterBean ) GetClusterConfig () (* k8s.ClusterConfig , error ) {
121123 host := bean .ServerUrl
122124 configMap := bean .Config
125+ proxyUrl := bean .ProxyUrl
123126 bearerToken := configMap [k8s .BearerToken ]
124- clusterCfg := & k8s.ClusterConfig {Host : host , BearerToken : bearerToken }
127+ clusterCfg := & k8s.ClusterConfig {Host : host , BearerToken : bearerToken , ProxyUrl : proxyUrl }
125128 clusterCfg .InsecureSkipTLSVerify = bean .InsecureSkipTLSVerify
126129 if bean .InsecureSkipTLSVerify == false {
127130 clusterCfg .KeyData = configMap [k8s .TlsKey ]
@@ -226,7 +229,7 @@ func (impl *ClusterServiceImpl) ConvertClusterBeanToCluster(clusterBean *Cluster
226229 model .Config = clusterBean .Config
227230 model .PrometheusEndpoint = clusterBean .PrometheusUrl
228231 model .InsecureSkipTlsVerify = clusterBean .InsecureSkipTLSVerify
229-
232+ model . ProxyUrl = clusterBean . ProxyUrl
230233 if clusterBean .PrometheusAuth != nil {
231234 model .PUserName = clusterBean .PrometheusAuth .UserName
232235 model .PPassword = clusterBean .PrometheusAuth .Password
@@ -475,7 +478,9 @@ func (impl *ClusterServiceImpl) Update(ctx context.Context, bean *ClusterBean, u
475478 bean .Config [k8s .CertificateAuthorityData ] = model .Config [k8s .CertificateAuthorityData ]
476479 }
477480
478- if bean .ServerUrl != model .ServerUrl || bean .InsecureSkipTLSVerify != model .InsecureSkipTlsVerify || dbConfigBearerToken != requestConfigBearerToken || dbConfigTlsKey != requestConfigTlsKey || dbConfigCertData != requestConfigCertData || dbConfigCAData != requestConfigCAData {
481+ if bean .ServerUrl != model .ServerUrl || bean .ProxyUrl != model .ProxyUrl ||
482+ bean .InsecureSkipTLSVerify != model .InsecureSkipTlsVerify || dbConfigBearerToken != requestConfigBearerToken ||
483+ dbConfigTlsKey != requestConfigTlsKey || dbConfigCertData != requestConfigCertData || dbConfigCAData != requestConfigCAData {
479484 if bean .ClusterName == DEFAULT_CLUSTER {
480485 impl .logger .Errorw ("default_cluster is reserved by the system and cannot be updated, default_cluster" , "name" , bean .ClusterName )
481486 return nil , fmt .Errorf ("default_cluster is reserved by the system and cannot be updated" )
@@ -491,7 +496,7 @@ func (impl *ClusterServiceImpl) Update(ctx context.Context, bean *ClusterBean, u
491496 model .ServerUrl = bean .ServerUrl
492497 model .InsecureSkipTlsVerify = bean .InsecureSkipTLSVerify
493498 model .PrometheusEndpoint = bean .PrometheusUrl
494-
499+ model . ProxyUrl = bean . ProxyUrl
495500 if bean .PrometheusAuth != nil {
496501 if bean .PrometheusAuth .UserName != "" {
497502 model .PUserName = bean .PrometheusAuth .UserName
@@ -612,6 +617,7 @@ func (impl *ClusterServiceImpl) SyncNsInformer(bean *ClusterBean) {
612617 ClusterName : bean .ClusterName ,
613618 BearerToken : requestConfig ,
614619 ServerUrl : bean .ServerUrl ,
620+ ProxyUrl : bean .ProxyUrl ,
615621 InsecureSkipTLSVerify : bean .InsecureSkipTLSVerify ,
616622 }
617623 if ! bean .InsecureSkipTLSVerify {
@@ -668,6 +674,7 @@ func (impl *ClusterServiceImpl) buildInformer() {
668674 ClusterName : model .ClusterName ,
669675 BearerToken : bearerToken ,
670676 ServerUrl : model .ServerUrl ,
677+ ProxyUrl : model .ProxyUrl ,
671678 InsecureSkipTLSVerify : model .InsecureSkipTlsVerify ,
672679 KeyData : model .Config [k8s .TlsKey ],
673680 CertData : model .Config [k8s .CertData ],
@@ -1023,6 +1030,7 @@ func (impl *ClusterServiceImpl) ValidateKubeconfig(kubeConfig string) (map[strin
10231030
10241031 if clusterObj != nil {
10251032 clusterBeanObject .InsecureSkipTLSVerify = clusterObj .InsecureSkipTLSVerify
1033+ clusterBeanObject .ProxyUrl = clusterObj .ProxyURL
10261034 }
10271035
10281036 if (clusterObj != nil ) && ! clusterObj .InsecureSkipTLSVerify && (clusterBeanObject .ErrorInConnecting == "" ) {
0 commit comments