Skip to content

Commit 905a86f

Browse files
committed
Use proper v1.PodTemplateSpec
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
1 parent 5cd2dca commit 905a86f

File tree

6 files changed

+70
-68
lines changed

6 files changed

+70
-68
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $(GENERATED): go.mod $(CRD_TYPE_SOURCE)
3535
./hack/update-codegen.sh
3636

3737
$(GENERATED_CRDS): $(GENERATED) $(CRD_SOURCES)
38-
go tool controller-gen crd:crdVersions=v1,allowDangerousTypes=true paths=./pkg/apis/... output:crd:dir=docs
38+
go tool controller-gen crd:crdVersions=v1,allowDangerousTypes=true,generateEmbeddedObjectMeta=true paths=./pkg/apis/... output:crd:dir=docs
3939
go run hack/crd/trim.go < docs/zalando.org_stacksets.yaml > docs/stackset_crd.yaml
4040
go run hack/crd/trim.go < docs/zalando.org_stacks.yaml > docs/stack_crd.yaml
4141
rm docs/zalando.org_stacksets.yaml docs/zalando.org_stacks.yaml

docs/stack_crd.yaml

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -526,26 +526,26 @@ spec:
526526
description: PodTemplate describes the pods that will be created.
527527
properties:
528528
metadata:
529-
description: Object's metadata.
529+
description: |-
530+
Standard object's metadata.
531+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
530532
properties:
531533
annotations:
532534
additionalProperties:
533535
type: string
534-
description: |-
535-
Annotations is an unstructured key value map stored with a resource that may be
536-
set by external tools to store and retrieve arbitrary metadata. They are not
537-
queryable and should be preserved when modifying objects.
538-
More info: http://kubernetes.io/docs/user-guide/annotations
539536
type: object
537+
finalizers:
538+
items:
539+
type: string
540+
type: array
540541
labels:
541542
additionalProperties:
542543
type: string
543-
description: |-
544-
Map of string keys and values that can be used to organize and categorize
545-
(scope and select) objects. May match selectors of replication controllers
546-
and services.
547-
More info: http://kubernetes.io/docs/user-guide/labels
548544
type: object
545+
name:
546+
type: string
547+
namespace:
548+
type: string
549549
type: object
550550
spec:
551551
description: |-
@@ -1101,6 +1101,11 @@ spec:
11011101
type: object
11021102
x-kubernetes-map-type: atomic
11031103
namespaces:
1104+
description: |-
1105+
namespaces specifies a static list of namespace names that the term applies to.
1106+
The term is applied to the union of the namespaces listed in this field
1107+
and the ones selected by namespaceSelector.
1108+
null or empty namespaces list and null namespaceSelector means "this pod's namespace".
11041109
items:
11051110
type: string
11061111
type: array
@@ -6287,6 +6292,12 @@ spec:
62876292
properties:
62886293
name:
62896294
default: ""
6295+
description: |-
6296+
Name of the referent.
6297+
This field is effectively required, but due to backwards compatibility is
6298+
allowed to be empty. Instances of this type with an empty value here are
6299+
almost certainly wrong.
6300+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
62906301
type: string
62916302
type: object
62926303
x-kubernetes-map-type: atomic
@@ -6448,6 +6459,23 @@ spec:
64486459
May contain labels and annotations that will be copied into the PVC
64496460
when creating it. No other fields are allowed and will be rejected during
64506461
validation.
6462+
properties:
6463+
annotations:
6464+
additionalProperties:
6465+
type: string
6466+
type: object
6467+
finalizers:
6468+
items:
6469+
type: string
6470+
type: array
6471+
labels:
6472+
additionalProperties:
6473+
type: string
6474+
type: object
6475+
name:
6476+
type: string
6477+
namespace:
6478+
type: string
64516479
type: object
64526480
spec:
64536481
description: |-
@@ -7231,12 +7259,6 @@ spec:
72317259
properties:
72327260
name:
72337261
default: ""
7234-
description: |-
7235-
Name of the referent.
7236-
This field is effectively required, but due to backwards compatibility is
7237-
allowed to be empty. Instances of this type with an empty value here are
7238-
almost certainly wrong.
7239-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
72407262
type: string
72417263
type: object
72427264
x-kubernetes-map-type: atomic
@@ -7390,12 +7412,6 @@ spec:
73907412
properties:
73917413
name:
73927414
default: ""
7393-
description: |-
7394-
Name of the referent.
7395-
This field is effectively required, but due to backwards compatibility is
7396-
allowed to be empty. Instances of this type with an empty value here are
7397-
almost certainly wrong.
7398-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
73997415
type: string
74007416
type: object
74017417
x-kubernetes-map-type: atomic

docs/stackset_crd.yaml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -738,26 +738,26 @@ spec:
738738
description: PodTemplate describes the pods that will be created.
739739
properties:
740740
metadata:
741-
description: Object's metadata.
741+
description: |-
742+
Standard object's metadata.
743+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
742744
properties:
743745
annotations:
744746
additionalProperties:
745747
type: string
746-
description: |-
747-
Annotations is an unstructured key value map stored with a resource that may be
748-
set by external tools to store and retrieve arbitrary metadata. They are not
749-
queryable and should be preserved when modifying objects.
750-
More info: http://kubernetes.io/docs/user-guide/annotations
751748
type: object
749+
finalizers:
750+
items:
751+
type: string
752+
type: array
752753
labels:
753754
additionalProperties:
754755
type: string
755-
description: |-
756-
Map of string keys and values that can be used to organize and categorize
757-
(scope and select) objects. May match selectors of replication controllers
758-
and services.
759-
More info: http://kubernetes.io/docs/user-guide/labels
760756
type: object
757+
name:
758+
type: string
759+
namespace:
760+
type: string
761761
type: object
762762
spec:
763763
description: |-
@@ -6694,6 +6694,23 @@ spec:
66946694
May contain labels and annotations that will be copied into the PVC
66956695
when creating it. No other fields are allowed and will be rejected during
66966696
validation.
6697+
properties:
6698+
annotations:
6699+
additionalProperties:
6700+
type: string
6701+
type: object
6702+
finalizers:
6703+
items:
6704+
type: string
6705+
type: array
6706+
labels:
6707+
additionalProperties:
6708+
type: string
6709+
type: object
6710+
name:
6711+
type: string
6712+
namespace:
6713+
type: string
66976714
type: object
66986715
spec:
66996716
description: |-

pkg/apis/zalando.org/v1/types.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -396,19 +396,6 @@ type Stack struct {
396396
Status StackStatus `json:"status"`
397397
}
398398

399-
// PodTemplateSpec describes the data a pod should have when created from a template
400-
// +k8s:deepcopy-gen=true
401-
type PodTemplateSpec struct {
402-
// Object's metadata.
403-
// +optional
404-
EmbeddedObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
405-
406-
// Specification of the desired behavior of the pod.
407-
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
408-
// +optional
409-
Spec v1.PodSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
410-
}
411-
412399
// StackSpec is the spec part of the Stack.
413400
// +k8s:deepcopy-gen=true
414401
type StackSpec struct {
@@ -426,7 +413,7 @@ type StackSpec struct {
426413
// container port and ingress backendport.
427414
Service *StackServiceSpec `json:"service,omitempty"`
428415
// PodTemplate describes the pods that will be created.
429-
PodTemplate PodTemplateSpec `json:"podTemplate"`
416+
PodTemplate v1.PodTemplateSpec `json:"podTemplate"`
430417

431418
Autoscaler *Autoscaler `json:"autoscaler,omitempty"`
432419

pkg/apis/zalando.org/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/core/stack_resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func (sc *StackContainer) GenerateDeployment() *appsv1.Deployment {
231231
strategy = stack.Spec.StackSpec.Strategy.DeepCopy()
232232
}
233233

234-
embeddedCopy := stack.Spec.StackSpec.PodTemplate.EmbeddedObjectMeta.DeepCopy()
234+
embeddedCopy := stack.Spec.StackSpec.PodTemplate.ObjectMeta.DeepCopy()
235235

236236
templateObjectMeta := metav1.ObjectMeta{
237237
Annotations: embeddedCopy.Annotations,

0 commit comments

Comments
 (0)