Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Arsh Sharma <[email protected]>
  • Loading branch information
RinkiyaKeDad committed Jan 29, 2025
2 parents 604dcdd + fcb80cd commit ad9101f
Show file tree
Hide file tree
Showing 121 changed files with 5,296 additions and 856 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ body:
**Expected Behavior**:
**Reproduction Steps** (Please include `ResourceGroup` and `Instances` files):
**Reproduction Steps** (Please include `ResourceGraphDefinition` and `Instances` files):
**Versions**:
- kro version:
Expand All @@ -38,7 +38,7 @@ body:
label: Which option describes the most your issue?
multiple: true
options:
- ResourceGroup (Create, Update, Deletion)
- ResourceGraphDefinition (Create, Update, Deletion)
- Instance (Create, Update, Deletion)
- Directed Acyclic Graph inference
- Common Expression Language (CEL)
Expand Down
6 changes: 3 additions & 3 deletions ATTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

[//]: # (File generated by attribution-gen. DO NOT EDIT.)

The github.com/awslabs/kro source code is licensed under the
The github.com/kro-run/kro source code is licensed under the
Apache License, version 2.0. A copy of this license is available in the
[LICENSE](LICENSE) file in the root source code directory and is included,
along with this document, in any images containing github.com/awslabs/kro
along with this document, in any images containing github.com/kro-run/kro
binaries.

## Package dependencies

The module github.com/awslabs/kro depends on a number of Open Source Go packages. Direct
The module github.com/kro-run/kro depends on a number of Open Source Go packages. Direct
dependencies are listed in the ./go.mod file.
Those direct package dependencies have some dependencies of their own (known as
"transitive dependencies")
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

tt:
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./pkg/controller/resourcegroup"
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./pkg/controller/resourcegraphdefinition"

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand Down Expand Up @@ -177,13 +177,13 @@ $(CONTROLLER_GEN): $(LOCALBIN)
.PHONY: image
build-image: ## Build the kro controller images using ko build
$(WITH_GOFLAGS) KOCACHE=$(KOCACHE) KO_DOCKER_REPO="public.ecr.aws/kro/controller" \
ko build --bare github.com/awslabs/kro/cmd/controller \
ko build --bare github.com/kro-run/kro/cmd/controller \
--push=false --tags ${RELEASE_VERSION} --sbom=none

.PHONY: publish
publish-image: ## Publish the kro controller images to ECR
$(WITH_GOFLAGS) KOCACHE=$(KOCACHE) KO_DOCKER_REPO="public.ecr.aws/kro/controller" \
ko publish --bare github.com/awslabs/kro/cmd/controller \
ko publish --bare github.com/kro-run/kro/cmd/controller \
--tags ${RELEASE_VERSION} --sbom=none

.PHONY: package-helm
Expand Down
31 changes: 11 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This project aims to simplify the creation and management of complex custom resources for Kubernetes.

Kube Resource Orchestrator (**kro**) provides a powerful abstraction layer that allows you to define complex multi-resource constructs as reusable components in your applications and systems.
You define these using kro's fundamental custom resource, *ResourceGroup*.
You define these using kro's fundamental custom resource, *ResourceGraphDefinition*.
This resource serves as a blueprint for creating and managing collections of underlying Kubernetes resources.

With kro, you define custom resources as your fundamental building blocks for Kubernetes.
Expand All @@ -19,7 +19,7 @@ kro is Kubernetes native and integrates seamlessly with existing tools to preser
| -------------------------------------- | ------------------------------- |
| [Introduction][kro-overview] | An introduction to kro |
| [Installation][kro-installation] | Install kro in your cluster |
| [Getting started][kro-getting-started] | Deploy your first ResourceGroup |
| [Getting started][kro-getting-started] | Deploy your first ResourceGraphDefinition |
| [Concepts][kro-concepts] | Learn more about kro concepts |
| [Examples][kro-examples] | Example resources |
| [Contributions](./CONTRIBUTING.md) | How to get involved |
Expand All @@ -35,28 +35,28 @@ kro is Kubernetes native and integrates seamlessly with existing tools to preser
1. **What is kro?**

Kube Resource Orchestrator (**kro**) is a new operator for Kubernetes that simplifies the creation of complex Kubernetes resource configurations.
kro lets you create and manage custom groups of Kubernetes resources by defining them as a *ResourceGroup*, the project's fundamental custom resource.
ResourceGroup specifications define a set of resources and how they relate to each other functionally.
kro lets you create and manage custom groups of Kubernetes resources by defining them as a *ResourceGraphDefinition*, the project's fundamental custom resource.
ResourceGraphDefinition specifications define a set of resources and how they relate to each other functionally.
Once defined, resource groups can be applied to a Kubernetes cluster where the kro controller is running.
Once validated by kro, you can create instances of your resource group.
kro translates your ResourceGroup instance and its parameters into specific Kubernetes resources and configurations which it then manages for you.
kro translates your ResourceGraphDefinition instance and its parameters into specific Kubernetes resources and configurations which it then manages for you.

2. **How does kro work?**

kro is designed to use core Kubernetes primitives to make resource grouping, customization, and dependency management simpler.
When a ResourceGroup is applied to the cluster, the kro controller verifies its specification, then dynamically creates a new CRD and registers it with the API server.
When a ResourceGraphDefinition is applied to the cluster, the kro controller verifies its specification, then dynamically creates a new CRD and registers it with the API server.
kro then deploys a dedicated controller to respond to instance events on the CRD.
This microcontroller is responsible for managing the lifecycle of resources defined in the ResourceGroup for each instance that is created.
This microcontroller is responsible for managing the lifecycle of resources defined in the ResourceGraphDefinition for each instance that is created.

3. **How do I use kro?**

First, you define your custom resource groups by creating *ResourceGroup* specifications.
First, you define your custom resource groups by creating *ResourceGraphDefinition* specifications.
These specify one or more Kubernetes resources, and can include specific configuration for each resource.

For example, you can define a *WebApp* resource group that is composed of a *Deployment*, pre-configured to deploy your web server backend, and a *Service* configured to run on a specific port.
You can just as easily create a more complex *WebAppWithDB* resource group by combining the existing *WebApp* resource group with a *Table* custom resource to provision a cloud managed database instance for your web app to use.

Once you have defined a ResourceGroup, you can apply it to a Kubernetes cluster where the kro controller is running.
Once you have defined a ResourceGraphDefinition, you can apply it to a Kubernetes cluster where the kro controller is running.
kro will take care of the heavy lifting of creating CRDs and deploying dedicated controllers in order to manage instances of your new custom resource group.

You are now ready to create instances of your new custom resource group, and kro will respond by dynamically creating, configuring, and managing the underlying Kubernetes resources for you.
Expand All @@ -67,19 +67,10 @@ kro is Kubernetes native and integrates seamlessly with existing tools to preser
Building with Kubernetes means dealing with resources that need to operate and work together, and orchestrating this can get complex and difficult at scale.
With this project, we're taking a first step in reducing the complexity of resource dependency management and customization, paving the way for a simple and scalable way to create complex custom resources for Kubernetes.

5. **Do I need to have an AWS account to use this?**

No, you can use kro with any Kubernetes cluster.

6. **Can I use this in production?**
5. **Can I use this in production?**

This project is in active development and not yet intended for production use.
The *ResourceGroup* CRD and other APIs used in this project are not solidified and highly subject to change.

7. **Will this be built into Amazon Elastic Kubernetes Service (EKS)?**

This project is a public experiment, and not currently integrated into Amazon EKS.
We welcome your feedback and want to hear about what works and what doesn't for your use cases, please let us know what you think.
The *ResourceGraphDefinition* CRD and other APIs used in this project are not solidified and highly subject to change.

## Community Participation

Expand Down
18 changes: 9 additions & 9 deletions api/v1alpha1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ import (
type ConditionType string

const (
// ResourceGroupConditionTypeGraphSynced indicates the state of the directed
// ResourceGraphDefinitionConditionTypeGraphSynced indicates the state of the directed
// acyclic graph (DAG) that kro uses to manage the resources in a
// ResourceGroup.
ResourceGroupConditionTypeGraphVerified ConditionType = "GraphVerified"
// ResourceGroupConditionTypeCustomResourceDefinitionSynced indicates the state of the
// ResourceGraphDefinition.
ResourceGraphDefinitionConditionTypeGraphVerified ConditionType = "GraphVerified"
// ResourceGraphDefinitionConditionTypeCustomResourceDefinitionSynced indicates the state of the
// CustomResourceDefinition (CRD) that kro uses to manage the resources in a
// ResourceGroup.
ResourceGroupConditionTypeCustomResourceDefinitionSynced ConditionType = "CustomResourceDefinitionSynced"
// ResourceGroupConditionTypeReconcilerReady indicates the state of the reconciler.
// Whenever an ResourceGroup resource is created, kro will spin up a
// ResourceGraphDefinition.
ResourceGraphDefinitionConditionTypeCustomResourceDefinitionSynced ConditionType = "CustomResourceDefinitionSynced"
// ResourceGraphDefinitionConditionTypeReconcilerReady indicates the state of the reconciler.
// Whenever an ResourceGraphDefinition resource is created, kro will spin up a
// reconciler for that resource. This condition indicates the state of the
// reconciler.
ResourceGroupConditionTypeReconcilerReady ConditionType = "ReconcilerReady"
ResourceGraphDefinitionConditionTypeReconcilerReady ConditionType = "ReconcilerReady"
)

const (
Expand Down
24 changes: 0 additions & 24 deletions api/v1alpha1/resourcegroup_state.go

This file was deleted.

70 changes: 40 additions & 30 deletions api/v1alpha1/resource_group.go → api/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ const (
DefaultServiceAccountKey = "*"
)

// ResourceGroupSpec defines the desired state of ResourceGroup
type ResourceGroupSpec struct {
// The schema of the resourcegroup, which includes the
// ResourceGraphDefinitionSpec defines the desired state of ResourceGraphDefinition
type ResourceGraphDefinitionSpec struct {
// The schema of the resourcegraphdefinition, which includes the
// apiVersion, kind, spec, status, types, and some validation
// rules.
//
// +kubebuilder:validation:Required
Schema *Schema `json:"schema,omitempty"`
// The resources that are part of the resourcegroup.
// The resources that are part of the resourcegraphdefinition.
//
// +kubebuilder:validation:Optional
Resources []*Resource `json:"resources,omitempty"`
Expand All @@ -46,36 +46,36 @@ type ResourceGroupSpec struct {
}

// Schema represents the attributes that define an instance of
// a resourcegroup.
// a resourcegraphdefinition.
type Schema struct {
// The kind of the resourcegroup. This is used to generate
// and create the CRD for the resourcegroup.
// The kind of the resourcegraphdefinition. This is used to generate
// and create the CRD for the resourcegraphdefinition.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="kind is immutable"
Kind string `json:"kind,omitempty"`
// The APIVersion of the resourcegroup. This is used to generate
// and create the CRD for the resourcegroup.
// The APIVersion of the resourcegraphdefinition. This is used to generate
// and create the CRD for the resourcegraphdefinition.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="apiVersion is immutable"
APIVersion string `json:"apiVersion,omitempty"`
// The group of the resourcegroup. This is used to set the API group
// The group of the resourcegraphdefinition. This is used to set the API group
// of the generated CRD. If omitted, it defaults to "kro.run".
//
// +kubebuilder:validation:Optional
// +kubebuilder:default="kro.run"
Group string `json:"group,omitempty"`
// The spec of the resourcegroup. Typically, this is the spec of
// the CRD that the resourcegroup is managing. This is adhering
// The spec of the resourcegraphdefinition. Typically, this is the spec of
// the CRD that the resourcegraphdefinition is managing. This is adhering
// to the SimpleSchema spec
Spec runtime.RawExtension `json:"spec,omitempty"`
// The status of the resourcegroup. This is the status of the CRD
// that the resourcegroup is managing. This is adhering to the
// The status of the resourcegraphdefinition. This is the status of the CRD
// that the resourcegraphdefinition is managing. This is adhering to the
// SimpleSchema spec.
Status runtime.RawExtension `json:"status,omitempty"`
// Validation is a list of validation rules that are applied to the
// resourcegroup.
// resourcegraphdefinition.
// Not implemented yet.
Validation []string `json:"validation,omitempty"`
}
Expand All @@ -96,11 +96,21 @@ type Resource struct {
IncludeWhen []string `json:"includeWhen,omitempty"`
}

// ResourceGroupStatus defines the observed state of ResourceGroup
type ResourceGroupStatus struct {
// State is the state of the resourcegroup
State ResourceGroupState `json:"state,omitempty"`
// TopologicalOrder is the topological order of the resourcegroup graph
// ResourceGraphDefinitionState defines the state of the resource group.
type ResourceGraphDefinitionState string

const (
// ResourceGraphDefinitionStateActive represents the active state of the resource group.
ResourceGraphDefinitionStateActive ResourceGraphDefinitionState = "Active"
// ResourceGraphDefinitionStateInactive represents the inactive state of the resource group
ResourceGraphDefinitionStateInactive ResourceGraphDefinitionState = "Inactive"
)

// ResourceGraphDefinitionStatus defines the observed state of ResourceGraphDefinition
type ResourceGraphDefinitionStatus struct {
// State is the state of the resourcegraphdefinition
State ResourceGraphDefinitionState `json:"state,omitempty"`
// TopologicalOrder is the topological order of the resourcegraphdefinition graph
TopologicalOrder []string `json:"topologicalOrder,omitempty"`
// Conditions represent the latest available observations of an object's state
Conditions []Condition `json:"conditions,omitempty"`
Expand All @@ -109,7 +119,7 @@ type ResourceGroupStatus struct {
}

// ResourceInformation defines the information about a resource
// in the resourcegroup
// in the resourcegraphdefinition
type ResourceInformation struct {
// ID represents the id of the resources we're providing information for
ID string `json:"id,omitempty"`
Expand All @@ -131,26 +141,26 @@ type Dependency struct {
// +kubebuilder:printcolumn:name="STATE",type=string,priority=0,JSONPath=`.status.state`
// +kubebuilder:printcolumn:name="TOPOLOGICALORDER",type=string,priority=1,JSONPath=`.status.topologicalOrder`
// +kubebuilder:printcolumn:name="AGE",type="date",priority=0,JSONPath=".metadata.creationTimestamp"
// +kubebuilder:resource:shortName=rg
// +kubebuilder:resource:shortName=rgd

// ResourceGroup is the Schema for the resourcegroups API
type ResourceGroup struct {
// ResourceGraphDefinition is the Schema for the resourcegraphdefinitions API
type ResourceGraphDefinition struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ResourceGroupSpec `json:"spec,omitempty"`
Status ResourceGroupStatus `json:"status,omitempty"`
Spec ResourceGraphDefinitionSpec `json:"spec,omitempty"`
Status ResourceGraphDefinitionStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ResourceGroupList contains a list of ResourceGroup
type ResourceGroupList struct {
// ResourceGraphDefinitionList contains a list of ResourceGraphDefinition
type ResourceGraphDefinitionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ResourceGroup `json:"items"`
Items []ResourceGraphDefinition `json:"items"`
}

func init() {
SchemeBuilder.Register(&ResourceGroup{}, &ResourceGroupList{})
SchemeBuilder.Register(&ResourceGraphDefinition{}, &ResourceGraphDefinitionList{})
}
Loading

0 comments on commit ad9101f

Please sign in to comment.