nephio-project / nephio

Nephio is a Kubernetes-based automation platform for deploying and managing highly distributed, interconnected workloads such as 5G Network Functions, and the underlying infrastructure on which those workloads depend.
Apache License 2.0
93 stars 52 forks source link

Figure out and document the recommended way to establish organizational defaults for individual resource types for Config Connector #618

Open liamfallon opened 2 months ago

liamfallon commented 2 months ago

Original issue URL: https://github.com/kptdev/kpt/issues/3344 Original issue user: https://github.com/bgrant0607 Original issue created at: 2022-07-06T16:28:17Z Original issue last updated at: 2023-07-27T14:49:36Z Original issue body: Copying a good question from slack:

If I have a complex application consisting of several GCP resources such as a bucket, pubsub topic and cloudsql, what kind of granularity in packages and their scope should I be considering?

The additional context here is that I want these GCP resources to have sane defaults for our environment, so I'd likely already create packages for many resources, just for that (and likely accompany things like cloudsql with a loggingsink).

Will everything end up in 1 package, with cloudsql, the bucket, etc packages being cloned from the blueprints I created?

Or will the user deploy each and every blueprint, with all the issues that involves?

I guess my question consists out of two:

  • how to provide my own defaults for most resources?
  • what does the end result look like from a user perspective / how are things composed?

The existing de facto approach to set defaults for individual resource types has been granular nested subpackages with setters.

Here's an example: https://github.com/GoogleCloudPlatform/blueprints/tree/main/catalog/bucket

That repo has other examples, of redis, spanner, and so on.

However, I've cautioned strongly against setters #3131, as they are manual and error-prone, and obstruct automation. For instance, setters are an obstacle to operating on blueprints with the package orchestrator, to editing them with a UI, to changing settings with security remediation automation, and to creating blueprints automatically.

And I've recommended that users should not need to create packages for individual resource types.

Packages are pretty heavyweight for that granularity, especially for deployment, and also often degenerate to the "every attribute is a parameter" pattern anyway (see the setter issue above).

I've even suggested that we reconsider whether we need nested subpackages #3343.

Furthermore, users should be able to author resources easily enough, such as via:

and so on.

Imperative generators have fewer issues than declarative ones (#2528), and authoring is an imperative process.

Enabling easy configuration authoring is a goal of the project. There's a lot that could be done to improve the UX via user interface surfaces #3145: recommended defaults, smart defaults, step-by-step guidance, and so on.

For Config Connector specifically, we need improvements and additions to the function catalog, such as:

cc @diviner524

Original issue comments: Comment user: https://github.com/bgrant0607 Comment created at: 2023-07-27T14:49:22Z Comment last updated at: 2023-07-27T14:49:36Z Comment body: I've been looking at other tools that support resource or package/module composition, such as terragrunt and kapitan.dev.

There are some common concepts or patterns:

  1. A workspace, or container for the composition.
  2. Shared properties within the workspace, including some well known properties.
  3. Components being composed, with their own customized property values.
  4. Targets / environments / variants that more or all of the components are provisioned into, with their own property values.

We may want to think about how to support this pattern more explicitly.

cc @justinsb

liamfallon commented 1 month ago

Triage Comment: A Config Connector is an operator that creates a link between the metadata world and the API world. Probably not critical for us.