-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding support ansible metrics-utility:
updating crd adding defaults adding cronjobs adding tasks to installer
- Loading branch information
Showing
8 changed files
with
202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,7 @@ rules: | |
- apiGroups: | ||
- batch | ||
resources: | ||
- cronjobs | ||
- jobs | ||
verbs: | ||
- get | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
# Check to make sure provided pvc exists, error loudly if not. Otherwise, the management pod will just stay in pending state forever. | ||
- name: Check provided PVC claim exists | ||
kubernetes.core.k8s_info: | ||
name: "{{ _metrics_pvc_claim }}" | ||
kind: PersistentVolumeClaim | ||
namespace: "{{ ansible_operator_meta.namespace }}" | ||
register: provided_pvc | ||
when: | ||
- _metrics_pvc_claim | length | ||
|
||
- block: | ||
- name: Create PVC for metrics | ||
kubernetes.core.k8s: | ||
kind: PersistentVolumeClaim | ||
definition: "{{ lookup('template', 'storage/metrics.yaml.j2') }}" | ||
|
||
- block: | ||
Check failure on line 18 in roles/installer/tasks/enable_metrics.yml GitHub Actions / molecule (--skip-tags=replicas)
|
||
- name: Create Kubernetes CronJob for metrics-gather | ||
kubernetes.core.k8s: | ||
name: "{{ ansible_operator_meta.name }}-metrics-gather" | ||
kind: CronJob | ||
definition: "{{ lookup('template', 'cronjobs/metrics-gather.yaml.j2') }}" | ||
wait: true | ||
|
||
- block: | ||
Check failure on line 26 in roles/installer/tasks/enable_metrics.yml GitHub Actions / molecule (--skip-tags=replicas)
|
||
- name: Create Kubernetes CronJob for metrics-report | ||
kubernetes.core.k8s: | ||
name: "{{ ansible_operator_meta.name }}-metrics-report" | ||
kind: CronJob | ||
definition: "{{ lookup('template', 'cronjobs/metrics-report.yaml.j2') }}" | ||
wait: true | ||
Check failure on line 32 in roles/installer/tasks/enable_metrics.yml GitHub Actions / molecule (--skip-tags=replicas)
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: CronJob | ||
metadata: | ||
name: {{ ansible_operator_meta.name }}-metrics-gather | ||
namespace: '{{ ansible_operator_meta.namespace }}' | ||
labels: | ||
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-metrics-gather' | ||
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }} | ||
spec: | ||
schedule: "{{ _metrics_cronjob_gather_schedule }}" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: {{ ansible_operator_meta.name }}-metrics-gather | ||
image: "{{ _metrics_image }}" | ||
imagePullPolicy: "{{ image_pull_policy }}" | ||
command: | ||
- /bin/sh | ||
- -c | ||
- metrics-utility gather_automation_controller_billing_data --ship --until=10m | ||
envFrom: | ||
- configMapRef: | ||
name: {{ _metrics_configmap }} | ||
volumeMounts: | ||
- name: {{ ansible_operator_meta.name }}-metrics | ||
mountPath: /metrics | ||
readOnly: false | ||
- name: "{{ ansible_operator_meta.name }}-application-credentials" | ||
mountPath: "/etc/tower/conf.d/credentials.py" | ||
subPath: credentials.py | ||
readOnly: true | ||
- name: {{ ansible_operator_meta.name }}-settings | ||
mountPath: /etc/tower/settings.py | ||
subPath: settings.py | ||
readOnly: true | ||
volumes: | ||
- name: {{ ansible_operator_meta.name }}-metrics | ||
persistentVolumeClaim: | ||
claimName: {{ _metrics_pvc_claim }} | ||
readOnly: false | ||
- name: "{{ ansible_operator_meta.name }}-application-credentials" | ||
secret: | ||
secretName: "{{ ansible_operator_meta.name }}-app-credentials" | ||
items: | ||
- key: credentials.py | ||
path: 'credentials.py' | ||
- name: {{ ansible_operator_meta.name }}-settings | ||
configMap: | ||
name: '{{ ansible_operator_meta.name }}-{{ deployment_type }}-configmap' | ||
items: | ||
- key: settings | ||
path: settings.py | ||
restartPolicy: OnFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: CronJob | ||
metadata: | ||
name: {{ ansible_operator_meta.name }}-metrics-report | ||
namespace: '{{ ansible_operator_meta.namespace }}' | ||
labels: | ||
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}-metrics-report' | ||
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }} | ||
spec: | ||
schedule: "{{ _metrics_cronjob_report_schedule }}" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: {{ ansible_operator_meta.name }}-metrics-report | ||
image: "{{ _metrics_image }}" | ||
imagePullPolicy: "{{ image_pull_policy }}" | ||
command: | ||
- /bin/sh | ||
- -c | ||
- metrics-utility build_report | ||
envFrom: | ||
- configMapRef: | ||
name: {{ _metrics_configmap }} | ||
volumeMounts: | ||
- name: {{ ansible_operator_meta.name }}-metrics | ||
mountPath: /metrics | ||
readOnly: false | ||
- name: "{{ ansible_operator_meta.name }}-application-credentials" | ||
mountPath: "/etc/tower/conf.d/credentials.py" | ||
subPath: credentials.py | ||
readOnly: true | ||
- name: {{ ansible_operator_meta.name }}-settings | ||
mountPath: /etc/tower/settings.py | ||
subPath: settings.py | ||
readOnly: true | ||
volumes: | ||
- name: {{ ansible_operator_meta.name }}-metrics | ||
persistentVolumeClaim: | ||
claimName: {{ _metrics_pvc_claim }} | ||
readOnly: false | ||
- name: "{{ ansible_operator_meta.name }}-application-credentials" | ||
secret: | ||
secretName: "{{ ansible_operator_meta.name }}-app-credentials" | ||
items: | ||
- key: credentials.py | ||
path: 'credentials.py' | ||
- name: {{ ansible_operator_meta.name }}-settings | ||
configMap: | ||
name: '{{ ansible_operator_meta.name }}-{{ deployment_type }}-configmap' | ||
items: | ||
- key: settings | ||
path: settings.py | ||
restartPolicy: OnFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: {{ deployment_type }}-metrics-claim | ||
namespace: {{ ansible_operator_meta.namespace }} | ||
ownerReferences: null | ||
labels: | ||
{{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }} | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: {{ metrics_storage_size | default('5Gi') }} |