Skip to content
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $(GENERATED): go.mod $(CRD_TYPE_SOURCE)
./hack/update-codegen.sh

$(GENERATED_CRDS): $(GENERATED) $(CRD_SOURCES)
go tool controller-gen crd:crdVersions=v1,allowDangerousTypes=true paths=./pkg/apis/... output:crd:dir=docs
go tool controller-gen crd:crdVersions=v1,allowDangerousTypes=true,generateEmbeddedObjectMeta=true paths=./pkg/apis/... output:crd:dir=docs
go run hack/crd/trim.go < docs/zalando.org_stacksets.yaml > docs/stackset_crd.yaml
go run hack/crd/trim.go < docs/zalando.org_stacks.yaml > docs/stack_crd.yaml
rm docs/zalando.org_stacksets.yaml docs/zalando.org_stacks.yaml
Expand Down
22 changes: 11 additions & 11 deletions cmd/e2e/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (
apps "k8s.io/api/apps/v1"
autoscalingv2 "k8s.io/api/autoscaling/v2"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/networking/v1"
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)

var (
pathType = v1.PathTypeImplementationSpecific
pathType = networkingv1.PathTypeImplementationSpecific
testAnnotationsCreate = map[string]string{
"user-test-annotation": "create",
}
Expand Down Expand Up @@ -179,7 +179,7 @@ func (f *TestStacksetSpecFactory) Create(t *testing.T, stackVersion string) zv1.
Spec: zv1.StackSpecTemplate{
StackSpec: zv1.StackSpec{
Replicas: pint32(f.replicas),
PodTemplate: zv1.PodTemplateSpec{
PodTemplate: corev1.PodTemplateSpec{
Spec: skipperPod,
},
Service: &zv1.StackServiceSpec{
Expand Down Expand Up @@ -506,19 +506,19 @@ func verifyStackIngressSources(
require.Contains(t, stackIngress.Annotations, k)
require.Equal(t, v, stackIngress.Annotations[k])
}
stackIngressRules := make([]v1.IngressRule, 0, len(clusterDomains))
stackIngressRules := make([]networkingv1.IngressRule, 0, len(clusterDomains))
for _, domain := range domains {
stackIngressRules = append(stackIngressRules, v1.IngressRule{
stackIngressRules = append(stackIngressRules, networkingv1.IngressRule{
Host: domain,
IngressRuleValue: v1.IngressRuleValue{
HTTP: &v1.HTTPIngressRuleValue{
Paths: []v1.HTTPIngressPath{
IngressRuleValue: networkingv1.IngressRuleValue{
HTTP: &networkingv1.HTTPIngressRuleValue{
Paths: []networkingv1.HTTPIngressPath{
{
PathType: &pathType,
Backend: v1.IngressBackend{
Service: &v1.IngressServiceBackend{
Backend: networkingv1.IngressBackend{
Service: &networkingv1.IngressServiceBackend{
Name: stack.Name,
Port: v1.ServiceBackendPort{
Port: networkingv1.ServiceBackendPort{
Number: 80,
},
},
Expand Down
2 changes: 1 addition & 1 deletion controller/stackset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func TestCreateCurrentStack(t *testing.T) {
Version: "v1",
StackSpec: zv1.StackSpec{
Replicas: &replicas,
PodTemplate: zv1.PodTemplateSpec{
PodTemplate: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Expand Down
62 changes: 39 additions & 23 deletions docs/stack_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -526,26 +526,26 @@ spec:
description: PodTemplate describes the pods that will be created.
properties:
metadata:
description: Object's metadata.
description: |-
Standard object's metadata.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
properties:
annotations:
additionalProperties:
type: string
description: |-
Annotations is an unstructured key value map stored with a resource that may be
set by external tools to store and retrieve arbitrary metadata. They are not
queryable and should be preserved when modifying objects.
More info: http://kubernetes.io/docs/user-guide/annotations
type: object
finalizers:
items:
type: string
type: array
labels:
additionalProperties:
type: string
description: |-
Map of string keys and values that can be used to organize and categorize
(scope and select) objects. May match selectors of replication controllers
and services.
More info: http://kubernetes.io/docs/user-guide/labels
type: object
name:
type: string
namespace:
type: string
type: object
spec:
description: |-
Expand Down Expand Up @@ -1101,6 +1101,11 @@ spec:
type: object
x-kubernetes-map-type: atomic
namespaces:
description: |-
namespaces specifies a static list of namespace names that the term applies to.
The term is applied to the union of the namespaces listed in this field
and the ones selected by namespaceSelector.
null or empty namespaces list and null namespaceSelector means "this pod's namespace".
items:
type: string
type: array
Expand Down Expand Up @@ -6287,6 +6292,12 @@ spec:
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
Expand Down Expand Up @@ -6448,6 +6459,23 @@ spec:
May contain labels and annotations that will be copied into the PVC
when creating it. No other fields are allowed and will be rejected during
validation.
properties:
annotations:
additionalProperties:
type: string
type: object
finalizers:
items:
type: string
type: array
labels:
additionalProperties:
type: string
type: object
name:
type: string
namespace:
type: string
type: object
spec:
description: |-
Expand Down Expand Up @@ -7231,12 +7259,6 @@ spec:
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
Expand Down Expand Up @@ -7390,12 +7412,6 @@ spec:
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
Expand Down
39 changes: 28 additions & 11 deletions docs/stackset_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -738,26 +738,26 @@ spec:
description: PodTemplate describes the pods that will be created.
properties:
metadata:
description: Object's metadata.
description: |-
Standard object's metadata.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
properties:
annotations:
additionalProperties:
type: string
description: |-
Annotations is an unstructured key value map stored with a resource that may be
set by external tools to store and retrieve arbitrary metadata. They are not
queryable and should be preserved when modifying objects.
More info: http://kubernetes.io/docs/user-guide/annotations
type: object
finalizers:
items:
type: string
type: array
labels:
additionalProperties:
type: string
description: |-
Map of string keys and values that can be used to organize and categorize
(scope and select) objects. May match selectors of replication controllers
and services.
More info: http://kubernetes.io/docs/user-guide/labels
type: object
name:
type: string
namespace:
type: string
type: object
spec:
description: |-
Expand Down Expand Up @@ -6694,6 +6694,23 @@ spec:
May contain labels and annotations that will be copied into the PVC
when creating it. No other fields are allowed and will be rejected during
validation.
properties:
annotations:
additionalProperties:
type: string
type: object
finalizers:
items:
type: string
type: array
labels:
additionalProperties:
type: string
type: object
name:
type: string
namespace:
type: string
type: object
spec:
description: |-
Expand Down
15 changes: 1 addition & 14 deletions pkg/apis/zalando.org/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,19 +396,6 @@ type Stack struct {
Status StackStatus `json:"status"`
}

// PodTemplateSpec describes the data a pod should have when created from a template
// +k8s:deepcopy-gen=true
type PodTemplateSpec struct {
// Object's metadata.
// +optional
EmbeddedObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// Specification of the desired behavior of the pod.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Spec v1.PodSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
}

// StackSpec is the spec part of the Stack.
// +k8s:deepcopy-gen=true
type StackSpec struct {
Expand All @@ -426,7 +413,7 @@ type StackSpec struct {
// container port and ingress backendport.
Service *StackServiceSpec `json:"service,omitempty"`
// PodTemplate describes the pods that will be created.
PodTemplate PodTemplateSpec `json:"podTemplate"`
PodTemplate v1.PodTemplateSpec `json:"podTemplate"`

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

Expand Down
18 changes: 0 additions & 18 deletions pkg/apis/zalando.org/v1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion pkg/core/stack_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (sc *StackContainer) GenerateDeployment() *appsv1.Deployment {
strategy = stack.Spec.StackSpec.Strategy.DeepCopy()
}

embeddedCopy := stack.Spec.StackSpec.PodTemplate.EmbeddedObjectMeta.DeepCopy()
embeddedCopy := stack.Spec.StackSpec.PodTemplate.ObjectMeta.DeepCopy()

templateObjectMeta := metav1.ObjectMeta{
Annotations: embeddedCopy.Annotations,
Expand Down
24 changes: 12 additions & 12 deletions pkg/core/stack_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestGetServicePorts(tt *testing.T) {
stackSpec: zv1.StackSpecInternal{
StackSpec: zv1.StackSpec{
Service: nil,
PodTemplate: zv1.PodTemplateSpec{
PodTemplate: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Expand Down Expand Up @@ -115,7 +115,7 @@ func TestGetServicePorts(tt *testing.T) {
stackSpec: zv1.StackSpecInternal{
StackSpec: zv1.StackSpec{
Service: nil,
PodTemplate: zv1.PodTemplateSpec{
PodTemplate: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestGetServicePorts(tt *testing.T) {
stackSpec: zv1.StackSpecInternal{
StackSpec: zv1.StackSpec{
Service: nil,
PodTemplate: zv1.PodTemplateSpec{
PodTemplate: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestGetServicePorts(tt *testing.T) {
stackSpec: zv1.StackSpecInternal{
StackSpec: zv1.StackSpec{
Service: nil,
PodTemplate: zv1.PodTemplateSpec{
PodTemplate: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Expand Down Expand Up @@ -217,7 +217,7 @@ func TestGetServicePorts(tt *testing.T) {
},
},
},
PodTemplate: zv1.PodTemplateSpec{
PodTemplate: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Expand Down Expand Up @@ -1166,7 +1166,7 @@ func TestStackGenerateService(t *testing.T) {
Spec: zv1.StackSpecInternal{
StackSpec: zv1.StackSpec{
Service: nil,
PodTemplate: zv1.PodTemplateSpec{
PodTemplate: v1.PodTemplateSpec{
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Expand Down Expand Up @@ -1415,8 +1415,8 @@ func TestStackGenerateDeployment(t *testing.T) {
StackSpec: zv1.StackSpec{
MinReadySeconds: tc.minReadySeconds,
Strategy: strategy,
PodTemplate: zv1.PodTemplateSpec{
EmbeddedObjectMeta: zv1.EmbeddedObjectMeta{
PodTemplate: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"pod-label": "pod-foo",
},
Expand Down Expand Up @@ -1603,8 +1603,8 @@ func TestGenerateHPA(t *testing.T) {
},
} {
t.Run(tc.name, func(t *testing.T) {
podTemplate := zv1.PodTemplateSpec{
EmbeddedObjectMeta: zv1.EmbeddedObjectMeta{
podTemplate := v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"pod-label": "pod-foo",
},
Expand Down Expand Up @@ -1679,8 +1679,8 @@ func TestGenerateHPAToSegment(t *testing.T) {
ObjectMeta: testStackMeta,
Spec: zv1.StackSpecInternal{
StackSpec: zv1.StackSpec{
PodTemplate: zv1.PodTemplateSpec{
EmbeddedObjectMeta: zv1.EmbeddedObjectMeta{
PodTemplate: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"pod-label": "pod-foo",
},
Expand Down