Skip to content

Commit 6075203

Browse files
authored
Merge pull request #11 from aws/revert-9-feature/compress_user_data
Revert "Compress user_data using gzip to avoid to exceed the hard limit (32KB)" I found that CompressData returned an empty byte array. I will fix the issue in the other PR.
2 parents 8f3d016 + 64c269a commit 6075203

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

controllers/cloudstackmachine_controller.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,7 @@ func (r *CloudStackMachineReconciler) reconcile(
167167
if !ok {
168168
return ctrl.Result{}, errors.New("Bootstrap secret data not ok.")
169169
}
170-
171-
compressedValue, err := cloud.CompressData(value)
172-
if err != nil {
173-
log.Error(err, "Failed to compress userData")
174-
return ctrl.Result{}, err
175-
}
176-
177-
userData := base64.StdEncoding.EncodeToString(compressedValue)
170+
userData := base64.StdEncoding.EncodeToString(value)
178171

179172
// Create VM (or Fetch if present). Will set ready to true.
180173
if err := r.CS.GetOrCreateVMInstance(csMachine, machine, csCluster, userData); err == nil {

pkg/cloud/helpers.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,10 @@ limitations under the License.
1616

1717
package cloud
1818

19-
import (
20-
"bytes"
21-
"compress/gzip"
22-
)
23-
2419
type set func(string)
2520

2621
func setIfNotEmpty(str string, setFn set) {
2722
if str != "" {
2823
setFn(str)
2924
}
3025
}
31-
32-
func CompressData(data []byte) ([]byte, error) {
33-
buf := &bytes.Buffer{}
34-
gzipWriter := gzip.NewWriter(buf)
35-
defer gzipWriter.Close()
36-
if _, err := gzipWriter.Write(data); err != nil {
37-
return nil, err
38-
}
39-
return buf.Bytes(), nil
40-
}

0 commit comments

Comments
 (0)