diff --git a/Gopkg.lock b/Gopkg.lock index 2b39388..53aef1a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -18,6 +18,15 @@ revision = "2d1d76c9013c4feb6695a2346f0e66ea0ef77aa6" version = "v11.3.0-beta" +[[projects]] + branch = "master" + name = "github.com/Azure/go-ansiterm" + packages = [ + ".", + "winterm" + ] + revision = "d6e3b3328b783f23731bc4d058875b0371ff8109" + [[projects]] name = "github.com/Azure/go-autorest" packages = [ @@ -37,6 +46,12 @@ revision = "b26d9c308763d68093482582cea63d69be07a0f0" version = "v0.3.0" +[[projects]] + branch = "master" + name = "github.com/MakeNowJust/heredoc" + packages = ["."] + revision = "e9091a26100e9cfb2b6a8f470085bfa541931a91" + [[projects]] name = "github.com/Masterminds/semver" packages = ["."] @@ -54,6 +69,48 @@ packages = ["."] revision = "5bd2802263f21d8788851d5305584c82a5c75d7e" +[[projects]] + name = "github.com/aws/aws-sdk-go" + packages = [ + "aws", + "aws/awserr", + "aws/awsutil", + "aws/client", + "aws/client/metadata", + "aws/corehandlers", + "aws/credentials", + "aws/credentials/ec2rolecreds", + "aws/credentials/endpointcreds", + "aws/credentials/stscreds", + "aws/csm", + "aws/defaults", + "aws/ec2metadata", + "aws/endpoints", + "aws/request", + "aws/session", + "aws/signer/v4", + "internal/sdkio", + "internal/sdkrand", + "internal/shareddefaults", + "private/protocol", + "private/protocol/ec2query", + "private/protocol/json/jsonutil", + "private/protocol/jsonrpc", + "private/protocol/query", + "private/protocol/query/queryutil", + "private/protocol/rest", + "private/protocol/xml/xmlutil", + "service/autoscaling", + "service/ec2", + "service/ecr", + "service/elb", + "service/elbv2", + "service/kms", + "service/sts" + ] + revision = "47309c012812d9e9c488a54313e5cdfa7479df93" + version = "v1.14.1" + [[projects]] name = "github.com/beorn7/perks" packages = ["quantile"] @@ -90,7 +147,9 @@ "api/types/strslice", "api/types/swarm", "api/types/swarm/runtime", - "api/types/versions" + "api/types/versions", + "pkg/term", + "pkg/term/windows" ] revision = "4f3616fb1c112e206b88cb7a9922bf49067a7756" @@ -121,12 +180,6 @@ ] revision = "09691a3b6378b740595c1002f40c34dd5f218a22" -[[projects]] - name = "github.com/emicklei/go-restful-swagger12" - packages = ["."] - revision = "dcef7f55730566d41eae5db10e7d6981829720f6" - version = "1.0.1" - [[projects]] branch = "master" name = "github.com/evanphx/json-patch" @@ -150,6 +203,12 @@ revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7" version = "v1.0.0" +[[projects]] + name = "github.com/go-ini/ini" + packages = ["."] + revision = "06f5f3d67269ccec1fe5fe4134ba6e982984f7f5" + version = "v1.37.0" + [[projects]] name = "github.com/go-openapi/jsonpointer" packages = ["."] @@ -212,7 +271,8 @@ "ptypes/duration", "ptypes/timestamp" ] - revision = "2bba0603135d7d7f5cb73b2125beeda19c09f4ef" + revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" + version = "v1.1.0" [[projects]] name = "github.com/google/btree" @@ -279,6 +339,11 @@ revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" version = "v1.0" +[[projects]] + name = "github.com/jmespath/go-jmespath" + packages = ["."] + revision = "0b12d6b5" + [[projects]] name = "github.com/json-iterator/go" packages = ["."] @@ -321,6 +386,12 @@ packages = ["."] revision = "9520e82c474b0a04dd04f8a40959027271bab992" +[[projects]] + branch = "master" + name = "github.com/mitchellh/go-wordwrap" + packages = ["."] + revision = "ad45545899c7b13c020ea92b2072220eefad42b8" + [[projects]] name = "github.com/opencontainers/go-digest" packages = ["."] @@ -385,6 +456,12 @@ ] revision = "65c1f6f8f0fc1e2185eb9863a3bc751496404259" +[[projects]] + name = "github.com/russross/blackfriday" + packages = ["."] + revision = "55d61fa8aa702f59229e6cff85793c22e580eaf5" + version = "v1.5.1" + [[projects]] name = "github.com/sirupsen/logrus" packages = ["."] @@ -510,24 +587,45 @@ ] revision = "9d8544a6b2c7df9cff240fcf92d7b2f59bc13416" +[[projects]] + name = "google.golang.org/genproto" + packages = ["googleapis/rpc/status"] + revision = "09f6ed296fc66555a25fe4ce95173148778dfa85" + [[projects]] name = "google.golang.org/grpc" packages = [ ".", + "balancer", "codes", + "connectivity", "credentials", + "grpclb/grpc_lb_v1/messages", "grpclog", + "health/grpc_health_v1", "internal", "keepalive", "metadata", "naming", "peer", + "resolver", "stats", + "status", "tap", "transport" ] - revision = "8050b9cbc271307e5a716a9d782803d09b0d6f2d" - version = "v1.2.1" + revision = "5ffe3083946d5603a0578721101dc8165b1d5b5f" + +[[projects]] + name = "gopkg.in/gcfg.v1" + packages = [ + ".", + "scanner", + "token", + "types" + ] + revision = "61b2c08bc8f6068f7c5ca684372f9a6cb1c45ebe" + version = "v1.2.3" [[projects]] name = "gopkg.in/inf.v0" @@ -547,6 +645,12 @@ packages = ["."] revision = "460c83432a98c35224a6fe352acf8b23e067ad06" +[[projects]] + name = "gopkg.in/warnings.v0" + packages = ["."] + revision = "ec4a0fea49c7b46c2aeb0b51aac55779c607e52b" + version = "v0.1.2" + [[projects]] name = "gopkg.in/yaml.v2" packages = ["."] @@ -555,7 +659,10 @@ [[projects]] name = "k8s.io/api" packages = [ + "admission/v1beta1", "admissionregistration/v1alpha1", + "admissionregistration/v1beta1", + "apps/v1", "apps/v1beta1", "apps/v1beta2", "authentication/v1", @@ -569,7 +676,9 @@ "batch/v2alpha1", "certificates/v1beta1", "core/v1", + "events/v1beta1", "extensions/v1beta1", + "imagepolicy/v1alpha1", "networking/v1", "policy/v1beta1", "rbac/v1", @@ -578,10 +687,11 @@ "scheduling/v1alpha1", "settings/v1alpha1", "storage/v1", + "storage/v1alpha1", "storage/v1beta1" ] - revision = "fe29995db37613b9c5b2a647544cf627bfa8d299" - version = "kubernetes-1.8.0" + revision = "006a217681ae70cbacdd66a5e2fca1a61a8ff28e" + version = "kubernetes-1.9.1" [[projects]] name = "k8s.io/apiextensions-apiserver" @@ -606,7 +716,6 @@ "pkg/apis/meta/v1alpha1", "pkg/conversion", "pkg/conversion/queryparams", - "pkg/conversion/unstructured", "pkg/fields", "pkg/labels", "pkg/runtime", @@ -631,6 +740,7 @@ "pkg/util/mergepatch", "pkg/util/net", "pkg/util/rand", + "pkg/util/remotecommand", "pkg/util/runtime", "pkg/util/sets", "pkg/util/strategicpatch", @@ -645,8 +755,8 @@ "third_party/forked/golang/netutil", "third_party/forked/golang/reflect" ] - revision = "019ae5ada31de202164b118aee88ee2d14075c31" - version = "kubernetes-1.8.0" + revision = "68f9c3a1feb3140df59c67ced62d3a5df8e6c9c2" + version = "kubernetes-1.9.1" [[projects]] name = "k8s.io/apiserver" @@ -660,20 +770,59 @@ "pkg/util/feature", "pkg/util/flag" ] - revision = "2dd507a8787ba292298071383e7e68456b7cd344" + revision = "2a1092aaa7202e8f9b188281ff9424a014ce61c2" + version = "kubernetes-1.9.2" [[projects]] name = "k8s.io/client-go" packages = [ "discovery", "dynamic", + "informers", + "informers/admissionregistration", + "informers/admissionregistration/v1alpha1", + "informers/admissionregistration/v1beta1", + "informers/apps", + "informers/apps/v1", "informers/apps/v1beta1", + "informers/apps/v1beta2", + "informers/autoscaling", + "informers/autoscaling/v1", + "informers/autoscaling/v2beta1", + "informers/batch", + "informers/batch/v1", + "informers/batch/v1beta1", + "informers/batch/v2alpha1", + "informers/certificates", + "informers/certificates/v1beta1", + "informers/core", "informers/core/v1", + "informers/events", + "informers/events/v1beta1", + "informers/extensions", "informers/extensions/v1beta1", "informers/internalinterfaces", + "informers/networking", + "informers/networking/v1", + "informers/policy", + "informers/policy/v1beta1", + "informers/rbac", + "informers/rbac/v1", + "informers/rbac/v1alpha1", + "informers/rbac/v1beta1", + "informers/scheduling", + "informers/scheduling/v1alpha1", + "informers/settings", + "informers/settings/v1alpha1", + "informers/storage", + "informers/storage/v1", + "informers/storage/v1alpha1", + "informers/storage/v1beta1", "kubernetes", "kubernetes/scheme", "kubernetes/typed/admissionregistration/v1alpha1", + "kubernetes/typed/admissionregistration/v1beta1", + "kubernetes/typed/apps/v1", "kubernetes/typed/apps/v1beta1", "kubernetes/typed/apps/v1beta2", "kubernetes/typed/authentication/v1", @@ -687,6 +836,7 @@ "kubernetes/typed/batch/v2alpha1", "kubernetes/typed/certificates/v1beta1", "kubernetes/typed/core/v1", + "kubernetes/typed/events/v1beta1", "kubernetes/typed/extensions/v1beta1", "kubernetes/typed/networking/v1", "kubernetes/typed/policy/v1beta1", @@ -696,10 +846,32 @@ "kubernetes/typed/scheduling/v1alpha1", "kubernetes/typed/settings/v1alpha1", "kubernetes/typed/storage/v1", + "kubernetes/typed/storage/v1alpha1", "kubernetes/typed/storage/v1beta1", + "listers/admissionregistration/v1alpha1", + "listers/admissionregistration/v1beta1", + "listers/apps/v1", "listers/apps/v1beta1", + "listers/apps/v1beta2", + "listers/autoscaling/v1", + "listers/autoscaling/v2beta1", + "listers/batch/v1", + "listers/batch/v1beta1", + "listers/batch/v2alpha1", + "listers/certificates/v1beta1", "listers/core/v1", + "listers/events/v1beta1", "listers/extensions/v1beta1", + "listers/networking/v1", + "listers/policy/v1beta1", + "listers/rbac/v1", + "listers/rbac/v1alpha1", + "listers/rbac/v1beta1", + "listers/scheduling/v1alpha1", + "listers/settings/v1alpha1", + "listers/storage/v1", + "listers/storage/v1alpha1", + "listers/storage/v1beta1", "pkg/version", "plugin/pkg/client/auth", "plugin/pkg/client/auth/azure", @@ -720,9 +892,12 @@ "tools/portforward", "tools/record", "tools/reference", + "tools/remotecommand", "transport", "transport/spdy", + "util/buffer", "util/cert", + "util/exec", "util/flowcontrol", "util/homedir", "util/integer", @@ -730,8 +905,8 @@ "util/retry", "util/workqueue" ] - revision = "35874c597fed17ca62cd197e516d7d5ff9a2958c" - version = "v5.0.0" + revision = "9389c055a838d4f208b699b3c7c51b70f2368861" + version = "kubernetes-1.9.1" [[projects]] name = "k8s.io/helm" @@ -752,51 +927,41 @@ "pkg/provenance", "pkg/repo", "pkg/resolver", + "pkg/sympath", "pkg/tlsutil", "pkg/urlutil", "pkg/version" ] - revision = "8478fb4fc723885b155c924d1c8c410b7a9444e6" - version = "v2.7.2" + revision = "a80231648a1473929271764b920a8e346f6de844" + version = "v2.8.2" [[projects]] name = "k8s.io/kube-openapi" - packages = ["pkg/common"] - revision = "868f2f29720b192240e18284659231b440f9cda5" + packages = [ + "pkg/common", + "pkg/util/proto", + "pkg/util/proto/validation" + ] + revision = "39a7bf85c140f972372c2a0d1ee40adbf0c8bfe1" [[projects]] name = "k8s.io/kubernetes" packages = [ - "federation/apis/federation", - "federation/apis/federation/install", - "federation/apis/federation/v1beta1", - "federation/client/clientset_generated/federation_clientset", - "federation/client/clientset_generated/federation_clientset/scheme", - "federation/client/clientset_generated/federation_clientset/typed/autoscaling/v1", - "federation/client/clientset_generated/federation_clientset/typed/batch/v1", - "federation/client/clientset_generated/federation_clientset/typed/core/v1", - "federation/client/clientset_generated/federation_clientset/typed/extensions/v1beta1", - "federation/client/clientset_generated/federation_clientset/typed/federation/v1beta1", - "pkg/api", "pkg/api/events", - "pkg/api/helper", - "pkg/api/helper/qos", - "pkg/api/install", + "pkg/api/legacyscheme", "pkg/api/pod", "pkg/api/ref", "pkg/api/resource", "pkg/api/service", - "pkg/api/util", - "pkg/api/v1", - "pkg/api/v1/helper", - "pkg/api/v1/helper/qos", "pkg/api/v1/pod", - "pkg/api/validation", + "pkg/api/v1/service", "pkg/apis/admissionregistration", "pkg/apis/admissionregistration/install", "pkg/apis/admissionregistration/v1alpha1", + "pkg/apis/admissionregistration/v1beta1", "pkg/apis/apps", "pkg/apis/apps/install", + "pkg/apis/apps/v1", "pkg/apis/apps/v1beta1", "pkg/apis/apps/v1beta2", "pkg/apis/authentication", @@ -822,6 +987,18 @@ "pkg/apis/componentconfig", "pkg/apis/componentconfig/install", "pkg/apis/componentconfig/v1alpha1", + "pkg/apis/core", + "pkg/apis/core/helper", + "pkg/apis/core/helper/qos", + "pkg/apis/core/install", + "pkg/apis/core/pods", + "pkg/apis/core/v1", + "pkg/apis/core/v1/helper", + "pkg/apis/core/v1/helper/qos", + "pkg/apis/core/validation", + "pkg/apis/events", + "pkg/apis/events/install", + "pkg/apis/events/v1beta1", "pkg/apis/extensions", "pkg/apis/extensions/install", "pkg/apis/extensions/v1beta1", @@ -846,6 +1023,7 @@ "pkg/apis/storage/install", "pkg/apis/storage/util", "pkg/apis/storage/v1", + "pkg/apis/storage/v1alpha1", "pkg/apis/storage/v1beta1", "pkg/capabilities", "pkg/client/clientset_generated/internalclientset", @@ -858,6 +1036,7 @@ "pkg/client/clientset_generated/internalclientset/typed/batch/internalversion", "pkg/client/clientset_generated/internalclientset/typed/certificates/internalversion", "pkg/client/clientset_generated/internalclientset/typed/core/internalversion", + "pkg/client/clientset_generated/internalclientset/typed/events/internalversion", "pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion", "pkg/client/clientset_generated/internalclientset/typed/networking/internalversion", "pkg/client/clientset_generated/internalclientset/typed/policy/internalversion", @@ -866,27 +1045,36 @@ "pkg/client/clientset_generated/internalclientset/typed/settings/internalversion", "pkg/client/clientset_generated/internalclientset/typed/storage/internalversion", "pkg/client/unversioned", + "pkg/cloudprovider", + "pkg/cloudprovider/providers/aws", "pkg/controller", "pkg/controller/daemon", "pkg/controller/daemon/util", "pkg/controller/deployment/util", "pkg/controller/history", "pkg/controller/statefulset", + "pkg/controller/volume/events", + "pkg/controller/volume/persistentvolume", "pkg/credentialprovider", + "pkg/credentialprovider/aws", "pkg/features", "pkg/fieldpath", "pkg/kubectl", + "pkg/kubectl/apps", + "pkg/kubectl/categories", + "pkg/kubectl/cmd/templates", "pkg/kubectl/cmd/util", "pkg/kubectl/cmd/util/openapi", "pkg/kubectl/cmd/util/openapi/validation", "pkg/kubectl/plugins", "pkg/kubectl/resource", + "pkg/kubectl/scheme", "pkg/kubectl/util", "pkg/kubectl/util/hash", "pkg/kubectl/util/slice", + "pkg/kubectl/util/term", "pkg/kubectl/validation", "pkg/kubelet/apis", - "pkg/kubelet/qos", "pkg/kubelet/types", "pkg/master/ports", "pkg/printers", @@ -895,18 +1083,23 @@ "pkg/security/apparmor", "pkg/serviceaccount", "pkg/util/file", + "pkg/util/goroutinemap", + "pkg/util/goroutinemap/exponentialbackoff", "pkg/util/hash", + "pkg/util/interrupt", "pkg/util/io", "pkg/util/labels", "pkg/util/metrics", "pkg/util/mount", "pkg/util/net/sets", "pkg/util/node", + "pkg/util/nsenter", "pkg/util/parsers", "pkg/util/pointer", "pkg/util/slice", "pkg/util/taints", "pkg/version", + "pkg/volume", "pkg/volume/util", "plugin/pkg/scheduler/algorithm", "plugin/pkg/scheduler/algorithm/predicates", @@ -914,23 +1107,10 @@ "plugin/pkg/scheduler/api", "plugin/pkg/scheduler/schedulercache", "plugin/pkg/scheduler/util", - "staging/src/k8s.io/apimachinery/pkg/util/rand" - ] - revision = "0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4" - version = "v1.8.0" - -[[projects]] - name = "k8s.io/metrics" - packages = [ - "pkg/apis/metrics", - "pkg/apis/metrics/v1alpha1", - "pkg/apis/metrics/v1beta1", - "pkg/client/clientset_generated/clientset", - "pkg/client/clientset_generated/clientset/scheme", - "pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1", - "pkg/client/clientset_generated/clientset/typed/metrics/v1beta1" + "plugin/pkg/scheduler/volumebinder" ] - revision = "79239b4dbcda894c89aadd3cffa4cc70a81175cb" + revision = "5fa2db2bd46ac79e5e00a4e6ed24191080aa463b" + version = "v1.9.2" [[projects]] name = "k8s.io/utils" @@ -946,6 +1126,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "1525ee40a879bfa11ac42109113b22c8f7058fb115a4e79b762e9753a79ec86c" + inputs-digest = "fdc395b646427489d2e83113357c4557d227b353a5f8806694573071a7e906fe" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 8c1ada9..18e6f8f 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -20,6 +20,16 @@ # name = "github.com/x/y" # version = "2.4.0" +[[constraint]] + name = "k8s.io/helm" + version = "=2.8.2" + +# Fix google.org/protobuf +# https://github.com/google/protobuf/issues/4582 +# Override Helm version with the closest release version +[[override]] + name = "github.com/golang/protobuf" + version = "=1.1.0" [[constraint]] name = "github.com/Azure/azure-sdk-for-go" @@ -51,26 +61,3 @@ [[constraint]] name = "github.com/x-cray/logrus-prefixed-formatter" version = "=0.5.2" - -[[constraint]] - name = "google.golang.org/grpc" - version = "1.2.1" - -#[[constraint]] -# name = "gopkg.in/validator.v2" - -[[constraint]] - name = "k8s.io/apimachinery" - version = "kubernetes-1.8.0" - -[[constraint]] - name = "k8s.io/client-go" - version = "=5.0.0" - -[[constraint]] - name = "k8s.io/helm" - version = "=2.7.2" - -[[constraint]] - name = "k8s.io/kubernetes" - version = "1.8.0" diff --git a/README.md b/README.md index a01a5f7..8f0ae39 100644 --- a/README.md +++ b/README.md @@ -263,6 +263,9 @@ Landscaper uses both Helm and Kubernetes. The following Landscaper releases are | Landscaper | Helm | Kubernetes | |------------|-------|------------| +| 1.0.17 | 2.8.2 | 1.9 | +| 1.0.16 | 2.7.2 | 1.8 | +| 1.0.15 | 2.7.2 | 1.8 | | 1.0.14 | 2.7.2 | 1.8 | | 1.0.13 | 2.7.2 | 1.8 | | 1.0.12 | 2.7.2 | 1.8 | diff --git a/pkg/landscaper/environment.go b/pkg/landscaper/environment.go index 06f8f68..fecfee4 100644 --- a/pkg/landscaper/environment.go +++ b/pkg/landscaper/environment.go @@ -12,8 +12,8 @@ import ( "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/kube" helmversion "k8s.io/helm/pkg/version" - "k8s.io/kubernetes/pkg/api" podutil "k8s.io/kubernetes/pkg/api/pod" + "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" ) @@ -71,7 +71,16 @@ func (e *Environment) HelmClient() helm.Interface { return nil } - e.helmClient = helm.NewClient(helm.Host(tillerHost)) + logrus.WithField("host", tillerHost).Debug("Tiller host address") + + e.helmClient = helm.NewClient(helm.Host(tillerHost), helm.ConnectTimeout(5)) + logrus.WithField("client", e.helmClient).Debug("Helm client") + + err = e.helmClient.PingTiller() + + if err != nil { + logrus.WithField("error", err).Fatalf("Can't ping Tiller") + } tillerVersion, err := e.helmClient.GetVersion() if err != nil { @@ -190,7 +199,7 @@ func getTillerPodName(client internalversion.PodsGetter, namespace string) (stri return pod.ObjectMeta.GetName(), nil } -func getFirstRunningPod(client internalversion.PodsGetter, namespace string, selector labels.Selector) (*api.Pod, error) { +func getFirstRunningPod(client internalversion.PodsGetter, namespace string, selector labels.Selector) (*core.Pod, error) { options := metav1.ListOptions{LabelSelector: selector.String()} pods, err := client.Pods(namespace).List(options) if err != nil { diff --git a/pkg/landscaper/executor.go b/pkg/landscaper/executor.go index e6d8fa2..e5d0dc6 100644 --- a/pkg/landscaper/executor.go +++ b/pkg/landscaper/executor.go @@ -84,14 +84,14 @@ func (e *executor) Apply(desired, current Components) error { logrus.WithFields(logrus.Fields{"create": len(create), "update": len(update), "delete": len(delete)}).Info("Apply desired state") - if err := logDifferences(current, create, update, delete, logrus.Infof); err != nil { + if err := logDifferences(current, create, update, delete, e.stageEnabled("update"), e.stageEnabled("delete"), logrus.Infof); err != nil { return err } if e.stageEnabled("delete") { for _, cmp := range delete { if err := e.DeleteComponent(cmp); err != nil { - logrus.WithFields(logrus.Fields{"error": err}).Error("DeleteComponent failed") + logrus.WithFields(logrus.Fields{"error": err, "component": cmp}).Error("DeleteComponent failed") return err } } @@ -100,7 +100,7 @@ func (e *executor) Apply(desired, current Components) error { if e.stageEnabled("update") { for _, cmp := range update { if err := e.UpdateComponent(cmp); err != nil { - logrus.WithFields(logrus.Fields{"error": err}).Error("UpdateComponent failed") + logrus.WithFields(logrus.Fields{"error": err, "component": cmp}).Error("UpdateComponent failed") return err } } @@ -109,7 +109,7 @@ func (e *executor) Apply(desired, current Components) error { if e.stageEnabled("create") { for _, cmp := range create { if err := e.CreateComponent(cmp); err != nil { - logrus.WithFields(logrus.Fields{"error": err}).Error("CreateComponent failed") + logrus.WithFields(logrus.Fields{"error": err, "component": cmp}).Error("CreateComponent failed") return err } } @@ -318,7 +318,7 @@ func componentDiffText(current, desired *Component) (string, error) { } // logDifferences logs the Create, Update and Delete w.r.t. current to logf -func logDifferences(current, creates, updates, deletes Components, logf func(format string, args ...interface{})) error { +func logDifferences(current, creates, updates, deletes Components, updateStageEnabled bool, deleteStageEnabled bool, logf func(format string, args ...interface{})) error { log := func(action string, current, desired *Component) error { diff, err := componentDiffText(current, desired) if err != nil { @@ -334,8 +334,11 @@ func logDifferences(current, creates, updates, deletes Components, logf func(for return nil } - for _, d := range deletes { - logf("Delete: %s", d.Name) + // Log diffs only if delete is applied + if deleteStageEnabled { + for _, d := range deletes { + logf("Delete: %s", d.Name) + } } for _, d := range creates { @@ -344,10 +347,13 @@ func logDifferences(current, creates, updates, deletes Components, logf func(for } } - for _, d := range updates { - c := current[d.Name] - if err := log("Update: "+d.Name, c, d); err != nil { - return err + // Log diffs only if upadete is applied + if updateStageEnabled { + for _, d := range updates { + c := current[d.Name] + if err := log("Update: "+d.Name, c, d); err != nil { + return err + } } } diff --git a/pkg/landscaper/mocks_test.go b/pkg/landscaper/mocks_test.go index 11d3923..44e1c02 100644 --- a/pkg/landscaper/mocks_test.go +++ b/pkg/landscaper/mocks_test.go @@ -13,15 +13,11 @@ type HelmclientMock struct { listReleases func(opts ...helm.ReleaseListOption) (*services.ListReleasesResponse, error) } -func (m *HelmclientMock) DeleteRelease(rlsName string, opts ...helm.DeleteOption) (*services.UninstallReleaseResponse, error) { - return m.deleteRelease(rlsName, opts...) -} - -func (m *HelmclientMock) GetVersion(opts ...helm.VersionOption) (*services.GetVersionResponse, error) { - return nil, nil +func (m *HelmclientMock) ListReleases(opts ...helm.ReleaseListOption) (*services.ListReleasesResponse, error) { + return m.listReleases(opts...) } -func (m *HelmclientMock) InstallRelease(chStr string, namespace string, opts ...helm.InstallOption) (*services.InstallReleaseResponse, error) { +func (m *HelmclientMock) InstallRelease(chStr, namespace string, opts ...helm.InstallOption) (*services.InstallReleaseResponse, error) { return m.installRelease(chStr, namespace, opts...) } @@ -29,19 +25,19 @@ func (m *HelmclientMock) InstallReleaseFromChart(chart *chart.Chart, namespace s return nil, nil } -func (m *HelmclientMock) ListReleases(opts ...helm.ReleaseListOption) (*services.ListReleasesResponse, error) { - return m.listReleases(opts...) +func (m *HelmclientMock) DeleteRelease(rlsName string, opts ...helm.DeleteOption) (*services.UninstallReleaseResponse, error) { + return m.deleteRelease(rlsName, opts...) } -func (m *HelmclientMock) ReleaseContent(rlsName string, opts ...helm.ContentOption) (*services.GetReleaseContentResponse, error) { +func (m *HelmclientMock) ReleaseStatus(rlsName string, opts ...helm.StatusOption) (*services.GetReleaseStatusResponse, error) { return nil, nil } -func (m *HelmclientMock) ReleaseHistory(rlsName string, opts ...helm.HistoryOption) (*services.GetHistoryResponse, error) { - return nil, nil +func (m *HelmclientMock) UpdateRelease(rlsName string, chStr string, opts ...helm.UpdateOption) (*services.UpdateReleaseResponse, error) { + return m.updateRelease(rlsName, chStr, opts...) } -func (m *HelmclientMock) ReleaseStatus(rlsName string, opts ...helm.StatusOption) (*services.GetReleaseStatusResponse, error) { +func (m *HelmclientMock) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...helm.UpdateOption) (*services.UpdateReleaseResponse, error) { return nil, nil } @@ -49,11 +45,15 @@ func (m *HelmclientMock) RollbackRelease(rlsName string, opts ...helm.RollbackOp return nil, nil } -func (m *HelmclientMock) UpdateRelease(rlsName string, chStr string, opts ...helm.UpdateOption) (*services.UpdateReleaseResponse, error) { - return m.updateRelease(rlsName, chStr, opts...) +func (m *HelmclientMock) ReleaseContent(rlsName string, opts ...helm.ContentOption) (*services.GetReleaseContentResponse, error) { + return nil, nil } -func (m *HelmclientMock) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...helm.UpdateOption) (*services.UpdateReleaseResponse, error) { +func (m *HelmclientMock) ReleaseHistory(rlsName string, opts ...helm.HistoryOption) (*services.GetHistoryResponse, error) { + return nil, nil +} + +func (m *HelmclientMock) GetVersion(opts ...helm.VersionOption) (*services.GetVersionResponse, error) { return nil, nil } @@ -61,6 +61,10 @@ func (m *HelmclientMock) RunReleaseTest(rlsName string, opts ...helm.ReleaseTest return nil, nil } +func (m *HelmclientMock) PingTiller() error { + return nil +} + type MockChartLoader func(chartRef string) (*chart.Chart, string, error) func (m MockChartLoader) Load(chartRef string) (*chart.Chart, string, error) { return m(chartRef) } diff --git a/pkg/landscaper/secrets.go b/pkg/landscaper/secrets.go index 8617633..96038e9 100644 --- a/pkg/landscaper/secrets.go +++ b/pkg/landscaper/secrets.go @@ -8,8 +8,8 @@ import ( "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/kubernetes/pkg/apis/core" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" ) @@ -97,7 +97,7 @@ func (sp *kubeSecretsProvider) Write(componentName, namespace string, secrets Se return err } - _, err = sp.kubeClient.Secrets(namespace).Create(&api.Secret{ + _, err = sp.kubeClient.Secrets(namespace).Create(&core.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: componentName, }, @@ -142,7 +142,7 @@ func (sp *kubeSecretsProvider) Delete(componentName, namespace string) error { // ensureNamespace trigger namespace creation and filter errors, only already-exists type of error won't be returned. func (sp *kubeSecretsProvider) ensureNamespace(namespace string) error { _, err := sp.kubeClient.Namespaces().Create( - &api.Namespace{ + &core.Namespace{ ObjectMeta: metav1.ObjectMeta{ Name: namespace, },