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

api: support user provided names for generated k8s resources #3527

Merged
merged 2 commits into from
Jun 4, 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
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