Skip to content

Commit

Permalink
refactor client to be a generic proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanholsteijn committed Dec 29, 2021
1 parent cb34df2 commit aea90a3
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions client/cmd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gkeclient
package client

import (
"log"
Expand All @@ -7,8 +7,8 @@ import (
"github.com/spf13/cobra"
)

// NewGKEClientCmd create a gke client command
func NewGKEClientCmd() *cobra.Command {
// NewClientCmd create a gke client command
func NewClientCmd() *cobra.Command {
c := Proxy{
RootCommand: cmd.RootCommand{
Command: cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion client/load_certificate.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gkeclient
package client

import (
"crypto/tls"
Expand Down
2 changes: 1 addition & 1 deletion client/proxy.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gkeclient
package client

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion client/rewrite_request_url.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gkeclient
package client

import (
"net/http"
Expand Down
2 changes: 1 addition & 1 deletion cmd/generate_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/spf13/cobra"
)

// GeneratedCertificate command
// GenerateCertificate represents the command to generate a certificate
type GenerateCertificate struct {
RootCommand
DNSName string
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"

"github.com/binxio/simple-iap-proxy/cmd"
"github.com/binxio/simple-iap-proxy/gkeclient"
"github.com/binxio/simple-iap-proxy/client"
"github.com/binxio/simple-iap-proxy/gkeserver"
"github.com/spf13/cobra"
)
Expand All @@ -24,7 +24,7 @@ is run inside the VPC.
}
c.AddPersistentFlags()
c.AddCommand(cmd.NewGenerateCertificateCmd())
c.AddCommand(gkeclient.NewGKEClientCmd())
c.AddCommand(client.NewClientCmd())
c.AddCommand(gkeserver.NewGKEServerCmd())
return &c
}
Expand Down
2 changes: 1 addition & 1 deletion terraform/iap-proxy.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ After=docker.service network-online.target


[Service]
Environment="IMAGE=gcr.io/binx-io-public/simple-iap-proxy:0.4.1"
Environment="IMAGE=gcr.io/binx-io-public/simple-iap-proxy:0.5.1"

ExecStartPre=ctr images pull ${IMAGE}

Expand Down
4 changes: 2 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ locals {
cloud_config = {
runcmd = [
"c_rehash > /dev/null",
"iptables -I INPUT -p tcp -j ACCEPT",
"i6ptables -I INPUT -p tcp -j ACCEPT",
"iptables -I INPUT -p tcp -j ACCEPT --dport 8443",
"i6ptables -I INPUT -p tcp -j ACCEPT --dport 8443",
"systemctl daemon-reload",
"systemctl enable --now iap-proxy.service"
]
Expand Down
5 changes: 3 additions & 2 deletions terraform/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ EOF

output "iap_proxy_command" {
value = <<EOF
simple-iap-proxy gke-client \
simple-iap-proxy client \
--target-url ${local.exports.target-url} \
--iap-audience ${local.exports.audience} \
--service-account ${local.exports.service-account} \
--key-file server.key \
--certificate-file server.crt
--certificate-file server.crt \
--to-gke
EOF
}

Expand Down

0 comments on commit aea90a3

Please sign in to comment.