Skip to content

Commit

Permalink
fix(app kustomization): don't mix vars & setters
Browse files Browse the repository at this point in the history
* Don't use kpt setters and FluxCD variables within the same field, see kptdev/kpt#3965.
* Bind default Secret in addition to the user-defined one in order to allow for app updates to also update the config.
  • Loading branch information
mgoltzsche committed May 18, 2023
1 parent 882e706 commit 8b22b20
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 27 deletions.
21 changes: 17 additions & 4 deletions deploy/app/appconfigschema.yaml → deploy/app/configschema.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
apiVersion: apps.kubemate.mgoltzsche.github.com/v1alpha1
kind: AppConfigSchema
metadata:
name: mopidy # kpt-set: ${name}
name: ${APP_NAME:=app}
spec:
params:
- name: MOPIDY_YOUTUBE_ENABLED
title: Use the Youtube Data API
type: bool
title: Use Youtube
type: enum
enum:
- "true"
- "false"
category: Youtube
- name: MOPIDY_YOUTUBE_API_ENABLED
title: Use Youtube Data API
category: Youtube
type: enum
enum:
- "true"
- "false"
- name: MOPIDY_YOUTUBE_API_KEY
title: Youtube Data API Key
type: password
Expand All @@ -17,8 +27,11 @@ spec:
Obtain it from https://console.cloud.google.com after creating an account and a project.
- name: MOPIDY_YOUTUBE_MUSICAPI_ENABLED
title: Use Youtube Music
type: bool
category: Youtube
type: enum
enum:
- "true"
- "false"
- name: MOPIDY_MPD_PASSWORD
title: MPD password
type: password
Expand Down
4 changes: 1 addition & 3 deletions deploy/app/defaults.yaml → deploy/app/defaultconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: mopidy-defaults # kpt-set: ${name}-defaults
annotations:
kubemate.mgoltzsche.github.com/default-config: "true"
name: ${APP_NAME:=app}-defaultconfig
stringData:
MOPIDY_MPD_PASSWORD: generate
MOPIDY_YOUTUBE_ENABLED: "true"
Expand Down
4 changes: 3 additions & 1 deletion deploy/app/deployment-patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ spec:
- name: app
envFrom:
- secretRef:
name: ${APP_CONFIG_SECRET_NAME:=mopidy-defaults} # kpt-set: ${APP_CONFIG_SECRET_NAME:=${name}-defaults}
name: ${APP_NAME:=app}-defaultconfig
- secretRef:
name: ${APP_CONFIG_SECRET_NAME:=app-defaultconfig}
4 changes: 2 additions & 2 deletions deploy/app/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace: kubemate
resources:
- appconfigschema.yaml
- defaults.yaml
- configschema.yaml
- defaultconfig.yaml
- ../default
patchesStrategicMerge:
- deployment-patch.yaml
17 changes: 0 additions & 17 deletions deploy/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,6 @@ spec:
- name: app
image: ghcr.io/mgoltzsche/mopidy:0.5.1 # kpt-set: ${image}:${version}
imagePullPolicy: IfNotPresent
env:
- name: MOPIDY_YOUTUBE_ENABLED
value: "true"
- name: MOPIDY_YOUTUBE_API_ENABLED
value: "true"
- name: MOPIDY_YOUTUBE_API_KEY
value: ""
- name: MOPIDY_YOUTUBE_MUSICAPI_ENABLED
value: "false"
- name: MOPIDY_YOUTUBE_MUSICAPI_COOKIE
value: ""
- name: MOPIDY_YOUTUBE_MUSICAPI_CHANNEL
value: UCYwjcFiUg8PpWM45vpBUc3Q
- name: MOPIDY_YOUTUBE_MAX_SEARCH_RESULTS
value: "15"
- name: MOPIDY_YOUTUBE_MAX_VIDEOS
value: "20"
resources:
limits:
cpu: 200m
Expand Down

0 comments on commit 8b22b20

Please sign in to comment.