diff --git a/go.mod b/go.mod index 7aa4e1a..4a7165c 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,9 @@ replace ( ) require ( - github.com/layer5io/meshery-adapter-library v0.5.9 - github.com/layer5io/meshkit v0.5.31 + github.com/google/uuid v1.3.0 + github.com/layer5io/meshery-adapter-library v0.5.10 + github.com/layer5io/meshkit v0.5.37 github.com/layer5io/service-mesh-performance v0.3.4 gopkg.in/yaml.v2 v2.4.0 k8s.io/apimachinery v0.23.5 @@ -38,11 +39,11 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect github.com/cockroachdb/apd/v2 v2.0.1 // indirect - github.com/containerd/containerd v1.6.1 // indirect + github.com/containerd/containerd v1.6.6 // indirect github.com/cyphar/filepath-securejoin v0.2.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/cli v20.10.11+incompatible // indirect - github.com/docker/distribution v2.7.1+incompatible // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect github.com/docker/docker v20.10.12+incompatible // indirect github.com/docker/docker-credential-helpers v0.6.4 // indirect github.com/docker/go-connections v0.4.0 // indirect @@ -68,7 +69,6 @@ require ( github.com/google/go-cmp v0.5.8 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/google/uuid v1.3.0 // indirect github.com/googleapis/gnostic v0.5.5 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gosuri/uitable v0.0.4 // indirect @@ -109,13 +109,13 @@ require ( github.com/morikuni/aec v1.0.0 // indirect github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.0.2 // indirect + github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.11.0 // indirect + github.com/prometheus/client_golang v1.11.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.30.0 // indirect github.com/prometheus/procfs v0.7.3 // indirect diff --git a/go.sum b/go.sum index 457b01c..62d229e 100644 --- a/go.sum +++ b/go.sum @@ -130,8 +130,8 @@ github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+V github.com/Microsoft/hcsshim v0.8.20/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= -github.com/Microsoft/hcsshim v0.9.2 h1:wB06W5aYFfUB3IvootYAY2WnOmIdgPGfqSI6tufQNnY= github.com/Microsoft/hcsshim v0.9.2/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= +github.com/Microsoft/hcsshim v0.9.3 h1:k371PzBuRrz2b+ebGuI2nVgVhgsVX60jMfSw80NECxo= github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= @@ -291,8 +291,9 @@ github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoT github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= -github.com/containerd/containerd v1.6.1 h1:oa2uY0/0G+JX4X7hpGCYvkp9FjUancz56kSNnb1sG3o= github.com/containerd/containerd v1.6.1/go.mod h1:1nJz5xCZPusx6jJU8Frfct988y0NpumIq9ODB0kLtoE= +github.com/containerd/containerd v1.6.6 h1:xJNPhbrmz8xAMDNoVjHy9YHtWwEQNS+CDkcIRh7t8Y0= +github.com/containerd/containerd v1.6.6/go.mod h1:ZoP1geJldzCVY3Tonoz7b1IXk8rIX0Nltt5QE4OMNk0= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -404,8 +405,9 @@ github.com/docker/cli v20.10.11+incompatible h1:tXU1ezXcruZQRrMP8RN2z9N91h+6egZT github.com/docker/cli v20.10.11+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v1.4.2-0.20190916154449-92cc603036dd/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= @@ -862,10 +864,10 @@ github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6Fm github.com/layer5io/kuttl v0.4.1-0.20200723152044-916f10574334/go.mod h1:UmrVd7x+bNVKrpmKgTtfRiTKHZeNPcMjQproJ0vGwhE= github.com/layer5io/learn-layer5/smi-conformance v0.0.0-20210317075357-06b4f88b3e34 h1:QaViadDOBCMDUwYx78kfRvHMkzRVnh/GOhm3s2gxoP4= github.com/layer5io/learn-layer5/smi-conformance v0.0.0-20210317075357-06b4f88b3e34/go.mod h1:BQPLwdJt7v7y0fXIejI4whR9zMyX07Wjt5xrbgEmHLw= -github.com/layer5io/meshery-adapter-library v0.5.9 h1:Zp79l4J8kMjML9zAQ4Xu4QiKM5q5HEGcv04Jjg+xWSA= -github.com/layer5io/meshery-adapter-library v0.5.9/go.mod h1:IvURQMnZHa3z0OTcUSPqCHUgTsW2x0/+KjCqpYfMbt0= -github.com/layer5io/meshkit v0.5.31 h1:z6U3Ggp0sJaU47j/l8MClCgmkm7cZwJssYHpk/eorPI= -github.com/layer5io/meshkit v0.5.31/go.mod h1:dt0uOluDzatK6hbJEDAZbUsm7LJNb4nsXXaGUDtYxD0= +github.com/layer5io/meshery-adapter-library v0.5.10 h1:Qgr6vDx2s10mkhtk7Mnz5I73m/9yf2yyjCkPMeB4jmA= +github.com/layer5io/meshery-adapter-library v0.5.10/go.mod h1:Sg6WNN82uRo2kiFDEMc/LM/AJ/Pu6ZmBZGbFxZuC7zc= +github.com/layer5io/meshkit v0.5.37 h1:EO0wXAI+eqAm+4uKSzFd50rDkr6nqQ17m1j0wmv9hQA= +github.com/layer5io/meshkit v0.5.37/go.mod h1:dt0uOluDzatK6hbJEDAZbUsm7LJNb4nsXXaGUDtYxD0= github.com/layer5io/service-mesh-performance v0.3.2-0.20210122142912-a94e0658b021/go.mod h1:W153amv8aHAeIWxO7b7d7Vibt9RhaEVh4Uh+RG+BumQ= github.com/layer5io/service-mesh-performance v0.3.4 h1:aw/elsx0wkry7SyiQRIj31wW7TPCP4YfhINdNOLXVg8= github.com/layer5io/service-mesh-performance v0.3.4/go.mod h1:W153amv8aHAeIWxO7b7d7Vibt9RhaEVh4Uh+RG+BumQ= @@ -1035,8 +1037,9 @@ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3I github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.2-0.20211117181255-693428a734f5/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= +github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= @@ -1092,8 +1095,9 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.11.1 h1:+4eQaD7vAZ6DsfsxB15hbE0odUjGI5ARs9yskGu1v4s= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/main.go b/main.go index 23ed9b8..3e4ac70 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,7 @@ import ( "github.com/layer5io/meshery-adapter-library/api/grpc" configprovider "github.com/layer5io/meshery-adapter-library/config/provider" "github.com/layer5io/meshery-nginx/internal/config" + "github.com/layer5io/meshkit/utils/events" ) var ( @@ -85,11 +86,12 @@ func main() { // } // Initialize Handler intance - handler := nginx.New(cfg, log, kubeconfigHandler) + e := events.NewEventStreamer() + handler := nginx.New(cfg, log, kubeconfigHandler, e) handler = adapter.AddLogger(log, handler) service.Handler = handler - service.Channel = make(chan interface{}, 10) + service.EventStreamer = e service.StartedAt = time.Now() service.Version = version service.GitSHA = gitsha diff --git a/nginx/nginx.go b/nginx/nginx.go index 3afb34f..0d8b90d 100644 --- a/nginx/nginx.go +++ b/nginx/nginx.go @@ -13,6 +13,7 @@ import ( "github.com/layer5io/meshkit/errors" "github.com/layer5io/meshkit/logger" "github.com/layer5io/meshkit/models" + "github.com/layer5io/meshkit/utils/events" "gopkg.in/yaml.v2" ) @@ -22,24 +23,24 @@ type Nginx struct { } // New initializes nginx handler. -func New(c adapterconfig.Handler, l logger.Handler, kc adapterconfig.Handler) adapter.Handler { +func New(c adapterconfig.Handler, l logger.Handler, kc adapterconfig.Handler, e *events.EventStreamer) adapter.Handler { return &Nginx{ Adapter: adapter.Adapter{ Config: c, Log: l, KubeconfigHandler: kc, + EventStreamer: e, }, } } // ApplyOperation applies the operation on nginx -func (nginx *Nginx) ApplyOperation(ctx context.Context, opReq adapter.OperationRequest, hchan *chan interface{}) error { +func (nginx *Nginx) ApplyOperation(ctx context.Context, opReq adapter.OperationRequest) error { err := nginx.CreateKubeconfigs(opReq.K8sConfigs) if err != nil { return err } kubeConfigs := opReq.K8sConfigs - nginx.SetChannel(hchan); operations := make(adapter.Operations) err = nginx.Config.GetObject(adapter.OperationsKey, &operations) @@ -50,12 +51,11 @@ func (nginx *Nginx) ApplyOperation(ctx context.Context, opReq adapter.OperationR stat := status.Deploying e := &meshes.EventsResponse{ - OperationId: opReq.OperationID, - Summary: status.Deploying, - Details: status.None, - Component: internalconfig.ServerConfig["type"], + OperationId: opReq.OperationID, + Summary: status.Deploying, + Details: status.None, + Component: internalconfig.ServerConfig["type"], ComponentName: internalconfig.ServerConfig["name"], - } switch opReq.OperationName { @@ -64,12 +64,12 @@ func (nginx *Nginx) ApplyOperation(ctx context.Context, opReq adapter.OperationR version := string(operations[opReq.OperationName].Versions[0]) if stat, err = hh.installNginx(opReq.IsDeleteOperation, version, opReq.Namespace, kubeConfigs); err != nil { summary := fmt.Sprintf("Error while %s NGINX Service Mesh", stat) - hh.streamErr(summary, e, err) + hh.streamErr(summary, ee, err) return } ee.Summary = fmt.Sprintf("NGINX Service Mesh %s successfully", stat) ee.Details = fmt.Sprintf("NGINX Service Mesh is now %s.", stat) - hh.StreamInfo(e) + hh.StreamInfo(ee) }(nginx, e) case internalconfig.LabelNamespace: go func(hh *Nginx, ee *meshes.EventsResponse) { @@ -80,12 +80,12 @@ func (nginx *Nginx) ApplyOperation(ctx context.Context, opReq adapter.OperationR } if err != nil { summary := fmt.Sprintf("Error while labelling %s", opReq.Namespace) - hh.streamErr(summary, e, err) + hh.streamErr(summary, ee, err) return } ee.Summary = fmt.Sprintf("Label updated on %s namespace", opReq.Namespace) ee.Details = fmt.Sprintf("NGINX-INJECTION label %s on %s namespace", operation, opReq.Namespace) - hh.StreamInfo(e) + hh.StreamInfo(ee) }(nginx, e) case common.SmiConformanceOperation: go func(hh *Nginx, ee *meshes.EventsResponse) { @@ -102,12 +102,12 @@ func (nginx *Nginx) ApplyOperation(ctx context.Context, opReq adapter.OperationR }) if err != nil { summary := fmt.Sprintf("Error while %s %s test", status.Running, name) - hh.streamErr(summary, e, err) + hh.streamErr(summary, ee, err) return } ee.Summary = fmt.Sprintf("%s test %s successfully", name, status.Completed) ee.Details = "" - hh.StreamInfo(e) + hh.StreamInfo(ee) }(nginx, e) case common.BookInfoOperation, common.HTTPBinOperation, common.ImageHubOperation, common.EmojiVotoOperation: go func(hh *Nginx, ee *meshes.EventsResponse) { @@ -115,24 +115,24 @@ func (nginx *Nginx) ApplyOperation(ctx context.Context, opReq adapter.OperationR stat, err := hh.installSampleApp(opReq.Namespace, opReq.IsDeleteOperation, operations[opReq.OperationName].Templates, kubeConfigs) if err != nil { summary := fmt.Sprintf("Error while %s %s application", stat, appName) - hh.streamErr(summary, e, err) + hh.streamErr(summary, ee, err) return } ee.Summary = fmt.Sprintf("%s application %s successfully", appName, stat) ee.Details = fmt.Sprintf("The %s application is now %s.", appName, stat) - hh.StreamInfo(e) + hh.StreamInfo(ee) }(nginx, e) case common.CustomOperation: go func(hh *Nginx, ee *meshes.EventsResponse) { stat, err := hh.applyCustomOperation(opReq.Namespace, opReq.CustomBody, opReq.IsDeleteOperation, kubeConfigs) if err != nil { summary := fmt.Sprintf("Error while %s custom operation", stat) - hh.streamErr(summary, e, err) + hh.streamErr(summary, ee, err) return } ee.Summary = fmt.Sprintf("Manifest %s successfully", status.Deployed) ee.Details = "" - hh.StreamInfo(e) + hh.StreamInfo(ee) }(nginx, e) default: nginx.streamErr("Invalid operation", e, ErrOpInvalid) @@ -151,7 +151,6 @@ func (nginx *Nginx) CreateKubeconfigs(kubeconfigs []string) error { errs = append(errs, err) continue } - // To have control over what exactly to take in on kubeconfig nginx.KubeconfigHandler.SetKey("kind", kconfig.Kind) nginx.KubeconfigHandler.SetKey("apiVersion", kconfig.APIVersion) @@ -186,12 +185,11 @@ func (nginx *Nginx) CreateKubeconfigs(kubeconfigs []string) error { return mergeErrors(errs) } - -func(nginx *Nginx) streamErr(summary string, e *meshes.EventsResponse, err error) { +func (nginx *Nginx) streamErr(summary string, e *meshes.EventsResponse, err error) { e.Summary = summary e.Details = err.Error() e.ErrorCode = errors.GetCode(err) e.ProbableCause = errors.GetCause(err) e.SuggestedRemediation = errors.GetRemedy(err) nginx.StreamErr(e, err) -} \ No newline at end of file +} diff --git a/nginx/oam.go b/nginx/oam.go index 0b76297..8e48614 100644 --- a/nginx/oam.go +++ b/nginx/oam.go @@ -5,15 +5,17 @@ import ( "fmt" "strings" + "github.com/google/uuid" "github.com/layer5io/meshery-adapter-library/adapter" + "github.com/layer5io/meshery-adapter-library/meshes" + "github.com/layer5io/meshery-nginx/internal/config" "github.com/layer5io/meshery-nginx/nginx/oam" "github.com/layer5io/meshkit/models/oam/core/v1alpha1" "gopkg.in/yaml.v2" ) // ProcessOAM will handles the grpc invocation for handling OAM objects -func (nginx *Nginx) ProcessOAM(ctx context.Context, oamReq adapter.OAMRequest, hchan *chan interface{}) (string, error) { - nginx.SetChannel(hchan) +func (nginx *Nginx) ProcessOAM(ctx context.Context, oamReq adapter.OAMRequest) (string, error) { err := nginx.CreateKubeconfigs(oamReq.K8sConfigs) if err != nil { return "", err @@ -73,29 +75,48 @@ type CompHandler func(*Nginx, v1alpha1.Component, bool, []string) (string, error func (nginx *Nginx) HandleComponents(comps []v1alpha1.Component, isDel bool, kubeconfigs []string) (string, error) { var errs []error var msgs []string + stat1 := "deploying" + stat2 := "deployed" + if isDel { + stat1 = "removing" + stat2 = "removed" + } compFuncMap := map[string]CompHandler{ "NginxMesh": handleComponentNginxMesh, } for _, comp := range comps { + ee := &meshes.EventsResponse{ + OperationId: uuid.New().String(), + Component: config.ServerConfig["type"], + ComponentName: config.ServerConfig["name"], + } fnc, ok := compFuncMap[comp.Spec.Type] if !ok { msg, err := handleNginxCoreComponents(nginx, comp, isDel, "", "", kubeconfigs) if err != nil { + ee.Summary = fmt.Sprintf("Error while %s %s", stat1, comp.Spec.Type) + nginx.streamErr(ee.Summary, ee, err) errs = append(errs, err) continue } - + ee.Summary = fmt.Sprintf("%s %s successfully", comp.Spec.Type, stat2) + ee.Details = fmt.Sprintf("The %s is now %s.", comp.Spec.Type, stat2) + nginx.StreamInfo(ee) msgs = append(msgs, msg) continue } msg, err := fnc(nginx, comp, isDel, kubeconfigs) if err != nil { + ee.Summary = fmt.Sprintf("Error while %s %s", stat1, comp.Spec.Type) + nginx.streamErr(ee.Summary, ee, err) errs = append(errs, err) continue } - + ee.Summary = fmt.Sprintf("%s %s %s successfully", comp.Name, comp.Spec.Type, stat2) + ee.Details = fmt.Sprintf("The %s %s is now %s.", comp.Name, comp.Spec.Type, stat2) + nginx.StreamInfo(ee) msgs = append(msgs, msg) } if err := mergeErrors(errs); err != nil {