Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
055af3c
Adds key verification to lambda function
JoshVanL Dec 18, 2018
f41dd76
Finishes up verification tests
JoshVanL Dec 18, 2018
4c2969d
Adds test for create tags
JoshVanL Dec 18, 2018
6b29b32
Complete lambda logic
JoshVanL Dec 18, 2018
0a9c0f7
Updates naming and Makefile
JoshVanL Dec 18, 2018
bbfd1e6
Adds tagging_control terraform module
JoshVanL Dec 18, 2018
5397261
Adds start of lambda request client to wing
JoshVanL Dec 18, 2018
b628635
Adds tagging request to wing and allows bastion wing dev mode
JoshVanL Dec 19, 2018
3242678
Set up permissions and networking for instances to lambda function
JoshVanL Dec 19, 2018
0599093
Strictly enforce and maintain known hosts file
JoshVanL Dec 19, 2018
1080f41
Adds ignore changes to tags for instances
JoshVanL Dec 19, 2018
49de727
Further restricts instance lambda invoking privileges
JoshVanL Dec 19, 2018
150d770
Updates vendor
JoshVanL Dec 19, 2018
c2c649a
Share tagging control policy across roles
JoshVanL Jan 2, 2019
62af15f
Adds `wing tag` command, used by Jenkins
JoshVanL Jan 2, 2019
7f4fe24
Updates docs and formats terraform code
JoshVanL Jan 2, 2019
2d0cc22
Removes unused Jenkins user data file
JoshVanL Jan 2, 2019
6991e5c
Adds environment to lambda name with fixes
JoshVanL Jan 3, 2019
88a99e2
Adds in tree zip pkg to zip tagging_control during generate
JoshVanL Jan 4, 2019
3efa646
Uses cobra for tagging_control function
JoshVanL Jan 4, 2019
24f34a0
Remove lambda function ingress SG
JoshVanL Jan 4, 2019
d79852c
Share wing binary read policy across roles in terraform
JoshVanL Jan 9, 2019
f74b18d
Adds a fallback for instances that have no public key tags
JoshVanL Jan 10, 2019
42ad0ff
Use iam_policy_role_attachment for shared wing binary read policy
JoshVanL Jan 11, 2019
06f23fe
Use option `ask` for strict host checking when in interactive mode
JoshVanL Jan 11, 2019
97c52c8
Disable cmd auto gen tags for tagging_control
JoshVanL Jan 11, 2019
086fb9c
Move important instance tags to awstag_ec2_tag
JoshVanL Jan 11, 2019
423a13e
Remove quotes from `WING_ENVIRONMENT`
JoshVanL Jan 11, 2019
db18013
Removes duplicate variable declarations in terraform
JoshVanL Jan 14, 2019
ac70dff
Updates terraform aws provider to prevent early timeouts on lambda
JoshVanL Jan 15, 2019
962cd33
Updates depreciated terraform vpc_id
JoshVanL Jan 15, 2019
66152d1
Remove trailing period from private_zone name
JoshVanL Jan 16, 2019
b1d7eb7
Use in package ssh for all programmatic use cases
JoshVanL Nov 20, 2018
791d421
Adds host key call back function
JoshVanL Jan 21, 2019
bbeaa49
Updates docs, Gopkg.lock and fixes tunnel port string
JoshVanL Jan 21, 2019
884d7da
Adds consul and etcd save and consul restore
JoshVanL Jan 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/tarmak_local_build
/wing_linux_amd64
/wing_linux_amd64_unversioned
/tagging_control_linux_amd64
/tagging_control.zip
/dist/
/bin/
.DS_Store
Expand Down
52 changes: 33 additions & 19 deletions Gopkg.lock

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

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ required = [

[[constraint]]
name = "github.com/terraform-providers/terraform-provider-aws"
version = "1.35.0"
version = "1.43.2"

[[override]]
name = "github.com/aws/aws-sdk-go"
version = "v1.15.31"
version = "v1.15.72"

[[constraint]]
name = "github.com/terraform-providers/terraform-provider-random"
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ verify: generate go_verify verify_boilerplate verify_codegen verify_vendor verif

test: go_test ## runs all defined tests, no puppet tests

generate: go_generate ## generates mocks and assets files
generate: go_build_tagging_control go_generate ## generates mocks and assets files

build: generate go_build ## runs generate, and then go_build targets

Expand All @@ -87,6 +87,9 @@ clean:
go_vet:
go vet $$(go list ./pkg/... ./cmd/...| grep -v pkg/wing/client/clientset/internalversion/fake | grep -v pkg/wing/client/clientset/versioned/fake)

go_build_tagging_control:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-w -X main.version=$(CI_COMMIT_TAG) -X main.commit=$(CI_COMMIT_SHA) -X main.date=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)' -o tagging_control_linux_amd64 ./cmd/tagging_control/.

go_build:
# Build a wing binary
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-w -X main.version=$(CI_COMMIT_TAG) -X main.commit=$(CI_COMMIT_SHA) -X main.date=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)' -o wing_linux_amd64 ./cmd/wing
Expand Down
25 changes: 25 additions & 0 deletions cmd/tagging_control/cmd/handle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright Jetstack Ltd. See LICENSE for details.
package cmd

import (
"fmt"

"github.com/aws/aws-lambda-go/lambda"
"github.com/spf13/cobra"

"github.com/jetstack/tarmak/pkg/tagging_control"
)

var handleCmd = &cobra.Command{
Use: "handle",
Short: "Launch lambda request handler",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("running tagging_control lambda function request handler...\n")

lambda.Start(tagging_control.HandleRequests)
},
}

func init() {
RootCmd.AddCommand(handleCmd)
}
25 changes: 25 additions & 0 deletions cmd/tagging_control/cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright Jetstack Ltd. See LICENSE for details.
package cmd

import (
"fmt"
"os"

"github.com/spf13/cobra"
)

var RootCmd = &cobra.Command{
Use: "tagging_control",
Short: "lambda function used to tag AWS instances with their ssh public keys",
Run: handleCmd.Run,
DisableAutoGenTag: true,
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
42 changes: 42 additions & 0 deletions cmd/tagging_control/cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright Jetstack Ltd. See LICENSE for details.
package cmd

import (
"fmt"
"reflect"
"strings"

"github.com/spf13/cobra"
)

var Version struct {
Version string
BuildDate string
Commit string
}

var AppName string = "tarmak"

func init() {
RootCmd.AddCommand(versionCmd)
}

var versionCmd = &cobra.Command{
Use: "version",
Short: fmt.Sprint("Print the version number of ", AppName),
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("%s", AppName)

v := reflect.ValueOf(Version)

for i := 0; i < v.NumField(); i++ {
fmt.Printf(
" %s: %s",
strings.ToLower(v.Type().Field(i).Name),
v.Field(i).Interface(),
)
}

fmt.Println("")
},
}
37 changes: 37 additions & 0 deletions cmd/tagging_control/cmd/zip.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright Jetstack Ltd. See LICENSE for details.
package cmd

import (
"errors"
"fmt"
"github.com/spf13/cobra"

"github.com/jetstack/tarmak/pkg/tarmak/utils/zip"
)

var zipCmd = &cobra.Command{
Use: "zip [dst] [src...]",
Short: "zip utility",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 2 {
return errors.New("zip expecting files: [dst] [src...]")
}

dst := args[0]
src := args[1:]

fmt.Printf("deflating %s into %s...\n", src, dst)

if err := zip.Zip(src, dst, true); err != nil {
return fmt.Errorf("zip failed: %s", err)
}

fmt.Print("done.\n")

return nil
},
}

func init() {
RootCmd.AddCommand(zipCmd)
}
19 changes: 19 additions & 0 deletions cmd/tagging_control/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright Jetstack Ltd. See LICENSE for details.
package main

import (
"github.com/jetstack/tarmak/cmd/tagging_control/cmd"
)

var (
version string = "dev"
commit string = "unknown"
date string = ""
)

func main() {
cmd.Version.Version = version
cmd.Version.Commit = commit
cmd.Version.BuildDate = date
cmd.Execute()
}
25 changes: 25 additions & 0 deletions cmd/tarmak/cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,31 @@ func clusterKubeconfigFlags(fs *flag.FlagSet) {
)
}

func clusterSnapshotEtcdRestoreFlags(fs *flag.FlagSet) {
store := &globalFlags.Cluster.Snapshot.Etcd.Restore

fs.StringVar(
&store.K8sMain,
consts.RestoreK8sMainFlagName,
"",
"location of k8s-main snapshot backup",
)

fs.StringVar(
&store.K8sEvents,
consts.RestoreK8sEventsFlagName,
"",
"location of k8s-events snapshot backup",
)

fs.StringVar(
&store.Overlay,
consts.RestoreOverlayFlagName,
"",
"location of overlay snapshot backup",
)
}

func init() {
RootCmd.AddCommand(clusterCmd)
}
Loading