Skip to content

Commit

Permalink
Merge pull request moby#46926 from thaJeztah/carry_logentries_removal
Browse files Browse the repository at this point in the history
logger: remove logentries driver (carry 44442)
  • Loading branch information
thaJeztah authored Dec 13, 2023
2 parents 77ea269 + 3b1d9f1 commit f3cc936
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 449 deletions.
8 changes: 8 additions & 0 deletions api/server/router/swarm/cluster_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ func (sr *swarmRouter) createService(ctx context.Context, w http.ResponseWriter,
if err := httputils.ReadJSON(r, &service); err != nil {
return err
}
// TODO(thaJeztah): remove logentries check and migration code in release v26.0.0.
if service.TaskTemplate.LogDriver != nil && service.TaskTemplate.LogDriver.Name == "logentries" {
return errdefs.InvalidParameter(errors.New("the logentries logging driver has been deprecated and removed"))
}

// Get returns "" if the header does not exist
encodedAuth := r.Header.Get(registry.AuthHeader)
Expand Down Expand Up @@ -245,6 +249,10 @@ func (sr *swarmRouter) updateService(ctx context.Context, w http.ResponseWriter,
if err := httputils.ReadJSON(r, &service); err != nil {
return err
}
// TODO(thaJeztah): remove logentries check and migration code in release v26.0.0.
if service.TaskTemplate.LogDriver != nil && service.TaskTemplate.LogDriver.Name == "logentries" {
return errdefs.InvalidParameter(errors.New("the logentries logging driver has been deprecated and removed"))
}

rawVersion := r.URL.Query().Get("version")
version, err := strconv.ParseUint(rawVersion, 10, 64)
Expand Down
4 changes: 4 additions & 0 deletions daemon/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func (daemon *Daemon) containerCreate(ctx context.Context, daemonCfg *configStor
if opts.params.Config == nil {
return containertypes.CreateResponse{}, errdefs.InvalidParameter(runconfig.ErrEmptyConfig)
}
// TODO(thaJeztah): remove logentries check and migration code in release v26.0.0.
if opts.params.HostConfig != nil && opts.params.HostConfig.LogConfig.Type == "logentries" {
return containertypes.CreateResponse{}, errdefs.InvalidParameter(fmt.Errorf("the logentries logging driver has been deprecated and removed"))
}

// Normalize some defaults. Doing this "ad-hoc" here for now, as there's
// only one field to migrate, but we should consider having a better
Expand Down
37 changes: 26 additions & 11 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
_ "github.com/docker/docker/daemon/graphdriver/register" // register graph drivers
"github.com/docker/docker/daemon/images"
dlogger "github.com/docker/docker/daemon/logger"
"github.com/docker/docker/daemon/logger/local"
"github.com/docker/docker/daemon/network"
"github.com/docker/docker/daemon/snapshotter"
"github.com/docker/docker/daemon/stats"
Expand Down Expand Up @@ -339,17 +340,31 @@ func (daemon *Daemon) restore(cfg *configStore) error {

baseLogger := log.G(context.TODO()).WithField("container", c.ID)

// Migrate containers that don't have the default ("no") restart-policy set.
// The RestartPolicy.Name field may be empty for containers that were
// created with versions before v25.0.0.
//
// We also need to set the MaximumRetryCount to 0, to prevent
// validation from failing (MaximumRetryCount is not allowed if
// no restart-policy ("none") is set).
if c.HostConfig != nil && c.HostConfig.RestartPolicy.Name == "" {
baseLogger.WithError(err).Debug("migrated restart-policy")
c.HostConfig.RestartPolicy.Name = containertypes.RestartPolicyDisabled
c.HostConfig.RestartPolicy.MaximumRetryCount = 0
if c.HostConfig != nil {
// Migrate containers that don't have the default ("no") restart-policy set.
// The RestartPolicy.Name field may be empty for containers that were
// created with versions before v25.0.0.
//
// We also need to set the MaximumRetryCount to 0, to prevent
// validation from failing (MaximumRetryCount is not allowed if
// no restart-policy ("none") is set).
if c.HostConfig.RestartPolicy.Name == "" {
baseLogger.Debug("migrated restart-policy")
c.HostConfig.RestartPolicy.Name = containertypes.RestartPolicyDisabled
c.HostConfig.RestartPolicy.MaximumRetryCount = 0
}

// Migrate containers that use the deprecated (and now non-functional)
// logentries driver. Update them to use the "local" logging driver
// instead.
//
// TODO(thaJeztah): remove logentries check and migration code in release v26.0.0.
if c.HostConfig.LogConfig.Type == "logentries" {
baseLogger.Warn("migrated deprecated logentries logging driver")
c.HostConfig.LogConfig = containertypes.LogConfig{
Type: local.Name,
}
}
}

if err := daemon.checkpointAndSave(c); err != nil {
Expand Down
1 change: 0 additions & 1 deletion daemon/logdrivers_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
_ "github.com/docker/docker/daemon/logger/journald"
_ "github.com/docker/docker/daemon/logger/jsonfilelog"
_ "github.com/docker/docker/daemon/logger/local"
_ "github.com/docker/docker/daemon/logger/logentries"
_ "github.com/docker/docker/daemon/logger/loggerutils/cache"
_ "github.com/docker/docker/daemon/logger/splunk"
_ "github.com/docker/docker/daemon/logger/syslog"
Expand Down
1 change: 0 additions & 1 deletion daemon/logdrivers_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
_ "github.com/docker/docker/daemon/logger/gcplogs"
_ "github.com/docker/docker/daemon/logger/gelf"
_ "github.com/docker/docker/daemon/logger/jsonfilelog"
_ "github.com/docker/docker/daemon/logger/logentries"
_ "github.com/docker/docker/daemon/logger/loggerutils/cache"
_ "github.com/docker/docker/daemon/logger/splunk"
_ "github.com/docker/docker/daemon/logger/syslog"
Expand Down
117 changes: 0 additions & 117 deletions daemon/logger/logentries/logentries.go

This file was deleted.

1 change: 0 additions & 1 deletion vendor.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ require (
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.24
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.15.17
github.com/aws/smithy-go v1.13.5
github.com/bsphere/le_go v0.0.0-20200109081728-fc06dab2caa8
github.com/cloudflare/cfssl v1.6.4
github.com/containerd/cgroups/v3 v3.0.2
github.com/containerd/containerd v1.7.11
Expand Down
2 changes: 0 additions & 2 deletions vendor.sum
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ github.com/bombsimon/wsl/v3 v3.0.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2
github.com/bombsimon/wsl/v3 v3.1.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
github.com/bsphere/le_go v0.0.0-20200109081728-fc06dab2caa8 h1:fcONpniVVbh9+duVZYYbJuc+yGGdLRxTqpk7pTTz/qI=
github.com/bsphere/le_go v0.0.0-20200109081728-fc06dab2caa8/go.mod h1:GrjfimWtH8h8EqJSfbO+sTQYV/fAjL/VN7dMeU8XP2Y=
github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8=
github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50=
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
Expand Down
23 changes: 0 additions & 23 deletions vendor/github.com/bsphere/le_go/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions vendor/github.com/bsphere/le_go/.travis.yml

This file was deleted.

21 changes: 0 additions & 21 deletions vendor/github.com/bsphere/le_go/LICENSE

This file was deleted.

37 changes: 0 additions & 37 deletions vendor/github.com/bsphere/le_go/README.md

This file was deleted.

Loading

0 comments on commit f3cc936

Please sign in to comment.