Skip to content

Commit 93122c9

Browse files
authored
Merge pull request #732 from PureStorage-OpenConnect/trainingdns
wetty: use real certs and provision route53 record
2 parents 901a19d + a5b47d9 commit 93122c9

File tree

3 files changed

+172
-119
lines changed

3 files changed

+172
-119
lines changed

assets/wetty.yaml

Lines changed: 0 additions & 117 deletions
This file was deleted.

infra/k8s-master

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,75 @@ echo "Applying Flannel"
2525
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/v0.25.1/Documentation/kube-flannel.yml
2626
kubectl config set-context --current --namespace=default
2727

28-
# on aws ec2 install aws-load-balancer-controller
28+
# on aws ec2 install aws-load-balancer-controller and external-dns
2929
if [ $cloud = aws ] && [ $platform != eks ] && [ $platform != ocp4 ]; then
3030
echo "Applying aws-eks-load-balancer-controller"
3131
helm repo add eks https://aws.github.io/eks-charts
3232
helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --version 1.14.0 --set clusterName=$name-$cluster --set feature-gates=ServiceTypeLoadBalancerOnly=true --wait
3333
kubectl patch deployment aws-load-balancer-controller -n kube-system --type "json" -p '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--default-load-balancer-scheme=internet-facing"}]'
34+
kubectl apply -f - <<EOF
35+
apiVersion: v1
36+
kind: ServiceAccount
37+
metadata:
38+
name: external-dns
39+
namespace: kube-system
40+
---
41+
apiVersion: rbac.authorization.k8s.io/v1
42+
kind: ClusterRole
43+
metadata:
44+
name: external-dns
45+
rules:
46+
- apiGroups: [""]
47+
resources:
48+
- services
49+
- endpoints
50+
- pods
51+
- nodes
52+
verbs: ["get", "watch", "list"]
53+
- apiGroups: ["extensions", "networking.k8s.io"]
54+
resources:
55+
- ingresses
56+
verbs: ["get", "watch", "list"]
57+
---
58+
apiVersion: rbac.authorization.k8s.io/v1
59+
kind: ClusterRoleBinding
60+
metadata:
61+
name: external-dns
62+
roleRef:
63+
apiGroup: rbac.authorization.k8s.io
64+
kind: ClusterRole
65+
name: external-dns
66+
subjects:
67+
- kind: ServiceAccount
68+
name: external-dns
69+
namespace: kube-system
70+
---
71+
apiVersion: apps/v1
72+
kind: Deployment
73+
metadata:
74+
name: external-dns
75+
namespace: kube-system
76+
spec:
77+
replicas: 1
78+
selector:
79+
matchLabels:
80+
app: external-dns
81+
template:
82+
metadata:
83+
labels:
84+
app: external-dns
85+
spec:
86+
serviceAccountName: external-dns
87+
containers:
88+
- name: external-dns
89+
image: k8s.gcr.io/external-dns/external-dns:v0.14.2
90+
args:
91+
- --source=service
92+
- --source=ingress
93+
- --provider=aws
94+
- --policy=sync
95+
- --registry=txt
96+
- --txt-owner-id=k8s
97+
- --domain-filter=$ocp4_domain
98+
EOF
3499
fi

scripts/wetty

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,108 @@
11
mkdir /etc/wetty
22
rm -f /etc/securetty
3-
kubectl apply -f /assets/wetty.yaml
3+
sed -i '/master-1/s/$/ px-training/' /etc/hosts
4+
5+
echo "kubectl delete svc -n wetty wetty" >/px-deploy/script-delete/delete-service
6+
7+
kubectl apply -f - <<EOF
8+
apiVersion: v1
9+
kind: Namespace
10+
metadata:
11+
name: wetty
12+
---
13+
apiVersion: v1
14+
kind: ConfigMap
15+
metadata:
16+
name: ssh-config
17+
namespace: wetty
18+
data:
19+
ssh-config: |
20+
LogLevel=ERROR
21+
---
22+
apiVersion: v1
23+
kind: Secret
24+
metadata:
25+
name: wetty-tls
26+
namespace: wetty
27+
type: kubernetes.io/tls
28+
data:
29+
tls.crt: $training_cert
30+
tls.key: $training_key
31+
---
32+
apiVersion: apps/v1
33+
kind: Deployment
34+
metadata:
35+
name: wetty
36+
namespace: wetty
37+
labels:
38+
app: wetty
39+
spec:
40+
replicas: 1
41+
selector:
42+
matchLabels:
43+
app: wetty
44+
template:
45+
metadata:
46+
labels:
47+
app: wetty
48+
spec:
49+
nodeSelector:
50+
node-role.kubernetes.io/control-plane: ""
51+
tolerations:
52+
- key: node-role.kubernetes.io/control-plane
53+
operator: Exists
54+
effect: NoSchedule
55+
- key: node-role.kubernetes.io/master
56+
operator: Exists
57+
effect: NoSchedule
58+
hostNetwork: true
59+
containers:
60+
- name: wetty
61+
image: wettyoss/wetty:latest
62+
args:
63+
- "--port"
64+
- "3000"
65+
- "--base"
66+
- "/"
67+
- "--ssh-host"
68+
- "px-training"
69+
- "--force-ssh"
70+
- "--ssl-key"
71+
- "/etc/tls/tls.key"
72+
- "--ssl-cert"
73+
- "/etc/tls/tls.crt"
74+
ports:
75+
- containerPort: 3000
76+
securityContext:
77+
allowPrivilegeEscalation: false
78+
volumeMounts:
79+
- name: tls
80+
mountPath: /etc/tls
81+
- name: ssh-config
82+
mountPath: /etc/ssh/ssh_config
83+
subPath: ssh-config
84+
volumes:
85+
- name: tls
86+
secret:
87+
secretName: wetty-tls
88+
- name: ssh-config
89+
configMap:
90+
name: ssh-config
91+
---
92+
apiVersion: v1
93+
kind: Service
94+
metadata:
95+
name: wetty
96+
namespace: wetty
97+
annotations:
98+
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
99+
external-dns.alpha.kubernetes.io/hostname: $name.training.$ocp4_domain
100+
spec:
101+
type: LoadBalancer
102+
selector:
103+
app: wetty
104+
ports:
105+
- name: https
106+
port: 443
107+
targetPort: 3000
108+
EOF

0 commit comments

Comments
 (0)