Skip to content

Commit 778d927

Browse files
authored
Merge branch 'master' into ecs-add-targetgroup-healthcheck
2 parents 8dd7584 + 369374d commit 778d927

File tree

7 files changed

+43
-33
lines changed

7 files changed

+43
-33
lines changed

clouddriver-docker/clouddriver-docker.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies {
2121
implementation "io.spinnaker.kork:kork-retrofit"
2222
implementation "io.spinnaker.kork:kork-exceptions"
2323

24+
testImplementation "com.squareup.retrofit2:retrofit-mock"
2425
testImplementation "cglib:cglib-nodep"
2526
testImplementation "org.objenesis:objenesis"
2627
testImplementation "org.assertj:assertj-core"

clouddriver-docker/src/test/java/com/netflix/spinnaker/clouddriver/docker/registry/controllers/DockerRegistryImageLookupControllerTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import org.springframework.context.annotation.Import;
6262
import org.springframework.security.test.context.support.WithMockUser;
6363
import org.springframework.test.web.servlet.MockMvc;
64+
import retrofit2.mock.Calls;
6465

6566
@SpringBootTest(classes = TestConfig.class, properties = "services.fiat.cache.max-entries=0")
6667
@AutoConfigureMockMvc
@@ -112,7 +113,7 @@ void setUp() {
112113
@Test
113114
void authorizedToReadTags() throws Exception {
114115
var permissions = createAuthorizedUserPermission();
115-
given(fiatService.getUserPermission(eq("user"))).willReturn(permissions);
116+
given(fiatService.getUserPermission(eq("user"))).willReturn(Calls.response(permissions));
116117

117118
mockMvc
118119
.perform(
@@ -125,7 +126,7 @@ void authorizedToReadTags() throws Exception {
125126
@Test
126127
void notAuthorizedToReadTags() throws Exception {
127128
var permissions = createUnauthorizedUserPermission();
128-
given(fiatService.getUserPermission("user")).willReturn(permissions);
129+
given(fiatService.getUserPermission("user")).willReturn(Calls.response(permissions));
129130

130131
mockMvc
131132
.perform(
@@ -138,7 +139,7 @@ void notAuthorizedToReadTags() throws Exception {
138139
@Test
139140
void canSearchForAuthorizedItems() throws Exception {
140141
var permissions = createAuthorizedUserPermission();
141-
given(fiatService.getUserPermission("user")).willReturn(permissions);
142+
given(fiatService.getUserPermission("user")).willReturn(Calls.response(permissions));
142143
cache.merge(Keys.Namespace.TAGGED_IMAGE.getNs(), createTestAccountTaggedImageCacheData());
143144
var credentials = createTestAccountCredentials();
144145
accountCredentialsRepository.save(credentials.getName(), credentials);
@@ -151,7 +152,7 @@ void canSearchForAuthorizedItems() throws Exception {
151152
@Test
152153
void filtersOutUnauthorizedItems() throws Exception {
153154
var permissions = createUnauthorizedUserPermission();
154-
given(fiatService.getUserPermission("user")).willReturn(permissions);
155+
given(fiatService.getUserPermission("user")).willReturn(Calls.response(permissions));
155156
cache.merge(Keys.Namespace.TAGGED_IMAGE.getNs(), createTestAccountTaggedImageCacheData());
156157
var credentials = createTestAccountCredentials();
157158
accountCredentialsRepository.save(credentials.getName(), credentials);

clouddriver-kubernetes/clouddriver-kubernetes.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ dependencies {
8585
implementation "org.springframework.cloud:spring-cloud-config-server"
8686
implementation "io.github.resilience4j:resilience4j-retry"
8787
implementation "io.github.resilience4j:resilience4j-micrometer"
88+
implementation "io.swagger.core.v3:swagger-annotations"
8889

8990
testImplementation "io.spinnaker.kork:kork-test"
9091
testImplementation "org.apache.commons:commons-exec"

clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/controllers/PodController.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
package com.netflix.spinnaker.clouddriver.kubernetes.controllers;
1818

1919
import com.netflix.spinnaker.clouddriver.kubernetes.provider.view.KubernetesJobProvider;
20-
import io.swagger.annotations.ApiOperation;
21-
import io.swagger.annotations.ApiParam;
20+
import io.swagger.v3.oas.annotations.Operation;
21+
import io.swagger.v3.oas.annotations.Parameter;
2222
import java.util.Collections;
2323
import java.util.Map;
2424
import org.springframework.security.access.prepost.PreAuthorize;
@@ -38,18 +38,25 @@ public PodController(KubernetesJobProvider jobProvider) {
3838

3939
@PreAuthorize(
4040
"hasPermission(#application, 'APPLICATION', 'READ') and hasPermission(#account, 'ACCOUNT', 'READ')")
41-
@ApiOperation(value = "Collect a file from a pod", notes = "Collects the file result of a pod.")
41+
@Operation(
42+
summary = "Collect a file from a pod",
43+
description = "Collects the file result of a pod.")
4244
@RequestMapping(
4345
value = "/{account}/{namespace}/{podName}/{fileName:.+}",
4446
method = RequestMethod.GET)
4547
Map<String, Object> getFileContents(
46-
@ApiParam(value = "Application name", required = true) @PathVariable String application,
47-
@ApiParam(value = "Account job was created by", required = true) @PathVariable String account,
48-
@ApiParam(value = "Namespace in which the pod is running in", required = true) @PathVariable
48+
@Parameter(description = "Application name", required = true) @PathVariable
49+
String application,
50+
@Parameter(description = "Account job was created by", required = true) @PathVariable
51+
String account,
52+
@Parameter(description = "Namespace in which the pod is running in", required = true)
53+
@PathVariable
4954
String namespace,
50-
@ApiParam(value = "Unique identifier of pod being looked up", required = true) @PathVariable
55+
@Parameter(description = "Unique identifier of pod being looked up", required = true)
56+
@PathVariable
5157
String podName,
52-
@ApiParam(value = "File name to look up", required = true) @PathVariable String fileName) {
58+
@Parameter(description = "File name to look up", required = true) @PathVariable
59+
String fileName) {
5360
Map<String, Object> results =
5461
kubernetesJobProvider.getFileContentsFromPod(account, namespace, podName, fileName);
5562

clouddriver-web/clouddriver-web.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies {
3232
implementation "io.spinnaker.kork:kork-moniker"
3333
implementation "commons-io:commons-io"
3434
implementation "io.reactivex:rxjava"
35-
implementation "io.swagger:swagger-annotations"
35+
implementation "io.swagger.core.v3:swagger-annotations"
3636
implementation "org.apache.groovy:groovy"
3737
implementation "org.slf4j:slf4j-api"
3838
implementation "org.springframework.boot:spring-boot-starter-actuator"

clouddriver-web/src/main/groovy/com/netflix/spinnaker/clouddriver/controllers/JobController.groovy

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ package com.netflix.spinnaker.clouddriver.controllers
1919
import com.netflix.spinnaker.clouddriver.model.JobProvider
2020
import com.netflix.spinnaker.clouddriver.model.JobStatus
2121
import com.netflix.spinnaker.kork.web.exceptions.NotFoundException
22-
import io.swagger.annotations.ApiOperation
23-
import io.swagger.annotations.ApiParam
22+
import io.swagger.v3.oas.annotations.Operation
23+
import io.swagger.v3.oas.annotations.Parameter
2424
import org.springframework.beans.factory.annotation.Autowired
2525
import org.springframework.context.MessageSource
2626
import org.springframework.security.access.prepost.PreAuthorize
@@ -42,12 +42,12 @@ class JobController {
4242
MessageSource messageSource
4343

4444
@PreAuthorize("hasPermission(#application, 'APPLICATION', 'READ') and hasPermission(#account, 'ACCOUNT', 'READ')")
45-
@ApiOperation(value = "Collect a JobStatus", notes = "Collects the output of the job.")
45+
@Operation(summary = "Collect a JobStatus", description = "Collects the output of the job.")
4646
@RequestMapping(value = "/{account}/{location}/{id:.+}", method = RequestMethod.GET)
47-
JobStatus collectJob(@ApiParam(value = "Application name", required = true) @PathVariable String application,
48-
@ApiParam(value = "Account job was created by", required = true) @PathVariable String account,
49-
@ApiParam(value = "Namespace, region, or zone job is running in", required = true) @PathVariable String location,
50-
@ApiParam(value = "Unique identifier of job being looked up", required = true) @PathVariable String id) {
47+
JobStatus collectJob(@Parameter(description = "Application name", required = true) @PathVariable String application,
48+
@Parameter(description = "Account job was created by", required = true) @PathVariable String account,
49+
@Parameter(description = "Namespace, region, or zone job is running in", required = true) @PathVariable String location,
50+
@Parameter(description = "Unique identifier of job being looked up", required = true) @PathVariable String id) {
5151
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
5252
Collection<JobStatus> jobMatches = jobProviders.findResults {
5353
return it.collectJob(account, location, id)
@@ -59,26 +59,26 @@ class JobController {
5959
}
6060

6161
@PreAuthorize("hasPermission(#application, 'APPLICATION', 'EXECUTE') and hasPermission(#account, 'ACCOUNT', 'WRITE')")
62-
@ApiOperation(value = "Cancel a Job", notes = "Cancels the job.")
62+
@Operation(summary = "Cancel a Job", description = "Cancels the job.")
6363
@RequestMapping(value = "/{account}/{location}/{id:.+}", method = RequestMethod.DELETE)
64-
void cancelJob(@ApiParam(value = "Application name", required = true) @PathVariable String application,
65-
@ApiParam(value = "Account job is running in", required = true) @PathVariable String account,
66-
@ApiParam(value = "Namespace, region, or zone job is running in", required = true) @PathVariable String location,
67-
@ApiParam(value = "Unique identifier of job to be canceled", required = true) @PathVariable String id) {
64+
void cancelJob(@Parameter(description = "Application name", required = true) @PathVariable String application,
65+
@Parameter(description = "Account job is running in", required = true) @PathVariable String account,
66+
@Parameter(description = "Namespace, region, or zone job is running in", required = true) @PathVariable String location,
67+
@Parameter(description = "Unique identifier of job to be canceled", required = true) @PathVariable String id) {
6868
jobProviders.forEach {
6969
it.cancelJob(account, location, id)
7070
}
7171
}
7272

7373
@PreAuthorize("hasPermission(#application, 'APPLICATION', 'READ') and hasPermission(#account, 'ACCOUNT', 'READ')")
74-
@ApiOperation(value = "Collect a file from a job", notes = "Collects the file result of a job.")
74+
@Operation(summary = "Collect a file from a job", description = "Collects the file result of a job.")
7575
@RequestMapping(value = "/{account}/{location}/{id}/{fileName:.+}", method = RequestMethod.GET)
7676
Map<String, Object> getFileContents(
77-
@ApiParam(value = "Application name", required = true) @PathVariable String application,
78-
@ApiParam(value = "Account job was created by", required = true) @PathVariable String account,
79-
@ApiParam(value = "Namespace, region, or zone job is running in", required = true) @PathVariable String location,
80-
@ApiParam(value = "Unique identifier of job being looked up", required = true) @PathVariable String id,
81-
@ApiParam(value = "File name to look up", required = true) @PathVariable String fileName
77+
@Parameter(description = "Application name", required = true) @PathVariable String application,
78+
@Parameter(description = "Account job was created by", required = true) @PathVariable String account,
79+
@Parameter(description = "Namespace, region, or zone job is running in", required = true) @PathVariable String location,
80+
@Parameter(description = "Unique identifier of job being looked up", required = true) @PathVariable String id,
81+
@Parameter(description = "File name to look up", required = true) @PathVariable String fileName
8282
) {
8383
Collection<Map<String, Object>> results = jobProviders.findResults {
8484
it.getFileContents(account, location, id, fileName)

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
korkVersion=7.245.0
2-
fiatVersion=1.51.0
1+
korkVersion=7.247.0
2+
fiatVersion=1.53.0
33
org.gradle.parallel=true
44
spinnakerGradleVersion=8.32.1
55
targetJava17=true

0 commit comments

Comments
 (0)