Skip to content

Commit 0a28c83

Browse files
committed
Revert "Merge pull request openshift#981 from jhadvig/CONSOLE-4523_2"
This reverts commit c005930, reversing changes made to 06aa473.
1 parent f2050d2 commit 0a28c83

File tree

5 files changed

+18
-93
lines changed

5 files changed

+18
-93
lines changed

bindata/assets/deployments/downloads-deployment.yaml

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ spec:
4545
periodSeconds: 10
4646
successThreshold: 1
4747
failureThreshold: 3
48-
initialDelaySeconds: 5
4948
name: download-server
5049
securityContext:
5150
readOnlyRootFilesystem: false
@@ -64,7 +63,6 @@ spec:
6463
periodSeconds: 10
6564
successThreshold: 1
6665
failureThreshold: 3
67-
initialDelaySeconds: 5
6866
ports:
6967
- name: http
7068
containerPort: 8080
@@ -80,8 +78,6 @@ spec:
8078
8179
signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(0))
8280
83-
ready = threading.Event()
84-
8581
def write_index(path, message):
8682
with open(path, 'wb') as f:
8783
f.write('\n'.join([
@@ -116,8 +112,7 @@ spec:
116112
# https://stackoverflow.com/questions/46210672/
117113
httpd.socket = self.socket
118114
httpd.server_bind = self.server_close = lambda self: None
119-
if self.i == 0:
120-
ready.set()
115+
121116
httpd.serve_forever()
122117
123118
temp_dir = tempfile.mkdtemp()
@@ -130,26 +125,19 @@ spec:
130125
131126
for arch, operating_system, path in [
132127
('amd64', 'linux', '/usr/share/openshift/linux_amd64/oc'),
133-
('amd64', 'linux', '/usr/share/openshift/linux_amd64/oc.rhel8'),
134-
('amd64', 'linux', '/usr/share/openshift/linux_amd64/oc.rhel9'),
135128
('amd64', 'mac', '/usr/share/openshift/mac/oc'),
136129
('amd64', 'windows', '/usr/share/openshift/windows/oc.exe'),
137130
('arm64', 'linux', '/usr/share/openshift/linux_arm64/oc'),
138-
('arm64', 'linux', '/usr/share/openshift/linux_arm64/oc.rhel8'),
139-
('arm64', 'linux', '/usr/share/openshift/linux_arm64/oc.rhel9'),
140131
('arm64', 'mac', '/usr/share/openshift/mac_arm64/oc'),
141132
('ppc64le', 'linux', '/usr/share/openshift/linux_ppc64le/oc'),
142-
('ppc64le', 'linux', '/usr/share/openshift/linux_ppc64le/oc.rhel8'),
143-
('ppc64le', 'linux', '/usr/share/openshift/linux_ppc64le/oc.rhel9'),
144133
('s390x', 'linux', '/usr/share/openshift/linux_s390x/oc'),
145-
('s390x', 'linux', '/usr/share/openshift/linux_s390x/oc.rhel8'),
146-
('s390x', 'linux', '/usr/share/openshift/linux_s390x/oc.rhel9'),
147134
]:
148135
basename = os.path.basename(path)
149136
target_path = os.path.join(arch, operating_system, basename)
150-
os.makedirs(os.path.join(arch, operating_system), exist_ok=True)
137+
os.mkdir(os.path.join(arch, operating_system))
151138
os.symlink(path, target_path)
152-
archive_path_root = os.path.join(arch, operating_system, basename)
139+
base_root, _ = os.path.splitext(basename)
140+
archive_path_root = os.path.join(arch, operating_system, base_root)
153141
with tarfile.open('{}.tar'.format(archive_path_root), 'w') as tar:
154142
tar.add(path, basename)
155143
with zipfile.ZipFile('{}.zip'.format(archive_path_root), 'w') as zip:
@@ -191,32 +179,12 @@ spec:
191179
addr = ('', 8080)
192180
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
193181
else:
194-
raise
182+
raise
195183
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
196184
sock.bind(addr)
197185
sock.listen(5)
198186
199-
# Start server threads - using 10 threads to handle a good number of concurrent
200-
# downloads while maintaining reasonable resource usage
201-
threads = [Thread(i, socket=sock) for i in range(10)]
202-
203-
# Wait for server to be ready
204-
ready.wait()
205-
206-
# Verify server is actually listening
207-
for _ in range(30): # Try for 30 seconds
208-
try:
209-
test_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
210-
test_sock.connect(('localhost', 8080))
211-
test_sock.close()
212-
break
213-
except socket.error:
214-
time.sleep(1)
215-
else:
216-
print("Failed to verify server is listening", file=sys.stderr)
217-
sys.exit(1)
218-
219-
print("Server is ready and listening on port 8080")
187+
[Thread(i, socket=sock) for i in range(100)]
220188
time.sleep(9e9)
221189
EOF
222190
exec python3 /tmp/serve.py

pkg/console/controllers/clidownloads/controller.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,12 @@ func PlatformBasedOCConsoleCLIDownloads(host, cliDownloadsName string) *v1.Conso
177177
archType string
178178
}{
179179
{"Linux for x86_64", "amd64/linux", "oc.tar"},
180-
{"Linux for x86_64 - RHEL 8", "amd64/linux", "oc.rhel8.tar"},
181-
{"Linux for x86_64 - RHEL 9", "amd64/linux", "oc.rhel9.tar"},
182180
{"Mac for x86_64", "amd64/mac", "oc.zip"},
183-
{"Windows for x86_64", "amd64/windows", "oc.exe.zip"},
181+
{"Windows for x86_64", "amd64/windows", "oc.zip"},
184182
{"Linux for ARM 64", "arm64/linux", "oc.tar"},
185-
{"Linux for ARM 64 - RHEL 8", "arm64/linux", "oc.rhel8.tar"},
186-
{"Linux for ARM 64 - RHEL 9", "arm64/linux", "oc.rhel9.tar"},
187183
{"Mac for ARM 64", "arm64/mac", "oc.zip"},
188184
{"Linux for IBM Power, little endian", "ppc64le/linux", "oc.tar"},
189-
{"Linux for IBM Power, little endian - RHEL 8", "ppc64le/linux", "oc.rhel8.tar"},
190-
{"Linux for IBM Power, little endian - RHEL 9", "ppc64le/linux", "oc.rhel9.tar"},
191185
{"Linux for IBM Z", "s390x/linux", "oc.tar"},
192-
{"Linux for IBM Z - RHEL 8", "s390x/linux", "oc.rhel8.tar"},
193-
{"Linux for IBM Z - RHEL 9", "s390x/linux", "oc.rhel9.tar"},
194186
}
195187

196188
links := []v1.CLIDownloadLink{}
@@ -213,7 +205,7 @@ func PlatformBasedOCConsoleCLIDownloads(host, cliDownloadsName string) *v1.Conso
213205
Spec: v1.ConsoleCLIDownloadSpec{
214206
Description: `With the OpenShift command line interface, you can create applications and manage OpenShift projects from a terminal.
215207
216-
The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features. You can download oc using the following links.
208+
The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features.
217209
`,
218210
DisplayName: "oc - OpenShift Command Line Interface (CLI)",
219211
Links: links,

pkg/console/controllers/clidownloads/controller_test.go

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -116,42 +116,26 @@ func TestPlatformBasedOCConsoleCLIDownloads(t *testing.T) {
116116
Spec: v1.ConsoleCLIDownloadSpec{
117117
Description: `With the OpenShift command line interface, you can create applications and manage OpenShift projects from a terminal.
118118
119-
The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features. You can download oc using the following links.
119+
The oc binary offers the same capabilities as the kubectl binary, but it is further extended to natively support OpenShift Container Platform features.
120120
`,
121121
DisplayName: "oc - OpenShift Command Line Interface (CLI)",
122122
Links: []v1.CLIDownloadLink{
123123
{
124124
Href: "https://www.example.com/amd64/linux/oc.tar",
125125
Text: "Download oc for Linux for x86_64",
126126
},
127-
{
128-
Href: "https://www.example.com/amd64/linux/oc.rhel8.tar",
129-
Text: "Download oc for Linux for x86_64 - RHEL 8",
130-
},
131-
{
132-
Href: "https://www.example.com/amd64/linux/oc.rhel9.tar",
133-
Text: "Download oc for Linux for x86_64 - RHEL 9",
134-
},
135127
{
136128
Href: "https://www.example.com/amd64/mac/oc.zip",
137129
Text: "Download oc for Mac for x86_64",
138130
},
139131
{
140-
Href: "https://www.example.com/amd64/windows/oc.exe.zip",
132+
Href: "https://www.example.com/amd64/windows/oc.zip",
141133
Text: "Download oc for Windows for x86_64",
142134
},
143135
{
144136
Href: "https://www.example.com/arm64/linux/oc.tar",
145137
Text: "Download oc for Linux for ARM 64",
146138
},
147-
{
148-
Href: "https://www.example.com/arm64/linux/oc.rhel8.tar",
149-
Text: "Download oc for Linux for ARM 64 - RHEL 8",
150-
},
151-
{
152-
Href: "https://www.example.com/arm64/linux/oc.rhel9.tar",
153-
Text: "Download oc for Linux for ARM 64 - RHEL 9",
154-
},
155139
{
156140
Href: "https://www.example.com/arm64/mac/oc.zip",
157141
Text: "Download oc for Mac for ARM 64",
@@ -160,26 +144,10 @@ The oc binary offers the same capabilities as the kubectl binary, but it is furt
160144
Href: "https://www.example.com/ppc64le/linux/oc.tar",
161145
Text: "Download oc for Linux for IBM Power, little endian",
162146
},
163-
{
164-
Href: "https://www.example.com/ppc64le/linux/oc.rhel8.tar",
165-
Text: "Download oc for Linux for IBM Power, little endian - RHEL 8",
166-
},
167-
{
168-
Href: "https://www.example.com/ppc64le/linux/oc.rhel9.tar",
169-
Text: "Download oc for Linux for IBM Power, little endian - RHEL 9",
170-
},
171147
{
172148
Href: "https://www.example.com/s390x/linux/oc.tar",
173149
Text: "Download oc for Linux for IBM Z",
174150
},
175-
{
176-
Href: "https://www.example.com/s390x/linux/oc.rhel8.tar",
177-
Text: "Download oc for Linux for IBM Z - RHEL 8",
178-
},
179-
{
180-
Href: "https://www.example.com/s390x/linux/oc.rhel9.tar",
181-
Text: "Download oc for Linux for IBM Z - RHEL 9",
182-
},
183151
{
184152
Href: "https://www.example.com/oc-license",
185153
Text: "LICENSE",

pkg/console/subresource/deployment/deployment_test.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,11 +1660,10 @@ func TestDefaultDownloadsDeployment(t *testing.T) {
16601660
Scheme: corev1.URIScheme("HTTP"),
16611661
},
16621662
},
1663-
TimeoutSeconds: 1,
1664-
PeriodSeconds: 10,
1665-
SuccessThreshold: 1,
1666-
FailureThreshold: 3,
1667-
InitialDelaySeconds: 5,
1663+
TimeoutSeconds: 1,
1664+
PeriodSeconds: 10,
1665+
SuccessThreshold: 1,
1666+
FailureThreshold: 3,
16681667
},
16691668
LivenessProbe: &corev1.Probe{
16701669
ProbeHandler: corev1.ProbeHandler{
@@ -1674,11 +1673,10 @@ func TestDefaultDownloadsDeployment(t *testing.T) {
16741673
Scheme: corev1.URIScheme("HTTP"),
16751674
},
16761675
},
1677-
TimeoutSeconds: 1,
1678-
PeriodSeconds: 10,
1679-
SuccessThreshold: 1,
1680-
FailureThreshold: 3,
1681-
InitialDelaySeconds: 5,
1676+
TimeoutSeconds: 1,
1677+
PeriodSeconds: 10,
1678+
SuccessThreshold: 1,
1679+
FailureThreshold: 3,
16821680
},
16831681
Command: []string{"/bin/sh"},
16841682
Resources: corev1.ResourceRequirements{

test/e2e/downloads_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ func TestDownloadsEndpoint(t *testing.T) {
4242
req := getRequest(t, link.Href)
4343
client := getInsecureClient()
4444
resp, err := client.Do(req)
45-
t.Logf("Requesting %s at %s\n", link.Text, link.Href)
4645

4746
if err != nil {
4847
t.Fatalf("http error getting %s at %s: %s", link.Text, link.Href, err)

0 commit comments

Comments
 (0)