Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incident Priority Service HA #60

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ansible/playbooks/group_vars/kafka_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ kafka_topics: >
{"name": "topic-mission-event", "partitions": "15", "replicas": "2", "config": "{}"},
{"name": "topic-responder-command", "partitions": "15", "replicas": "2", "config": "{}"},
{"name": "topic-responder-event", "partitions": "15", "replicas": "2", "config": "{}"},
{"name": "topic-responder-location-update", "partitions": "15", "replicas": "2", "config": "{}"}]
{"name": "topic-responder-location-update", "partitions": "15", "replicas": "2", "config": "{}"},
{"name": "topic-incident-assignment-event", "partitions": "1", "replicas": "2", "config": "{}"},
{"name": "topic-incident-priority-control", "partitions": "1", "replicas": "2", "config": "{}"}]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ http:
kafka:
bootstrap-servers: {{ kafka_bootstrap_address }}
group-id: {{ kafka_groupid }}
topic-incident-assignment-event: {{ kafka_incident_assignment_event_topic }}
topic-incident-assignment-event: {{ kafka_incident_assignment_event_topic }}
topic-incident-priority-control: {{ kafka_incident_priority_control_topic }}
ha:
leader-configmap: {{ ha_leader_configmap }}
lease-duration-millis: {{ ha_lease_duration_millis }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: {{ service_account_role_name }}
labels:
app: {{ application_name }}
rules:
- apiGroups:
- ""
resources:
- pods
- services
- endpoints
- persistentvolumeclaims
- configmaps
- secrets
- serviceaccounts
verbs:
- create
- delete
- deletecollection
- get
- list
- patch
- update
- watch
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,10 @@ items:
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 9779
name: prometheus
protocol: TCP
- containerPort: 8778
name: jolokia
protocol: TCP
livenessProbe:
failureThreshold: 3
httpGet:
path: /health
path: /liveness
port: 8080
scheme: HTTP
initialDelaySeconds: 30
Expand All @@ -107,11 +101,11 @@ items:
readinessProbe:
failureThreshold: 3
httpGet:
path: /health
path: /readiness
port: 8080
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
periodSeconds: 10
timeoutSeconds: 3
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,21 @@ pipeline_buildconfig_template: incident-priority-service-pipeline.yml

application_template: incident-priority-service.yml

service_account_role_name: "{{ service_account }}-role"
service_account_role_template: incident-priority-service-role.yml

kafka_bootstrap_service: "{{ kafka_cluster }}-kafka-bootstrap.{{ namespace_kafka_cluster }}.svc"
kafka_bootstrap_port: 9092
kafka_bootstrap_address: "{{ kafka_bootstrap_service }}:{{ kafka_bootstrap_port }}"
kafka_groupid: incident-priority

kafka_incident_assignment_event_topic: topic-incident-event
kafka_incident_assignment_event_topic: topic-incident-assignment-event
kafka_incident_priority_control_topic: topic-incident-priority-control

logging_style: dev

prometheus_endpoint_path: "/metrics"
prometheus_endpoint_port: 8080
prometheus_endpoint_port: 8080

ha_leader_configmap: incident-priority-service-leaders
ha_lease_duration_millis: 2000
26 changes: 26 additions & 0 deletions ansible/roles/openshift_incident_priority_service/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,32 @@
namespace: "{{ namespace }}"
rolebinding_name: "{{ service_account }}-view"

- name: copy service account role template
template:
src: "{{ resources_dir }}/{{ service_account_role_template }}"
dest: "{{ work_dir }}/{{ service_account_role_template }}"

- name: create {{ service_account_role_name }} role
oc_obj:
oc_binary: "{{ openshift_cli }}"
state: present
namespace: "{{ namespace }}"
kind: role
name: "{{ service_account_role_name }}"
files:
- "{{ work_dir }}/{{ service_account_role_template }}"

- name: give {{ service_account_role_name }} role privileges to {{ service_account }} service account
oc_adm_policy_user:
state: present
oc_binary: "{{ openshift_cli }}"
resource_kind: role
resource_name: "{{ service_account_role_name }}"
role_namespace: "{{ namespace }}"
user: "system:serviceaccount:{{ namespace }}:{{ service_account }}"
namespace: "{{ namespace }}"
rolebinding_name: "{{ service_account_role_name }}"

- name: copy application properties template
template:
src: "{{ resources_dir }}/{{ application_properties }}"
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/openshift_process_service/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ kafka_mission_event_topic: topic-mission-event
kafka_update_responder_command_topic: topic-responder-command
kafka_responder_updated_event_topic: topic-responder-event
kafka_update_incident_command_topic: topic-incident-command
kafka_incident_assignment_event_topic: topic-incident-event
kafka_incident_assignment_event_topic: topic-incident-assignment-event

process_service_postgresql_template: "{{ resources_dir }}/postgresql-persistent-template.yaml"
process_service_postgresql_init_configmap: "{{ process_service_postgresql_service_name }}-init"
Expand Down