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

Add support for custom subscription config #446

Merged

Conversation

VaishnaviHire
Copy link
Member

@VaishnaviHire VaishnaviHire commented Aug 14, 2023

Fixes #436

Description

How Has This Been Tested?

  1. Deploy following dev catalogsource
quay.io/vhire/opendatahub-operator-catalog:v2.0.32 
  1. Subscribe to operator using following subscription
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: opendatahub-operator
  namespace: openshift-operators
spec:
  channel: fast
  name: opendatahub-operator
  source: opendatahub-dev-catalog
  sourceNamespace: openshift-marketplace
  config:
     env:
        - name: "DISABLE_DSC_CONFIG"
  1. Verify no namespaces are created
  2. Verify when DataScienceCluster CR is created, it goes into Error phase

To Enable Components
5. Create DSCInitialization CR

apiVersion: dscinitialization.opendatahub.io/v1alpha1
kind: DSCInitialization
metadata:
  name: default
spec:
  monitoring:
    enabled: false
    namespace: 'opendatahub'
  applicationsNamespace: 'opendatahub'
  1. Then create DataScienceCluster CR
apiVersion: datasciencecluster.opendatahub.io/v1alpha1
kind: DataScienceCluster
metadata:
  name: default
spec:
  components:
    dashboard:
      enabled: true

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@openshift-ci openshift-ci bot requested a review from cfchase August 14, 2023 18:49
main.go Outdated Show resolved Hide resolved
main.go Outdated
Monitoring: dsci.Monitoring{
Enabled: false,
// Check if Auto configuration is enabled
if os.Getenv("ENABLE_AUTO_CONFIG") == "" || os.Getenv("ENABLE_AUTO_CONFIG") != "false" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it wouldn't be better to check == "true" for proceeding, == "false" for disabling and failing if it is not true or false? it would make intent explicit and avoid silent failures on this critical flag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a user installs the operator through OperatorHub, subscription is created for the user by default. That will not include this config. In that case, if we set up failure for not defining the flag, it will result in operator install failure

Copy link
Contributor

@etirelli etirelli Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, what I mean is if the user makes a typo like: ENABLE_AUTO_CONFIG=flse . With the current code, although the user intended to disable auto-config, it will silently proceed with the configuration.
I completely agree with you that in the absence of the flag, it should use the default behaviour of configuring everything.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will that be easier to just have a flag in subscritipion, rather than set to "true" or "false".
so, if install from opendatahub, this flag (say, ENABLE_AUTO_CONFIG) does not exist. then do as-is
if subsciption created by user and set this flag ENABLE_AUTO_CONFIG then proceed without create DSCI instance.

.spec.config.env
Description
Env is a list of environment variables to set in the container. Cannot be updated.

instead of using

.spec.config.env[]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, can we change the name to something more specific,
the final catalogsource image can have different operators in it.
if others have a logic check on env ENABLE_AUTO_CONFIG as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@VaishnaviHire VaishnaviHire force-pushed the add_subscription_flag branch from 1c94bae to e8bb313 Compare August 14, 2023 22:25
Copy link
Contributor

@etirelli etirelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment, but I think we can merge as address that later.

LGTM

main.go Outdated
Monitoring: dsci.Monitoring{
Enabled: false,
// Check if Auto configuration is enabled
if os.Getenv("ENABLE_AUTO_CONFIG") == "" || os.Getenv("ENABLE_AUTO_CONFIG") != "false" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will that be easier to just have a flag in subscritipion, rather than set to "true" or "false".
so, if install from opendatahub, this flag (say, ENABLE_AUTO_CONFIG) does not exist. then do as-is
if subsciption created by user and set this flag ENABLE_AUTO_CONFIG then proceed without create DSCI instance.

.spec.config.env
Description
Env is a list of environment variables to set in the container. Cannot be updated.

instead of using

.spec.config.env[]

main.go Outdated
Monitoring: dsci.Monitoring{
Enabled: false,
// Check if Auto configuration is enabled
if os.Getenv("ENABLE_AUTO_CONFIG") == "" || os.Getenv("ENABLE_AUTO_CONFIG") != "false" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, can we change the name to something more specific,
the final catalogsource image can have different operators in it.
if others have a logic check on env ENABLE_AUTO_CONFIG as well.

@VaishnaviHire VaishnaviHire force-pushed the add_subscription_flag branch from e8bb313 to d97ced0 Compare August 15, 2023 13:13
@openshift-ci openshift-ci bot removed the lgtm label Aug 15, 2023
Copy link
Member

@zdtsw zdtsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci
Copy link

openshift-ci bot commented Aug 15, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: etirelli, zdtsw

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@VaishnaviHire VaishnaviHire merged commit 94be749 into opendatahub-io:main Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Operator only installation of ODH
3 participants