Skip to content

Commit

Permalink
use brotli to compress kubecost manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
phyrog committed Sep 30, 2024
1 parent be9e7c5 commit e0bc316
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/controller/lifecycle/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
package lifecycle

import (
"bytes"
"context"
_ "embed"
"errors"
"time"

"github.com/andybalholm/brotli"
"github.com/go-logr/logr"

"github.com/liquid-reply/gardener-extension-shoot-kubecost/kubecost"
Expand Down Expand Up @@ -141,7 +143,15 @@ func getKubeCostConfig(cmData map[string]string) (kubecost.KubeCostConfig, error

func createShootResourceKubeCostInstall(config kubecost.KubeCostConfig) (map[string][]byte, error) {
manifest := kubecost.Render(config)
var buf bytes.Buffer
w := brotli.NewWriterV2(&buf, 7)
if _, err := w.Write(manifest); err != nil {
return nil, err
}
if err := w.Close(); err != nil {
return nil, err
}
return map[string][]byte{
"manifest": manifest,
"kubecost.br": buf.Bytes(),
}, nil
}

0 comments on commit e0bc316

Please sign in to comment.