@@ -58,12 +58,16 @@ func (h *GetRawConfigurationHandlerImpl) Handle(params configuration.GetHAProxyC
5858 return configuration .NewGetConfigurationVersionDefault (int (* e .Code )).WithPayload (e )
5959 }
6060
61- v , data , err := cfg .GetRawConfiguration (t , v )
61+ v , clusterVersion , md5Hash , data , err := cfg .GetRawConfigurationWithClusterData (t , v )
6262 if err != nil {
6363 e := misc .HandleError (err )
6464 return configuration .NewGetHAProxyConfigurationDefault (int (* e .Code )).WithPayload (e )
6565 }
66- return configuration .NewGetHAProxyConfigurationOK ().WithPayload (& configuration.GetHAProxyConfigurationOKBody {Version : v , Data : & data })
66+ cVersion := ""
67+ if clusterVersion != 0 {
68+ cVersion = strconv .FormatInt (clusterVersion , 10 )
69+ }
70+ return configuration .NewGetHAProxyConfigurationOK ().WithPayload (& configuration.GetHAProxyConfigurationOKBody {Version : v , Data : & data }).WithClusterVersion (cVersion ).WithConfigurationChecksum (md5Hash )
6771}
6872
6973// Handle executing the request and returning a response
@@ -115,9 +119,19 @@ func (h *PostRawConfigurationHandlerImpl) Handle(params configuration.PostHAProx
115119 return configuration .NewPostHAProxyConfigurationDefault (int (* e .Code )).WithPayload (e )
116120 }
117121
122+ _ , clusterVersion , md5Hash , data , err := cfg .GetRawConfigurationWithClusterData ("" , 0 )
123+ if err != nil {
124+ e := misc .HandleError (err )
125+ return configuration .NewPostHAProxyConfigurationDefault (int (* e .Code )).WithPayload (e )
126+ }
127+
128+ cVersion := ""
129+ if clusterVersion != 0 {
130+ cVersion = strconv .FormatInt (clusterVersion , 10 )
131+ }
118132 if onlyValidate {
119133 // return here without reloading, since config is only validated.
120- return configuration .NewPostHAProxyConfigurationAccepted ().WithPayload (params . Data )
134+ return configuration .NewPostHAProxyConfigurationAccepted ().WithPayload (data ). WithClusterVersion ( cVersion ). WithConfigurationChecksum ( md5Hash )
121135 }
122136 if skipReload {
123137 if params .XRuntimeActions != nil {
@@ -126,7 +140,7 @@ func (h *PostRawConfigurationHandlerImpl) Handle(params configuration.PostHAProx
126140 return configuration .NewPostHAProxyConfigurationDefault (int (* e .Code )).WithPayload (e )
127141 }
128142 }
129- return configuration .NewPostHAProxyConfigurationCreated ().WithPayload (params . Data )
143+ return configuration .NewPostHAProxyConfigurationCreated ().WithPayload (data ). WithClusterVersion ( cVersion ). WithConfigurationChecksum ( md5Hash )
130144 }
131145 if forceReload {
132146 var callbackNeeded bool
@@ -145,7 +159,7 @@ func (h *PostRawConfigurationHandlerImpl) Handle(params configuration.PostHAProx
145159 e := misc .HandleError (err )
146160 return configuration .NewPostHAProxyConfigurationDefault (int (* e .Code )).WithPayload (e )
147161 }
148- return configuration .NewPostHAProxyConfigurationCreated ().WithPayload (params . Data )
162+ return configuration .NewPostHAProxyConfigurationCreated ().WithPayload (data ). WithClusterVersion ( cVersion ). WithConfigurationChecksum ( md5Hash )
149163 }
150164 callbackNeeded , reconfigureFunc , err := cn .ReconfigureRuntime (h .Client , runtimeAPIsOld )
151165 if err != nil {
@@ -160,7 +174,7 @@ func (h *PostRawConfigurationHandlerImpl) Handle(params configuration.PostHAProx
160174 rID = h .ReloadAgent .Reload ()
161175 }
162176
163- return configuration .NewPostHAProxyConfigurationAccepted ().WithReloadID (rID ).WithPayload (params . Data )
177+ return configuration .NewPostHAProxyConfigurationAccepted ().WithReloadID (rID ).WithPayload (data ). WithClusterVersion ( cVersion ). WithConfigurationChecksum ( md5Hash )
164178}
165179
166180func executeRuntimeActions (actionsStr string , client client_native.HAProxyClient ) error {
0 commit comments