Skip to content

Commit ab282e6

Browse files
committed
remove the Dataserver dependency since functions have moved to sdc-protos
1 parent 8bb2a4d commit ab282e6

File tree

4 files changed

+15
-32
lines changed

4 files changed

+15
-32
lines changed

go.mod

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ require (
2525
github.com/prometheus/client_golang v1.23.0
2626
github.com/prometheus/client_model v0.6.2
2727
github.com/prometheus/prometheus v0.300.1
28-
github.com/sdcio/data-server v0.0.62
2928
github.com/sdcio/sdc-protos v0.0.44
3029
github.com/spf13/cobra v1.9.1
3130
github.com/stretchr/testify v1.10.0
@@ -59,7 +58,6 @@ require (
5958
github.com/NYTimes/gziphandler v1.1.1 // indirect
6059
github.com/ProtonMail/go-crypto v1.0.0 // indirect
6160
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
62-
github.com/beevik/etree v1.5.1 // indirect
6361
github.com/beorn7/perks v1.0.1 // indirect
6462
github.com/blang/semver/v4 v4.0.0 // indirect
6563
github.com/bufbuild/protocompile v0.14.1 // indirect
@@ -125,10 +123,7 @@ require (
125123
github.com/prometheus/common v0.65.0 // indirect
126124
github.com/prometheus/procfs v0.16.1 // indirect
127125
github.com/rogpeppe/go-internal v1.14.1 // indirect
128-
github.com/sdcio/cache v0.0.38 // indirect
129-
github.com/sdcio/schema-server v0.0.31 // indirect
130126
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
131-
github.com/sirupsen/logrus v1.9.3 // indirect
132127
github.com/skeema/knownhosts v1.2.2 // indirect
133128
github.com/spf13/pflag v1.0.6 // indirect
134129
github.com/stoewer/go-strcase v1.3.0 // indirect
@@ -165,7 +160,6 @@ require (
165160
gopkg.in/inf.v0 v0.9.1 // indirect
166161
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
167162
gopkg.in/warnings.v0 v0.1.2 // indirect
168-
gopkg.in/yaml.v2 v2.4.0 // indirect
169163
gopkg.in/yaml.v3 v3.0.1 // indirect
170164
k8s.io/apiextensions-apiserver v0.32.1 // indirect
171165
k8s.io/gengo/v2 v2.0.0-20250207200755-1244d31929d7 // indirect

go.sum

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYW
2121
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
2222
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
2323
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
24-
github.com/beevik/etree v1.5.1 h1:TC3zyxYp+81wAmbsi8SWUpZCurbxa6S8RITYRSkNRwo=
25-
github.com/beevik/etree v1.5.1/go.mod h1:gPNJNaBGVZ9AwsidazFZyygnd+0pAU38N4D+WemwKNs=
2624
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
2725
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
2826
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
@@ -244,12 +242,6 @@ github.com/prometheus/prometheus v0.300.1/go.mod h1:gtTPY/XVyCdqqnjA3NzDMb0/nc5H
244242
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
245243
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
246244
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
247-
github.com/sdcio/cache v0.0.38 h1:8meykZC/DAgzKI+R3GtZvTs0/OXWRCeNN5mxVKG0Ba8=
248-
github.com/sdcio/cache v0.0.38/go.mod h1:PHJd4pTmfFZBLdPohtXJAVBNmAKhhKdZHTi3MejGrk0=
249-
github.com/sdcio/data-server v0.0.62 h1:1nHjm8e+zC1O+7sK7g+tDF00p6ZQGXddyQqjj3YABLM=
250-
github.com/sdcio/data-server v0.0.62/go.mod h1:pDM51uL89Bo7mQXBcJc72vn4XxdKu5xInD+7o7E4L4Q=
251-
github.com/sdcio/schema-server v0.0.31 h1:gWSSDvyzwWy2xYu2TCQdXYvqCA0gg3RhYKb9PplYeD4=
252-
github.com/sdcio/schema-server v0.0.31/go.mod h1:qa2bbfKyR4bHeZ85hicRpD4d+VtiPp9xs9/ey3shqZg=
253245
github.com/sdcio/sdc-protos v0.0.44 h1:YIvP4b4QPGtFJ90QlImGAturBun6vDgeGrynFLGxbgM=
254246
github.com/sdcio/sdc-protos v0.0.44/go.mod h1:i7eqaPKkw3bVaK3kLOgrnHvuphUQtRCXrDH0grX5n8w=
255247
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
@@ -275,7 +267,6 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/
275267
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
276268
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
277269
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
278-
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
279270
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
280271
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
281272
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=

pkg/target/context.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
"github.com/sdcio/config-server/apis/config"
3333
invv1alpha1 "github.com/sdcio/config-server/apis/inv/v1alpha1"
3434
dsclient "github.com/sdcio/config-server/pkg/sdc/dataserver/client"
35-
"github.com/sdcio/data-server/pkg/utils"
3635
sdcpb "github.com/sdcio/sdc-protos/sdcpb"
3736
"google.golang.org/grpc"
3837
"google.golang.org/grpc/codes"
@@ -271,7 +270,7 @@ func (r *Context) getIntentUpdate(ctx context.Context, key storebackend.Key, con
271270
}
272271

273272
for _, config := range configSpec {
274-
path, err := utils.ParsePath(config.Path)
273+
path, err := sdcpb.ParsePath(config.Path)
275274
if err != nil {
276275
return nil, fmt.Errorf("create data failed for target %s, path %s invalid", key.String(), config.Path)
277276
}
@@ -294,7 +293,7 @@ func (r *Context) getDeviationUpdate(ctx context.Context, targetKey storebackend
294293

295294
for _, deviation := range deviation.Spec.Deviations {
296295
if deviation.Reason == "NOT_APPLIED" {
297-
path, err := utils.ParsePath(deviation.Path)
296+
path, err := sdcpb.ParsePath(deviation.Path)
298297
if err != nil {
299298
return nil, fmt.Errorf("deviation path parsing failed forr target %s, path %s invalid", targetKey.String(), deviation.Path)
300299
}
@@ -304,7 +303,7 @@ func (r *Context) getDeviationUpdate(ctx context.Context, targetKey storebackend
304303
log.Error("deviation proto unmarshal failed", "key", targetKey.String(), "path", deviation.Path, "currentValue", deviation.CurrentValue)
305304
continue
306305
//return nil, fmt.Errorf("create data failed for target %s, val %s invalid", key.String(), deviation.CurrentValue)
307-
}
306+
}
308307

309308
//val, err := parse_value((deviation.CurrentValue))
310309
//if err != nil {
@@ -396,7 +395,7 @@ func (r *Context) TransactionSet(ctx context.Context, req *sdcpb.TransactionSetR
396395
if req.DryRun {
397396
return msg, nil
398397
}
399-
398+
400399
if err := r.TransactionConfirm(ctx, req.DatastoreName, req.TransactionId); err != nil {
401400
return msg, err
402401
}
@@ -492,11 +491,11 @@ func (r *Context) DeleteIntent(ctx context.Context, key storebackend.Key, config
492491
Timeout: ptr.To(int32(60)),
493492
Intents: []*sdcpb.TransactionIntent{
494493
{
495-
Intent: GetGVKNSN(config),
496-
Priority: int32(config.Spec.Priority),
497-
Delete: true,
494+
Intent: GetGVKNSN(config),
495+
Priority: int32(config.Spec.Priority),
496+
Delete: true,
498497
DeleteIgnoreNoExist: true,
499-
Orphan: config.Orphan(),
498+
Orphan: config.Orphan(),
500499
},
501500
},
502501
})
@@ -611,9 +610,9 @@ func (r *Context) SetIntents(
611610
deviationsToDeleteSet.Insert(key)
612611
// only include items for which deviations exist
613612
intents = append(intents, &sdcpb.TransactionIntent{
614-
Intent: fmt.Sprintf("deviation:%s", GetGVKNSN(deviation)),
613+
Intent: fmt.Sprintf("deviation:%s", GetGVKNSN(deviation)),
615614
//Priority: int32(config.Spec.Priority),
616-
Delete: true,
615+
Delete: true,
617616
DeleteIgnoreNoExist: true,
618617
})
619618
}
@@ -633,9 +632,9 @@ func (r *Context) SetIntents(
633632
for key, config := range configsToDelete {
634633
configsToDeleteSet.Insert(key)
635634
intents = append(intents, &sdcpb.TransactionIntent{
636-
Intent: GetGVKNSN(config),
635+
Intent: GetGVKNSN(config),
637636
//Priority: int32(config.Spec.Priority),
638-
Delete: true,
637+
Delete: true,
639638
DeleteIgnoreNoExist: true,
640639
})
641640
}

pkg/target/deviation_watcher.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
"k8s.io/apimachinery/pkg/types"
3535

3636
//"k8s.io/utils/ptr"
37-
"github.com/sdcio/data-server/pkg/utils"
37+
3838
"sigs.k8s.io/controller-runtime/pkg/client"
3939
)
4040

@@ -246,16 +246,15 @@ func (r *DeviationWatcher) processConfigDeviations(
246246
}
247247
}
248248

249-
250249
func ConvertSdcpbDeviations2ConfigDeviations(devs []*sdcpb.WatchDeviationResponse) []configv1alpha1.ConfigDeviation {
251250
deviations := make([]configv1alpha1.ConfigDeviation, 0, len(devs))
252251
for _, dev := range devs {
253252
deviations = append(deviations, configv1alpha1.ConfigDeviation{
254-
Path: utils.ToXPath(dev.GetPath(), false),
253+
Path: dev.GetPath().ToXPath(false),
255254
DesiredValue: dev.GetExpectedValue().String(),
256255
CurrentValue: dev.GetCurrentValue().String(),
257256
Reason: dev.GetReason().String(),
258257
})
259258
}
260259
return deviations
261-
}
260+
}

0 commit comments

Comments
 (0)