-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
953 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
sdkkonnectgocomp "github.com/Kong/sdk-konnect-go/models/components" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func init() { | ||
SchemeBuilder.Register(&KonnectControlPlane{}, &KonnectControlPlaneList{}) | ||
} | ||
|
||
// KonnectControlPlane is the Schema for the KonnectControlplanes API. | ||
// | ||
// +genclient | ||
// +kubebuilder:resource:scope=Namespaced | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:object:generate=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="Programmed",description="The Resource is Programmed on Konnect",type=string,JSONPath=`.status.conditions[?(@.type=='Programmed')].status` | ||
// +kubebuilder:printcolumn:name="ID",description="Konnect ID",type=string,JSONPath=`.status.id` | ||
// +kubebuilder:printcolumn:name="OrgID",description="Konnect Organization ID this resource belongs to.",type=string,JSONPath=`.status.organizationID` | ||
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.spec.konnect.authRef) || has(oldSelf.spec.konnect.authRef)", message="Konnect Configuration's API auth ref reference is immutable" | ||
type KonnectControlPlane struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec KonnectControlPlaneSpec `json:"spec,omitempty"` | ||
|
||
Status KonnectControlPlaneStatus `json:"status,omitempty"` | ||
} | ||
|
||
// KonnectControlPlaneSpec defines the desired state of KonnectControlPlane. | ||
type KonnectControlPlaneSpec struct { | ||
sdkkonnectgocomp.CreateControlPlaneRequest `json:",inline"` | ||
|
||
KonnectConfiguration KonnectConfiguration `json:"konnect,omitempty"` | ||
} | ||
|
||
// KonnectControlPlaneStatus defines the observed state of KonnectControlPlane. | ||
type KonnectControlPlaneStatus struct { | ||
KonnectEntityStatus `json:",inline"` | ||
|
||
// Conditions describe the current conditions of the KonnectControlPlane. | ||
// | ||
// Known condition types are: | ||
// | ||
// * "Programmed" | ||
// | ||
// +listType=map | ||
// +listMapKey=type | ||
// +kubebuilder:validation:MaxItems=8 | ||
// +kubebuilder:default={{type: "Programmed", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}} | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
// GetKonnectStatus returns the Konnect Status of the KonnectControlPlane. | ||
func (c *KonnectControlPlane) GetKonnectStatus() *KonnectEntityStatus { | ||
return &c.Status.KonnectEntityStatus | ||
} | ||
|
||
// GetTypeName returns the KonnectControlPlane type name. | ||
func (c KonnectControlPlane) GetTypeName() string { | ||
return "KonnectControlPlane" | ||
} | ||
|
||
// GetKonnectLabels gets the Konnect Labels from object's spec. | ||
func (c *KonnectControlPlane) GetKonnectLabels() map[string]string { | ||
return c.Spec.Labels | ||
} | ||
|
||
// SetKonnectLabels sets the Konnect Labels in object's spec. | ||
func (c *KonnectControlPlane) SetKonnectLabels(labels map[string]string) { | ||
c.Spec.Labels = labels | ||
} | ||
|
||
// GetKonnectAPIAuthConfigurationRef returns the Konnect API Auth Configuration Ref. | ||
func (c *KonnectControlPlane) GetKonnectAPIAuthConfigurationRef() KonnectAPIAuthConfigurationRef { | ||
return c.Spec.KonnectConfiguration.APIAuthConfigurationRef | ||
} | ||
|
||
// GetConditions returns the Status Conditions | ||
func (c *KonnectControlPlane) GetConditions() []metav1.Condition { | ||
return c.Status.Conditions | ||
} | ||
|
||
// SetConditions sets the Status Conditions | ||
func (c *KonnectControlPlane) SetConditions(conditions []metav1.Condition) { | ||
c.Status.Conditions = conditions | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
type KonnectControlPlaneList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
Items []KonnectControlPlane `json:"items"` | ||
} |
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.