Merge pull request #49951 from mkumatag/multiarch_nonewprivs

Automatic merge from submit-queue (batch tested with PRs 50485, 49951, 50508, 50511, 50506)

Multiarch nonewprivs test image

**What this PR does / why we need it**:
This PR is for converting nonewprivs image which pushed very recently part of https://github.com/kubernetes/kubernetes/pull/47019.
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
Fixes #50498 
**Special notes for your reviewer**:

**Release note**:

```NONE```
pull/6/head
Kubernetes Submit Queue 2017-08-11 20:37:54 -07:00 committed by GitHub
commit bbc74a3478
8 changed files with 78 additions and 40 deletions

View File

@ -31,6 +31,7 @@ filegroup(
"//test/images/nettest:all-srcs", "//test/images/nettest:all-srcs",
"//test/images/no-snat-test:all-srcs", "//test/images/no-snat-test:all-srcs",
"//test/images/no-snat-test-proxy:all-srcs", "//test/images/no-snat-test-proxy:all-srcs",
"//test/images/nonewprivs:all-srcs",
"//test/images/port-forward-tester:all-srcs", "//test/images/port-forward-tester:all-srcs",
"//test/images/porter:all-srcs", "//test/images/porter:all-srcs",
"//test/images/resource-consumer:all-srcs", "//test/images/resource-consumer:all-srcs",

View File

@ -0,0 +1,4 @@
amd64=alpine:3.6
arm=arm32v6/alpine:3.6
arm64=arm64v8/alpine:3.6
ppc64le=ppc64le/alpine:3.6

View File

@ -0,0 +1,34 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "nonewprivs",
library = ":go_default_library",
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["nnp.go"],
tags = ["automanaged"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)

View File

@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM alpine:latest FROM BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
COPY nnp /usr/local/bin/nnp COPY nnp /usr/local/bin/nnp
RUN chmod +s /usr/local/bin/nnp RUN chmod +s /usr/local/bin/nnp

View File

@ -12,22 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
.PHONY: all image push clean SRCS = nnp
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
SRC_DIR = $(notdir $(shell pwd))
export
TAG = 1.2 bin:
PREFIX = gcr.io/google_containers ../image-util.sh bin $(SRCS)
.PHONY: bin
all: push
nnp: nnp.c
gcc -static -o $@ $@.c
image: nnp
docker build --pull -t $(PREFIX)/nonewprivs:$(TAG) .
push: image
gcloud docker -- push $(PREFIX)/nonewprivs:$(TAG)
clean:
rm -f nnp

View File

@ -0,0 +1 @@
1.0

View File

@ -1,22 +0,0 @@
// Copyright 2017 The Kubernetes Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main(int argc, char *argv[]){
printf("Effective uid: %d\n", geteuid());
return 0;
}

View File

@ -0,0 +1,26 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"fmt"
"os"
)
func main() {
fmt.Printf("Effective uid: %d\n", os.Geteuid())
}