Skip to content
Open
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
4 changes: 4 additions & 0 deletions bindata/assets/deployments/console-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ metadata:
app: console
component: ui
spec:
progressDeadlineSeconds: 600
revisionHistoryLimit: 10
selector:
matchLabels:
app: console
Expand All @@ -23,10 +25,12 @@ spec:
target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
openshift.io/required-scc: restricted-v2
spec:
dnsPolicy: ClusterFirst
nodeSelector:
node-role.kubernetes.io/master: ""
restartPolicy: Always
serviceAccountName: console
serviceAccount: console
schedulerName: default-scheduler
securityContext:
runAsNonRoot: true
Expand Down
4 changes: 4 additions & 0 deletions bindata/assets/deployments/downloads-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ metadata:
component: downloads
annotations: {}
spec:
progressDeadlineSeconds: 600
revisionHistoryLimit: 10
selector:
matchLabels:
app: console
Expand All @@ -24,7 +26,9 @@ spec:
target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
openshift.io/required-scc: restricted-v2
spec:
dnsPolicy: ClusterFirst
serviceAccountName: downloads
serviceAccount: downloads
nodeSelector:
kubernetes.io/os: linux
node-role.kubernetes.io/master: ""
Expand Down
5 changes: 4 additions & 1 deletion pkg/console/subresource/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ func withAffinity(
}

func withStrategy(deployment *appsv1.Deployment, infrastructureConfig *configv1.Infrastructure) {
rollingUpdateParams := &appsv1.RollingUpdateDeployment{}
rollingUpdateParams := &appsv1.RollingUpdateDeployment{
MaxSurge: &intstr.IntOrString{Type: intstr.String, StrVal: "25%"},
MaxUnavailable: &intstr.IntOrString{Type: intstr.String, StrVal: "25%"},
}
if ShouldDeployHA(infrastructureConfig) {
rollingUpdateParams = &appsv1.RollingUpdateDeployment{
MaxSurge: &intstr.IntOrString{
Expand Down
63 changes: 43 additions & 20 deletions pkg/console/subresource/deployment/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ func TestDefaultDeployment(t *testing.T) {
Annotations: consoleDeploymentTemplateAnnotations,
},
Spec: corev1.PodSpec{
ServiceAccountName: "console",
DNSPolicy: corev1.DNSClusterFirst,
ServiceAccountName: "console",
DeprecatedServiceAccount: "console",
// we want to deploy on master nodes
NodeSelector: map[string]string{"node-role.kubernetes.io/master": ""},
Affinity: consoleDeploymentAffinity,
Expand Down Expand Up @@ -272,9 +274,9 @@ func TestDefaultDeployment(t *testing.T) {
},
},
MinReadySeconds: 0,
RevisionHistoryLimit: nil,
RevisionHistoryLimit: ptr.To(int32(10)),
Paused: false,
ProgressDeadlineSeconds: nil,
ProgressDeadlineSeconds: ptr.To(int32(600)),
},
Status: appsv1.DeploymentStatus{},
},
Expand Down Expand Up @@ -317,7 +319,9 @@ func TestDefaultDeployment(t *testing.T) {
Annotations: consoleDeploymentTemplateAnnotations,
},
Spec: corev1.PodSpec{
ServiceAccountName: "console",
DNSPolicy: corev1.DNSClusterFirst,
ServiceAccountName: "console",
DeprecatedServiceAccount: "console",
// we want to deploy on master nodes
NodeSelector: map[string]string{"node-role.kubernetes.io/master": ""},
Affinity: consoleDeploymentAffinity,
Expand Down Expand Up @@ -351,9 +355,9 @@ func TestDefaultDeployment(t *testing.T) {
},
},
MinReadySeconds: 0,
RevisionHistoryLimit: nil,
RevisionHistoryLimit: ptr.To(int32(10)),
Paused: false,
ProgressDeadlineSeconds: nil,
ProgressDeadlineSeconds: ptr.To(int32(600)),
},
Status: appsv1.DeploymentStatus{},
},
Expand Down Expand Up @@ -396,7 +400,9 @@ func TestDefaultDeployment(t *testing.T) {
Annotations: consoleDeploymentTemplateAnnotations,
},
Spec: corev1.PodSpec{
ServiceAccountName: "console",
DNSPolicy: corev1.DNSClusterFirst,
ServiceAccountName: "console",
DeprecatedServiceAccount: "console",
// we want to deploy on master nodes
NodeSelector: map[string]string{"node-role.kubernetes.io/master": ""},
Affinity: &corev1.Affinity{},
Expand All @@ -419,13 +425,16 @@ func TestDefaultDeployment(t *testing.T) {
},
},
Strategy: appsv1.DeploymentStrategy{
Type: appsv1.RollingUpdateDeploymentStrategyType,
RollingUpdate: &appsv1.RollingUpdateDeployment{},
Type: appsv1.RollingUpdateDeploymentStrategyType,
RollingUpdate: &appsv1.RollingUpdateDeployment{
MaxSurge: &intstr.IntOrString{Type: intstr.String, StrVal: "25%"},
MaxUnavailable: &intstr.IntOrString{Type: intstr.String, StrVal: "25%"},
},
},
MinReadySeconds: 0,
RevisionHistoryLimit: nil,
RevisionHistoryLimit: ptr.To(int32(10)),
Paused: false,
ProgressDeadlineSeconds: nil,
ProgressDeadlineSeconds: ptr.To(int32(600)),
},
Status: appsv1.DeploymentStatus{},
},
Expand Down Expand Up @@ -468,7 +477,9 @@ func TestDefaultDeployment(t *testing.T) {
Annotations: consoleDeploymentTemplateAnnotations,
},
Spec: corev1.PodSpec{
ServiceAccountName: "console",
DNSPolicy: corev1.DNSClusterFirst,
ServiceAccountName: "console",
DeprecatedServiceAccount: "console",
// we do not want to deploy on master nodes
NodeSelector: map[string]string{},
Affinity: consoleDeploymentAffinity,
Expand Down Expand Up @@ -502,9 +513,9 @@ func TestDefaultDeployment(t *testing.T) {
},
},
MinReadySeconds: 0,
RevisionHistoryLimit: nil,
RevisionHistoryLimit: ptr.To(int32(10)),
Paused: false,
ProgressDeadlineSeconds: nil,
ProgressDeadlineSeconds: ptr.To(int32(600)),
},
Status: appsv1.DeploymentStatus{},
},
Expand Down Expand Up @@ -1519,7 +1530,10 @@ func TestWithStrategy(t *testing.T) {
infrastructureConfigExternalTopologyHighlyAvailable := infrastructureConfigWithTopology(configv1.ExternalTopologyMode, configv1.HighlyAvailableTopologyMode)
infrastructureConfigExternalTopologySingleReplica := infrastructureConfigWithTopology(configv1.ExternalTopologyMode, configv1.SingleReplicaTopologyMode)

singleReplicaStrategy := appsv1.RollingUpdateDeployment{}
singleReplicaStrategy := appsv1.RollingUpdateDeployment{
MaxSurge: &intstr.IntOrString{Type: intstr.String, StrVal: "25%"},
MaxUnavailable: &intstr.IntOrString{Type: intstr.String, StrVal: "25%"},
}
highAvailStrategy := appsv1.RollingUpdateDeployment{
MaxSurge: &intstr.IntOrString{
IntVal: int32(3),
Expand Down Expand Up @@ -1719,7 +1733,9 @@ func TestDefaultDownloadsDeployment(t *testing.T) {
configv1.SingleReplicaTopologyMode)

downloadsDeploymentPodSpecSingleReplica := corev1.PodSpec{
ServiceAccountName: "downloads",
DNSPolicy: corev1.DNSClusterFirst,
ServiceAccountName: "downloads",
DeprecatedServiceAccount: "downloads",
NodeSelector: map[string]string{
"kubernetes.io/os": "linux",
"node-role.kubernetes.io/master": "",
Expand Down Expand Up @@ -1850,10 +1866,15 @@ func TestDefaultDownloadsDeployment(t *testing.T) {
},
ObjectMeta: downloadsDeploymentObjectMeta,
Spec: appsv1.DeploymentSpec{
Replicas: &singleNodeReplicaCount,
Replicas: &singleNodeReplicaCount,
RevisionHistoryLimit: ptr.To(int32(10)),
ProgressDeadlineSeconds: ptr.To(int32(600)),
Strategy: appsv1.DeploymentStrategy{
Type: appsv1.RollingUpdateDeploymentStrategyType,
RollingUpdate: &appsv1.RollingUpdateDeployment{},
Type: appsv1.RollingUpdateDeploymentStrategyType,
RollingUpdate: &appsv1.RollingUpdateDeployment{
MaxSurge: &intstr.IntOrString{Type: intstr.String, StrVal: "25%"},
MaxUnavailable: &intstr.IntOrString{Type: intstr.String, StrVal: "25%"},
},
},
Selector: &metav1.LabelSelector{
MatchLabels: labels,
Expand Down Expand Up @@ -1886,7 +1907,9 @@ func TestDefaultDownloadsDeployment(t *testing.T) {
},
ObjectMeta: downloadsDeploymentObjectMeta,
Spec: appsv1.DeploymentSpec{
Replicas: &defaultReplicaCount,
Replicas: &defaultReplicaCount,
RevisionHistoryLimit: ptr.To(int32(10)),
ProgressDeadlineSeconds: ptr.To(int32(600)),
Strategy: appsv1.DeploymentStrategy{
Type: appsv1.RollingUpdateDeploymentStrategyType,
RollingUpdate: &appsv1.RollingUpdateDeployment{
Expand Down