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

Refactored exporter chart as a subchart of pelorus #158

Merged
merged 6 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from 5 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
11 changes: 0 additions & 11 deletions _test/conftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ setup_file() {
[ "$status" -eq 0 ]
}

@test "charts/exporter" {
tmp=$(helm_template "charts/exporter")

namespaces=$(get_rego_namespaces "ocp\.deprecated\.*")
cmd="conftest test ${tmp} --output tap ${namespaces}"
run ${cmd}

print_info "${status}" "${output}" "${cmd}" "${tmp}"
[ "$status" -eq 0 ]
}

@test "storage/minio-scc.yaml" {
tmp=$(split_files "storage/minio-scc.yaml")

Expand Down
52 changes: 0 additions & 52 deletions charts/exporter/templates/deploymentconfig.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions charts/exporter/templates/imagestream.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions charts/exporter/templates/route.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions charts/exporter/templates/service.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions charts/exporter/values.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion charts/pelorus/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: v1.2.1
version: v1.2.1-rc-3-g4c285d1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: exporter
name: exporters
version: v1.1.0
apiVersion: v2
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{{- define "exporters.buildconfig" }}
---
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
labels:
app: {{ .Values.app_name }}
app.kubernetes.io/name: {{ .Values.app_name }}
application: {{ .Values.app_name}}
name: {{ .Values.app_name }}
app: {{ .app_name }}
app.kubernetes.io/name: {{ .app_name }}
application: {{ .app_name}}
name: {{ .app_name }}
spec:
failedBuildsHistoryLimit: 5
output:
to:
kind: ImageStreamTag
name: {{ .Values.app_name }}:latest
name: {{ .app_name }}:latest
source:
contextDir: {{ .Values.source_context_dir }}
contextDir: {{ .source_context_dir }}
git:
ref: {{ .Values.source_ref }}
uri: {{ .Values.source_url }}
ref: {{ .source_ref }}
uri: {{ .source_url }}
type: Git
strategy:
sourceStrategy:
Expand All @@ -33,3 +35,4 @@ spec:
type: GitHub
- type: ConfigChange
- type: ImageChange
{{- end }}
55 changes: 55 additions & 0 deletions charts/pelorus/charts/exporters/templates/_deploymentconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{{- define "exporters.deploymentconfig" }}
---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
app.kubernetes.io/name: {{ .app_name }}
application: {{ .app_name }}
name: {{ .app_name }}
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
app.kubernetes.io/name: {{ .app_name }}
app: {{ .app_name }}
deploymentconfig: {{ .app_name }}
strategy:
type: Rolling
template:
metadata:
labels:
app.kubernetes.io/name: {{ .app_name }}
app: {{ .app_name }}
deploymentconfig: {{ .app_name }}
application: {{ .app_name}}
spec:
containers:
- name: {{ .app_name }}
imagePullPolicy: Always
{{- if .env_from_secrets }}
envFrom:
{{- range .env_from_secrets }}
- secretRef:
name: {{ . }}
{{- end}}
{{- end}}
env:
{{- if .extraEnv }}
{{ toYaml .extraEnv | indent 8 }}
{{- end }}
ports:
- containerPort: 8080
protocol: TCP
serviceAccount: pelorus-exporter
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- {{ .app_name }}
from:
kind: ImageStreamTag
name: {{ .app_name }}:latest
type: ImageChange
{{- end }}
10 changes: 10 additions & 0 deletions charts/pelorus/charts/exporters/templates/_imagestream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- define "exporters.imagestream" }}
---
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
labels:
app.kubernetes.io/name: {{ .app_name }}
app: {{ .app_name }}
name: {{ .app_name }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/pelorus/charts/exporters/templates/_route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- define "exporters.route" }}
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app.kubernetes.io/name: {{ .app_name }}
name: {{ .app_name }}
spec:
port:
targetPort: http
to:
kind: Service
name: {{ .app_name }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/pelorus/charts/exporters/templates/_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- define "exporters.service" }}
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: {{ .app_name }}
k8s-app: {{ .app_name }}
name: {{ .app_name }}
spec:
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 8080
selector:
app.kubernetes.io/name: {{ .app_name }}
deploymentconfig: {{ .app_name }}
type: ClusterIP
{{- end }}
7 changes: 7 additions & 0 deletions charts/pelorus/charts/exporters/templates/exporters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- range $index, $exporter := .Values.instances }}
{{ include "exporters.buildconfig" $exporter }}
{{ include "exporters.deploymentconfig" $exporter }}
{{ include "exporters.imagestream" $exporter }}
{{ include "exporters.route" $exporter }}
{{ include "exporters.service" $exporter }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ kind: ClusterRole
metadata:
labels:
app.kubernetes.io/component: pelorus-exporters
app.kubernetes.io/name: {{ .Values.app_name }}
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/version: v1.1
name: pelorus-exporter
name: pelorus-exporter-{{ .Release.Namespace }}
rules:
- apiGroups:
- ""
Expand All @@ -32,9 +32,9 @@ kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: pelorus-exporters
app.kubernetes.io/name: exporters
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/version: v1.2
name: {{ .Release.Namespace }}-pelorus-exporter
name: pelorus-exporter-{{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
7 changes: 7 additions & 0 deletions charts/pelorus/charts/exporters/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
instances:
- app_name: deploytime-exporter
source_context_dir: exporters/
source_ref: master
source_url: https://github.com/redhat-cop/pelorus.git

scrapeInterval: 5m
11 changes: 11 additions & 0 deletions charts/pelorus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ deployment:
app.kubernetes.io/component: prometheus
app.kubernetes.io/name: pelorus
app.kubernetes.io/version: v0.33.0

exporters:
instances:
# Values file for exporter helm chart
- app_name: deploytime-exporter
source_context_dir: exporters/
extraEnv:
- name: APP_FILE
value: deploytime/app.py
source_ref: master
source_url: https://github.com/redhat-cop/pelorus.git
Loading