[ 
https://issues.apache.org/jira/browse/FLINK-29536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627467#comment-17627467
 ] 

James Busche commented on FLINK-29536:
--------------------------------------

When I build an OLM bundle of the PR and deploy it on OpenShift, the behavior 
changes as expected.

I installed in both the default namespace and testing121 namespaces:
{quote}oc rsh -n testing121  flink-kubernetes-operator-7c9b585b76-sxwfw env 
|grep WATCH

*WATCH*_NAMESPACES=testing121

[r...@api.jim-fips.cp.fyre.ibm.com ~]# oc rsh -n default  
flink-kubernetes-operator-d955cc679-9sx85 env |grep WATCH

*WATCH*_NAMESPACES=default
{quote}
When I installed in all namespaces, then the WATCH_NAMESPACES= remained empty 
(watching all the namespaces, as expected.

If you want to try to my OLM bundle, you could do the following:
{quote} # Install OLM if you don't already have it:
{quote}curl -sL 
[https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.22.0/install.sh]
 | bash -s v0.22.0{quote}
 # Deploy my catsrc:cat <<EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: flink-29536-operator-catalog
  namespace: openshift-marketplace
spec:
  sourceType: grpc
  image: docker.io/jimbdocker/flink-29536-catalog:1.2.1
EOF

 # Create a namespace (or use the default) and then deploy a subscription like 
this:oc create ns testing121

oc project testing121

 

cat << EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1alpha2
kind: OperatorGroup
metadata:
  name: default-og
  namespace: testing121
spec:
  targetNamespaces:
  - testing121
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: flink-operator
  namespace: testing121
spec:
  channel: alpha
  name: flink-kubernetes-operator
  source: flink-29536-operator-catalog
  sourceNamespace: openshift-marketplace
  installPlanApproval: Automatic
  startingCSV: flink-kubernetes-operator.v1.2.1
EOF

 

oc rsh flink-kubernetes-operator-7c9b585b76-sxwfw env |grep WATCH

*WATCH*_NAMESPACES=testing121
{quote}
 

 

> Add WATCH_NAMESPACES env var to kubernetes operator
> ---------------------------------------------------
>
>                 Key: FLINK-29536
>                 URL: https://issues.apache.org/jira/browse/FLINK-29536
>             Project: Flink
>          Issue Type: Improvement
>          Components: Kubernetes Operator
>    Affects Versions: kubernetes-operator-1.2.0
>            Reporter: Tony Garrard
>            Assignee: Tony Garrard
>            Priority: Major
>              Labels: pull-request-available
>
> Provide the ability to set the namespaces watched by the operator using an 
> env var. Whilst the additional config can still be used, the presence of the 
> env var will take priority.
>  
> Reasons for issue
>  # Operator will take effect of the setting immediately as pod will roll 
> (rather than waiting for the config to be refreshed)
>  # If the operator is to be olm bundled we will be able to set the target 
> namespace using the following 
> {{                    env:}}
>   {{                      - name: WATCHED_NAMESPACE}}
>       {{                        valueFrom:}}
>           {{                          fieldRef:}}
>              {{                            fieldPath: 
> metadata.annotations['olm.targetNamespaces']}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to