Skip to content

Commit

Permalink
Merge pull request #75 from startechnica/external-service
Browse files Browse the repository at this point in the history
[external-service] Bump version to 0.1.1
  • Loading branch information
firmansyahn authored Jun 11, 2024
2 parents fb10287 + 5e8b707 commit 1acb2f0
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/external-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ maintainers:
email: [email protected]
url: https://firmansyah.nainggolan.id
name: external-service
version: 0.1.0
version: 0.1.1
22 changes: 22 additions & 0 deletions charts/external-service/templates/Role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if and .Values.serviceAccount.create .Values.rbac.create }}
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "external-service.fullname" . }}
namespace: {{ include "external-service.namespace" . | quote }}
labels: {{- include "external-service.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "external-service.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
rules:
{{- if .Values.rbac.rules }}
{{- include "external-service.tplvalues.render" (dict "value" .Values.rbac.rules "context" $) | nindent 2 }}
{{- end }}
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- list
{{- end }}
19 changes: 19 additions & 0 deletions charts/external-service/templates/RoleBinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if and .Values.serviceAccount.create .Values.rbac.create }}
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "external-service.fullname" . }}
namespace: {{ include "external-service.namespace" . | quote }}
labels: {{- include "external-service.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "external-service.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "external-service.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "external-service.serviceAccountName" . }}
namespace: {{ include "external-service.namespace" . | quote }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/external-service/templates/ServiceAccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
metadata:
name: {{ include "external-service.serviceAccountName" . }}
namespace: {{ include "external-service.namespace" . | quote }}
labels: {{- include "external-service.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if or .Values.commonAnnotations .Values.serviceAccount.annotations }}
{{- $annotations := include "external-service.tplvalues.merge" ( dict "values" (list .Values.serviceAccount.annotations .Values.commonAnnotations ) "context" .) }}
annotations: {{- include "external-service.tplvalues.render" (dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}
10 changes: 10 additions & 0 deletions charts/external-service/templates/helpers/_rbac.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{/*
Create the name of the service account to use
*/}}
{{- define "external-service.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{- default (include "external-service.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{- default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
5 changes: 1 addition & 4 deletions charts/external-service/templates/metrics/Endpoints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ metadata:
subsets:
{{- if not (empty .Values.addresses) }}
- addresses:
{{ range $address := .Values.addresses }}
- ip: {{ $address.ip }}
nodeName: {{ $address.nodeName }}
{{- end }}
{{- toYaml .Values.addresses | nindent 6 }}
ports:
- name: http-metrics
port: {{ .Values.metrics.ports.metrics }}
Expand Down
2 changes: 2 additions & 0 deletions charts/external-service/templates/metrics/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ spec:
- {{ $externalIP | quote }}
{{- end }}
{{- end }}
{{- if not (eq .Values.metrics.service.type "ExternalName") }}
ipFamilyPolicy: {{ default "SingleStack" .Values.metrics.service.ipFamilyPolicy }}
{{- end }}
ports:
- name: http-metrics
port: {{ .Values.metrics.service.ports.http }}
Expand Down
42 changes: 40 additions & 2 deletions charts/external-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,52 @@ annotations: {}
##
addresses: []
## @param ports
## addresses:
## ports:
## - name:
## ip:
## port:
## protocol:
##
ports: []

## @section RBAC parameter
## Specifies whether a ServiceAccount should be created
##
serviceAccount:
## @param serviceAccount.create Enable the creation of a ServiceAccount for Netbox pods
##
create: false
## @param serviceAccount.name Name of the created ServiceAccount
## If not set and create is true, a name is generated using the fullname template
##
name: ""
## @param serviceAccount.automountServiceAccountToken Auto-mount the service account token in the pod
##
automountServiceAccountToken: false
## @param serviceAccount.annotations Additional custom annotations for the ServiceAccount
##
annotations: {}
## @param serviceAccount.extraLabels Additional labels for the ServiceAccount
##
extraLabels: {}
## Specifies whether RBAC resources should be created
##
rbac:
## @param rbac.create Whether to create and use RBAC resources or not
##
create: false
## @param rbac.rules Custom RBAC rules
## Example:
## rules:
## - apiGroups:
## - ""
## resources:
## - pods
## verbs:
## - get
## - list
##
rules: []

## @section Metrics Parameters

## Prometheus Exporter / Metrics
Expand Down

0 comments on commit 1acb2f0

Please sign in to comment.