Skip to content

Commit

Permalink
Kotsadm works with HTTP_PROXY
Browse files Browse the repository at this point in the history
Add proxy template functions
  • Loading branch information
Andrew Reed committed May 28, 2020
1 parent d0b4625 commit 6c3e103
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ kots: fmt vet

.PHONY: ffi
ffi: fmt vet
go build ${LDFLAGS} -o bin/kots.so -buildmode=c-shared ./ffi/...
go build ${LDFLAGS} $(BUILDFLAGS) -o bin/kots.so -buildmode=c-shared ./ffi/...

.PHONY: fmt
fmt:
Expand Down
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ require (
github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c // indirect
github.com/containers/image v3.0.2+incompatible
github.com/containers/storage v1.16.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.2 // indirect
github.com/coreos/etcd v3.3.15+incompatible // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker-credential-helpers v0.6.3 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
github.com/etcd-io/bbolt v1.3.3 // indirect
github.com/fatih/color v1.7.0
github.com/ghodss/yaml v1.0.0
github.com/go-logfmt/logfmt v0.4.0 // indirect
github.com/google/gofuzz v1.1.0
github.com/google/uuid v1.1.1
github.com/gorilla/mux v1.7.4 // indirect
Expand All @@ -33,7 +32,6 @@ require (
github.com/mattn/go-isatty v0.0.9
github.com/mholt/archiver v3.1.1+incompatible
github.com/mtrmac/gpgme v0.1.2 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/ostreedev/ostree-go v0.0.0-20190702140239-759a8c1ac913 // indirect
github.com/otiai10/copy v1.0.2
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
Expand All @@ -48,6 +46,7 @@ require (
github.com/vbauerster/mpb v3.4.0+incompatible // indirect
go.undefinedlabs.com/scopeagent v0.1.12
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904
golang.org/x/net v0.0.0-20200202094626-16171245cfb2
gopkg.in/yaml.v2 v2.2.8
helm.sh/helm/v3 v3.1.2
k8s.io/api v0.17.4
Expand Down
2 changes: 1 addition & 1 deletion kotsadm/api/src/snapshots/resolvers/veleroClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class VeleroClient {
if (!cluster) {
throw new Error("No cluster available from kubeconfig");
}
this.server = cluster.server;
this.server = "https://kubernetes.default"
}

// tslint:disable-next-line cyclomatic-complexity
Expand Down
1 change: 1 addition & 0 deletions kotsadm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ require (
go.uber.org/zap v1.13.0
go.undefinedlabs.com/scopeagent v0.1.15
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
google.golang.org/api v0.6.1-0.20190607001116-5213b8090861
gopkg.in/go-playground/assert.v1 v1.2.1
gopkg.in/ini.v1 v1.51.0
Expand Down
9 changes: 9 additions & 0 deletions kotsadm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ github.com/containers/storage v1.16.2/go.mod h1:/RNmsK01ajCL+VtMSi3W8kHzpBwN+Q5g
github.com/coredns/corefile-migration v1.0.4/go.mod h1:OFwBp/Wc9dJt5cAZzHWMNhK1r5L0p0jDwIBc6j8NC8E=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.15+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
Expand Down Expand Up @@ -502,6 +503,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/heketi/heketi v9.0.1-0.20190917153846-c2e2a4ab7ab9+incompatible/go.mod h1:bB9ly3RchcQqsQ9CpyaQwvva7RS5ytVoSoholZQON6o=
github.com/heketi/tests v0.0.0-20151005000721-f3775cbcefd6/go.mod h1:xGMAM8JLi7UkZt1i4FQeQy0R2T8GLUwQhOP5M1gBhy4=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
Expand Down Expand Up @@ -641,6 +644,8 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/hashstructure v1.0.0 h1:ZkRJX1CyOoTkar7p/mLS5TZU4nJ1Rn/F8u9dGS02Q3Y=
github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ=
github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
Expand Down Expand Up @@ -722,6 +727,8 @@ github.com/ostreedev/ostree-go v0.0.0-20190702140239-759a8c1ac913/go.mod h1:J6OG
github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/pact-foundation/pact-go v1.0.0-beta.5 h1:pTm7BOQ/karCyvZQtRk9lwJ7ZEK5rF+ocdcd5oZFkXc=
github.com/pact-foundation/pact-go v1.0.0-beta.5/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
Expand Down Expand Up @@ -771,6 +778,8 @@ github.com/quobyte/api v0.1.2/go.mod h1:jL7lIHrmqQ7yh05OJ+eEEdHr0u/kmT1Ff9iHd+4H
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be h1:ta7tUOvsPHVHGom5hKW5VXNc2xZIkfCKP8iaqOyYtUQ=
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be/go.mod h1:MIDFMn7db1kT65GmV94GzpX9Qdi7N/pQlwb+AN8wh+Q=
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
github.com/replicatedhq/kots/kotsadm/operator v0.0.0-20200527192614-bfc9e41260ef h1:881xTukpk9/kApfCRTAtURBPHZw7J5G4BicteUsAzOg=
github.com/replicatedhq/kots/kotsadm/operator v0.0.0-20200527192614-bfc9e41260ef/go.mod h1:25JyKZ44n+Pmq1YeghP4kXLxIMS2Jig15j0GsPBOE/8=
github.com/replicatedhq/kurl/kurlkinds v0.0.0-20200306230415-b6d377a48a56 h1:W4lzQxpdUPFVTjs6zCDFGyAbPfow28zbFU65QCQf+SY=
github.com/replicatedhq/kurl/kurlkinds v0.0.0-20200306230415-b6d377a48a56/go.mod h1:Vp5X4tM0KmahplYOvdRqs2NY2qy1amZ89zZBm9CDENw=
github.com/replicatedhq/troubleshoot v0.9.36 h1:lrMOTJFQ/q5u1TVaHBHYBv4mLhmHtxnJQJf88eLgtFo=
Expand Down
1 change: 1 addition & 0 deletions pkg/docker/registry/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var (
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
Proxy: http.ProxyFromEnvironment,
},
}
)
Expand Down
11 changes: 11 additions & 0 deletions pkg/template/static_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ func (ctx StaticCtx) FuncMap() template.FuncMap {
funcMap["IsKurl"] = ctx.isKurl
funcMap["Distribution"] = ctx.distribution

funcMap["HTTPProxy"] = ctx.httpProxy
funcMap["NoProxy"] = ctx.noProxy

return funcMap
}

Expand Down Expand Up @@ -495,3 +498,11 @@ func (ctx StaticCtx) distribution() string {

return provider
}

func (ctx StaticCtx) httpProxy() string {
return os.Getenv("HTTP_PROXY")
}

func (ctx StaticCtx) noProxy() string {
return os.Getenv("NO_PROXY")
}

0 comments on commit 6c3e103

Please sign in to comment.