Skip to content

Commit

Permalink
Merge pull request #474 from benluddy/scratch-nsswitch
Browse files Browse the repository at this point in the history
Make the inability to create /etc/nsswitch.conf non-fatal.
  • Loading branch information
openshift-merge-robot committed Oct 12, 2020
2 parents c76735d + d0d1be5 commit ef1f1ec
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions appr-registry.Dockerfile
Expand Up @@ -22,6 +22,7 @@ COPY --from=builder /go/src/github.com/operator-framework/operator-registry/vend
RUN CGO_ENABLED=0 go install -a -tags netgo -ldflags "-w"

FROM scratch
COPY ["nsswitch.conf", "/etc/nsswitch.conf"]
COPY --from=builder /go/src/github.com/operator-framework/operator-registry/bin/appregistry-server /bin/appregistry-server
COPY --from=probe-builder /go/bin/grpc-health-probe /bin/grpc_health_probe
EXPOSE 50051
Expand Down
2 changes: 1 addition & 1 deletion cmd/appregistry-server/main.go
Expand Up @@ -65,7 +65,7 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
}
// Ensure there is a default nsswitch config
if err := dns.EnsureNsswitch(); err != nil {
return err
logrus.WithError(err).Warn("unable to write default nsswitch config")
}
kubeconfig, err := cmd.Flags().GetString("kubeconfig")
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/configmap-server/main.go
Expand Up @@ -71,7 +71,7 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
}
// Ensure there is a default nsswitch config
if err := dns.EnsureNsswitch(); err != nil {
return err
logrus.WithError(err).Warn("unable to write default nsswitch config")
}
kubeconfig, err := cmd.Flags().GetString("kubeconfig")
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/opm/registry/serve.go
Expand Up @@ -63,7 +63,7 @@ func serveFunc(cmd *cobra.Command, args []string) error {

// Ensure there is a default nsswitch config
if err := dns.EnsureNsswitch(); err != nil {
return err
logrus.WithError(err).Warn("unable to write default nsswitch config")
}

dbName, err := cmd.Flags().GetString("database")
Expand Down
2 changes: 1 addition & 1 deletion cmd/registry-server/main.go
Expand Up @@ -65,7 +65,7 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
}
// Ensure there is a default nsswitch config
if err := dns.EnsureNsswitch(); err != nil {
return err
logrus.WithError(err).Warn("unable to write default nsswitch config")
}
dbName, err := cmd.Flags().GetString("database")
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions configmap-registry.Dockerfile
Expand Up @@ -2,6 +2,7 @@ FROM quay.io/operator-framework/upstream-registry-builder:latest as builder
FROM busybox as userspace

FROM scratch
COPY ["nsswitch.conf", "/etc/nsswitch.conf"]
COPY --from=builder /bin/configmap-server /bin/configmap-server
COPY --from=builder /bin/opm /bin/opm
COPY --from=userspace /bin/cp /bin/cp
Expand Down
1 change: 1 addition & 0 deletions index.Dockerfile
Expand Up @@ -2,6 +2,7 @@ FROM quay.io/operator-framework/upstream-registry-builder AS builder

FROM scratch
LABEL operators.operatorframework.io.index.database.v1=./index.db
COPY ["nsswitch.conf", "/etc/nsswitch.conf"]
COPY database ./
COPY --from=builder /bin/opm /opm
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
Expand Down
1 change: 1 addition & 0 deletions nsswitch.conf
@@ -0,0 +1 @@
hosts: files dns
1 change: 1 addition & 0 deletions opm-example.Dockerfile
Expand Up @@ -2,6 +2,7 @@ FROM quay.io/operator-framework/upstream-opm-builder AS builder

FROM scratch
LABEL operators.operatorframework.io.index.database.v1=./index.db
COPY ["nsswitch.conf", "/etc/nsswitch.conf"]
COPY database ./
COPY --from=builder /bin/opm /opm
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
Expand Down
1 change: 1 addition & 0 deletions registry.Dockerfile
Expand Up @@ -14,6 +14,7 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.3.2 && \
chmod +x /bin/grpc_health_probe

FROM scratch
COPY ["nsswitch.conf", "/etc/nsswitch.conf"]
COPY --from=builder /build/bin/registry-server /registry-server
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
EXPOSE 50051
Expand Down
2 changes: 2 additions & 0 deletions upstream-builder.Dockerfile
Expand Up @@ -15,6 +15,8 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.3.2 && \

FROM alpine:3

COPY ["nsswitch.conf", "/etc/nsswitch.conf"]

RUN chgrp -R 0 /etc && \
chmod -R g+rwx /etc

Expand Down
1 change: 1 addition & 0 deletions upstream-example.Dockerfile
Expand Up @@ -4,6 +4,7 @@ COPY manifests manifests
RUN /bin/initializer -o ./bundles.db

FROM scratch
COPY ["nsswitch.conf", "/etc/nsswitch.conf"]
COPY --from=builder /build/bundles.db /bundles.db
COPY --from=builder /bin/registry-server /registry-server
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
Expand Down
1 change: 1 addition & 0 deletions upstream-opm-builder.Dockerfile
Expand Up @@ -15,5 +15,6 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.3.2 && \

FROM alpine
RUN apk update && apk add ca-certificates
COPY ["nsswitch.conf", "/etc/nsswitch.conf"]
COPY --from=builder /build/bin/opm /bin/opm
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe

0 comments on commit ef1f1ec

Please sign in to comment.