This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function which takes a namespace, and waits until ip is assigned to it. | |
function wait_for_ip() { | |
namespace=$1 | |
echo "Waiting for IP for namespace: $namespace" | |
while [ -z $ip ]; do | |
ip=$(kubectl get ingress -n $namespace -o jsonpath="{.items[*].status.loadBalancer.ingress[*].ip}") | |
[ -z "$ip" ] | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: myapp | |
namespace: ingress-demo | |
spec: | |
replicas: 10 | |
selector: | |
matchLabels: | |
app: myapp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: hello-svc | |
namespace: ingress-demo | |
spec: | |
selector: | |
app: myapp | |
ports: | |
- port: 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: ingress-demo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
annotations: | |
kubernetes.io/ingress.class: "nginx" | |
nginx.ingress.kubernetes.io/ssl-redirect: "true" | |
name: hello-world-ingress | |
namespace: ingress-demo | |
labels: | |
name: hello-world-ingress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
annotations: | |
kubernetes.io/ingress.class: "nginx" | |
nginx.ingress.kubernetes.io/ssl-redirect: "true" | |
name: dashboard-ingress | |
namespace: kubernetes-dashboard | |
labels: | |
name: dashboard-ingress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
annotations: | |
kubernetes.io/ingress.class: "nginx" | |
nginx.ingress.kubernetes.io/ssl-redirect: "true" | |
name: logs-ingress | |
namespace: kube-system | |
labels: | |
name: logs-ingress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cost = [10, 10, 10, 10, 1, 1, 1] | |
function count_no_improvements(x) | |
counter = 0 | |
for i in 1:size(x, 1) | |
if (i > 1) && abs(x[i] - x[i-1]) < (1e-6 * x[i]) | |
counter += 1 | |
else | |
counter = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Plots | |
using MLJBase | |
using StableRNGs # Seeding generator for reproducibility | |
# Generate fake data | |
X, y = make_blobs(10_000, 3; centers=2, as_table=false, rng=2020); | |
X = Matrix(X'); | |
y = reshape(y, (1, size(X, 2))); | |
f(x) = x == 2 ? 0 : x | |
y2 = f.(y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Train the network using the desired architecture that best possible | |
matches the training inputs (DMatrix) and their corresponding ouptuts(Y) | |
over some number of iterations (epochs) and a learning rate (η). | |
""" | |
function train_network(layer_dims , DMatrix, Y; η=0.001, epochs=1000, seed=2020, verbose=true) | |
# Initiate an empty container for cost, iterations, and accuracy at each iteration | |
costs = [] | |
iters = [] | |
accuracy = [] |
NewerOlder