Merge pull request #2968 from justinsb/make_manifest_rewrite_optional

Add a feature flag for formatting assets
This commit is contained in:
Chris Love 2017-07-17 21:40:22 -06:00 committed by GitHub
commit 43eede3c25
2 changed files with 17 additions and 0 deletions

View File

@ -2,6 +2,15 @@ _This is a WIP document describing changes to the upcoming kops 1.7 release_
# Significant changes # Significant changes
* Manifests are rewritten by default, which includes a normalization phase.
This can make it hard to understand the actual changes (as opposed to just the formatting changes).
A feature flag has been added, `export KOPS_FEATURE_FLAGS="-RewriteManifests"` which can be used
to disable manifest rewriting. A recommendation: you can run `kops update` twice, once without
manifest formatting to show the real changes, and then immediately afterwards with manifest changes,
which will be just formatting changes. Run `KOPS_FEATURE_FLAGS="-RewriteManifests" kops update cluster`,
to show the real changes, apply them with `KOPS_FEATURE_FLAGS="-RewriteManifests" kops update cluster --yes`,
then run `kops update cluster` to show the formatting changes, followed by `kops update cluster --yes`
* Default disk size increased to 64GB (masters) and 128GB (nodes). This does have a higher cost, but also gives us more inodes & more iops (and more disk space, of course!) * Default disk size increased to 64GB (masters) and 128GB (nodes). This does have a higher cost, but also gives us more inodes & more iops (and more disk space, of course!)
* Calico now configured with the correct pod CIDR: #2768. Please refer to the *Required Actions* section for details regarding this. * Calico now configured with the correct pod CIDR: #2768. Please refer to the *Required Actions* section for details regarding this.

View File

@ -22,9 +22,14 @@ import (
"os" "os"
"strings" "strings"
"k8s.io/kops/pkg/featureflag"
"k8s.io/kops/pkg/kubemanifest" "k8s.io/kops/pkg/kubemanifest"
) )
// RewriteManifests controls whether we rewrite manifests
// Because manifest rewriting converts everything to and from YAML, we normalize everything by doing so
var RewriteManifests = featureflag.New("RewriteManifests", featureflag.Bool(true))
// AssetBuilder discovers and remaps assets // AssetBuilder discovers and remaps assets
type AssetBuilder struct { type AssetBuilder struct {
Assets []*Asset Assets []*Asset
@ -40,6 +45,9 @@ func NewAssetBuilder() *AssetBuilder {
} }
func (a *AssetBuilder) RemapManifest(data []byte) ([]byte, error) { func (a *AssetBuilder) RemapManifest(data []byte) ([]byte, error) {
if !RewriteManifests.Enabled() {
return data, nil
}
manifests, err := kubemanifest.LoadManifestsFrom(data) manifests, err := kubemanifest.LoadManifestsFrom(data)
if err != nil { if err != nil {
return nil, err return nil, err