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

fix(mpp): tag resources #606

Merged
merged 1 commit into from
Oct 30, 2024
Merged
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
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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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:
app-code: "{{ appcode }}"
service-phase: "{{ servicephase }}"
cost-center: "{{ 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
Loading