Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document resource.template, readyWhen and includeWhen #128

Closed
wants to merge 159 commits into from

Conversation

michaelhtm
Copy link
Contributor

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

amazon-auto and others added 30 commits September 12, 2024 10:34
This is the code snapshot for Symphony `v0.1.0-rc.3`. It's our 4th or 5th
rewrite, and we're finally getting somewhere!!

Symphony aims, to simplify complex application deployments on Kubernetes,
addressing the challenges K8s users face when managing multi-resource
applications.

At the core of Symphony are `ResourceGroups`, which allow users to define
entire application stacks, as single, reusable units. This abstraction
significantly reduces the compplexity of managing interconnected K8S
resources.

We could make this commit message longer than a Kubernetes YAML file, but
your git log deserves better :). To start playing with YAML-breathing
dragon, feel free to explore `./examples` and `./website` directories.

Signed-off-by: Amine <[email protected]>
These files are required for Prow's code review automation
- Change repository path from `github.com/aws/symphony` to `github.com/aws-controllers-k8s/symphony`
- Update import paths across multiple files to reflect new repository location
- Modify `ATTRIBUTION.md` and `PROJECT` files to use new repository path
- Update go.mod with new module path

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
…ing (#10)

This patch refactors the `DnamicController` package and struct for better
concurrency and error handling. Key changes include:

- Replacing mutexes with `sync.Map` for thread safe operations
- Implementing graceful shutdown with timeout
- Adding metrics for reconciliation and requeues
- Refactoring `RegisterWorkflowOperator` and `UnregisterWorkflowOperator`
- Leverage context for both `Run` and `Shutdown` methods
- Improving queue management and requeue strategies

The patch also includes initial unit tests for the DC, covering very basic
functionality, GVK registriation/unregistration, object queueing and sync
function behaviour.

Note that current test implementation is exploratory, aiming to identify
the parts that needs to be reworked/mocked/generated. I'll probably iterate
more on this in the future.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
TLDR; https://aws-controllers-k8s.github.io/private-symphony

- Change project and organization names to `aws-controllers-k8s/private-symphony`
- Fix dark theme styling that was broken in production builds
- Tiny CSS refining and adjustements

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
This patch refactors the controller architecture, improves schema handling,
and enhances the overall structure of the codebase. It separates concerns
more clearly, and introduces a more flexible **dynamiccontroller,**
implemenatation and improves various aspects of **CRD** management
and schema processing. In brief:

- Restructure packages for clearer separation of concerns:
  - Move `ResourceGroup` controller to its own controller/resourcegroup
  - Separate `Instance` controller logic from `ResourceGroup` and move to
    controller/instance
  - Move some schema related functionality in resourcegroup package
- Refactor `DynamicController` to use abstract Handler interface:
  - Remove direct dependency on graph execution logic
  - Enhance generic reconciliation process
  - Addedmetrics for `DynamicController` operations
- Enhance schema processing and CRD generation:
  - Move CRD builds/creation to `ResourceGroup` builder
  - Improve schema validation and transformation logic
  - Add `observedGeneration` to default status fields in instance schemas
- Add wait for ready functionality to the CRD manager (dealing with some eventual
  consistency issues)
- Update client initialization to return multiple clients
- Improve error handling, logging, and reporting throughout the codebase

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
This patch removes the `Dockerfile` and updates the Makefile with new targets:

- `build-image`: builds the Symphony controller image using `ko build`
- `publish-image`: publishes the controller image to ECR using `ko publish`
- `package-helm`: packages the helm chart, updating versions in values.yaml/Chart.yaml
- `publish-helm`: publishes the helm chart to an ECR OCI repository using `helm push`
- `release`: runs all the above

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
This patch adds basic Github action workflows to help with deploying
the docs website and test the deployment on open PRs.
…lows

Add github workflows for deploying the docs website
This commit significantly improves the `simpleschema` package ability to handle
complex, nested data structures. The `parseMapType` function has been refactored
to correctly parse nested map types and a new `findMatchingBracket` function has
been added to ensure robust bracket parsing. The Transformer.BuildOpenAPISchema
method has been restructured allowing for more flexible and accurate schema
generation for nested slices and maps.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
setting up a golangcilint job on PR changes (only new code will
get scanned). We still need to fix golangcilint for previously
merged code.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
This patch includes a few improvements to the instance controller (controller
that is reponsible of executing the RG DAG):

- Split the controller logic into separate files for better organization:
- Introduced a `ReconcileConfig` struct to allow customization of reconciliation behavior.
- Improved resource state tracking and status updates.
- Refactored the deletion process to be more robust and handle edge cases bettr
- Enhanced status mgmt:
  - Add more granular condition reporting for individual resources.
  - Improved handling of resource states and errors
  - Support gradual updates of resource statuses (can partially update status fields
    if some resources are not yet ready)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
…tion (#34)

This patch improves our CEL expression parsing system, replacing
the regex based CELExpressionsExtractor with a more robust
parser. The previous implementation relied heavily on regulars
expressions, which proved to be ineffective for handling complex nested
structures and led to limitations in accurat parsing and extracting
CEL expressions from kubernetes resource definitions (`resources[*].definition`)

The new parser uses a token aware string traversal approach. It scans
input character by character recognizing `"${"` and `"}"` tokens. It tracks
brace nesting to handle complex structures, including nestde dictionaries
and conditionals.

In a nutshell, this patch makes the following changes:

- Remove the celextractor package and its regex based functionality
- Introduce a new parser package with the token aware parsing algorithm
  - Support both schemaless and structured parsing.
- Update the `resourcegroup`/`controller` packages to integrate the new parser
- Add unit tests and reach 87.5% coverage.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
This patch refactors the `parser.Parse*` functions, by split the validation
logic from the extraction logic. Now we use helper functions for schema validation
and type checking. Allowing reading to distinguish recursive walk logic, from
other mechanics used for parsing.

- Refactor `parseResource` function to use type specific parsing functions
- Introduce `TestParserEdgeCases` to cover various type mimatches and
  error conditions..
- Add `TestParseWithExpectedSchema` to validate schema extraction from
  objects


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
This commit adds additional printer columns to the ResourceGroup
instance CRDs, which will be displayed when listing ResourceGroup
instances using `kubectl get` command. The additional columns are:

- `State`: The current state of the ResourceGroup instance. Found in
  `.status.state`
- Synced: Whether all subresources of the ResourceGroup are ready.
  Found in `status.conditions[?(@.type==\"InstanceSynced\")].status`
- Age: The age of the ResourceGroup instance. Found in
  `.metadata.creationTimestamp`


Sample kubectl output:
```bash
➜  ~ k get eksclusters
NAME            STATE    SYNCED   AGE
testcluster29   ACTIVE   True     22d
```

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
…ability: (#40)

- Split schema related functionality into a new 'schema' subpackage
- Create a new 'crd' subpackage for CRD related operations
- Improve type inference and schema generation for CRDs.
- Enhance error handling and logging throughout the package.
- Update dependencies and remove unused functions
- Refactor utility functions for better reusability

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
This commit renames the ExpressionField to `CELField` throught
the code base to better reflect its purpose in handling CEL expressions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
a-hilaly and others added 28 commits November 9, 2024 21:52
Add structured gitHub issue templates to help users provide necessary
information when creating new issues:
- bug template with sections for reproduction steps, versions, logs
- feature request template for capturing requirements and alternatives
- documentation template for tracking doc improvements
- disable blank issues to ensure template usage
Remove redundant "docs" prefix from documentation URLs by setting routeBasePath to "/"
and updating navigation links.
github: add issue templates for bug, feature, and docs
- Reorganize examples into Basic and Advanced sections
- Add new examples for deploying CoreDNS, controllers, AWS resources
- Rename some examples for clarity (e.g. web-app instead of deploymentservice)
- Remove outdated EKSCluster example
- Add an index page summarizing the available examples

docs(concepts): Improve ResourceGroup and schema documentation

- Rewrite ResourceGroup concepts to be more clear and approachable
- Expand schema documentation to cover markers, status fields, conditions
- Clarify Instance lifecycle, status fields, and best practices
- Fix typos and formatting issues
Update README documentation table to include Installation section and fix doc URLs.
Change production URL from `awslabs.github.io` to `kro.run`
* fix docs links

---------

Co-authored-by: Amine <[email protected]>
Update index.tsx to include analytics
Updates the `DynamicController` to properly handle cases where an informer is
already registered by ensuring the handler is still updated. This fixes a bug
where handler changes wouldn't take effect for existing informers.

This patch also add comprehensive integration tests to verify recovery behavior
when a  `ResourceGroup` transitions between valid and invalid states, ensuring
the system properly recovers using the latest valid configuration.
Add CEL validation rules to prevent modifications to the schema `kind` and
`apiVersion` fields after a `ResourceGroup` is created. This ensures schema
stability and  prevents potential issues that could arise from changing
these fundamental identity fields.
fix: update handlers when informer already exists and add recovery tests
Comment out ResourceSynced condition updates in prepareConditions
to reduce status noise/churn. These will be re-enabled once we
determine a better approach for resource sync status reporting.
Temporarily disable noisy `ResourceSynced` conditions
feat: make ResourceGroup `schema.kind` and `schema.apiVersion` immutable
…tion management

- Move condition functions from separate package to api types
- Replace complex error hierarchy with simple error types in controller
- Remove separate error packages and consolidate error handling
- Clean up status management and condition setting logic
- Improve error wrapping and handling throughout controller
This gives the perception that the entrypoint should be unique
…nization

Move instance state handling into a dedicated struct and reorganize the package
for better code maintainability. Key changes include:

- Create i`InstanceState` struct to centralize state management
- Improve error handling with better context and messages
- Add detailed logging for namespace resolution
- Split `status-related` code into `controller_status.go`
- Improve separation of concerns in reconciliation logic
- Reset version to 0.1.0
- Rename and restructure ResourceGroup CRD with updated schema
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.

8 participants