-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a kubebash service, for running kubectl operations on the isidro …
…cluster, via the isidro chatbot
- Loading branch information
Showing
12 changed files
with
268 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{{ if eq .Values.kubebash.enabled true }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: kubebash | ||
labels: | ||
app: kubebash | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: 9000 | ||
selector: | ||
app: kubebash | ||
--- | ||
kind: ServiceExport | ||
apiVersion: net.gke.io/v1 | ||
metadata: | ||
name: kubebash | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: kubebash | ||
labels: | ||
app: kubebash | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: kubebash | ||
template: | ||
metadata: | ||
labels: | ||
app: kubebash | ||
sidecar.istio.io/inject: "true" | ||
istio.io/rev: "asm-managed-rapid" | ||
spec: | ||
serviceAccountName: kubebash-microservice | ||
containers: | ||
- name: kubebash | ||
image: {{ .Values.kubebash.image.repository }}:{{ .Values.kubebash.image.tag }} | ||
imagePullPolicy: Always | ||
env: | ||
- name: RESPONDER_HOST | ||
value: responder.{{ .Release.Namespace }}.svc.clusterset.local | ||
restartPolicy: Always | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: kubebash | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: kubebash | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
- from: | ||
# GCP Health Check IPs | ||
- ipBlock: | ||
cidr: 35.191.0.0/16 | ||
- ipBlock: | ||
cidr: 130.211.0.0/22 | ||
# RFC1918 (overkill, but enables multi-cluster and multi-region) | ||
- ipBlock: | ||
cidr: 10.0.0.0/8 | ||
- ipBlock: | ||
cidr: 172.16.0.0/12 | ||
- ipBlock: | ||
cidr: 192.168.0.0/16 | ||
# In-cluster services (failover for non-RFC1918 topologies) | ||
- podSelector: | ||
matchLabels: | ||
app: orchestration | ||
egress: | ||
- {} | ||
{{ end }} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dockerfile |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM almir/webhook:2.8.0 | ||
|
||
# apk install system prerequisite packages | ||
RUN apk add --no-cache curl | ||
|
||
# install kubectl, kubeadm, and kubelet | ||
RUN RELEASE="$(curl -sSL https://dl.k8s.io/release/stable.txt)" && \ | ||
curl -L --remote-name-all "https://storage.googleapis.com/kubernetes-release/release/${RELEASE}/bin/linux/amd64/{kubeadm,kubelet,kubectl}" && \ | ||
install kubeadm /usr/local/bin/ && \ | ||
install kubelet /usr/local/bin/ && \ | ||
install kubectl /usr/local/bin/ && \ | ||
rm kubeadm kubelet kubectl | ||
|
||
ADD hooks.yaml /etc/webhook/hooks.yaml | ||
ADD pass.sh /var/webhook/pass.sh | ||
|
||
EXPOSE 9000 | ||
|
||
ENTRYPOINT webhook -verbose -hooks /etc/webhook/hooks.yaml |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- id: kubebash | ||
execute-command: "/var/webhook/pass.sh" | ||
command-working-directory: "/var/webhook" | ||
pass-arguments-to-command: | ||
- source: payload | ||
name: command |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env sh | ||
set -x | ||
sh -c "$1" |
Oops, something went wrong.