Skip to content

Commit

Permalink
Merge branch 'ver/install-context' into ver/upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
olix0r committed Mar 28, 2019
2 parents 50f27e3 + 2219d8f commit 14b68ed
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile-proxy
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN (proxy=$(bin/fetch-proxy $PROXY_VERSION) && \
echo "$version" >version.txt)

## compile proxy-identity agent
FROM gcr.io/linkerd-io/go-deps:cdba5b70 as golang
FROM gcr.io/linkerd-io/go-deps:f39dc9a4 as golang
WORKDIR /go/src/github.com/linkerd/linkerd2
ENV CGO_ENABLED=0 GOOS=linux
COPY pkg/flags pkg/flags
Expand Down
1 change: 1 addition & 0 deletions Gopkg.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@
"github.com/sirupsen/logrus",
"github.com/spf13/cobra",
"github.com/spf13/cobra/doc",
"github.com/spf13/pflag",
"github.com/wercker/stern/stern",
"golang.org/x/net/context",
"google.golang.org/grpc",
Expand Down
2 changes: 1 addition & 1 deletion cli/Dockerfile-bin
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## compile binaries
FROM gcr.io/linkerd-io/go-deps:cdba5b70 as golang
FROM gcr.io/linkerd-io/go-deps:f39dc9a4 as golang
WORKDIR /go/src/github.com/linkerd/linkerd2
COPY cli cli
COPY chart chart
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (options *installOptions) recordFlags(flags *pflag.FlagSet) {
if f.Changed {
switch f.Name {
case "ignore-cluster", "linkerd-version":
// Thse flags don't make sense to record.
// These flags don't make sense to record.
default:
options.recordedFlags = append(options.recordedFlags, &pb.Install_Flag{
Name: f.Name,
Expand Down
2 changes: 1 addition & 1 deletion cni-plugin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## compile cni-plugin utility
FROM gcr.io/linkerd-io/go-deps:cdba5b70 as golang
FROM gcr.io/linkerd-io/go-deps:f39dc9a4 as golang
WORKDIR /go/src/github.com/linkerd/linkerd2
COPY proxy-init proxy-init
COPY pkg pkg
Expand Down
2 changes: 1 addition & 1 deletion controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## compile controller services
FROM gcr.io/linkerd-io/go-deps:cdba5b70 as golang
FROM gcr.io/linkerd-io/go-deps:f39dc9a4 as golang
WORKDIR /go/src/github.com/linkerd/linkerd2
COPY controller/gen controller/gen
COPY pkg pkg
Expand Down
43 changes: 43 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,46 @@ func ToJSON(configs *pb.All) (global, proxy, install string, err error) {
install, err = m.MarshalToString(configs.GetInstall())
return
}

func unmarshal(json string, msg proto.Message) error {
u := jsonpb.Unmarshaler{AllowUnknownFields: true}
return u.Unmarshal(strings.NewReader(json), msg)
}

// FromConfigMap builds a configuration by reading a map with the keys "global"
// and "proxy", each containing JSON values.
func FromConfigMap(configMap map[string]string) (*pb.All, error) {
c := &pb.All{Global: &pb.Global{}, Proxy: &pb.Proxy{}, Install: &pb.Install{}}

if err := unmarshal(configMap["global"], c.Global); err != nil {
return nil, err
}

if err := unmarshal(configMap["proxy"], c.Proxy); err != nil {
return nil, err
}

if err := unmarshal(configMap["install"], c.Install); err != nil {
return nil, err
}

return c, nil
}

// ToJSON encode the configuration to JSON, i.e. to be stored in a ConfigMap.
func ToJSON(configs *pb.All) (global, proxy, install string, err error) {
m := jsonpb.Marshaler{EmitDefaults: true}

global, err = m.MarshalToString(configs.GetGlobal())
if err != nil {
return
}

proxy, err = m.MarshalToString(configs.GetProxy())
if err != nil {
return
}

install, err = m.MarshalToString(configs.GetInstall())
return
}
2 changes: 1 addition & 1 deletion proto/config/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ message LogLevel {
//
// Useful for driving upgrades.
message Install {
// The unique ID fr this installation. Does not change on upgrade.
// The unique ID for this installation. Does not change on upgrade.
string uuid = 1;

// The CLI version that drove the last install or upgrade.
Expand Down
2 changes: 1 addition & 1 deletion proxy-init/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## compile proxy-init utility
FROM gcr.io/linkerd-io/go-deps:cdba5b70 as golang
FROM gcr.io/linkerd-io/go-deps:f39dc9a4 as golang
WORKDIR /go/src/github.com/linkerd/linkerd2
COPY ./proxy-init ./proxy-init
RUN CGO_ENABLED=0 GOOS=linux go install -v ./proxy-init/
Expand Down
2 changes: 1 addition & 1 deletion web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ COPY web/app .
RUN $ROOT/bin/web build

## compile go server
FROM gcr.io/linkerd-io/go-deps:cdba5b70 as golang
FROM gcr.io/linkerd-io/go-deps:f39dc9a4 as golang
WORKDIR /go/src/github.com/linkerd/linkerd2
RUN mkdir -p web
COPY web/main.go web
Expand Down

0 comments on commit 14b68ed

Please sign in to comment.