git.psu.edu will be upgraded to critical security release 13.7.4 Monday, 11/18 between 9 and 10pm. Please email support@git.psu.edu if you have trouble with anything Gitlab-related. Please see the git.psu.edu Yammer group for more information.

Commit 8fe99f1e authored by Christopher Harm's avatar Christopher Harm

Fixing minikube ingress configurations

parent 24c4809a
Pipeline #92369 passed with stages
in 1 minute and 10 seconds
......@@ -20,7 +20,6 @@ import (
"runtime"
"git.psu.edu/k8s/devtool/config"
"git.psu.edu/k8s/devtool/environment"
"github.com/fatih/color"
"github.com/spf13/cobra"
)
......@@ -78,15 +77,7 @@ func init() {
func openBrowser(config config.Config) error {
color.Blue("Launching the Application")
var host string
if minikubeProvider() {
output := environment.RunAndGetOutputRequired("minikube", "ip")
host = output[0]
} else if kindProvider() {
host = "localhost"
}
url := fmt.Sprintf("http://%s%s", host, config.OpenUrlPath)
url := fmt.Sprintf("http://kubernetes.local%s", config.OpenUrlPath)
fmt.Printf("Opening Browser: %s\n", url)
err := open(url)
......
......@@ -22,6 +22,7 @@ import (
"log"
"os"
"os/exec"
"regexp"
"strconv"
"strings"
"time"
......@@ -178,7 +179,7 @@ func start() {
}
defer os.Remove(file.Name())
pkger.Include("/templates/kind-config.yaml")
_ = pkger.Include("/templates/kind-config.yaml")
kindConfigTemplate, err := readPkgedFile("/templates/kind-config.yaml")
if err != nil {
color.New(color.FgRed).Printf("Error reading kind template file: %v\n", err)
......@@ -246,9 +247,13 @@ func start() {
if minikubeProvider() {
environment.RunRequired(true, "minikube", "addons", "enable", "ingress")
applyMinikubeIngressConfig()
}
setupHostsFile()
err := setupHostsFile()
if err != nil {
color.New(color.FgRed).Printf("Failed to setup hosts file: %v\n", err)
}
}
......@@ -450,7 +455,7 @@ func checkIfNginxIngressInstalled() {
}
defer os.Remove(file.Name())
pkger.Include("/templates/nginx-ingress-values.yaml")
_ = pkger.Include("/templates/nginx-ingress-values.yaml")
nginxConfig, err := readPkgedFile("/templates/nginx-ingress-values.yaml")
if err != nil {
color.New(color.FgRed).Printf("Error reading nginx ingress values file: %v", err)
......@@ -472,6 +477,31 @@ func checkIfNginxIngressInstalled() {
}
}
func applyMinikubeIngressConfig() {
color.Blue("Applying minikube ingress configuration.")
file, err := ioutil.TempFile("/tmp", "devtool")
if err != nil {
log.Fatal(err)
}
defer os.Remove(file.Name())
_ = pkger.Include("/templates/minikube-ingress-cm.yaml")
nginxConfig, err := readPkgedFile("/templates/minikube-ingress-cm.yaml")
if err != nil {
color.New(color.FgRed).Printf("Error reading nginx ingress values file: %v", err)
return
}
_, err = file.WriteString(nginxConfig)
if err != nil {
color.New(color.FgRed).Printf("Failed to write nginx values file: %v", err)
}
environment.RunRequired(true, "kubectl", "apply", "-f", file.Name())
}
func helmReleaseInstalled(releaseName string) bool {
var helmReleases []string
if helmVersion2() {
......@@ -519,20 +549,27 @@ func setupHostsFile() error {
var ip string
if minikubeProvider() {
output := environment.RunAndGetOutputRequired("minikube", "ip")
ip = output[0]
output := environment.RunAndGetOutputRequired("minikube", "service", "swagger-ui", "--url")
url := output[0]
urlPattern := regexp.MustCompile(`^http:\/\/([\w.-]+):([\d]+)$`)
urlParts := urlPattern.FindStringSubmatch(url)
ip = urlParts[1]
} else if kindProvider() {
ip = "127.0.0.1"
}
color.New(color.FgGreen).Printf("Cluster Ingress is at: 'http://%s'\n", ip)
if !hostsfile.Has(ip, "kubernetes.local") {
if hostsfile.HasHostname("kubernetes.local") {
color.Red("host ip address has changed. Please clean up your /etc/hosts file")
return fmt.Errorf("host ip address has changed. Please clean up your /etc/hosts file")
color.Red("ACTION REQUIRED: host ip address has changed. Please clean up your /etc/hosts file")
color.New(color.FgRed).Printf("\tKubernetes entry: \"%s kubernetes.local\"\n", ip)
}
color.Red("ACTION REQUIRED: Please modify your /etc/hosts file!")
color.New(color.FgRed).Printf("\tRun: 'echo \"%s kubernetes.local\" | sudo tee -a /etc/hosts'\n", ip)
} else {
color.Green("/etc/hosts file is configured correctly.")
}
return nil
......
......@@ -7,4 +7,4 @@ import (
"github.com/markbates/pkger/pkging/mem"
)
var _ = pkger.Apply(mem.UnmarshalEmbed([]byte(`1f8b08000000000000ffec595973e2b8b7ff2e7a26f1860950751f423221d00999d0098ba7baba6449d8022d1e4b7680aefeeeb7649b2590edde9997ffbf7800eb9cf3b374b49cf393a55f808a9954a0fd0b44549f272a3b2738b3164d6561926b2999315dd314b481154b4e2c94c6beebfb564a12b903d5408f2732d57f421d83f6bb75d5c0007202da80432a400d5c4b04da00d4c0134c23a28f1a89a41552b1f7fa50ca63d4a12bf750a318b4ff02e7e0470d7cd79011d09e41a648250d095452942d77e50d6544197855c37924410d248b886053fcb1e95b8179a76716e218d48c35cec27324b9c561ba08a126ca3235a51f1acd3f1591c50937cd5d93a4682bcc66d4b812ae3451a00690e4494a94b2660c6ab2af88d6342964a1211524b51855ba529065514a578996db8205cb1a4b01d1242e5cac64bc6fc40aee04825e8bd8f57da775a4b0a8d02415905904bfc014ab43186334d114ed3431877bd2f6f5140a9c69cade30a92cd48cec0c1cfb3bc1bcb727a1fa9eb0df011543e795e4fa8d57b2efb87bf241939aed8dd3d2b75baf252b59d025a8010c350ca12296fa9b5938a57931d6442089a988f68a1654c2d997cd5b8dfa2b0d15305ded6b90caf7c5982cf7c5b959e87b7242b811d354a6c6f71983c68119d7e502fd786dbf6d956246a30f0044e43495821371d8887a21679164d0f42ba30ce72455b4f0772f5650bc5e91d44a09c48c0af2da38839ac616924c1e44d84c09a9e96cb52dbc364732cc6633c8a41593941cda64c4889565f420a463a8628a649a5831621f988a1f54fa33480253759819de40a5c592ff0ca61014e20b309d2229f2cf605a2e88f80864d6d5173a50c0bee05a817ba3d17936cf2c2814d524e51f982c0dc397941e8d13cb045d8612c5caca3562048ac3441c512405a4a995a43221a9a645ee7b051174261946d24078a233fa2960937f3f4129941222c26cf60fa8639b0f394c8e3c7f07aae1824861bd098d4902ffa56aac19659aa49f785572df97f891f0907c4cb3fb4cfa159cd2581ef9a7b5b022795664151832f28e9d2aa8f5415ee154a39830161b80d9a4607a387f5b8499309d664867871928218c114d496a6ad1921f241b95cc1ccf823392ca770dc723501ad1515eaaf4324ce15b86f90b3493f842a08e49ca0f03a80425158f1c19729a940bb8c8f2e7328daca5a556ca327179a8375b154ba750a8992ca3fdc89a098a242696d8009245744e85b5829c9de786aa4d5ea91e164a9157e8743184e66169c2936afbb45dc866830559b4af4249b62fceb85632d5fb2a41b44e217a55915405b3eeab12c9d8be7cf84a4a668c20cde86b97141511233346a3f855ab6aa510646c337ebb58244a33597441167f1695d5c6a95473b3332f1f5648a35d51ab4db9da3471ca49f5b078c6344d60d1f342f1772635c1052755a121882effad58eb64af58fc6d8668abdc785ce9ccac26a92cb6a646ce52632962522a8b2c092a4b8a46e54b49d90ff330f9855472358c452922cb645bb0d44a6868c62acd842ebb56952c54ecf437d2762ca196bcd89b1e59aa413cd2ab9571b85a213b8a553aa5222a4c2b81aac7aefa6a2e410d942b7f8fc24ac56ea9be924bde35dab23b5550ec4a56a6674ee3b5dc2c44056706971381a5c92e7bf1b5f91688218aa16b2792ad1ccff63f41170f133f5fc56df6b81f81b334279b2f860f70f102cf3e46ecc2b9ead517e1db8dfe07e04f06c82c662c94f971a2148cdeabee55b84459118e9fe292542e579f005d2b4e205a7c80a258c077cc26479739f02d6bb11c1541594aac90629a66ef8ed651527f17b459aca6c2afe00a0ef851034f44e9ed57bcc8182b55db8ff652752fb171b2fd0b7c7a46710fa9006d9d66a4f6a5a38faebc97f8639415c9732e71011e555f396de09c3b2ef8fdfb770dcc4aefdf3d85696f835f590b2af059f9d5756e78cfbc46c54c9a27261a5256d424ca939623740d28ba26a0edd7fd1ae0266fb4ebae5d147f1609a50d5cdbb5cf6cefcc6d3c395ebb7ed1f65be74daf65db1717f5fa995d6fdb2690a8fa6976379b93159303dbbfc035c941bb51bf68346ba0272468fb178d0bdfb65b353060542c40db29268380b6e739cd660d3c530cda8e6ddb35d0dd15273f7f2610dba06dd7c0109b4aed1af8bef3bcc316653fea76ab614489160ab49b3570a929379e7c2708b41dbfe9bbf57aabdea88181321aafe1f9b6efdaceef1ab87f03dabc686da0db3effae81abaf43273f7f6622530483f65f76cdaed93f8a398e49faa5c3b4dd541f1eabedcecff621c78768bb83b2dd695819055f3d0c2bd10721549e4bed22ec3f3ae8aa9d84716d117de5c8f2a308fc5d1ef28036802ecb826b193dba4b07794386a224465d360e26fd351cb7b207da49e1d85fdc8948c375bcbee32cbff3a6cbe978f902bb7fd857dccf83ee68fd1049ddbbede761f7b9d1eb0ef2500c57a1fba251771987fcf95befaa9384e31b113cc9a868b33b5ae3ab5616ba43f620f445efcadfb6d9bb755a57f43282de8806e39b45f83cc8431e2481d38971772083c97dc3d8efbe779ae6d9bb2a7d7ca09d7ec899fde8b6b280338127fd1877591e4632ea5d5d46216f2d82519f052e5be3dbca3697df8ccdfccaf6960cff31aa1bfbe3a42fd07a67ef5d750a7fefc6cb78ca470aad65d4e32c0bbc3e43debd467c1407b78b16beed3bc1f7defe7b319e0c65e8f513c26f6cd3c7bbb1930766acaefa9df016c76432e884dd658e57e6bd0e23b7c3d574d4c991180ea693ce0b1cfb1b5f7435be311cfb0c3183796cf4aea3976a2c64e80dece76e6b85af65f4707d59fa71db5985de309fba2df5403bcf8fcee507753ddaf72fe598c16e6b8d6f8ef5e8b69fe36e6b1eba2f8ddecdf0faf932b9202b3b42fc260bdce7a87f1bc4e1d565e3cfef9d3eee8e56d3c990f5aefc073c7626a1d74fcd5c97f36cde6929b32eb0db5a4177b42ae67eecc4816bd6924e423e64c87bcc8bf97b32ed5c2eee58c0901824a15b8f6613fb1bf194ee75475970d569cd1ee5ff145bee9408bd8b985d6814e1f405e6121115cb332aa294287596439611f5050a7bffb50d97d57dfb532ebb7872ecb6db6cfbf5f356a3e5d49b17b6f7ffe4b2e6bfc76585e7ff072ef39c96e7f91bd6712f3cc7b79bcde65b5c5640eb1be8b6cf6f71d9fbd01397fd9773d9fbc1b52335e48e5698b379f07c339fba2d27148f056184fc469b4413729c8486d04c52e5a3355a39eb60d277e178c0a6e3c13cf44619be4c16c13888f178693ff29b39744786288be41cf21b1a76478670f874bc5c078fc93c747ddb24b2b03b5a3d18c2b91d302482646a92d8659934f12d7b31ed3f15445424d56f7be4f5c7743cd2a1eb3f0593425f90cdb33b52c17860875eaf5125f824e478154c06ebbb499f4dc743ff815ed21de974ecd05d325411cd8e34342345df5b8be0bbb332983bae9d291fad423eb283c97d06c7cd3c1cdfac4dc2aedaca5199bc733497d17072e34cc72f25a174473ce0a3b9219927de7a9aba310b6e472a789451af3b8c83b1938762c0f07545a0b7a375f01ce7c81b3e865edf7ea01d1b891133ed4c2bc27ea8883a18fbf1942fd9ddb8f5128ccdb8decccd5cbdeea7a93349902108eacc4377b919275d90d6b521e7d6fc6e3cc8c3ee924dbd618ea86fc637c1ddd6cad4d7abdac39301bb1b07391238467cc8822b479a8d8721a9fd363f239532d190d315f4e90afa74057dba823e5d419faea04f57d0a72be8d315f4e90afa74057dba823e5d419faea04f57d0a72be8d315f43fbf82fe5f000000ffff010000ffff5901207609300000`)))
var _ = pkger.Apply(mem.UnmarshalEmbed([]byte(`1f8b08000000000000ffec5a5b73e2bab2fe2f7e26f10d134cd57e0864b84d427698048377ad9a9265610b74f1b664825935fffd946c7309e4c2d499f37056f10056ab3f4b2d59fd754ba5bf35cce65c68adbfb508cbeb4464d728ccf46553e8215a49ce8952dde1546b697acc29d2611a3b96e3e8294af81e54d30634e1a9fc3790b1d6fab0ad9a360214692d8d02ccb49a76c7a1d6d2b49af60cd208c9934e22ae07981dbc3ee6fc14756cca039030d65affd1aeb5bf6ada0f0908d25a734004aaa4310282b3b2e71eef62828482572d5c475cab69c93242a12afeb51d5b81f960643aa4a15653da380bae21a73a05e9320012095db5947eaa54ff98453a455475778792a2af209b63654a904b24b49a06394d5224843e2740a2c38a6883934266126086529d6021ab0ab42e4a699e48be2be8a06cb114204ee2c2c44a0e0f95a1007b01c1b76268398ee99e54e898499432407414be823414c73042702231dcd7c4141c48bbd753c0c24c62f28e4a64812468afa0a1b317d47b0712ac1f088703103130df4896d378233ba675201f7529c9c13cad1dc37d2be9c912afb59a1602090220902efe4bf430c5ab62ae11833cc42c3a28ea4030f350566f35ea6f6a3003697e5803c5ea508cd1fa505ca8857e2027882a314d79aa6c9f13a00c9853592ed0cfd7f6fb5acee638fa0480d80aa79c51c48e3b11afe82ae204a8716598842b940a5cd87be02b30dee428d553044282197aab9c0389631d72c28f3c6c2e1897789eef0a6fd5110fb2f91c10aec72845c73a1ec65c48a117ff734c4e0111417a96e1239f8f818831e469a2c7907ca22a7e40c8af200948c53175bc834a0b9ff80a262060ec0c984c2167abaf60922f11fb0ca416de19032860679856e0dee974912d321d3081254ae9272a5d82e035c527f3443286d70187b1d057121204d831534718720670aa27294f502a71418e6f200ccf39092157109ac80c7f09d812f417280153845890cdff17b1654798142427967f0095608938d3df85c628017fa8197d8e8944e9175695c1f1ac008a68803e8fc387a1f61c9c90213fb14f4aa647fcaaa01d101cd3c34e8f0590f288782896304684c40aa0b298101f7fbf1d427d3099665066c71495204290c42855ad484e8fc8462473d3d6c11ca5fc43c5e90c944a78c24b553d0f52f09e62f10ad4477c4540c628a5c70e5482922ad09c2856382917701106ae791ae96b5de442577e795caf72195da68089392fbdfd449b310c798874b60524cbe81a333d07945caf542c57bc523d749842bba893c514aa872e114daafc6ab7905506064874580593ec509c5329782a0fab18923205f04d435c14a1f7b02ae1841ccac7afa4684e109404bf35496016113427388adff42a72010121dbf9dbfb221292f06208bcf8d331af32abb29aaad4bd7ce8018ef64529b6e52aaba298a2eaa1d38c489c8062e445c57f332e5158c4a4ca351892e5bf1e4b991c148bbfed14ed2ab7165775eaab26292f72572567a9d2143ec9858ed608962581a3f2a5a41c877a287e41955c4d63518ad03ad91574913309d45ca51993e5d0aa920e8badc056dacd25909c16c9eb89a69ac4937a912b83ab15b20fb142a69845852a67b07aec9bafbea556d3ca957f10c2ca8afd527d23977157d596c3a99c625fd23339371b6fe566210a3057b815622157ec72e05fdbcd420c600c2ce33c54c2496eda86f305ba78282f3b17b74d953f0367e90a6d371e9fe0e26538ff1c71bae7f804fcc588d51a0e99503f8a8400d147cdbdf192282bbcf04b5c92f275fe05d0d2e304c0e527281c32f0815a5173497def698b552810cc52a40738c469f6e16c9d70f987a0ed1a550d9e832ba8ffaf9af68c84dcedee59464859b5dbcc97550f3c5446b6fed6be3cbb780098692d9966a876d691488f3ff0f073941ef16bcac3023ca9763f2dcdbc362dedd7af5f356d5e5affe1e94c6be7f3425f62165e95bbb16b15eed46b98cdb97a8648024c8a965879027382ae69026f90d672ea4e4da38a2e5a75cb288a3f0b1e696996611957867d65359e4dbb55bf6939ee75d3760de3e6a65ebf32ea2d43b102163f5552b33d7151d4d7fa5bbb432badd5a8df349a356dc0b8d6726e1a378e61b8356d44305b6a2db3f818486bd9b6d96cd6b4171c6a2dd3308c9ad6db17a73f7f262034b49651d3c6a16ad4a8693ff696b7c9b21c47dd701b4ae47029b456b3a6dd4a4c95253f10d45aa6d3749a0db3a1463812aaa6d130ea46fdc6747fd5b48763a855af376fdc2d7437e65f35ad733e74faf367c6328142adf51fa366d48cbf8a6f1ca3f4ac43b6fda73e3e6edb9fab1d424e0fd7f60768fb53b2d20bce3d242bd1472e549e57ed3decffb5d3550984326d199d7394f99907fe2a0f7fb496062c92f9773c7ab2d626b4c70446490c7bc4f3a7c30df0dcec11b753e039cb7b1649b08937f794aceeedd97ae6ad5f41ef9bd1a1cecaef4d368f119783fe7015f45e1a83de6815b0711e58af12f6d671405fbe0f3aed24f0bacc7fe651d1676fb2093b6e165863f2c8e4cda0e3ecfa1cf44db7836f23604fb0ef7597c1cb6815503ff1cd761cf646dc9f3e3494fefe47bba99e834e69e3236e0f034a8c27cbcd7c4a58381dc6618fac82884783ce6d145077e94f86c4b7c826ec57ba05ffae74ea57f6b726e1b7495de99fa64306377bfda0d32eecbdf7d6f18c4e04dcf0684049e6db4302ed0709e924f6fb4b37ec0f4dffc7e0f0bd389c8e79600f1344bb861ae3bd67ae7c35579d613be887319a8eda416fbd0a73f55e9ba0fe389f4dda2bc8c6a3d9b4fd0a3c676b8bace637069e43205198a7c6e02e7aade68207f6c878e9b97978c7a3c7bbdbd28e7e3b0fecf16a66b9e211b75f9eccdb4fda7a321e5ecb39033d7713764feb617fb80a7bee22b05e1b83eef8eee536b941b91141dacd7ceb251af6fd38e8dc36fefda33d0c7b937c361d9341c7790c3d731ad8c3547debf23bab775ca1d64568b939b02679f1ed3d33f62db5966412d03181f6d3aaf87ecfaa9fdbe53df10964a324b0ead17c6a7c47b69083de24f33b6d77fec4ff5564da296272ef317bd728dce98cc84531c3cb2c405798452912e20ad23322d8876f6d239965373f8f64f52bc37e36dc9669b70cebfaa65eb71a8d46f3e6772359c3685af5ba63ffb9485658fe1b91cc355dc735b731c7beb16cdbacdbe67b914c419bd616ba1bf37b91ec63e82592fdc323d987beb58f68b3693b99d0490ead82dda370f1edfb3eca9591e1d9ebbe76e8380e7bdf8a48e27b4e3ca36b72efb9afbee7189076178a711ff12ddeb379bb01a62ad2d4a562d1a03759843d37bff7e215b49f1a837e9240c556d859fa9e1f87dedab867236b963b8ba03fd92816bca7ebd5ccea8a82e1fa23a38c207e1cf44764a0a254cf8c61c7e4b3e988df7b437366491276cc0d982644d9f2f03ca80fa244fad371ecf7bac6ec5945847636f34cf288db996f910c754c1158dde5bd378c835e379b5993fcde531174b6c342bb1dcf4a763567f445429b28fb6427fad79f614e1661b6de7da4152019126750e7c7af6db9b36ed5bfe44eebd9bc6919cd96d9bc366f2cd7a93bd66f7367b50b68fe39ee2c2cffcd5d80dbdcb29c63d45da7d1741bef71e75be86eccef71e7c7d00b77fec3b9f363e7da9327b4267948c9c27fe92e66966b06eca920c88076a54ad1021a2681da0aa874944e36303737fe7468016f4466de6811d8932cbc4d7604f8a488d49a28f22dd2da807671d09ba8549dcebcf5c67f4a1681a508b720d4fc5191607f4420f39382a06ecb7433ec9357d5ff7391c217e9e8f783b4ffdbcc9bc8c0729efd69515fa4e92fd644f8dec808ec41a34a8d938086b93f1d6deea74332f3c6ce11c11b81b526b04ad1f7e9b624a818bbbbf47f98b9c2dc53459c933ca013c39f3e64c06bae02af5b907cd5d70a9669ef0a2e78349e76cd99f75aa6e2bd09f5e964a1d2f367ea3ecfac98f8fd89f09f540018c7be67ae023622e15db5f5e84f36fe8b0a32e3a7c01e1a8fb86d403621aa9f5915d01eab2dce79814cb5b90d56e622b0d6db799245ba7fc7a3013b3f980dce081a2591a0cba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dcba59dffbb4b3bff030000ffff010000ffff3931a24253350000`)))
apiVersion: v1
kind: ConfigMap
data:
enable-opentracing: "true"
zipkin-collector-host: zipkin.default.svc.cluster.local
hsts: "false"
map-hash-bucket-size: "128"
metadata:
name: nginx-load-balancer-conf
namespace: kube-system
......@@ -16,5 +16,4 @@ controller:
useHostPort: true
config:
enable-opentracing: "true"
zipkin-collector-host: "oc-collector.monitoring"
use-forwarded-headers: "true"
zipkin-collector-host: "zipkin.default.svc.cluster.local"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment