qontract-development-cli 0.18.1__tar.gz → 0.19.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/PKG-INFO +1 -1
  2. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/pyproject.toml +1 -1
  3. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/commands/profile.py +1 -0
  4. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/models.py +13 -0
  5. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/api.yml.j2 +5 -0
  6. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/compose.override.yml.j2 +19 -1
  7. qontract_development_cli-0.19.0/qontract_development_cli/templates/opa.yml.j2 +37 -0
  8. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/.gitignore +0 -0
  9. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/README.md +0 -0
  10. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/__init__.py +0 -0
  11. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/__main__.py +0 -0
  12. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/cli.py +0 -0
  13. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/commands/__init__.py +0 -0
  14. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/commands/config.py +0 -0
  15. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/commands/env.py +0 -0
  16. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/completions.py +0 -0
  17. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/config.py +0 -0
  18. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/shell.py +0 -0
  19. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/cache.yml.j2 +0 -0
  20. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/compose.yml.j2 +0 -0
  21. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/internal-redhat-ca.yml.j2 +0 -0
  22. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/prep-worktree.sh.j2 +0 -0
  23. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/reconcile.yml.j2 +0 -0
  24. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/server.yml.j2 +0 -0
  25. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/subscriber.yml.j2 +0 -0
  26. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/vault.yml.j2 +0 -0
  27. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates/worker.yml.j2 +0 -0
  28. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/templates.py +0 -0
  29. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/utils.py +0 -0
  30. {qontract_development_cli-0.18.1 → qontract_development_cli-0.19.0}/qontract_development_cli/watchdog.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qontract-development-cli
3
- Version: 0.18.1
3
+ Version: 0.19.0
4
4
  Summary: Helper tool for qontract-reconcile development
5
5
  Project-URL: homepage, http://github.com/chassing/qontract-development-cli
6
6
  Project-URL: repository, http://github.com/chassing/qontract-development-cli
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "qontract-development-cli"
3
- version = "0.18.1"
3
+ version = "0.19.0"
4
4
  description = "Helper tool for qontract-reconcile development"
5
5
  authors = [{ name = "Christian Assing", email = "cassing@redhat.com" }]
6
6
  license = { text = "MIT" }
@@ -265,6 +265,7 @@ def run( # noqa: C901, PLR0912, PLR0913, PLR0915
265
265
  compose_template_files = profile.settings.compose_template_files(
266
266
  api=env.settings.run_qontract_api,
267
267
  cache=env.settings.run_cache,
268
+ opa=env.settings.run_opa,
268
269
  reconcile=env.settings.run_qontract_reconcile,
269
270
  server=env.settings.run_qontract_server,
270
271
  subscriber=env.settings.run_qontract_api_subscriber,
@@ -21,6 +21,7 @@ class EnvSettings(BaseModel):
21
21
  run_qontract_api_subscriber: bool = False
22
22
  run_qontract_api_worker: bool = False
23
23
  run_cache: bool = False
24
+ run_opa: bool = False
24
25
  run_qontract_reconcile: bool = True
25
26
  run_qontract_server: bool = True
26
27
  run_vault: bool = False
@@ -103,6 +104,12 @@ class ProfileSettings(BaseModel):
103
104
  localstack: bool = False
104
105
  localstack_compose_file: Path | None
105
106
 
107
+ # opa
108
+ opa_build_image: bool = True
109
+ opa_image: str = "openpolicyagent/opa:latest"
110
+ opa_container_platform: str | None = None
111
+ opa_compose_file: str = "opa.yml.j2"
112
+
106
113
  # vault
107
114
  vault_image: str = "vault:1.5.4"
108
115
  vault_container_platform: str | None = None
@@ -120,11 +127,16 @@ class ProfileSettings(BaseModel):
120
127
  def qontract_api_path(self) -> Path | None:
121
128
  return self.qontract_reconcile_path / "qontract_api"
122
129
 
130
+ @property
131
+ def opa_path(self) -> Path | None:
132
+ return self.qontract_reconcile_path / "opa"
133
+
123
134
  def compose_template_files( # noqa: PLR0913
124
135
  self,
125
136
  *,
126
137
  api: bool,
127
138
  cache: bool,
139
+ opa: bool,
128
140
  reconcile: bool,
129
141
  server: bool,
130
142
  subscriber: bool,
@@ -135,6 +147,7 @@ class ProfileSettings(BaseModel):
135
147
  files += [self.qontract_api_subscriber_compose_file] if subscriber else []
136
148
  files += [self.qontract_api_worker_compose_file] if worker else []
137
149
  files += [self.cache_compose_file] if cache else []
150
+ files += [self.opa_compose_file] if opa else []
138
151
  files += [self.qontract_reconcile_compose_file] if reconcile else []
139
152
  files += [self.qontract_server_compose_file] if server else []
140
153
  files += [self.vault_compose_file] if vault else []
@@ -19,6 +19,11 @@ services:
19
19
  environment:
20
20
  - QAPI_START_MODE=api
21
21
  - QAPI_CACHE_BROKER_URL=redis://cache:6379/0
22
+ {% if env.settings.run_opa %}
23
+ - QAPI_OPA__HOST=http://opa:8181
24
+ {% else %}
25
+ - QAPI_OPA__ENABLED=false
26
+ {% endif %}
22
27
  # Enable debugpy
23
28
  - DEBUGGER_ENABLED={% if profile.settings.debugger %}true{% else %}false{% endif %}
24
29
  # Hot reload for development
@@ -8,19 +8,37 @@ services:
8
8
  {% endif %}
9
9
 
10
10
 
11
+ {% if env.settings.run_opa %}
12
+ opa:
13
+ networks:
14
+ - qontract-development
15
+ {% endif %}
16
+
17
+
11
18
  {% if env.settings.run_qontract_api %}
12
19
  qontract-api:
13
20
  networks:
14
21
  - qontract-development
15
22
 
16
- {% if env.settings.run_cache %}
23
+ {% if env.settings.run_cache or env.settings.run_opa %}
17
24
  depends_on:
25
+ {% if env.settings.run_cache %}
18
26
  cache:
19
27
  condition: service_healthy
28
+ {% endif %}
29
+ {% if env.settings.run_opa %}
30
+ opa:
31
+ condition: service_started
32
+ {% endif %}
20
33
 
21
34
  links:
35
+ {% if env.settings.run_cache %}
22
36
  - cache
23
37
  {% endif %}
38
+ {% if env.settings.run_opa %}
39
+ - opa
40
+ {% endif %}
41
+ {% endif %}
24
42
  {% endif %}
25
43
 
26
44
 
@@ -0,0 +1,37 @@
1
+ services:
2
+ # OPA (Open Policy Agent) sidecar for qontract-api authorization
3
+ opa:
4
+ container_name: opa
5
+ platform: {{ profile.settings.opa_container_platform or env.settings.container_platform }}
6
+ {% if profile.settings.opa_build_image %}
7
+ build:
8
+ context: {{ profile.settings.qontract_reconcile_path.expanduser().absolute() }}
9
+ dockerfile: {{ profile.settings.opa_path.expanduser().absolute() }}/Dockerfile
10
+ target: prod
11
+ {% else %}
12
+ image: {{ profile.settings.opa_image }}
13
+ {% endif %}
14
+
15
+ entrypoint: ["/opa"]
16
+ command:
17
+ - run
18
+ - --server
19
+ - --addr=0.0.0.0:8181
20
+ - --config-file=/config/config.yaml
21
+ - --log-level=info
22
+ - --disable-telemetry
23
+ - --watch
24
+ - /authz
25
+ - /data
26
+
27
+ ports:
28
+ - 8181:8181
29
+
30
+ # /authz is baked into the image (Rego policies)
31
+ # /data is mounted from dev/ (dev policy data, NOT in the prod image)
32
+ # --watch uses fsnotify: works on Linux, not on macOS/Colima.
33
+ # On macOS, run: docker restart opa
34
+ volumes:
35
+ - {{ profile.settings.opa_path.expanduser().absolute() }}/authz:/authz:z
36
+ - {{ profile.settings.opa_path.expanduser().absolute() }}/dev:/data:z
37
+ - {{ profile.settings.opa_path.expanduser().absolute() }}/dev/config.yaml:/config/config.yaml:z