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

Commit

Permalink
TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
hakman committed Sep 25, 2023
1 parent 407cbff commit 4154c56
Show file tree
Hide file tree
Showing 18 changed files with 2,437 additions and 738 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64"
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
Expand All @@ -31,7 +31,7 @@ jobs:

- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64"
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
Expand All @@ -49,7 +49,7 @@ jobs:

- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64"
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
Expand All @@ -67,7 +67,7 @@ jobs:

- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64"
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
Expand Down
14 changes: 7 additions & 7 deletions etcd-manager/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "56d8c5a5c91e1af73eca71a6fab2ced959b67c86d12ba37feedb0a2dfea441a6",
sha256 = "278b7ff5a826f3dc10f04feaf0b70d48b68748ccd512d7f98bf442077f043fe3",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.37.0/rules_go-v0.37.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.37.0/rules_go-v0.37.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
],
)

http_archive(
name = "bazel_gazelle",
sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
sha256 = "d3fa66a39028e97d76f9e2db8f1b0c11c099e8e01bf363a923074784e451f809",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
],
)

Expand All @@ -28,7 +28,7 @@ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

go_rules_dependencies()

go_register_toolchains(version = "1.19.9")
go_register_toolchains(version = "1.20.8")

gazelle_dependencies()

Expand Down
12 changes: 6 additions & 6 deletions etcd-manager/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ require (
go.etcd.io/etcd/client/v3 v3.5.9
golang.org/x/net v0.15.0
golang.org/x/oauth2 v0.12.0
google.golang.org/api v0.140.0
google.golang.org/api v0.142.0
google.golang.org/grpc v1.58.0
gopkg.in/gcfg.v1 v1.2.3
k8s.io/apimachinery v0.28.1
k8s.io/client-go v0.28.1
k8s.io/apimachinery v0.28.2
k8s.io/client-go v0.28.2
k8s.io/klog/v2 v2.100.1
k8s.io/kops v1.28.0-beta.2
k8s.io/mount-utils v0.28.1
k8s.io/kops v1.28.0
k8s.io/mount-utils v0.28.2
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/yaml v1.3.0
)
Expand Down Expand Up @@ -83,7 +83,7 @@ require (
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
24 changes: 12 additions & 12 deletions etcd-manager/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.140.0 h1:CaXNdYOH5oQQI7l6iKTHHiMTdxZca4/02hRg2U8c2hM=
google.golang.org/api v0.140.0/go.mod h1:aGbCiFgtwb2P6badchFbSBUurV6oR5d50Af4iNJtDdI=
google.golang.org/api v0.142.0 h1:mf+7EJ94fi5ZcnpPy+m0Yv2dkz8bKm+UL0snTCuwXlY=
google.golang.org/api v0.142.0/go.mod h1:zJAN5o6HRqR7O+9qJUFOWrZkYE66RH+efPBdTLA4xBA=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
Expand All @@ -312,8 +312,8 @@ google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWof
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8=
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44=
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832 h1:o4LtQxebKIJ4vkzyhtD2rfUNZ20Zf0ik5YVP5E7G7VE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb h1:Isk1sSH7bovx8Rti2wZK0UZF6oraBDK74uoyLEEVFN0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
Expand Down Expand Up @@ -352,16 +352,16 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/apimachinery v0.28.1 h1:EJD40og3GizBSV3mkIoXQBsws32okPOy+MkRyzh6nPY=
k8s.io/apimachinery v0.28.1/go.mod h1:X0xh/chESs2hP9koe+SdIAcXWcQ+RM5hy0ZynB+yEvw=
k8s.io/client-go v0.28.1 h1:pRhMzB8HyLfVwpngWKE8hDcXRqifh1ga2Z/PU9SXVK8=
k8s.io/client-go v0.28.1/go.mod h1:pEZA3FqOsVkCc07pFVzK076R+P/eXqsgx5zuuRWukNE=
k8s.io/apimachinery v0.28.2 h1:KCOJLrc6gu+wV1BYgwik4AF4vXOlVJPdiqn0yAWWwXQ=
k8s.io/apimachinery v0.28.2/go.mod h1:RdzF87y/ngqk9H4z3EL2Rppv5jj95vGS/HaFXrLDApU=
k8s.io/client-go v0.28.2 h1:DNoYI1vGq0slMBN/SWKMZMw0Rq+0EQW6/AK4v9+3VeY=
k8s.io/client-go v0.28.2/go.mod h1:sMkApowspLuc7omj1FOSUxSoqjr+d5Q0Yc0LOFnYFJY=
k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg=
k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kops v1.28.0-beta.2 h1:kTeOgn8iIF3T22+Q9KsdlxqmvyrgHFkRKvsCq67Z50s=
k8s.io/kops v1.28.0-beta.2/go.mod h1:h2uKSWUqA3C3yGLt118OYDF9b884TpM0wZwKyv5WGyY=
k8s.io/mount-utils v0.28.1 h1:oyPtn8ZVxniBfwSlQaBF4fr7QVNYzUuk+gkuxEJgil0=
k8s.io/mount-utils v0.28.1/go.mod h1:AyP8LmZSLgpGdFQr+vzHTerlPiGvXUdP99n98Er47jw=
k8s.io/kops v1.28.0 h1:AQuRGuUm1tUBxXHpcb4RTg1CG9LMK0bbrQpgUcKgXdM=
k8s.io/kops v1.28.0/go.mod h1:h2uKSWUqA3C3yGLt118OYDF9b884TpM0wZwKyv5WGyY=
k8s.io/mount-utils v0.28.2 h1:sIdMH7fRhcU48V1oYJ9cLmLm/TG+2jLhhe8eS3I+FWg=
k8s.io/mount-utils v0.28.2/go.mod h1:AyP8LmZSLgpGdFQr+vzHTerlPiGvXUdP99n98Er47jw=
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
Expand Down
11 changes: 8 additions & 3 deletions etcd-manager/pkg/backup/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package backup

import (
"bytes"
"context"
"fmt"
"os"
"path"
Expand Down Expand Up @@ -46,6 +47,8 @@ type vfsStore struct {
var _ Store = &vfsStore{}

func (s *vfsStore) AddBackup(srcFile string, sequence string, info *etcd.BackupInfo) (string, error) {
ctx := context.TODO()

now := time.Now()

if info.Timestamp == 0 {
Expand All @@ -63,7 +66,7 @@ func (s *vfsStore) AddBackup(srcFile string, sequence string, info *etcd.BackupI
defer f.Close()

destPath := s.backupsBase.Join(name).Join(DataFilename)
err = destPath.WriteFile(f, nil)
err = destPath.WriteFile(ctx, f, nil)
if err != nil {
return "", fmt.Errorf("error copying %q to %q: %v", srcFile, destPath, err)
}
Expand All @@ -78,7 +81,7 @@ func (s *vfsStore) AddBackup(srcFile string, sequence string, info *etcd.BackupI
return "", fmt.Errorf("error marshalling state: %v", err)
}

err = p.WriteFile(bytes.NewReader([]byte(data)), nil)
err = p.WriteFile(ctx, bytes.NewReader([]byte(data)), nil)
if err != nil {
return "", fmt.Errorf("error writing file %q: %v", p, err)
}
Expand Down Expand Up @@ -140,9 +143,11 @@ func (s *vfsStore) RemoveBackup(backup string) error {
func (s *vfsStore) LoadInfo(name string) (*etcd.BackupInfo, error) {
klog.Infof("Loading info for backup %q", name)

ctx := context.TODO()

p := s.backupsBase.Join(name, MetaFilename)

data, err := p.ReadFile()
data, err := p.ReadFile(ctx)
if err != nil {
return nil, fmt.Errorf("error reading file %q: %v", p, err)
}
Expand Down
13 changes: 7 additions & 6 deletions etcd-manager/pkg/commands/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package commands

import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
Expand Down Expand Up @@ -73,7 +74,7 @@ func (s *vfsStore) AddCommand(cmd *protoetcd.Command) error {

p := s.commandsBase.Join(name, CommandFilename)
klog.Infof("Adding command at %s: %v", p, cmd)
if err := p.WriteFile(bytes.NewReader([]byte(data)), nil); err != nil {
if err := p.WriteFile(context.TODO(), bytes.NewReader([]byte(data)), nil); err != nil {
return fmt.Errorf("error writing file %q: %v", p.Path(), err)
}
}
Expand All @@ -96,7 +97,7 @@ func (s *vfsStore) ListCommands() ([]Command, error) {
continue
}

data, err := f.ReadFile()
data, err := f.ReadFile(context.TODO())
if err != nil {
return nil, fmt.Errorf("error reading %s: %v", f, err)
}
Expand Down Expand Up @@ -134,7 +135,7 @@ func (s *vfsStore) RemoveCommand(command Command) error {

func (s *vfsStore) GetExpectedClusterSpec() (*protoetcd.ClusterSpec, error) {
p := s.commandsBase.Join(EtcdClusterSpec)
data, err := p.ReadFile()
data, err := p.ReadFile(context.TODO())
if err != nil {
if os.IsNotExist(err) {
// TODO: On S3, loop to try to establish consistency?
Expand All @@ -158,7 +159,7 @@ func (s *vfsStore) SetExpectedClusterSpec(spec *protoetcd.ClusterSpec) error {
}

p := s.commandsBase.Join(EtcdClusterSpec)
if err := p.WriteFile(bytes.NewReader([]byte(data)), nil); err != nil {
if err := p.WriteFile(context.TODO(), bytes.NewReader([]byte(data)), nil); err != nil {
return fmt.Errorf("error writing cluster spec file %s: %v", p.Path(), err)
}

Expand All @@ -169,7 +170,7 @@ func (s *vfsStore) IsNewCluster() (bool, error) {
p := s.commandsBase.Join(EtcdClusterCreated)

// Note that we use ReadFile so that we use a GET on S3, which is more consistent
data, err := p.ReadFile()
data, err := p.ReadFile(context.TODO())
if err != nil {
if os.IsNotExist(err) {
// TODO: On S3, loop to try to establish consistency?
Expand Down Expand Up @@ -198,7 +199,7 @@ func (s *vfsStore) MarkClusterCreated() error {
}

p := s.commandsBase.Join(EtcdClusterCreated)
if err := p.WriteFile(bytes.NewReader([]byte(data)), nil); err != nil {
if err := p.WriteFile(context.TODO(), bytes.NewReader([]byte(data)), nil); err != nil {
return fmt.Errorf("error creating cluster-creation marker file %s: %v", p.Path(), err)
}
return nil
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions etcd-manager/vendor/golang.org/x/sys/windows/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions etcd-manager/vendor/google.golang.org/api/internal/creds.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion etcd-manager/vendor/google.golang.org/api/internal/s2a.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions etcd-manager/vendor/google.golang.org/api/internal/settings.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4154c56

Please sign in to comment.