Skip to content

Commit

Permalink
switched to patch instead of replace for updates
Browse files Browse the repository at this point in the history
  • Loading branch information
xadhatter committed Nov 30, 2023
1 parent 55e66fc commit 7d74612
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Compress binary
FROM ghcr.io/xigxog/upx:4.2.0 AS upx
FROM ghcr.io/xigxog/upx:4.2.1 AS upx

ARG COMPRESS=false

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/xigxog/fox

go 1.21

replace github.com/xigxog/kubefox => ../kubefox

require (
github.com/cli/oauth v1.0.1
github.com/docker/docker v24.0.7+incompatible
Expand Down
8 changes: 8 additions & 0 deletions internal/kubernetes/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ func (c *Client) Apply(ctx context.Context, obj client.Object) error {
return c.Client.Apply(ctx, obj, opts...)
}

func (c *Client) Merge(ctx context.Context, modified, original client.Object) error {
opts := []client.PatchOption{}
if c.cfg.Flags.DryRun {
opts = append(opts, client.DryRunAll)
}
return c.Client.Merge(ctx, modified, original, opts...)
}

func (r *Client) ListPlatforms(ctx context.Context) ([]v1alpha1.Platform, error) {
pList := &v1alpha1.PlatformList{}
if err := r.Client.List(ctx, pList); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/repo/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (r *repo) Deploy(name string, skipImageCheck bool) *v1alpha1.AppDeployment
}
log.VerboseMarshal(d, "AppDeployment:")

if err := r.k8s.Upsert(ctx, d); err != nil {
if err := r.k8s.Merge(ctx, d, nil); err != nil {
log.Fatal("%v", err)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/repo/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (r *repo) Release(appDepId string) *v1alpha1.Release {
},
}

if err := r.k8s.Upsert(ctx, rel); err != nil {
if err := r.k8s.Apply(ctx, rel); err != nil {
log.Fatal("Error creating release: %v", err)
}

Expand Down

0 comments on commit 7d74612

Please sign in to comment.