Skip to content

Commit

Permalink
feat(resource-injector): migrate to object based approach
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswessels committed Aug 27, 2022
1 parent eae6869 commit d3ab6d0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 29 deletions.
2 changes: 1 addition & 1 deletion charts/resource-injector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
14 changes: 8 additions & 6 deletions charts/resource-injector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@

Manage Raw Kubernetes Resources using Helm

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

## Usage

Set `resources` to an array of Kubernetes Resources to inject into the Helm Release.
Set `resources` to an object, with each value being a Kubernetes Resources to inject into the Helm Release. The name of the key does not matter, but can be used to reference an object and override values in a layered values.yaml approach.

Example:

```yaml
# values.yaml

resources:
- apiVersion: v1
secret1:
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: YWRtaW4=
password: MWYyZDFlMmU2N2Rm
- apiVersion: v1
secret2:
apiVersion: v1
kind: Service
metadata:
name: my-service
Expand All @@ -39,8 +41,8 @@ resources:
| Key | Description | Type | Default |
|-----|-------------|------|---------|
| resources | Resources in the release. Each entry should be YAML for a valid Kubernetes Resource. | list | `[]` |
| resources | Resources in the release. Each map value should be YAML for a valid Kubernetes Resource. The name of the key does not matter, other than for overriding values. | object | `{}` |

## Contributing

We welcome and appreciate your contributions! Please see the [Contributor Guide](/CONTRIBUTING.md), [Code Of Conduct](/CODE_OF_CONDUCT.md) and [Security Notes](/SECURITY.md) for this repository.
We welcome and appreciate your contributions! Please see the [Contributor Guide](/CONTRIBUTING.md), [Code Of Conduct](/CODE_OF_CONDUCT.md) and [Security Notes](/SECURITY.md) for this repository.
10 changes: 6 additions & 4 deletions charts/resource-injector/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@

## Usage

Set `resources` to an array of Kubernetes Resources to inject into the Helm Release.
Set `resources` to an object, with each value being a Kubernetes Resources to inject into the Helm Release. The name of the key does not matter, but can be used to reference an object and override values in a layered values.yaml approach.

Example:

```yaml
# values.yaml

resources:
- apiVersion: v1
secret1:
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: YWRtaW4=
password: MWYyZDFlMmU2N2Rm
- apiVersion: v1
secret2:
apiVersion: v1
kind: Service
metadata:
name: my-service
Expand All @@ -41,4 +43,4 @@ resources:

{{ template "chart.valuesSection" . }}

{{ template "graphops.contributingSection" . }}
{{ template "graphops.contributingSection" . }}
5 changes: 3 additions & 2 deletions charts/resource-injector/templates/resources.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- range $resource := .Values.resources }}
{{- range $name, $resource := .Values.resources }}
---
# Resource key name: {{ $name }}
{{ toYaml $resource }}
{{- end }}
{{- end }}
18 changes: 2 additions & 16 deletions charts/resource-injector/values.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
# Default values for resource-injector.
# This is a YAML-formatted file.

# -- Resources in the release. Each entry should be YAML for a valid Kubernetes Resource.
resources: []
# # resource example
# - apiVersion: bitnami.com/v1alpha1
# kind: SealedSecret
# metadata:
# name: super-secret
# namespace: test
# spec:
# encryptedData:
# TESTER_SECRET: 'AgDXgxBqhd65Zf22pyunliiYuZGDy/8yDS9QaDy8mcR13Qp6irG0cDvoVw9g/wYcfpmxKoFIaHDzHl5L9wEeUdjITIPbFvMTrdRqYWRB9m3npC9gxWWAEoeWMj2xaO4eR1cVp2V0DcZ1AyC7ZS6sXfX78GMzM9V/6THfVBOeTcLvhuQ3hbHJitP0+27O7Xxka5AbhN3jyEVy0HdiTY38vZrGt9ovvh8fogfu1vs4IqOUC6XOzvpm//M1GBb3qdVx4zEY9Imoc66J596wLQxZbAPY2epHpOd6qP8uC1aMsFze/Ll/+fYLHTcLOezMufywXLM640F2LwOSjKW4u2qfVpRFOosjClFNsjrrtBpX9Qd49GlDwyAp6fTnlf5aFJjH6vZtj7gm2mtvRw5lVzpWC/PUQdryA1+28irqgIu5Kc7H65+DPSkkXNCNX57b6dPgsdh5rsHwqxY5b0/WYWWxiJ7uMHL7zqYwr4DyE4OR7hi5XRgYU7iRxq7JU58M+s254Iykm2RDlNva6CfBFVEg4RhuZeP/o5dxkwVu++jQZxBPUlxnHgFjB3oaDqGj+LJ9aeA3X9R56nN2OK4chBjzQ+Unqr/EN6s0TypCKUXGRAa9a7Yt9fbtWNnn8O1MC4a6JTSWn/fw+X/u22JW1ywbdY8E7pPunx2bM6gWtYfE5YndNsMoOAfkEiyZFHCslr2qvLuZrXe3SERzPw=='
# template:
# metadata:
# name: super-secret
# namespace: test
# type: Opaque
# -- Resources in the release. Each map value should be YAML for a valid Kubernetes Resource. The name of the key does not matter, other than for overriding values.
resources: {}

0 comments on commit d3ab6d0

Please sign in to comment.