Skip to content

Support the controller to watching a single namespace.#2374

Merged
TingluoHuang merged 1 commit into
masterfrom
users/tihuang/singlenamespace
Mar 14, 2023
Merged

Support the controller to watching a single namespace.#2374
TingluoHuang merged 1 commit into
masterfrom
users/tihuang/singlenamespace

Conversation

@TingluoHuang

Copy link
Copy Markdown
Member

Part 3 of #2275

  • Introduce watchSingleName to gha-runner-scale-set-controller to allow the controller only watch resources in a single namespace.

@TingluoHuang TingluoHuang changed the title [WIP] Support the controller to watching a single namespace. Support the controller to watching a single namespace. Mar 8, 2023
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from 06d8243 to 4c06ca2 Compare March 9, 2023 04:31
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch from fedc29a to 1725f23 Compare March 9, 2023 18:46
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from 4c06ca2 to f55e53a Compare March 9, 2023 18:49
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch from 1725f23 to b1d9c03 Compare March 9, 2023 22:31
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch 5 times, most recently from 0feb964 to 82dfa7f Compare March 10, 2023 21:24
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch from b1d9c03 to 8d924ae Compare March 10, 2023 22:05
@TingluoHuang TingluoHuang marked this pull request as ready for review March 10, 2023 22:07
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from 82dfa7f to b9b5743 Compare March 10, 2023 22:15
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch from 8d924ae to fb2b6a0 Compare March 11, 2023 00:38
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from b9b5743 to f3ee54e Compare March 11, 2023 00:39
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch from fb2b6a0 to b9c7561 Compare March 11, 2023 02:26
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from f3ee54e to 23884b9 Compare March 11, 2023 02:26
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch from b9c7561 to 2d1e2d2 Compare March 11, 2023 05:10
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch 3 times, most recently from b57b9d4 to a90f469 Compare March 11, 2023 20:09
Comment thread main.go
// We don't support metrics for AutoRunnerScaleSet for now
metricsAddr = "0"

managerNamespace = os.Getenv("CONTROLLER_MANAGER_POD_NAMESPACE")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't know if this would be a good idea, but I'll just ask for discussion:
Should we default to the default namespace if no namespace is provided, like k8s does? It seems more dangerous in case someone makes a mistake, but it also aligns well with the way k8s treats the empty value

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This env var gets its value from

    - name: CONTROLLER_MANAGER_POD_NAMESPACE
      valueFrom:
        fieldRef:
          apiVersion: v1
          fieldPath: metadata.namespace

so it depends on where arc is installed?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, but I am not sure if it is going to receive "" if no namespace is set ☺️ I'll play around to make sure, because I am not sure how it would look like if metadata.namespace is not set

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It should never be empty though, you can't create a resource outside a namespace?

Comment thread main.go
{{- $counter = add $counter 1 }}
{{- $controllerDeployment = $deployment }}
{{- if kindIs "map" $deployment.metadata.labels }}
{{- if eq (get $deployment.metadata.labels "app.kubernetes.io/part-of") "gha-runner-scale-set-controller" }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this a new value that we should set for the part-of?
The ADR says just "actions-runner-controller"
Should we update the ADR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good shout, the ADR pre dates the rename.

Comment thread charts/gha-runner-scale-set/templates/_helpers.tpl Outdated
Comment thread charts/gha-runner-scale-set/templates/_helpers.tpl Outdated
Comment thread charts/gha-runner-scale-set/templates/_helpers.tpl Outdated
Comment thread charts/gha-runner-scale-set/templates/_helpers.tpl Outdated
Comment thread charts/gha-runner-scale-set/templates/_helpers.tpl Outdated
Comment thread charts/gha-runner-scale-set/templates/_helpers.tpl Outdated
Comment thread charts/gha-runner-scale-set/templates/_helpers.tpl Outdated
Comment thread charts/gha-runner-scale-set/templates/_helpers.tpl Outdated
Comment thread charts/gha-runner-scale-set/templates/_helpers.tpl Outdated
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch 2 times, most recently from ca31c3e to 9b97a9f Compare March 13, 2023 19:42
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from 1823362 to 6577d7b Compare March 13, 2023 19:50
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch from 9b97a9f to 0825c8b Compare March 13, 2023 20:08
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from 6577d7b to 83ca034 Compare March 13, 2023 20:08
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch from 0825c8b to 1744fe4 Compare March 14, 2023 13:02
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from 82086d6 to 01dbfc3 Compare March 14, 2023 13:08
@TingluoHuang TingluoHuang force-pushed the users/tihuang/splitclusterrole branch from 1744fe4 to d286007 Compare March 14, 2023 13:23
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from 01dbfc3 to 5ef6ef3 Compare March 14, 2023 13:33
Base automatically changed from users/tihuang/splitclusterrole to master March 14, 2023 13:45
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from 5ef6ef3 to 9760054 Compare March 14, 2023 14:01
@TingluoHuang TingluoHuang force-pushed the users/tihuang/singlenamespace branch from 9760054 to b1d6551 Compare March 14, 2023 14:11
@TingluoHuang TingluoHuang merged commit 40811eb into master Mar 14, 2023
@TingluoHuang TingluoHuang deleted the users/tihuang/singlenamespace branch March 14, 2023 14:52
unpollito pushed a commit to DistruApp/actions-runner-controller that referenced this pull request Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants