diff --git a/backend/btrixcloud/k8sapi.py b/backend/btrixcloud/k8sapi.py index 6576bd31..155207d7 100644 --- a/backend/btrixcloud/k8sapi.py +++ b/backend/btrixcloud/k8sapi.py @@ -58,9 +58,8 @@ class K8sAPI: def get_redis_url(self, crawl_id): """get redis url for crawl id""" - redis_id = f"redis-{crawl_id}" redis_url = ( - f"redis://{redis_id}-0.{redis_id}.{self.namespace}.svc.cluster.local/0" + f"redis://redis-{crawl_id}-0.redis.{self.namespace}.svc.cluster.local/0" ) return redis_url diff --git a/backend/btrixcloud/operator.py b/backend/btrixcloud/operator.py index 03dccd32..fdbe639a 100644 --- a/backend/btrixcloud/operator.py +++ b/backend/btrixcloud/operator.py @@ -262,7 +262,7 @@ class BtrixOperator(K8sAPI): has_redis_children = redis_sts in data.children[STS] if has_redis_children: - children[2]["spec"]["volumeClaimTemplates"] = data.children[STS][redis_sts][ + children[1]["spec"]["volumeClaimTemplates"] = data.children[STS][redis_sts][ "spec" ]["volumeClaimTemplates"] diff --git a/backend/btrixcloud/profiles.py b/backend/btrixcloud/profiles.py index f37d822a..146a8d1b 100644 --- a/backend/btrixcloud/profiles.py +++ b/backend/btrixcloud/profiles.py @@ -315,12 +315,11 @@ class ProfileOps: async def _send_browser_req(self, browserid, path, method="GET", json=None): """make request to browser api to get state""" - browser_host = f"browser-{browserid}-0.browser-{browserid}" try: async with aiohttp.ClientSession() as session: async with session.request( method, - f"http://{browser_host}{self.browser_fqdn_suffix}:9223{path}", + f"http://browser-{browserid}-0.browser{self.browser_fqdn_suffix}:9223{path}", json=json, ) as resp: json = await resp.json() diff --git a/backend/btrixcloud/templates/crawler.yaml b/backend/btrixcloud/templates/crawler.yaml index 74b88aa0..b3800ed5 100644 --- a/backend/btrixcloud/templates/crawler.yaml +++ b/backend/btrixcloud/templates/crawler.yaml @@ -17,7 +17,7 @@ spec: crawl: {{ id }} role: crawler - serviceName: crawl-{{ id }} + serviceName: crawler replicas: {{ scale }} podManagementPolicy: OrderedReady @@ -165,23 +165,3 @@ spec: periodSeconds: 120 failureThreshold: 3 {% endif %} - ---- -apiVersion: v1 -kind: Service -metadata: - name: crawl-{{ id }} - labels: - crawl: {{ id }} - role: crawler - -spec: - clusterIP: None - selector: - crawl: {{ id }} - role: crawler - - ports: - - protocol: TCP - port: 9037 - name: screencast diff --git a/backend/btrixcloud/templates/profilebrowser.yaml b/backend/btrixcloud/templates/profilebrowser.yaml index b12c9f7b..af1b63ca 100644 --- a/backend/btrixcloud/templates/profilebrowser.yaml +++ b/backend/btrixcloud/templates/profilebrowser.yaml @@ -14,7 +14,7 @@ spec: browser: {{ id }} role: browser - serviceName: browser-{{ id }} + serviceName: browser replicas: 1 template: @@ -82,27 +82,3 @@ spec: - 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 - diff --git a/backend/btrixcloud/templates/redis.yaml b/backend/btrixcloud/templates/redis.yaml index 553ae9f7..3103ef95 100644 --- a/backend/btrixcloud/templates/redis.yaml +++ b/backend/btrixcloud/templates/redis.yaml @@ -17,7 +17,7 @@ spec: crawl: {{ id }} role: redis - serviceName: redis-{{ id }} + serviceName: redis replicas: {{ redis_scale }} podManagementPolicy: Parallel @@ -115,23 +115,3 @@ spec: command: - redis-cli - ping - ---- -apiVersion: v1 -kind: Service -metadata: - name: redis-{{ id }} - labels: - crawl: {{ id }} - role: redis - -spec: - clusterIP: None - selector: - crawl: {{ id }} - role: redis - - ports: - - protocol: TCP - port: 6379 - name: redis diff --git a/chart/templates/frontend.yaml b/chart/templates/frontend.yaml index 310f05f7..8564ad7e 100644 --- a/chart/templates/frontend.yaml +++ b/chart/templates/frontend.yaml @@ -41,9 +41,6 @@ spec: - name: CRAWLER_FQDN_SUFFIX value: ".{{ .Values.crawler_namespace }}.svc.cluster.local" - - name: CRAWLER_SVC_SUFFIX - value: ".crawl-$crawl" - - name: NGINX_ENTRYPOINT_WORKER_PROCESSES_AUTOTUNE value: "1" diff --git a/chart/templates/operators.yaml b/chart/templates/operators.yaml index e9d9c207..da723457 100644 --- a/chart/templates/operators.yaml +++ b/chart/templates/operators.yaml @@ -15,11 +15,6 @@ spec: updateStrategy: method: InPlace - - apiVersion: v1 - resource: services - updateStrategy: - method: OnDelete - hooks: sync: webhook: diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml new file mode 100644 index 00000000..435db462 --- /dev/null +++ b/chart/templates/service.yaml @@ -0,0 +1,57 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: crawler + namespace: {{ .Values.crawler_namespace }} + +spec: + clusterIP: None + publishNotReadyAddresses: true + selector: + role: crawler + + ports: + - protocol: TCP + port: 9037 + name: screencast + +--- +apiVersion: v1 +kind: Service +metadata: + name: redis + namespace: {{ .Values.crawler_namespace }} + +spec: + clusterIP: None + publishNotReadyAddresses: true + selector: + role: redis + + ports: + - protocol: TCP + port: 6379 + name: redis + +--- +apiVersion: v1 +kind: Service +metadata: + name: browser + namespace: {{ .Values.crawler_namespace }} + +spec: + clusterIP: None + publishNotReadyAddresses: true + selector: + role: browser + + ports: + - protocol: TCP + port: 9223 + name: browser-api + + - protocol: TCP + port: 9222 + name: browser-ws diff --git a/frontend/frontend.conf.template b/frontend/frontend.conf.template index 6f7ee98c..9b1f4968 100644 --- a/frontend/frontend.conf.template +++ b/frontend/frontend.conf.template @@ -54,7 +54,7 @@ server { set $crawl $2; set $num $3; set $auth_bearer $arg_auth_bearer; - set $svc_suffix "${CRAWLER_SVC_SUFFIX}"; + set $svc_suffix ".crawler"; set $fqdn_suffix "${CRAWLER_FQDN_SUFFIX}"; auth_request /access_check; @@ -88,7 +88,7 @@ server { auth_request /access_check_profiles; - proxy_pass http://browser-$browserid-0.browser-$browserid$fqdn_suffix:6080/websockify; + proxy_pass http://browser-$browserid-0.browser$fqdn_suffix:6080/websockify; proxy_set_header Host "localhost"; proxy_send_timeout 10m; @@ -107,7 +107,7 @@ server { auth_request /access_check_profiles; - proxy_pass http://browser-$browserid-0.browser-$browserid$fqdn_suffix:9223/vnc/; + proxy_pass http://browser-$browserid-0.browser$fqdn_suffix:9223/vnc/; proxy_set_header Host "localhost"; }