Skip to content

Commit

Permalink
api: support user provided names for generated k8s resources
Browse files Browse the repository at this point in the history
* Users prefer setting their own custom names for generated
k8s resources for the Envoy Proxy fleet instead of the autogenerated
resources
  * https://envoyproxy.slack.com/archives/C03E6NHLESV/p1717068088779319
  * knative-extensions/net-gateway-api#738
  * envoyproxy#2141

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg committed Jun 3, 2024
1 parent 6e946db commit c84ebf1
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
18 changes: 18 additions & 0 deletions api/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ type KubernetesDeploymentSpec struct {
// +optional
InitContainers []corev1.Container `json:"initContainers,omitempty"`

// Name of the deployment.
// When unset, this defaults to an autogenerated name.
//
// +optional
Name *string `json:"name,omitempty"`
// TODO: Expose config as use cases are better understood, e.g. labels.
}

Expand All @@ -113,6 +118,12 @@ type KubernetesDaemonSetSpec struct {
//
// +optional
Container *KubernetesContainerSpec `json:"container,omitempty"`

// Name of the daemonSet.
// When unset, this defaults to an autogenerated name.
//
// +optional
Name *string `json:"name,omitempty"`
}

// KubernetesPodSpec defines the desired state of the Kubernetes pod resource.
Expand Down Expand Up @@ -301,6 +312,13 @@ type KubernetesServiceSpec struct {
//
// +optional
Patch *KubernetesPatchSpec `json:"patch,omitempty"`

// Name of the service.
// When unset, this defaults to an autogenerated name.
//
// +optional
Name *string `json:"name,omitempty"`

// TODO: Expose config as use cases are better understood, e.g. labels.
}

Expand Down
15 changes: 15 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.

Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,11 @@ spec:
type: object
type: array
type: object
name:
description: |-
Name of the daemonSet.
When unset, this defaults to an autogenerated name.
type: string
patch:
description: Patch defines how to perform the patch operation
to daemonset
Expand Down Expand Up @@ -6095,6 +6100,11 @@ spec:
- name
type: object
type: array
name:
description: |-
Name of the deployment.
When unset, this defaults to an autogenerated name.
type: string
patch:
description: Patch defines how to perform the patch operation
to deployment
Expand Down Expand Up @@ -10103,6 +10113,11 @@ spec:
items:
type: string
type: array
name:
description: |-
Name of the service.
When unset, this defaults to an autogenerated name.
type: string
patch:
description: Patch defines how to perform the patch operation
to the service
Expand Down
3 changes: 3 additions & 0 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,7 @@ _Appears in:_
| `strategy` | _[DaemonSetUpdateStrategy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#daemonsetupdatestrategy-v1-apps)_ | false | The daemonset strategy to use to replace existing pods with new ones. |
| `pod` | _[KubernetesPodSpec](#kubernetespodspec)_ | false | Pod defines the desired specification of pod. |
| `container` | _[KubernetesContainerSpec](#kubernetescontainerspec)_ | false | Container defines the desired specification of main container. |
| `name` | _string_ | false | Name of the daemonSet.<br />When unset, this defaults to an autogenerated name. |


#### KubernetesDeployMode
Expand Down Expand Up @@ -2148,6 +2149,7 @@ _Appears in:_
| `pod` | _[KubernetesPodSpec](#kubernetespodspec)_ | false | Pod defines the desired specification of pod. |
| `container` | _[KubernetesContainerSpec](#kubernetescontainerspec)_ | false | Container defines the desired specification of main container. |
| `initContainers` | _[Container](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#container-v1-core) array_ | false | List of initialization containers belonging to the pod.<br />More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
| `name` | _string_ | false | Name of the deployment.<br />When unset, this defaults to an autogenerated name. |


#### KubernetesHorizontalPodAutoscalerSpec
Expand Down Expand Up @@ -2229,6 +2231,7 @@ _Appears in:_
| `loadBalancerIP` | _string_ | false | LoadBalancerIP defines the IP Address of the underlying load balancer service. This field<br />may be ignored if the load balancer provider does not support this feature.<br />This field has been deprecated in Kubernetes, but it is still used for setting the IP Address in some cloud<br />providers such as GCP. |
| `externalTrafficPolicy` | _[ServiceExternalTrafficPolicy](#serviceexternaltrafficpolicy)_ | false | ExternalTrafficPolicy determines the externalTrafficPolicy for the Envoy Service. Valid options<br />are Local and Cluster. Default is "Local". "Local" means traffic will only go to pods on the node<br />receiving the traffic. "Cluster" means connections are loadbalanced to all pods in the cluster. |
| `patch` | _[KubernetesPatchSpec](#kubernetespatchspec)_ | false | Patch defines how to perform the patch operation to the service |
| `name` | _string_ | false | Name of the service.<br />When unset, this defaults to an autogenerated name. |


#### KubernetesWatchMode
Expand Down
3 changes: 3 additions & 0 deletions site/content/zh/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,7 @@ _Appears in:_
| `strategy` | _[DaemonSetUpdateStrategy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#daemonsetupdatestrategy-v1-apps)_ | false | The daemonset strategy to use to replace existing pods with new ones. |
| `pod` | _[KubernetesPodSpec](#kubernetespodspec)_ | false | Pod defines the desired specification of pod. |
| `container` | _[KubernetesContainerSpec](#kubernetescontainerspec)_ | false | Container defines the desired specification of main container. |
| `name` | _string_ | false | Name of the daemonSet.<br />When unset, this defaults to an autogenerated name. |


#### KubernetesDeployMode
Expand Down Expand Up @@ -2148,6 +2149,7 @@ _Appears in:_
| `pod` | _[KubernetesPodSpec](#kubernetespodspec)_ | false | Pod defines the desired specification of pod. |
| `container` | _[KubernetesContainerSpec](#kubernetescontainerspec)_ | false | Container defines the desired specification of main container. |
| `initContainers` | _[Container](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#container-v1-core) array_ | false | List of initialization containers belonging to the pod.<br />More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ |
| `name` | _string_ | false | Name of the deployment.<br />When unset, this defaults to an autogenerated name. |


#### KubernetesHorizontalPodAutoscalerSpec
Expand Down Expand Up @@ -2229,6 +2231,7 @@ _Appears in:_
| `loadBalancerIP` | _string_ | false | LoadBalancerIP defines the IP Address of the underlying load balancer service. This field<br />may be ignored if the load balancer provider does not support this feature.<br />This field has been deprecated in Kubernetes, but it is still used for setting the IP Address in some cloud<br />providers such as GCP. |
| `externalTrafficPolicy` | _[ServiceExternalTrafficPolicy](#serviceexternaltrafficpolicy)_ | false | ExternalTrafficPolicy determines the externalTrafficPolicy for the Envoy Service. Valid options<br />are Local and Cluster. Default is "Local". "Local" means traffic will only go to pods on the node<br />receiving the traffic. "Cluster" means connections are loadbalanced to all pods in the cluster. |
| `patch` | _[KubernetesPatchSpec](#kubernetespatchspec)_ | false | Patch defines how to perform the patch operation to the service |
| `name` | _string_ | false | Name of the service.<br />When unset, this defaults to an autogenerated name. |


#### KubernetesWatchMode
Expand Down

0 comments on commit c84ebf1

Please sign in to comment.