Skip to content

Commit

Permalink
[stable/field-exporter]: field-exporter (#539)
Browse files Browse the repository at this point in the history
* [stable/field-exporter]: field-exporter

* Fix requests

* fix docs

* Update version
  • Loading branch information
vzholudev authored Nov 3, 2023
1 parent 509de80 commit 43f8a98
Show file tree
Hide file tree
Showing 10 changed files with 557 additions and 0 deletions.
23 changes: 23 additions & 0 deletions stable/field-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
15 changes: 15 additions & 0 deletions stable/field-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: field-exporter
description: |
A chart to install [field-exporter](https://github.com/deliveryhero/field-exporter). This controller is used to fill the gap in [k8s-config-connector](https://github.com/GoogleCloudPlatform/k8s-config-connector) for exporting value from Config Connector managed resources into Secrets and ConfigMaps.
type: application
version: 1.0.0
appVersion: "v1.0.0"
maintainers:
- name: vzholudev
email: [email protected]
url: https://github.com/vzholudev
- name: mtahaahmed
email: [email protected]
url: https://github.com/mtahaahmed
69 changes: 69 additions & 0 deletions stable/field-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# field-exporter

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.0.0](https://img.shields.io/badge/AppVersion-v1.0.0-informational?style=flat-square)

A chart to install [field-exporter](https://github.com/deliveryhero/field-exporter). This controller is used to fill the gap in [k8s-config-connector](https://github.com/GoogleCloudPlatform/k8s-config-connector) for exporting value from Config Connector managed resources into Secrets and ConfigMaps.

## How to install this chart

Add Delivery Hero public chart repo:

```console
helm repo add deliveryhero https://charts.deliveryhero.io/
```

A simple install with default values:

```console
helm install deliveryhero/field-exporter
```

To install the chart with the release name `my-release`:

```console
helm install my-release deliveryhero/field-exporter
```

To install with some set values:

```console
helm install my-release deliveryhero/field-exporter --set values_key1=value1 --set values_key2=value2
```

To install with custom values file:

```console
helm install my-release deliveryhero/field-exporter -f values.yaml
```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| controllerManager.manager.args[0] | string | `"--health-probe-bind-address=:8081"` | |
| controllerManager.manager.args[1] | string | `"--metrics-bind-address=127.0.0.1:8080"` | |
| controllerManager.manager.args[2] | string | `"--leader-elect"` | |
| controllerManager.manager.containerSecurityContext.allowPrivilegeEscalation | bool | `false` | |
| controllerManager.manager.containerSecurityContext.capabilities.drop[0] | string | `"ALL"` | |
| controllerManager.manager.image.repository | string | `"europe-docker.pkg.dev/dp-common-infra-5780/developer-platform-public/deliveryhero/field-exporter"` | |
| controllerManager.manager.image.tag | string | `"v1.0.0"` | |
| controllerManager.manager.resources.limits.cpu | string | `"500m"` | |
| controllerManager.manager.resources.limits.memory | string | `"128Mi"` | |
| controllerManager.manager.resources.requests.cpu | string | `"10m"` | |
| controllerManager.manager.resources.requests.memory | string | `"128Mi"` | |
| controllerManager.podLabels | object | `{}` | |
| controllerManager.replicas | int | `1` | |
| controllerManager.serviceAccount.annotations | object | `{}` | |
| kubernetesClusterDomain | string | `"cluster.local"` | |
| metricsService.ports[0].name | string | `"https"` | |
| metricsService.ports[0].port | int | `8443` | |
| metricsService.ports[0].protocol | string | `"TCP"` | |
| metricsService.ports[0].targetPort | string | `"https"` | |
| metricsService.type | string | `"ClusterIP"` | |

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| vzholudev | <[email protected]> | <https://github.com/vzholudev> |
| mtahaahmed | <[email protected]> | <https://github.com/mtahaahmed> |
138 changes: 138 additions & 0 deletions stable/field-exporter/crds/resourcefieldexport-crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: resourcefieldexports.gdp.deliveryhero.io
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
spec:
group: gdp.deliveryhero.io
names:
kind: ResourceFieldExport
listKind: ResourceFieldExportList
plural: resourcefieldexports
singular: resourcefieldexport
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: ResourceFieldExport is the Schema for the resourcefieldexports
API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ResourceFieldExportSpec defines the desired state of ResourceFieldExport
properties:
from:
properties:
apiVersion:
description: APIVersion is the group version of the resource
pattern: ^([a-zA-Z0-9.-]+[a-zA-Z0-9-]\/[a-zA-Z0-9]+|[a-zA-Z0-9]+)$
type: string
kind:
type: string
name:
type: string
required:
- apiVersion
- kind
- name
type: object
outputs:
items:
properties:
key:
type: string
path:
type: string
required:
- key
- path
type: object
type: array
requiredFields:
properties:
statusConditions:
items:
properties:
status:
type: string
type:
type: string
required:
- status
- type
type: object
type: array
type: object
to:
description: DestinationRef is where the fields should be written.
properties:
name:
type: string
type:
description: DestinationType is a ConfigMap or a Secret
enum:
- ConfigMap
- Secret
type: string
required:
- name
- type
type: object
required:
- from
- outputs
- to
type: object
status:
description: ResourceFieldExportStatus defines the observed state of ResourceFieldExport
properties:
conditions:
items:
properties:
lastTransitionTime:
description: The last time the condition transitioned from one
status to another.
format: date-time
type: string
message:
description: A human-readable message indicating details about
the transition.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type is the type of the Condition
type: string
required:
- status
- type
type: object
type: array
required:
- conditions
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
62 changes: 62 additions & 0 deletions stable/field-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "field-exporter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "field-exporter.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "field-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "field-exporter.labels" -}}
helm.sh/chart: {{ include "field-exporter.chart" . }}
{{ include "field-exporter.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "field-exporter.selectorLabels" -}}
app.kubernetes.io/name: {{ include "field-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "field-exporter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "field-exporter.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
56 changes: 56 additions & 0 deletions stable/field-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "field-exporter.fullname" . }}-controller-manager
labels:
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: field-exporter
app.kubernetes.io/part-of: field-exporter
control-plane: controller-manager
{{- include "field-exporter.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.controllerManager.replicas }}
selector:
matchLabels:
control-plane: controller-manager
{{- include "field-exporter.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
control-plane: controller-manager
{{- include "field-exporter.selectorLabels" . | nindent 8 }}
{{- if .Values.controllerManager.podLabels }}
{{ toYaml .Values.controllerManager.podLabels | indent 8 }}
{{- end }}
annotations:
kubectl.kubernetes.io/default-container: manager
spec:
containers:
- args: {{- toYaml .Values.controllerManager.manager.args | nindent 8 }}
command:
- /manager
env:
- name: KUBERNETES_CLUSTER_DOMAIN
value: {{ quote .Values.kubernetesClusterDomain }}
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag | default .Chart.AppVersion }}
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
name: manager
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
resources: {{- toYaml .Values.controllerManager.manager.resources | nindent 10
}}
securityContext: {{- toYaml .Values.controllerManager.manager.containerSecurityContext
| nindent 10 }}
securityContext:
runAsNonRoot: true
serviceAccountName: {{ include "field-exporter.fullname" . }}-controller-manager
terminationGracePeriodSeconds: 10
Loading

0 comments on commit 43f8a98

Please sign in to comment.