Skip to content

Commit

Permalink
Sanitize the source layout so it's more natural to work with
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Barry committed Dec 10, 2021
1 parent 3d50c27 commit 278a1fc
Show file tree
Hide file tree
Showing 96 changed files with 172 additions and 160 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
vendor
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"k8s.io/klog/v2"
kubecm "k8s.io/kubernetes/pkg/kubelet/cm"

"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
"github.com/Mirantis/cri-dockerd/libdocker"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package cm
import (
"fmt"

"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
"github.com/Mirantis/cri-dockerd/libdocker"
)

type unsupportedContainerManager struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ limitations under the License.
package cm

import (
"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
"github.com/Mirantis/cri-dockerd/libdocker"
)

// no-op
Expand Down
4 changes: 2 additions & 2 deletions dockershim/convert.go → src/core/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"fmt"
Expand All @@ -25,8 +25,8 @@ import (

dockertypes "github.com/docker/docker/api/types"

"github.com/Mirantis/cri-dockerd/libdocker"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
)

// This file contains helper functions to convert docker API types to runtime
Expand Down
2 changes: 1 addition & 1 deletion dockershim/convert_test.go → src/core/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"testing"
Expand Down
4 changes: 2 additions & 2 deletions dockershim/doc.go → src/core/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package dockershim implements a container runtime interface
// Package cri-dockerd implements a container runtime interface
// Docker integration using k8s.io/cri-api/pkg/apis/runtime/v1alpha2/api.pb.go
package dockershim
package core
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"context"
Expand All @@ -31,8 +31,8 @@ import (
dockerstrslice "github.com/docker/docker/api/types/strslice"
"k8s.io/klog/v2"

"github.com/Mirantis/cri-dockerd/libdocker"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
)

// ListContainers lists all containers matching the filter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
dockertypes "github.com/docker/docker/api/types"
Expand All @@ -38,10 +38,10 @@ func (ds *dockerService) performPlatformSpecificContainerCleanup(cleanupInfo *co
return
}

// platformSpecificContainerInitCleanup is called when dockershim
// platformSpecificContainerInitCleanup is called when cri-dockerd
// is starting, and is meant to clean up any cruft left by previous runs
// creating containers.
// Errors are simply logged, but don't prevent dockershim from starting.
// Errors are simply logged, but don't prevent cri-dockerd from starting.
func (ds *dockerService) platformSpecificContainerInitCleanup() (errors []error) {
return
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"crypto/rand"
Expand Down Expand Up @@ -185,10 +185,10 @@ func removeGMSARegistryValue(cleanupInfo *containerCleanupInfo) error {
return nil
}

// platformSpecificContainerInitCleanup is called when dockershim
// platformSpecificContainerInitCleanup is called when cri-dockerd
// is starting, and is meant to clean up any cruft left by previous runs
// creating containers.
// Errors are simply logged, but don't prevent dockershim from starting.
// Errors are simply logged, but don't prevent cri-dockerd from starting.
func (ds *dockerService) platformSpecificContainerInitCleanup() (errors []error) {
return removeAllGMSARegistryValues()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"bytes"
Expand Down
4 changes: 2 additions & 2 deletions dockershim/docker_image.go → src/core/docker_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"context"
Expand All @@ -27,9 +27,9 @@ import (
dockerfilters "github.com/docker/docker/api/types/filters"
"github.com/docker/docker/pkg/jsonmessage"

"github.com/Mirantis/cri-dockerd/libdocker"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
)

// This file implements methods in ImageManagerService.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"fmt"
Expand All @@ -27,8 +27,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/Mirantis/cri-dockerd/libdocker"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
)

func TestRemoveImage(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"context"
Expand All @@ -35,13 +35,13 @@ import (
"k8s.io/klog/v2"
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"

"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
"github.com/Mirantis/cri-dockerd/libdocker"
)

// We define `DockerLegacyService` in `pkg/kubelet/legacy`, instead of in this
// file. We make this decision because `pkg/kubelet` depends on
// `DockerLegacyService`, and we want to be able to build the `kubelet` without
// relying on `github.com/docker/docker` or `pkg/kubelet/dockershim`.
// relying on `github.com/docker/docker` or `pkg/kubelet/cri-dockerd`.
//
// See https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/1547-building-kubelet-without-docker/README.md
// for details.
Expand Down
2 changes: 1 addition & 1 deletion dockershim/docker_logs.go → src/core/docker_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"context"
Expand Down
4 changes: 2 additions & 2 deletions dockershim/docker_sandbox.go → src/core/docker_sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"context"
Expand All @@ -26,6 +26,7 @@ import (
"strings"
"time"

"github.com/Mirantis/cri-dockerd/libdocker"
dockertypes "github.com/docker/docker/api/types"
dockercontainer "github.com/docker/docker/api/types/container"
dockerfilters "github.com/docker/docker/api/types/filters"
Expand All @@ -35,7 +36,6 @@ import (
"k8s.io/kubernetes/pkg/kubelet/checkpointmanager"
"k8s.io/kubernetes/pkg/kubelet/checkpointmanager/errors"
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
"k8s.io/kubernetes/pkg/kubelet/types"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package dockershim
package core

import (
"errors"
Expand All @@ -29,10 +29,10 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/Mirantis/cri-dockerd/libdocker"
"github.com/Mirantis/cri-dockerd/network"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
"k8s.io/kubernetes/pkg/kubelet/dockershim/network"
"k8s.io/kubernetes/pkg/kubelet/types"
)

Expand Down Expand Up @@ -294,7 +294,7 @@ func TestSetUpPodFailure(t *testing.T) {
mockPlugin.EXPECT().SetUpPod(ns, name, cID).Return(errors.New("setup pod error")).AnyTimes()
// If SetUpPod() fails, we expect TearDownPod() to immediately follow
mockPlugin.EXPECT().TearDownPod(ns, name, cID)
// Assume network plugin doesn't return error, dockershim should still be able to return not ready correctly.
// Assume network plugin doesn't return error, cri-dockerd should still be able to return not ready correctly.
mockPlugin.EXPECT().GetPodNetworkStatus(ns, name, cID).Return(&network.PodNetworkStatus{IP: net.IP("127.0.0.01")}, nil).AnyTimes()

t.Logf("RunPodSandbox should return error")
Expand Down
Loading

0 comments on commit 278a1fc

Please sign in to comment.