Skip to content

Commit

Permalink
fix(mpp): tag resources
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko committed Oct 18, 2024
1 parent 443ccf2 commit 5819477
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 0 deletions.
6 changes: 6 additions & 0 deletions openshift/dashboard.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ metadata:
# https://docs.openshift.com/container-platform/4.11/openshift_images/triggering-updates-on-imagestream-changes.html
image.openshift.io/triggers: >-
[{"from":{"kind":"ImageStreamTag","name":"packit-dashboard:{{ deployment }}"},"fieldPath":"spec.template.spec.containers[?(@.name==\"packit-dashboard\")].image"}]
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/flower.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: flower
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/nginx.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ metadata:
# https://docs.openshift.com/container-platform/4.11/openshift_images/triggering-updates-on-imagestream-changes.html
image.openshift.io/triggers: >-
[{"from":{"kind":"ImageStreamTag","name":"nginx:{{ deployment }}"},"fieldPath":"spec.template.spec.containers[?(@.name==\"nginx\")].image"}]
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/packit-service-beat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ metadata:
# https://docs.openshift.com/container-platform/4.11/openshift_images/triggering-updates-on-imagestream-changes.html
image.openshift.io/triggers: >-
[{"from":{"kind":"ImageStreamTag","name":"packit-worker:{{ deployment }}"},"fieldPath":"spec.template.spec.containers[?(@.name==\"packit-service-beat\")].image"}]
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/packit-service-fedmsg.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ metadata:
# https://docs.openshift.com/container-platform/4.11/openshift_images/triggering-updates-on-imagestream-changes.html
image.openshift.io/triggers: >-
[{"from":{"kind":"ImageStreamTag","name":"packit-service-fedmsg:{{ deployment }}"},"fieldPath":"spec.template.spec.containers[?(@.name==\"packit-service-fedmsg\")].image"}]
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/packit-service.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ metadata:
# https://docs.openshift.com/container-platform/4.11/openshift_images/triggering-updates-on-imagestream-changes.html
image.openshift.io/triggers: >-
[{"from":{"kind":"ImageStreamTag","name":"packit-service:{{ deployment }}"},"fieldPath":"spec.template.spec.containers[?(@.name==\"packit-service\")].image"}]
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/packit-worker.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ metadata:
# https://docs.openshift.com/container-platform/4.11/openshift_images/triggering-updates-on-imagestream-changes.html
image.openshift.io/triggers: >-
[{"from":{"kind":"ImageStreamTag","name":"packit-worker:{{ deployment }}"},"fieldPath":"spec.template.spec.containers[?(@.name==\"packit-worker\")].image"}]
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/postgres.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: postgres-{{ postgres_version }}
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/pushgateway.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ metadata:
# https://docs.openshift.com/container-platform/4.11/openshift_images/triggering-updates-on-imagestream-changes.html
image.openshift.io/triggers: >-
[{"from":{"kind":"ImageStreamTag","name":"pushgateway:{{ deployment }}"},"fieldPath":"spec.template.spec.containers[?(@.name==\"pushgateway\")].image"}]
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/redict.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: redict
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/redis-commander.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: redis-commander
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/redis.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: redis
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/tokman.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ metadata:
# https://docs.openshift.com/container-platform/4.11/openshift_images/triggering-updates-on-imagestream-changes.html
image.openshift.io/triggers: >-
[{"from":{"kind":"ImageStreamTag","name":"tokman:{{ deployment }}"},"fieldPath":"spec.template.spec.containers[?(@.name==\"tokman\")].image"}]
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
6 changes: 6 additions & 0 deletions openshift/valkey.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: valkey
{% if managed_platform %}
labels:
paas.redhat.com/appcode: "{{ appcode }}"
pass.redhat.com/servicephase: "{{ servicephase }}"
pass.redhat.com/costcenter: "{{ costcenter }}"
{% endif %}
spec:
selector:
matchLabels:
Expand Down
2 changes: 2 additions & 0 deletions playbooks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
memory: "128Mi"
cpu: "50m"
appcode: PCKT-002
servicephase: lab
costcenter: "700"
registry: 172.30.1.1:5000
registry_user: developer
tasks:
Expand Down
2 changes: 2 additions & 0 deletions playbooks/roles/deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,7 @@ tokman: # noqa: var-naming[no-role-prefix]
memory: "128Mi"
cpu: "50m"
appcode: PCKT-002 # noqa: var-naming[no-role-prefix]
servicephase: lab # noqa: var-naming[no-role-prefix]
costcenter: "700" # noqa: var-naming[no-role-prefix]
registry: 172.30.1.1:5000 # noqa: var-naming[no-role-prefix]
registry_user: developer # noqa: var-naming[no-role-prefix]
14 changes: 14 additions & 0 deletions playbooks/tasks/set-facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@
sandbox_namespace: "{{ service }}-{{ deployment }}-sandbox"
when: not managed_platform

- name: Set servicephase
when: managed_platform
tags:
- always
block:
- name: Set servicephase for staging
ansible.builtin.set_fact:
servicephase: preprod
when: deployment == "stg"
- name: Set servicephase for production
ansible.builtin.set_fact:
servicephase: prod
when: deployment == "prod"

- name: Set Redis-like hostname
tags:
- always
Expand Down

0 comments on commit 5819477

Please sign in to comment.