Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ k8s_resource(
'sysdb-serviceaccount-rolebinding:RoleBinding:chroma',
'sysdb-query-service-memberlist-binding:RoleBinding:chroma',
'sysdb-compaction-service-memberlist-binding:RoleBinding:chroma',
'sysdb-rust-log-service-memberlist-binding:RoleBinding:chroma',

'query-service-serviceaccount:ServiceAccount:chroma',
'query-service-serviceaccount-rolebinding:RoleBinding:chroma',
Expand All @@ -266,6 +267,12 @@ k8s_resource(
'compaction-service-serviceaccount:ServiceAccount:chroma',
'compaction-service-serviceaccount-rolebinding:RoleBinding:chroma',

'rust-frontend-service-serviceaccount:ServiceAccount:chroma',
'rust-frontend-service-rolebinding:RoleBinding:chroma',
'rust-frontend-service-query-service-memberlist-binding:RoleBinding:chroma',
'rust-log-service-memberlist-readerwriter:Role:chroma',
'rust-frontend-service-rust-log-service-memberlist-binding:RoleBinding:chroma',
Comment on lines +270 to +274
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommended

[Maintainability] These new resource definitions are also duplicated for the chroma2 namespace below (lines 314-318). The entire objects list for k8s_setup and k8s_setup2 is almost identical.

To avoid future inconsistencies and make this file easier to maintain, consider abstracting the resource list into a function that takes the namespace as an argument. This would centralize the resource definitions and ensure both environments stay in sync.

For example:

def get_k8s_setup_objects(namespace):
  return [
    'pod-watcher:Role:{}'.format(namespace),
    # ... (rest of the common resources)
    'rust-frontend-service-serviceaccount:ServiceAccount:{}'.format(namespace),
    'rust-frontend-service-rolebinding:RoleBinding:{}'.format(namespace),
    'rust-frontend-service-query-service-memberlist-binding:RoleBinding:{}'.format(namespace),
    'rust-log-service-memberlist-readerwriter:Role:{}'.format(namespace),
    'rust-frontend-service-rust-log-service-memberlist-binding:RoleBinding:{}'.format(namespace),
    # ...
  ]

k8s_resource(
  objects=get_k8s_setup_objects('chroma'),
  new_name='k8s_setup',
  labels=["infrastructure"],
)

k8s_resource(
  objects=get_k8s_setup_objects('chroma2'),
  new_name='k8s_setup2',
  labels=["infrastructure2"],
)

Applying this pattern would make adding or removing resources for both environments a single-line change.

Context for Agents
These new resource definitions are also duplicated for the `chroma2` namespace below (lines 314-318). The entire `objects` list for `k8s_setup` and `k8s_setup2` is almost identical.

To avoid future inconsistencies and make this file easier to maintain, consider abstracting the resource list into a function that takes the namespace as an argument. This would centralize the resource definitions and ensure both environments stay in sync.

For example:
```python
def get_k8s_setup_objects(namespace):
  return [
    'pod-watcher:Role:{}'.format(namespace),
    # ... (rest of the common resources)
    'rust-frontend-service-serviceaccount:ServiceAccount:{}'.format(namespace),
    'rust-frontend-service-rolebinding:RoleBinding:{}'.format(namespace),
    'rust-frontend-service-query-service-memberlist-binding:RoleBinding:{}'.format(namespace),
    'rust-log-service-memberlist-readerwriter:Role:{}'.format(namespace),
    'rust-frontend-service-rust-log-service-memberlist-binding:RoleBinding:{}'.format(namespace),
    # ...
  ]

k8s_resource(
  objects=get_k8s_setup_objects('chroma'),
  new_name='k8s_setup',
  labels=["infrastructure"],
)

k8s_resource(
  objects=get_k8s_setup_objects('chroma2'),
  new_name='k8s_setup2',
  labels=["infrastructure2"],
)
```
Applying this pattern would make adding or removing resources for both environments a single-line change.

File: Tiltfile
Line: 274


'test-memberlist:MemberList:chroma',
'test-memberlist-reader:Role:chroma',
'test-memberlist-reader-binding:RoleBinding:chroma',
Expand All @@ -290,6 +297,7 @@ k8s_resource(
'sysdb-serviceaccount-rolebinding:RoleBinding:chroma2',
'sysdb-query-service-memberlist-binding:RoleBinding:chroma2',
'sysdb-compaction-service-memberlist-binding:RoleBinding:chroma2',
'sysdb-rust-log-service-memberlist-binding:RoleBinding:chroma2',

'query-service-serviceaccount:ServiceAccount:chroma2',
'query-service-serviceaccount-rolebinding:RoleBinding:chroma2',
Expand All @@ -303,6 +311,12 @@ k8s_resource(
'compaction-service-serviceaccount:ServiceAccount:chroma2',
'compaction-service-serviceaccount-rolebinding:RoleBinding:chroma2',

'rust-frontend-service-serviceaccount:ServiceAccount:chroma2',
'rust-frontend-service-rolebinding:RoleBinding:chroma2',
'rust-frontend-service-query-service-memberlist-binding:RoleBinding:chroma2',
'rust-log-service-memberlist-readerwriter:Role:chroma2',
'rust-frontend-service-rust-log-service-memberlist-binding:RoleBinding:chroma2',

'lease-watcher:Role:chroma2',
'rust-frontend-service-config:ConfigMap:chroma2',
],
Expand Down