diff --git a/.zuul.yaml b/.zuul.yaml index 1ac10a2..d81cb02 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -18,6 +18,8 @@ name: smokeping_prober:image:build parent: opendev-build-docker-image provides: smokeping_prober:image + dependencies: + - opendev-buildset-registry files: &smokeping_prober_files - Dockerfile vars: &smokeping_prober_images @@ -31,6 +33,8 @@ provides: smokeping_prober:image files: *smokeping_prober_files vars: *smokeping_prober_images + dependencies: + - opendev-buildset-registry secrets: - name: docker_credentials secret: smokeping-dockerhub @@ -46,14 +50,40 @@ secret: smokeping-dockerhub pass-to-parent: true +- job: + name: smokeping_prober-helm:functional + parent: apply-helm-charts + requires: + - smokeping_prober:image + run: playbooks/functional/run.yaml + vars: + docker_use_buildset_registry: true + minikube_dns_resolvers: ['1.1.1.1', '8.8.8.8'] + +- job: + name: smokeping_prober-helm:functional + parent: opendev-buildset-registry-consumer + - project: check: jobs: + - opendev-buildset-registry - chart-testing-lint + - smokeping_prober-helm:functional: + dependencies: + - name: opendev-buildset-registry + - name: smokeping_prober:image:build + soft: true - smokeping_prober:image:build gate: jobs: + - opendev-buildset-registry - chart-testing-lint + - smokeping_prober-helm:functional: + dependencies: + - name: opendev-buildset-registry + - name: smokeping_prober:image:upload + soft: true - smokeping_prober:image:upload promote: jobs: diff --git a/charts/smokeping-prober/templates/deployment.yaml b/charts/smokeping-prober/templates/deployment.yaml index 2f72231..775e621 100644 --- a/charts/smokeping-prober/templates/deployment.yaml +++ b/charts/smokeping-prober/templates/deployment.yaml @@ -31,16 +31,20 @@ spec: - --privileged - --log.level=info {{- range .Values.hosts }} - - "{{ .ip }}" + - "{{ . }}" {{- end }} ports: - - name: http + - name: metrics containerPort: 9374 protocol: TCP + readinessProbe: + httpGet: + path: / + port: metrics livenessProbe: httpGet: path: / - port: http + port: metrics resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} diff --git a/charts/smokeping-prober/templates/service.yaml b/charts/smokeping-prober/templates/service.yaml index 70dc89c..18c1680 100644 --- a/charts/smokeping-prober/templates/service.yaml +++ b/charts/smokeping-prober/templates/service.yaml @@ -8,7 +8,7 @@ spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} - targetPort: http + targetPort: metrics protocol: TCP name: http {{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} diff --git a/charts/smokeping-prober/values.yaml b/charts/smokeping-prober/values.yaml index 27bc407..27ffa6c 100644 --- a/charts/smokeping-prober/values.yaml +++ b/charts/smokeping-prober/values.yaml @@ -5,7 +5,7 @@ replicaCount: 1 image: - repository: vexxhost/smokeping + repository: vexxhost/smokeping-prober version: latest pullPolicy: IfNotPresent @@ -25,12 +25,11 @@ securityContext: {} # runAsUser: 1000 hosts: - - ip: localhost + - localhost service: - type: NodePort + type: ClusterIP port: 80 - nodePort: 30080 resources: {} # We usually recommend not to specify default resources and to leave this as a conscious diff --git a/playbooks/functional/run.yaml b/playbooks/functional/run.yaml new file mode 100644 index 0000000..d5abffb --- /dev/null +++ b/playbooks/functional/run.yaml @@ -0,0 +1,22 @@ +- hosts: all + roles: + - role: helm-template + vars: + helm_release_name: smokeping-prober + helm_chart: ./charts/smokeping-prober + tasks: + - name: Get the port + command: > + kubectl get svc/smokeping-prober -ojsonpath="http://{.spec.clusterIP}:{.spec.ports[0].port}" + register: _url + + - name: Wait for a few seconds for the prober to gather data + pause: + seconds: 10 + + - name: Get data back from the prober + uri: + url: "{{ _url.stdout }}/metrics" + return_content: true + register: _probe + failed_when: "'smokeping_response_duration_seconds_bucket{host=\"localhost\"' not in _probe.content"