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

EnvoyFleet customization improvements #143

Merged
merged 8 commits into from
Dec 13, 2021
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
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ delete-env: ## Destroy the local development k3d cluster
./development/cluster/delete-env.sh

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

generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
Expand All @@ -75,10 +75,11 @@ run: install-local generate fmt vet ## Run a controller from your host, proxying
ktunnel expose -n kusk-system kusk-xds-service 18000 & ENABLE_WEBHOOKS=false bin/manager ; fg

docker-build: ## Build docker image with the manager.
DOCKER_BUILDKIT=1 docker build -t ${IMG} .
@eval $$(minikube docker-env --profile kgw); DOCKER_BUILDKIT=1 docker build -t ${IMG} .

docker-build-debug: ## Build docker image with the manager and debugger.
@eval $$(minikube docker-env --profile kgw) ;DOCKER_BUILDKIT=1 docker build -t "${IMG}-debug" -f ./Dockerfile-debug .

docker-build-debug:## Build docker image with the manager and debugger.
DOCKER_BUILDKIT=1 docker build -t "${IMG}-debug" -f ./Dockerfile-debug .
docker-push: ## Push docker image with the manager.
docker push ${IMG}

Expand All @@ -99,18 +100,21 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
$(KUSTOMIZE) build config/crd | kubectl delete -f -

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -

deploy-debug: manifests kustomize ## Deploy controller with debugger to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}-debug
cd config/default && $(KUSTOMIZE) edit add patch --path ./manager_debug_patch.yaml
$(KUSTOMIZE) build config/default | kubectl apply -f -
cd config/default && $(KUSTOMIZE) edit remove patch --path ./manager_debug_patch.yaml
$(KUSTOMIZE) build config/debug | kubectl apply -f -

undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete -f -

update: docker-build deploy cycle ## Runs deploy, docker build and restarts kusk-gateway-manager deployment to pick up the change
update-debug: docker-build-debug deploy-debug cycle ## Runs Debug configuration deploy, docker build and restarts kusk-gateway-manager deployment to pick up the change

cycle: ## Triggers kusk-gateway-manager deployment rollout restart to pick up the new container image with the same tag
kubectl rollout restart deployment/kusk-gateway-manager -n kusk-system
@echo "Triggered deployment/kusk-gateway-manager restart, waiting for it to finish"
kubectl rollout status deployment/kusk-gateway-manager -n kusk-system --timeout=30s

CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
Expand Down
54 changes: 54 additions & 0 deletions api/v1alpha1/envoyfleet_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SOFTWARE.
package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -36,16 +37,69 @@ type EnvoyFleetSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Service describes Envoy K8s service settings
Service *ServiceConfig `json:"service"`

// Envoy image tag
Image string `json:"image"`
// Node Selector is used to schedule the Envoy pod(s) to the specificly labeled nodes, optional
// This is the map of "key: value" labels (e.g. "disktype": "ssd")
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// Affinity is used to schedule Envoy pod(s) to specific nodes, optional
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`
// Tolerations allow pod to be scheduled to the nodes that has specific toleration labels, optional
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
// Value must be non-negative integer. The value zero indicates stop immediately via
// the kill signal (no opportunity to shut down).
// If this value is nil, the default grace period will be used instead.
// The grace period is the duration in seconds after the processes running in the pod are sent
// a termination signal and the time when the processes are forcibly halted with a kill signal.
// Set this value longer than the expected cleanup time for your process.
// Defaults to 30 seconds.
// +optional
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
// Additional Envoy Deployment annotations, optional
// +optional
Annotations map[string]string `json:"annotations,omitempty"`
// Resources allow to set CPU and Memory resource requests and limits, optional
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`

// Size field specifies the number of Envoy Pods being deployed. Optional, default value is 1.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default:=1
Size *int32 `json:"size,omitempty"`
}

type ServiceConfig struct {
Tarick marked this conversation as resolved.
Show resolved Hide resolved

// Kubernetes service type: NodePort, ClusterIP or LoadBalancer
// +kubebuilder:validation:Enum=NodePort;ClusterIP;LoadBalancer
Type corev1.ServiceType `json:"type"`

// Kubernetes Service ports
Ports []corev1.ServicePort `json:"ports"`

// Service's annotations
// +optional
Annotations map[string]string `json:"annotations,omitempty"`

// Static ip address for the LoadBalancer type if available
// +optional
LoadBalancerIP string `json:"loadBalancerIP,omitempty"`
}

// EnvoyFleetStatus defines the observed state of EnvoyFleet
type EnvoyFleetStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

// State indicates Envoy Fleet state
State string `json:"state,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
71 changes: 71 additions & 0 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