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

Use extra_vars and CostManagement CR to drive data collection. #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ molecule/test-local/.kube/
testing/

# vscode settings
.vscode/
.vscode/

# pyenv ignore
.python-version
52 changes: 2 additions & 50 deletions molecule/test-local/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,21 +201,7 @@
ignore_errors: yes
failed_when: false
command: kubectl logs
deployment/{{ definition.metadata.name }} -n {{ namespace }} -c operator
environment:
KUBECONFIG: '{{ lookup("env", "KUBECONFIG") }}'
vars:
definition: "{{ lookup('template',
'/'.join([deploy_dir, 'operator.yaml'])) | from_yaml }}"
register: log

- debug: var=log.stdout_lines

- name: get ansible logs
ignore_errors: yes
failed_when: false
command: kubectl logs
deployment/{{ definition.metadata.name }} -n {{ namespace }} -c ansible
deployment/{{ definition.metadata.name }} -n {{ namespace }}
environment:
KUBECONFIG: '{{ lookup("env", "KUBECONFIG") }}'
vars:
Expand Down Expand Up @@ -396,21 +382,7 @@
ignore_errors: yes
failed_when: false
command: kubectl logs
deployment/{{ definition.metadata.name }} -n {{ namespace }} -c operator
environment:
KUBECONFIG: '{{ lookup("env", "KUBECONFIG") }}'
vars:
definition: "{{ lookup('template',
'/'.join([deploy_dir, 'operator.yaml'])) | from_yaml }}"
register: log

- debug: var=log.stdout_lines

- name: get ansible logs
ignore_errors: yes
failed_when: false
command: kubectl logs
deployment/{{ definition.metadata.name }} -n {{ namespace }} -c ansible
deployment/{{ definition.metadata.name }} -n {{ namespace }}
environment:
KUBECONFIG: '{{ lookup("env", "KUBECONFIG") }}'
vars:
Expand All @@ -420,9 +392,6 @@

- debug: var=log.stdout_lines

- fail:
msg: "Failed on action: converge"

- name: Start server on Operator container
hosts: k8s
tasks:
Expand Down Expand Up @@ -575,23 +544,6 @@

- debug: var=log.stdout_lines

- name: get ansible logs
ignore_errors: yes
failed_when: false
command: kubectl logs
deployment/{{ definition.metadata.name }} -n {{ namespace }} -c ansible
environment:
KUBECONFIG: '{{ lookup("env", "KUBECONFIG") }}'
vars:
definition: "{{ lookup('template',
'/'.join([deploy_dir, 'operator.yaml'])) | from_yaml }}"
register: log

- debug: var=log.stdout_lines

- fail:
msg: "Failed on action: converge"

- name: Copy tar.gz to k8s from Operator
hosts: k8s
tasks:
Expand Down
8 changes: 8 additions & 0 deletions roles/collect/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
---

- name: print _cost_mgmt_data_openshift_io_costmanagementdata
abaiken marked this conversation as resolved.
Show resolved Hide resolved
debug:
var: _cost_mgmt_data_openshift_io_costmanagementdata

- name: print meta
debug:
var: meta

- name: Obtain cost-mgmt-setup info
abaiken marked this conversation as resolved.
Show resolved Hide resolved
community.kubernetes.k8s_info:
api_version: cost-mgmt.openshift.io/v1alpha1
Expand Down
26 changes: 25 additions & 1 deletion roles/setup/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
---
namespace: openshift-metering
current_day: '{{ ansible_date_time.day | int }}'
current_month: '{{ ansible_date_time.month | int }}'
current_year: '{{ ansible_date_time.year | int }}'
setup_template_path: '/tmp/cost-mgmt-operator-collect'
setup_template_dir: "{{ lookup('password', '/dev/null chars=ascii_letters') }}"
setup_delete_after: 'true'
upload_cycle_seconds: 21600
collect_data: 'false'
collect_format: 'csv'
collect_manifest_uuid: '{{ 99999999999999999999 | random | to_uuid }}'
collect_archive_name: cost-mgmt
ocp_validate_cert: 'true'
ocp_cluster_id: ''
reporting_operator_token_name: ''
collect_reports:
- 'cm-openshift-usage-lookback-'
- 'cm-openshift-persistentvolumeclaim-lookback-'
- 'cm-openshift-node-labels-lookback-'
collect_download_path: '/tmp/cost-mgmt-operator-collect'
collect_delete_after: 'true'
collect_ocp_report_timeout: 60
collect_max_csvfile_size: 99
api_prefix: 'https://'
ingress_url: 'https://cloud.redhat.com/api/ingress/v1/upload'
authentication: 'token'
authentication_token: ''
username: ''
password: ''
cacert_path: '{{ collect_download_path }}/ca-bundle.crt'
debug: 'true'
collect_upload_wait: '{{ 2100 | random(step=10) }}'
Loading