Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ docker run -i --rm -v $(pwd):/apps helmunittest/helm-unittest chart -u
```

where the `-u` option is used to update the existing snapshots.

### Python scripts
The CI in this repository lints and checks python on PRs using `tox`.
For development, run `$ tox` in the root of the repo.
7 changes: 7 additions & 0 deletions azimuth_apps/models/v1alpha1/app_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ class AppTemplateSpec(schema.BaseModel):
"If not given, the platform name is used"
),
)
management_install: bool = Field(
False,
description=(
"Boolean for installing Helmrelease in the Azimuth management "
"Cluster, instead of the usual resources cluster."
),
)


class AppTemplateVersion(schema.BaseModel):
Expand Down
19 changes: 17 additions & 2 deletions azimuth_apps/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,16 @@ def generate_flux_resources(
target_namespace: str | None = None,
kubeconfig_secret_name: str | None = None,
kubeconfig_secret_key: str | None = None,
management_cluster_install=False,
management_install_target_namespace: str | None = None,
):
if management_cluster_install:
values["targetNamespace"] = management_install_target_namespace
values["kubeconfig"] = {
"name": kubeconfig_secret_name,
"key": kubeconfig_secret_key,
}

return [
{
"apiVersion": "source.toolkit.fluxcd.io/v1",
Expand Down Expand Up @@ -432,7 +441,7 @@ def generate_flux_resources(
},
},
}
if kubeconfig_secret_name
if kubeconfig_secret_name and not management_cluster_install
else {}
),
},
Expand Down Expand Up @@ -528,9 +537,15 @@ async def reconcile_app(instance: api.App, **kwargs):
instance.spec.template.version,
instance.spec.values,
instance.metadata.name,
template.spec.namespace or instance.metadata.name,
(
instance.metadata.namespace
if template.spec.management_install
else template.spec.namespace or instance.metadata.name
),
instance.spec.kubeconfig_secret.name,
instance.spec.kubeconfig_secret.key,
template.spec.management_install,
template.spec.namespace or instance.metadata.name,
):
await ekclient.apply_object(resource, force=True)

Expand Down
4 changes: 2 additions & 2 deletions chart/tests/__snapshot__/snapshot_test.yaml.snap
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ templated manifests should match snapshot:
template:
metadata:
annotations:
azimuth.stackhpc.com/config-hash: 433363aa020effa397e7e63c535231db34bbc4d2900eadd596609a64cb8ebbbd
azimuth.stackhpc.com/config-hash: 613542a26234db1ecd265d0386b85f6df442149f975e38f82b1920ef5ec4072a
labels:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: azimuth-apps-operator
Expand Down Expand Up @@ -171,7 +171,7 @@ templated manifests should match snapshot:
zenithOperator:
chartName: zenith-operator
chartRepo: https://azimuth-cloud.github.io/zenith
chartVersion: 0.15.1
chartVersion: 0.16.0
5: |
apiVersion: v1
kind: Service
Expand Down
Loading