66 "github.com/haproxytech/client-native/v2/models"
77 parser "github.com/haproxytech/config-parser/v4"
88 "github.com/haproxytech/config-parser/v4/types"
9+
10+ "github.com/haproxytech/kubernetes-ingress/controller/utils"
911)
1012
1113func (c * clientNative ) DefaultsGetConfiguration () (defaults * models.Defaults , err error ) {
@@ -50,9 +52,15 @@ func (c *clientNative) GlobalGetLogTargets() (lg models.LogTargets, err error) {
5052 return
5153}
5254
53- func (c * clientNative ) GlobalCreateLogTargets (logTargets models.LogTargets ) error {
55+ func (c * clientNative ) GlobalPushLogTargets (logTargets models.LogTargets ) error {
5456 var err error
5557 c .activeTransactionHasChanges = true
58+ for {
59+ err = c .nativeAPI .Configuration .DeleteLogTarget (0 , "global" , parser .GlobalSectionName , c .activeTransaction , 0 )
60+ if err != nil {
61+ break
62+ }
63+ }
5664 for _ , log := range logTargets {
5765 err = c .nativeAPI .Configuration .CreateLogTarget (string (parser .Global ), parser .GlobalSectionName , log , c .activeTransaction , 0 )
5866 if err != nil {
@@ -62,16 +70,6 @@ func (c *clientNative) GlobalCreateLogTargets(logTargets models.LogTargets) erro
6270 return nil
6371}
6472
65- func (c * clientNative ) GlobalDeleteLogTargets () {
66- c .activeTransactionHasChanges = true
67- for {
68- err := c .nativeAPI .Configuration .DeleteLogTarget (0 , "global" , parser .GlobalSectionName , c .activeTransaction , 0 )
69- if err != nil {
70- break
71- }
72- }
73- }
74-
7573func (c * clientNative ) GlobalGetConfiguration () (* models.Global , error ) {
7674 _ , global , err := c .nativeAPI .Configuration .GetGlobalConfiguration (c .activeTransaction )
7775 if err != nil {
0 commit comments