Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2935 from fidencio/wip/stable-1.11-backport-add-a…
Browse files Browse the repository at this point in the history
…---version-cli-option

[stable-1.11] shimv2: Add a "--version" cli option
  • Loading branch information
jodh-intel authored Sep 8, 2020
2 parents eba7ab2 + 14df242 commit 7840ed8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,16 @@ define MAKE_KERNEL_VIRTIOFS_NAME
$(if $(findstring uncompressed,$1),vmlinux-virtiofs.container,vmlinuz-virtiofs.container)
endef

GENERATED_CONFIG = $(abspath $(CLI_DIR)/config-generated.go)

GENERATED_FILES += $(CLI_DIR)/config-generated.go
GENERATED_FILES += $(GENERATED_CONFIG)
GENERATED_FILES += pkg/katautils/config-settings.go

$(TARGET_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) | show-summary
$(QUIET_BUILD)(cd $(CLI_DIR) && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .)

$(SHIMV2_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST)
$(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && ln -fs $(GENERATED_CONFIG))
$(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && go build $(KATA_LDFLAGS) $(BUILDTAGS) -i -o $@ .)

.PHONY: \
Expand Down Expand Up @@ -704,7 +706,14 @@ install-completions:
$(QUIET_INST)install --mode 0644 -D $(BASH_COMPLETIONS) $(DESTDIR)/$(BASH_COMPLETIONSDIR)/$(notdir $(BASH_COMPLETIONS));

clean:
$(QUIET_CLEAN)rm -f $(TARGET) $(SHIMV2) $(NETMON_TARGET) $(CONFIGS) $(GENERATED_FILES) .git-commit .git-commit.tmp
$(QUIET_CLEAN)rm -f \
$(CONFIGS) \
$(GENERATED_FILES) \
$(NETMON_TARGET) \
$(SHIMV2) \
$(SHIMV2_DIR)/$(notdir $(GENERATED_CONFIG)) \
$(TARGET) \
.git-commit .git-commit.tmp

show-usage: show-header
@printf "• Overview:\n"
Expand Down
12 changes: 11 additions & 1 deletion cli/containerd-shim-kata-v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@
package main

import (
"fmt"
"os"

"github.com/containerd/containerd/runtime/v2/shim"
"github.com/kata-containers/runtime/containerd-shim-v2"
)

const shimID = "io.containerd.kata.v2"

func shimConfig(config *shim.Config) {
config.NoReaper = true
config.NoSubreaper = true
}

func main() {
shim.Run("io.containerd.kata.v2", containerdshim.New, shimConfig)
if len(os.Args) == 2 && os.Args[1] == "--version" {
fmt.Printf("%s containerd shim: id: %q, version: %s, commit: %v\n", project, shimID, version, commit)
os.Exit(0)
}

shim.Run(shimID, containerdshim.New, shimConfig)
}

0 comments on commit 7840ed8

Please sign in to comment.