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

chore: remove admission controller operator #85

Merged
merged 3 commits into from
Oct 30, 2024
Merged
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
3 changes: 3 additions & 0 deletions .changelog/85.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:breaking-change
`crd kimup` - Refactor the `kimup` CRD to remove the `admissioncontroller` field.
```
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ help: ## Display this help.

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=manifests/crd

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down
84 changes: 49 additions & 35 deletions api/v1alpha1/kimup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,66 @@ import (
type (
// KimupSpec defines the desired state of Kimup
KimupSpec struct {
// TODO add namespace and serviceaccount settings
// +kubebuilder:validation:Required
// +kubebuilder:description: Kimup instance name
// The name of the Kimup instance in the suffix of the resource names.
Name string `json:"name"`

// +kubebuilder:validation:Optional
// +kubebuilder:description: Manage the controller settings
// Controller is a map of settings that will be used to configure the controller. If not set, the controller will not be deployed.
Controller *KimupControllerSpec `json:"controller"`
// +kubebuilder:description: Kimup container image
// Image of the Kimup container. If not set, the default image will be used.
Image string `json:"image,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:description: Manage the admissionController settings
// AdmissionController is a map of settings that will be used to configure the admissionController. If not set, the admissionController will not be deployed.
AdmissionController *KimupAdmissionControllerSpec `json:"admissionController"`
}
// +kubebuilder:description: Annotations to add to the Kimup pods.
// Annotations is a key value map that will be added to the Kimup pods.
Annotations map[string]string `json:"annotations,omitempty"`

// ! Controller
// +kubebuilder:validation:Optional
// +kubebuilder:description: Labels to add to the Kimup pods.
// Labels is a key value map that will be added to the Kimup pods.
Labels map[string]string `json:"labels,omitempty"`

KimupControllerSpec struct {
KimupInstanceSpec `json:",inline"`
// +kubebuilder:validation:Optional
// +kubebuilder:description: Env variables to add to the Kimup pods.
// Env is a list of key value pairs that will be added to the Kimup pods.
Env []corev1.EnvVar `json:"env,omitempty"`

KimupExtraSpec `json:",inline"`
}
// +kubebuilder:validation:Optional
// +kubebuilder:description: Kimup container resource limits.
// Resources is a map of resource requirements that will be added to the Kimup pods.
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`

// ! AdmissionController
// +kubebuilder:validation:Optional
// +kubebuilder:description: Affinity settings for the Kimup pods.
// Affinity is a map of affinity settings that will be added to the Kimup pods.
Affinity *corev1.Affinity `json:"affinity,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:description: Node selector for the Kimup pods.
// NodeSelector is a map of node selector settings that will be added to the Kimup pods.
NodeSelector map[string]string `json:"nodeSelector,omitempty"`

KimupAdmissionControllerSpec struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default:=Deployment
// +kubebuilder:validation:Enum=Deployment;DaemonSet
// +kubebuilder:description: Type of deployment for the admissionController. (default: Deployment)
DeploymentType string `json:"deploymentType,omitempty"`
// +kubebuilder:description: Tolerations for the Kimup pods.
// Tolerations is a list of tolerations that will be added to the Kimup pods.
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:description: TopologySpreadConstraints for the Kimup pods.
// TopologySpreadConstraints is a list of constraints that will be added to the Kimup pods.
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default:=3
// +kubebuilder:description: Number of replicas (default: 3) for the admissionController deployment. (Only for Deployment)
// Replicas is the number of replicas that will be used by the admissionController deployment. If not set, 3 replicas will be used. (Only for Deployment)
Replicas int32 `json:"replicas,omitempty"`
// +kubebuilder:description: Service account name for the Kimup pods.
// +kubebuilder:default:=kimup
// ServiceAccountName is the name of the service account that will be used by the Kimup pods.
ServiceAccountName string `json:"serviceAccountName,omitempty"`

KimupInstanceSpec `json:",inline"`
// +kubebuilder:validation:Optional
// +kubebuilder:description: Priority class name for the Kimup pods.
// PriorityClassName is the name of the priority class that will be used by the Kimup pods.
PriorityClassName string `json:"priorityClassName,omitempty"`

KimupExtraSpec `json:",inline"`
}
Expand Down Expand Up @@ -173,14 +196,6 @@ type (

// Status defines the observed state of Kimup
KimupStatus struct {
// Controller status
Controller KimupInstanceStatus `json:"controller,omitempty"`

// AdmissionController status
AdmissionController KimupInstanceStatus `json:"admissionController,omitempty"`
}

KimupInstanceStatus struct {
// Status of the Kimup Instance
// It can be one of the following:
// - "ready": The kimup instance is ready to serve requests
Expand All @@ -192,9 +207,8 @@ type (
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// +kubebuilder:printcolumn:name="Controller",type=string,JSONPath=`.status.controller.state`
// +kubebuilder:printcolumn:name="AdmissionController",type=string,JSONPath=`.status.admissionController.state`
// Kimup is the Schema for the kimups API. Permit to manage the Kimup instances. (Controller and AdmissionController)
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state`
// Kimup is the Schema for the kimups API. Permit to manage the Kimup instances (Controller).
type Kimup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
106 changes: 49 additions & 57 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading