8000 THREESCALE-10092 fix promote to stage with false production value by MStokluska · Pull Request #881 · 3scale/3scale-operator · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

THREESCALE-10092 fix promote to stage with false production value #881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

MStokluska
Copy link
Contributor

Follow up from #863

Verification:
Follow steps from the previous PR as follow up.

Add another case where the proxyConfigPromote created only promotes to stage but with production set to false.
Example:

spec:
  productCRName: product1
  production: false
  deleteCR: false

@MStokluska MStokluska requested a review from a team as a code owner October 16, 2023 10:02
@codeclimate
Copy link
codeclimate bot commented Oct 16, 2023

Code Climate has analyzed commit 2442457 and detected 0 issues on this pull request.

View more on Code Climate.

Copy link
Contributor
@austincunningham austincunningham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@austincunningham
Copy link
Contributor
austincunningham commented Oct 16, 2023

Verified

# product true
 oc get proxyconfigpromote product1 -oyaml
apiVersion: capabilities.3scale.net/v1beta1
kind: ProxyConfigPromote
metadata:
  creationTimestamp: "2023-10-16T10:26:48Z"
  generation: 1
  name: product1
  namespace: threescale
  resourceVersion: "149871"
  uid: e3510f1f-a2ec-4318-bcc7-9c5554a0ccdb
spec:
  deleteCR: false
  productCRName: product1-cr
  production: true
status:
  conditions:
  - lastTransitionTime: "2023-10-16T10:26:48Z"
    status: "False"
    type: Failed
  - lastTransitionTime: "2023-10-16T10:26:48Z"
    message: 3scale product has been successfully promoted, any further interactions
      with this CR (apart from deletion) won't be applied
    status: "True"
    type: Ready
  latestProductionVersion: 1
  latestStagingVersion: 1
  productId: "13"

# product false
oc get proxyconfigpromote product2 -oyaml
apiVersion: capabilities.3scale.net/v1beta1
kind: ProxyConfigPromote
metadata:
  creationTimestamp: "2023-10-16T10:27:15Z"
  generation: 1
  name: product2
  namespace: threescale
  resourceVersion: "150100"
  uid: 2b4ef63b-e5fd-4bcd-9e22-5e8a998860b6
spec:
  deleteCR: false
  productCRName: product2-cr
  production: false
status:
  conditions:
  - lastTransitionTime: "2023-10-16T10:27:15Z"
    status: "False"
    type: Failed
  - lastTransitionTime: "2023-10-16T10:27:15Z"
    message: 3scale product has been successfully promoted, any further interactions
      with this CR (apart from deletion) won't be applied
    status: "True"
    type: Ready
  latestStagingVersion: 1
  productId: "14"

# no product value set
oc get proxyconfigpromote product3 -oyaml
apiVersion: capabilities.3scale.net/v1beta1
kind: ProxyConfigPromote
metadata:
  creationTimestamp: "2023-10-16T10:27:36Z"
  generation: 1
  name: product3
  namespace: threescale
  resourceVersion: "150268"
  uid: 4eed07e9-d4fa-4854-a62b-3502348593a9
spec:
  deleteCR: false
  productCRName: product3-cr
status:
  conditions:
  - lastTransitionTime: "2023-10-16T10:27:37Z"
    status: "False"
    type: Failed
  - lastTransitionTime: "2023-10-16T10:27:37Z"
    message: 3scale product has been successfully promoted, any further interactions
      wit
8000
h this CR (apart from deletion) won't be applied
    status: "True"
    type: Ready
  latestStagingVersion: 1
  productId: "15"

Copy link
Member
@eguzki eguzki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right.

There is a better (IMO) and isolated way to do this: implement as method of the ProxyConfigPromote type

func (p *ProxyConfigPromote) IsProduction() bool {
    return p.Spec.Production == nil || !*p.Spec.Production
}

@MStokluska MStokluska merged commit dd94456 into 3scale:master Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0