Skip to content

Commit b931694

Browse files
authored
Merge branch 'main' into main_apps_cmd_process_instances
2 parents eb62132 + 0106328 commit b931694

22 files changed

Lines changed: 384 additions & 101 deletions
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Enable service binding rotation feature
2+
# See https://github.com/cloudfoundry/community/blob/main/toc/rfc/rfc-0040-service-binding-rotation.md#cf-cli
3+
---
4+
- type: replace
5+
path: /instance_groups/name=api/jobs/name=cloud_controller_ng/properties/cc/max_service_credential_bindings_per_app_service_instance?
6+
value: 2

.github/workflows/create-bosh-lite.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ jobs:
151151
-o ${GITHUB_WORKSPACE}/cli/.github/ops-files/add-uaa-client-credentials.yml \
152152
-o ${GITHUB_WORKSPACE}/cli/.github/ops-files/increase-route-registration-interval.yml \
153153
-o ${GITHUB_WORKSPACE}/cli/.github/ops-files/add-oidc-provider.yml ${additional_args} \
154+
-o ${GITHUB_WORKSPACE}/cli/.github/ops-files/increase-max-service-credential-bindings.yml \
154155
-v client-secret="${{ secrets.CLIENT_SECRET }}" \
155156
-v system_domain=${SYSTEM_DOMAIN} \
156157
> ./director.yml

actor/v7action/cloud_controller_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ type CloudControllerClient interface {
138138
GetAppFeature(appGUID string, featureName string) (resources.ApplicationFeature, ccv3.Warnings, error)
139139
GetStacks(query ...ccv3.Query) ([]resources.Stack, ccv3.Warnings, error)
140140
GetStagingSecurityGroups(spaceGUID string, queries ...ccv3.Query) ([]resources.SecurityGroup, ccv3.Warnings, error)
141-
UpdateStack(stackGUID string, state string) (resources.Stack, ccv3.Warnings, error)
141+
UpdateStack(stackGUID string, state string, reason string) (resources.Stack, ccv3.Warnings, error)
142142
GetTask(guid string) (resources.Task, ccv3.Warnings, error)
143143
GetUser(userGUID string) (resources.User, ccv3.Warnings, error)
144144
GetUsers(query ...ccv3.Query) ([]resources.User, ccv3.Warnings, error)

actor/v7action/stack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ func (actor Actor) GetStacks(labelSelector string) ([]resources.Stack, Warnings,
4747
return stacks, Warnings(warnings), nil
4848
}
4949

50-
func (actor Actor) UpdateStack(stackGUID string, state string) (resources.Stack, Warnings, error) {
51-
stack, warnings, err := actor.CloudControllerClient.UpdateStack(stackGUID, state)
50+
func (actor Actor) UpdateStack(stackGUID string, state string, reason string) (resources.Stack, Warnings, error) {
51+
stack, warnings, err := actor.CloudControllerClient.UpdateStack(stackGUID, state, reason)
5252
if err != nil {
5353
return resources.Stack{}, Warnings(warnings), err
5454
}

actor/v7action/stack_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ var _ = Describe("Stack", func() {
238238
var (
239239
stackGUID string
240240
state string
241+
reason string
241242
stack resources.Stack
242243
warnings Warnings
243244
executeErr error
@@ -246,10 +247,11 @@ var _ = Describe("Stack", func() {
246247
BeforeEach(func() {
247248
stackGUID = "some-stack-guid"
248249
state = "DEPRECATED"
250+
reason = ""
249251
})
250252

251253
JustBeforeEach(func() {
252-
stack, warnings, executeErr = actor.UpdateStack(stackGUID, state)
254+
stack, warnings, executeErr = actor.UpdateStack(stackGUID, state, reason)
253255
})
254256

255257
When("the cloud controller request is successful", func() {
@@ -277,9 +279,10 @@ var _ = Describe("Stack", func() {
277279
}))
278280

279281
Expect(fakeCloudControllerClient.UpdateStackCallCount()).To(Equal(1))
280-
actualGUID, actualState := fakeCloudControllerClient.UpdateStackArgsForCall(0)
282+
actualGUID, actualState, actualReason := fakeCloudControllerClient.UpdateStackArgsForCall(0)
281283
Expect(actualGUID).To(Equal(stackGUID))
282284
Expect(actualState).To(Equal(state))
285+
Expect(actualReason).To(Equal(reason))
283286
})
284287
})
285288

actor/v7action/v7actionfakes/fake_cloud_controller_client.go

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

api/cloudcontroller/ccv3/stack.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,19 @@ func (client *Client) GetStacks(query ...Query) ([]resources.Stack, Warnings, er
2222
return stacks, warnings, err
2323
}
2424

25-
// UpdateStack updates a stack's state.
26-
func (client *Client) UpdateStack(stackGUID string, state string) (resources.Stack, Warnings, error) {
25+
// UpdateStack updates a stack's state and optionally its state reason.
26+
func (client *Client) UpdateStack(stackGUID string, state string, reason string) (resources.Stack, Warnings, error) {
2727
var responseStack resources.Stack
2828

2929
type StackUpdate struct {
30-
State string `json:"state"`
30+
State string `json:"state"`
31+
StateReason string `json:"state_reason,omitempty"`
3132
}
3233

3334
_, warnings, err := client.MakeRequest(RequestParams{
3435
RequestName: internal.PatchStackRequest,
3536
URIParams: internal.Params{"stack_guid": stackGUID},
36-
RequestBody: StackUpdate{State: state},
37+
RequestBody: StackUpdate{State: state, StateReason: reason},
3738
ResponseBody: &responseStack,
3839
})
3940

api/cloudcontroller/ccv3/stack_test.go

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ var _ = Describe("Stacks", func() {
148148
var (
149149
stackGUID string
150150
state string
151+
reason string
151152
stack resources.Stack
152153
warnings Warnings
153154
err error
@@ -156,10 +157,11 @@ var _ = Describe("Stacks", func() {
156157
BeforeEach(func() {
157158
stackGUID = "some-stack-guid"
158159
state = "DEPRECATED"
160+
reason = ""
159161
})
160162

161163
JustBeforeEach(func() {
162-
stack, warnings, err = client.UpdateStack(stackGUID, state)
164+
stack, warnings, err = client.UpdateStack(stackGUID, state, reason)
163165
})
164166

165167
When("the request succeeds", func() {
@@ -192,6 +194,40 @@ var _ = Describe("Stacks", func() {
192194
})
193195
})
194196

197+
When("a reason is provided", func() {
198+
BeforeEach(func() {
199+
reason = "Use cflinuxfs4 instead"
200+
server.AppendHandlers(
201+
CombineHandlers(
202+
VerifyRequest(http.MethodPatch, "/v3/stacks/some-stack-guid"),
203+
VerifyJSONRepresenting(map[string]string{
204+
"state": "DEPRECATED",
205+
"state_reason": "Use cflinuxfs4 instead",
206+
}),
207+
RespondWith(http.StatusOK, `{
208+
"guid": "some-stack-guid",
209+
"name": "some-stack",
210+
"description": "some description",
211+
"state": "DEPRECATED",
212+
"state_reason": "Use cflinuxfs4 instead"
213+
}`, http.Header{"X-Cf-Warnings": {"this is a warning"}}),
214+
),
215+
)
216+
})
217+
218+
It("returns the updated stack with reason and warnings", func() {
219+
Expect(err).ToNot(HaveOccurred())
220+
Expect(warnings).To(ConsistOf("this is a warning"))
221+
Expect(stack).To(Equal(resources.Stack{
222+
GUID: "some-stack-guid",
223+
Name: "some-stack",
224+
Description: "some description",
225+
State: "DEPRECATED",
226+
StateReason: "Use cflinuxfs4 instead",
227+
}))
228+
})
229+
})
230+
195231
When("the cloud controller returns an error", func() {
196232
BeforeEach(func() {
197233
server.AppendHandlers(

api/cloudcontroller/ccversion/minimum_version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const (
1919

2020
MinVersionServiceBindingStrategy = "3.205.0"
2121

22-
MinVersionUpdateStack = "3.210.0"
23-
2422
MinVersionEmbeddedProcessInstances = "3.211.0"
23+
24+
MinVersionUpdateStack = "3.211.0"
2525
)

command/v7/actor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ type Actor interface {
179179
GetStackByName(stackName string) (resources.Stack, v7action.Warnings, error)
180180
GetStackLabels(stackName string) (map[string]types.NullString, v7action.Warnings, error)
181181
GetStacks(string) ([]resources.Stack, v7action.Warnings, error)
182-
UpdateStack(stackGUID string, state string) (resources.Stack, v7action.Warnings, error)
182+
UpdateStack(stackGUID string, state string, reason string) (resources.Stack, v7action.Warnings, error)
183183
GetStreamingLogsForApplicationByNameAndSpace(appName string, spaceGUID string, client sharedaction.LogCacheClient) (<-chan sharedaction.LogMessage, <-chan error, context.CancelFunc, v7action.Warnings, error)
184184
GetTaskBySequenceIDAndApplication(sequenceID int, appGUID string) (resources.Task, v7action.Warnings, error)
185185
GetUAAAPIVersion() (string, error)

0 commit comments

Comments
 (0)