Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CRD with meaningful set of parameters #56

Merged
merged 31 commits into from
Dec 12, 2023
Merged

Update CRD with meaningful set of parameters #56

merged 31 commits into from
Dec 12, 2023

Conversation

rm3l
Copy link
Member

@rm3l rm3l commented Dec 1, 2023

Description

This updates the CRD structure based on the proposal and discussion in #21 (comment), later refined in https://docs.google.com/document/d/14z9tE2XsCRl0hLTbHkyOdv26S6trHLgfpxYOfo-cm1I/edit

This is an example of what we agreed to have:

spec:
  enableLocalDb: true
  application:
    appConfig:
      # All ConfigMaps will be mounted in the same place
      mountPath: "/opt/app-root/src"
      configMaps:
          - name: "my-app-config-cm12"
            # key is optional
            key: "my-file1"
    extraFiles:
      # All ConfigMaps and Secrets will be mounted in the same place
      mountPath: /opt/app-root/src/path/to/my-extra-files
      configMaps:
          - name: "my-extra-config-secret12"
            # key is optional. All files will be mounted if not set
            key: "my-file1"
      secrets:
          - name: "my-extra-config-secret12"
            # key is optional. All files will be mounted if not set
            key: "my-file1"    
    # CM must have a key named 'dynamic-plugins.yaml'
    dynamicPluginsConfigMapName: "my-dynamic-plugins-config-cm"

    extraEnvs:
      configMaps:
        - name: "cm-name"
          # key is optional. Env vars from all keys if key is not set
          key: "key"
      secrets:
        - name: "secret-name"
          # key is optional. Env vars from all keys if key is not set
          key: "key"
      envs:
        - name: MY_ENV_VAR_1
          value: my-value-1
    replicas: 2
    image: "quay.io/rhdh/rhdh-hub-rhel9:1.0-194"
    imagePullSecrets:
      - rhdh-pull-secret

More context in:

Which issue(s) does this PR fix or relate to

PR acceptance criteria

  • Tests
  • Documentation

How to test changes / Special notes to the reviewer

The most basic CR (with no spec) should work.

See examples of more complete CRs here:

Noteworthy changes:

  • app-config files can be mounted under the same mount path (/opt/app-root/src by default)
  • extra-config files can be mounted under the same mount path (/opt/app-root/src by default)
  • Because dynamic plugins configuration needs to be handled differently from app-configs, the field introduced in Handle app-configs and config for dynamic plugins in Custom Resource #27 is still present. It is now renamed into a simple dynamicPluginsConfigMapName string field.
  • The backendAuthSecretRef field introduced in Handle app-configs and config for dynamic plugins in Custom Resource #27 has been removed to make it less confusing. Instead, if user did not specify any appConfig, extraFiles or extraEnv in their CR, we would create a default app-config with a default value for the backend auth key. Otherwise, users are expected to provide their own value for this key (either via their own app-config, or via an APP_CONFIG_... env var)

api/v1alpha1/backstage_types.go Outdated Show resolved Hide resolved
api/v1alpha1/backstage_types.go Outdated Show resolved Hide resolved
api/v1alpha1/backstage_types.go Show resolved Hide resolved
api/v1alpha1/backstage_types.go Outdated Show resolved Hide resolved
api/v1alpha1/backstage_types.go Outdated Show resolved Hide resolved
api/v1alpha1/backstage_types.go Outdated Show resolved Hide resolved
api/v1alpha1/backstage_types.go Outdated Show resolved Hide resolved
api/v1alpha1/backstage_types.go Outdated Show resolved Hide resolved
@rm3l rm3l changed the title [WIP] Update CRD with meaningful set of parameters Update CRD with meaningful set of parameters Dec 4, 2023
@rm3l rm3l changed the title Update CRD with meaningful set of parameters [WIP] Update CRD with meaningful set of parameters Dec 8, 2023
@rm3l
Copy link
Member Author

rm3l commented Dec 8, 2023

We discussed and agreed on the CRD structure: doc

Summarized in #26 (comment)

I'm updating this PR with the new changes..

rm3l and others added 19 commits December 8, 2023 18:13
Co-authored-by: Gennady Azarenkov <gazarenkov@gmail.com>
…or ephemeral containers

Co-authored-by: Gennady Azarenkov <gazarenkov@gmail.com>
Co-authored-by: Jianrong Zhang <jianrzha@redhat.com>
Co-authored-by: Jianrong Zhang <jianrzha@redhat.com>
…cal DB

Co-authored-by: Gennady Azarenkov <gazarenkov@gmail.com>
Now that we have support for environment variables and mounting extra files,
we can simplify the logic by not allowing using Secrets.
This is also more aligned with the Backstage way of writing configuration files [1]

[1] https://backstage.io/docs/conf/writing/

Co-authored-by: Gennady Azarenkov <gazarenkov@gmail.com>
…nfiguration

Now that we have support for environment variables and mounting extra files,
we can simplify the logic by not allowing using Secrets.
This is also more aligned with the Backstage way of writing configuration files [1]

[1] https://backstage.io/docs/conf/writing/

Co-authored-by: Gennady Azarenkov <gazarenkov@gmail.com>
This makes it more aligned with the other fields
This makes it more aligned with how references to secret keys are named generally in K8s
Co-authored-by: Jianrong Zhang <jianrzha@redhat.com>
rm3l and others added 7 commits December 8, 2023 18:13
[1] #26 (comment)

Co-authored-by: Gennady Azarenkov <gazarenkov@gmail.com>
Co-authored-by: Jianrong Zhang <jianrzha@redhat.com>
This sounds too low-level and might sound confusing.
Instead, if no AppConfig, ExtraFile or ExtraEnvVar is set,
we would create a default app-config with a default value
for this backend auth secret.
Otherwise, we would make it clear in the doc that users
need to additional define this in their own app-config or
extra-env vars.
@rm3l rm3l changed the title [WIP] Update CRD with meaningful set of parameters Update CRD with meaningful set of parameters Dec 11, 2023
We use pointers generally to be able to determine
if a field was purposely not set.
But it should not matter here as the default value is 'false'.
api/v1alpha1/backstage_types.go Outdated Show resolved Hide resolved
rm3l and others added 2 commits December 12, 2023 10:19
Co-authored-by: Jianrong Zhang <jianrzha@redhat.com>
@rm3l rm3l merged commit a8f4c02 into janus-idp:main Dec 12, 2023
@rm3l rm3l deleted the 26-update-crd-with-initial-set-of-meaningful-parameters branch December 12, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants