109 lines
2.4 KiB
YAML
109 lines
2.4 KiB
YAML
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: browser-{{ id }}
|
|
namespace: {{ namespace }}
|
|
labels:
|
|
browser: {{ id }}
|
|
role: browser
|
|
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
browser: {{ id }}
|
|
role: browser
|
|
|
|
serviceName: browser-{{ id }}
|
|
replicas: 1
|
|
|
|
template:
|
|
metadata:
|
|
labels:
|
|
browser: {{ id }}
|
|
role: browser
|
|
|
|
spec:
|
|
affinity:
|
|
nodeAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 1
|
|
preference:
|
|
matchExpressions:
|
|
- key: nodeType
|
|
operator: In
|
|
values:
|
|
- "{{ crawler_node_type }}"
|
|
|
|
podAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 2
|
|
podAffinityTerm:
|
|
topologyKey: "failure-domain.beta.kubernetes.io/zone"
|
|
labelSelector:
|
|
matchLabels:
|
|
job: job-{{ id }}
|
|
crawl: {{ id }}
|
|
|
|
tolerations:
|
|
- key: "nodeType"
|
|
operator: "Equal"
|
|
value: "crawling"
|
|
effect: "NoSchedule"
|
|
|
|
containers:
|
|
- name: browser
|
|
image: {{ crawler_image }}
|
|
imagePullPolicy: {{ crawler_image_pull_policy }}
|
|
command:
|
|
- create-login-profile
|
|
- --interactive
|
|
- --filename
|
|
- /tmp/profile.tar.gz
|
|
- --url
|
|
- {{ url }}
|
|
{%- if profile_filename %}
|
|
- --profile
|
|
- "@{{ profile_filename }}"
|
|
{%- endif %}
|
|
|
|
envFrom:
|
|
- secretRef:
|
|
name: storage-{{ storage_name }}
|
|
|
|
env:
|
|
- name: STORE_PATH
|
|
value: {{ storage_path }}
|
|
|
|
- name: VNC_PASS
|
|
value: {{ vnc_password }}
|
|
|
|
{% if crawler_socks_proxy_host %}
|
|
- name: CHROME_FLAGS
|
|
value: "--proxy-server=socks5://{{ crawler_socks_proxy_host }}:{{ crawler_socks_proxy_port | default('9050') }}"
|
|
{% endif %}
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: browser-{{ id }}
|
|
labels:
|
|
browser: {{ id }}
|
|
role: browser
|
|
|
|
spec:
|
|
clusterIP: None
|
|
selector:
|
|
browser: {{ id }}
|
|
role: browser
|
|
|
|
ports:
|
|
- protocol: TCP
|
|
port: 9223
|
|
name: browser-api
|
|
|
|
- protocol: TCP
|
|
port: 9222
|
|
name: browser-ws
|
|
|