Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fixed node creationg flow
Browse files Browse the repository at this point in the history
Signed-off-by: Ildar Valiullin <[email protected]>
  • Loading branch information
preved911 committed Jul 5, 2021
1 parent e3d6d58 commit f671100
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

############# builder #############
FROM golang:1.13.5 AS builder
FROM golang:1.15.13 AS builder

WORKDIR /go/src/github.com/flant/machine-controller-manager-provider-yandex
COPY go.mod go.sum ./
RUN go mod download -x
COPY . .

RUN .ci/build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o bin/rel/machine-controller cmd/machine-controller/main.go

############# base #############
FROM alpine:3.11.2 as base
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/flant/machine-controller-manager-provider-yandex
go 1.15

require (
github.com/gardener/machine-controller-manager v0.34.0
github.com/gardener/machine-controller-manager v0.39.0
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d
github.com/golang/protobuf v1.4.2 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
Expand All @@ -28,7 +28,7 @@ require (
)

replace (
github.com/gardener/machine-controller-manager => github.com/gardener/machine-controller-manager v0.33.1-0.20200828071210-90f8b67cc5e6
github.com/gardener/machine-controller-manager => github.com/gardener/machine-controller-manager v0.39.0
github.com/onsi/gomega => github.com/onsi/gomega v1.5.0
github.com/prometheus/client_golang => github.com/prometheus/client_golang v0.9.2
k8s.io/api => k8s.io/api v0.0.0-20190918155943-95b840bb6a1f // kubernetes-1.16.0
Expand Down
7 changes: 5 additions & 2 deletions pkg/provider/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineR
return nil, mcmstatus.Error(mcmcodes.Internal, fmt.Sprintf("Yandex.Cloud API returned %q instead of \"*compute.Instance\". That shouldn't happen", reflect.TypeOf(result).String()))
}

return &driver.CreateMachineResponse{ProviderID: encodeMachineID(newInstance.ZoneId, newInstance.Name), NodeName: machine.Name}, nil
return &driver.CreateMachineResponse{ProviderID: encodeMachineID(newInstance.ZoneId, newInstance.Id), NodeName: machine.Name}, nil
}

// DeleteMachine handles a machine deletion request
Expand Down Expand Up @@ -249,6 +249,9 @@ func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineS
if err != nil {
return nil, mcmstatus.Error(mcmcodes.Internal, err.Error())
}
if machine.Spec.ProviderID == "" {
return nil, mcmstatus.Error(mcmcodes.NotFound, "providerID field is empty")
}
_, instanceID, err := decodeMachineID(machine.Spec.ProviderID)
if err != nil {
return nil, mcmstatus.Error(mcmcodes.InvalidArgument, err.Error())
Expand All @@ -261,7 +264,7 @@ func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineS
}
}

return nil, nil
return &driver.GetMachineStatusResponse{ProviderID: machine.Spec.ProviderID, NodeName: instanceID}, nil
}

// ListMachines lists all the machines possibilly created by a providerSpec
Expand Down

0 comments on commit f671100

Please sign in to comment.