Skip to content

Commit

Permalink
feat: secret store (#96)
Browse files Browse the repository at this point in the history
* feat: secret store

* ci: fix helm lint version

* ci: photon architecture x86

* ci: use default phyton version
  • Loading branch information
irmannmal authored Nov 18, 2023
1 parent dc3bf39 commit a693a1b
Show file tree
Hide file tree
Showing 27 changed files with 109 additions and 815 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.9.4
version: v3.12.1
- name: Run chart-releaser
uses: helm/[email protected]
env:
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/tester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,17 @@ jobs:
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.9.4
version: v3.12.1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up Chart Testing
uses: helm/[email protected]
with:
version: v3.4.0
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
Expand Down
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,8 @@ Starting with Myriad.Social, we are creating a platform where social app, metave

---

## Actions

* [@helm/kind-action](https://github.com/helm/kind-action)
* [@helm/chart-testing-action](https://github.com/helm/chart-testing-action)
* [@helm/chart-releaser-action](https://github.com/helm/chart-releaser-action)

## Project Status

`main` supports Helm 3 only, i. e. both `v1` and `v2` [API version](https://helm.sh/docs/topics/charts/#the-apiversion-field) charts are installable.

## Chart Sources

* `charts/myriad-node`: [Myriad Node Chart](./charts/myriad-node)
* `charts/myriad-api` : [Myriad API Chart](./charts/myriad-api)
* `charts/myriad-web` : [Myriad Web App Chart](./charts/myriad-web)
* `charts/myriad-federated` : [Myriad Web Federated Chart](./charts/myriad-federated)
Expand All @@ -38,5 +27,5 @@ Starting with Myriad.Social, we are creating a platform where social app, metave
```bash
helm repo add myriadsocial https://charts.myriad.social
helm repo update
helm install myriad-node myriadsocial/myriad-node
helm install myriad-api myriadsocial/myriad-api
```
4 changes: 2 additions & 2 deletions charts/myriad-api/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ 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: 2.3.4
version: 2.4.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
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2.3.4"
appVersion: "2.4.0"
maintainers:
- email: [email protected]
name: myriadsocial
24 changes: 23 additions & 1 deletion charts/myriad-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.config.firebase.serviceAccountBase64 }}
{{- if and (not .Values.config.secretsStore.enabled) .Values.config.firebase.serviceAccountBase64 }}
volumes:
- name: google-service-account-credentials
secret:
Expand All @@ -48,6 +48,15 @@ spec:
- key: serviceAccount
path: sa_credentials.json
{{- end }}
{{- if and .Values.config.secretsStore.enabled .Values.config.secretsStore.providerClass }}
volumes:
- name: secrets-store
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: {{ .Values.config.secretsStore.providerClass }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand All @@ -56,6 +65,7 @@ spec:
{{- toYaml .Values.resources | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if not .Values.config.secretsStore.enabled }}
env:
{{- if .Values.config.domain }}
- name: DOMAIN
Expand Down Expand Up @@ -198,6 +208,18 @@ spec:
mountPath: /etc/google
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.config.secretsStore.enabled }}
envFrom:
{{- if .Values.config.secretsStore.name }}
- secretRef:
name: {{ .Values.config.secretsStore.name }}
{{- end }}
volumeMounts:
- name: secrets-store
mountPath: "/var/secrets"
readOnly: true
{{- end }}
ports:
- name: http
containerPort: 3000
Expand Down
2 changes: 2 additions & 0 deletions charts/myriad-api/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.config.secretsStore.enabled }}
{{- if .Values.config.adminSubstrateMnemonic }}
apiVersion: v1
kind: Secret
Expand Down Expand Up @@ -115,3 +116,4 @@ type: Opaque
data:
apiKey: {{ .Values.config.coinMarketCap.apiKey | b64enc }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/myriad-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ image:
imagePullSecrets: []

config:
secretsStore:
enabled: false
providerClass: ""
name: ""
domain: ""
adminSubstrateMnemonic: ""
adminNearMnemonic: ""
Expand Down Expand Up @@ -50,6 +54,12 @@ config:
apiKey: ""
coinMarketCap:
apiKey: ""
startupProbe:
path: ""
livenessProbe:
path: ""
readinessProbe:
path: ""

serviceAccount:
# Specifies whether a service account should be created
Expand Down
4 changes: 2 additions & 2 deletions charts/myriad-federated/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ 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: 1.0.4
version: 2.4.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
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.4"
appVersion: "2.4.0"
maintainers:
- email: [email protected]
name: myriadsocial
22 changes: 22 additions & 0 deletions charts/myriad-federated/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and .Values.config.secretsStore.enabled .Values.config.secretsStore.providerClass }}
volumes:
- name: secrets-store
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: {{ .Values.config.secretsStore.providerClass }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand All @@ -47,6 +56,7 @@ spec:
{{- toYaml .Values.resources | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if not .Values.config.secretsStore.enabled }}
env:
{{- if .Values.config.app.environment }}
- name: NEXT_PUBLIC_APP_ENVIRONMENT
Expand Down Expand Up @@ -87,6 +97,18 @@ spec:
- name: NEXT_PUBLIC_SENTRY_DSN
value: {{ .Values.config.sentry.dsn }}
{{- end }}
{{- end }}
{{- if .Values.config.secretsStore.enabled }}
envFrom:
{{- if .Values.config.secretsStore.name }}
- secretRef:
name: {{ .Values.config.secretsStore.name }}
{{- end }}
volumeMounts:
- name: secrets-store
mountPath: "/var/secrets"
readOnly: true
{{- end }}
ports:
- name: http
containerPort: 3000
Expand Down
2 changes: 2 additions & 0 deletions charts/myriad-federated/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.config.secretsStore.enabled }}
{{- if .Values.config.app.secret }}
apiVersion: v1
kind: Secret
Expand All @@ -10,3 +11,4 @@ data:
---

{{- end }}
{{- end }}
6 changes: 5 additions & 1 deletion charts/myriad-federated/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ image:
imagePullSecrets: []

config:
secretsStore:
enabled: false
providerClass: ""
name: ""
app:
environment: ""
name: ""
version: ""
authURL: ""
secret: ""
websiteURL: ""
supportMail: ""
websiteURL: ""
rpcURL: ""
sentry:
dsn: ""
Expand Down
23 changes: 0 additions & 23 deletions charts/myriad-node/.helmignore

This file was deleted.

27 changes: 0 additions & 27 deletions charts/myriad-node/Chart.yaml

This file was deleted.

Loading

0 comments on commit a693a1b

Please sign in to comment.