@@ -17,13 +17,15 @@ package handlers
1717
1818import (
1919 "fmt"
20+ "path"
2021 "strconv"
2122
2223 "github.com/go-openapi/runtime/middleware"
2324 "github.com/google/renameio"
2425 client_native "github.com/haproxytech/client-native/v2"
2526 "github.com/haproxytech/client-native/v2/misc"
2627 "github.com/haproxytech/client-native/v2/models"
28+ "github.com/haproxytech/client-native/v2/storage"
2729
2830 "github.com/haproxytech/dataplaneapi/configuration"
2931 "github.com/haproxytech/dataplaneapi/haproxy"
@@ -109,6 +111,18 @@ func (h *CreateClusterHandlerImpl) Handle(params cluster.PostClusterParams, prin
109111 if errStorage != nil {
110112 return h .err409 (errStorage , nil )
111113 }
114+ dirs := []storage.FileType {
115+ storage .BackupsType , storage .MapsType , storage .SSLType ,
116+ storage .SpoeTransactionsType , storage .SpoeType ,
117+ storage .TransactionsType ,
118+ storage .FileType ("certs-cluster" ),
119+ }
120+ for _ , dir := range dirs {
121+ _ , errStorage := misc .CheckOrCreateWritableDirectory (path .Join (storageDir , string (dir )))
122+ if errStorage != nil {
123+ return h .err409 (errStorage , nil )
124+ }
125+ }
112126 h .Config .Cluster .StorageDir .Store (storageDir )
113127 }
114128
0 commit comments