Skip to content
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

External components optional #737

Merged
merged 4 commits into from
Apr 20, 2022
Merged

External components optional #737

merged 4 commits into from
Apr 20, 2022

Conversation

eguzki
Copy link
Member

@eguzki eguzki commented Apr 19, 2022

what

  • Make spec.externalComponents fully optional. If struct fields do not exists, the apimanager controller will default to false.
    Currently the apimanager controller fills the *ExternalComponents` struct when not found:
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
  name: apimanager1
spec:
  wildcardDomain: example.com

Is updated to

apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
  name: apimanager1
spec:
  wildcardDomain: example.com
  externalComponents:
    backend:
      redis: false
    system:
      database: false
      redis: false
    zync:
      database: false 

After the changes on the PR, the externalComponents struct will be nil and default behavior will be applied.

  • Fix: When external component struct has changed, requeue.
  • Documentation about the external databases new feature.

Verification steps

Deploy APIManager CR:

apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
  name: apimanager1
spec:
  wildcardDomain: example.com

After the controller updated the CR, spec.externalComponents should not be in the CR

@eguzki eguzki requested a review from sergioifg94 April 19, 2022 10:28
@codeclimate
Copy link

codeclimate bot commented Apr 19, 2022

Code Climate has analyzed commit 9674b76 and detected 5 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 4
Style 1

View more on Code Climate.

Co-authored-by: Sergio Franco Garcia <sfrancog@redhat.com>
@sergioifg94
Copy link
Contributor

Code changes look good, and verified that the externalComponents field is not set by default, creating all the components in-cluster:

apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
  annotations:
    apps.3scale.net/apimanager-threescale-version: master
    apps.3scale.net/threescale-operator-version: 0.9.0
  creationTimestamp: '2022-04-20T16:33:58Z'
  generation: 2
  managedFields:
    - apiVersion: apps.3scale.net/v1alpha1
      fieldsType: FieldsV1     
      manager: main
      operation: Update
      time: '2022-04-20T16:33:58Z'
    - apiVersion: apps.3scale.net/v1alpha1
      fieldsType: FieldsV1     
      manager: main
      operation: Update
      subresource: status
      time: '2022-04-20T16:34:47Z'
  name: apimanager1
  namespace: default
  resourceVersion: '106165'
  uid: f80b71e8-1cdc-4cf2-b70d-904ae4542083
spec:
  imageStreamTagImportInsecure: false
  resourceRequirementsEnabled: true
  system:
    appSpec:
      replicas: 1
    sidekiqSpec:
      replicas: 1
    sphinxSpec: {}
  appLabel: 3scale-api-management
  zync:
    appSpec:
      replicas: 1
    queSpec:
      replicas: 1
  backend:
    cronSpec:
      replicas: 1
    listenerSpec:
      replicas: 1
    workerSpec:
      replicas: 1
  tenantName: 3scale
  apicast:
    managementAPI: status
    openSSLVerify: false
    productionSpec:
      replicas: 1
    registryURL: 'http://apicast-staging:8090/policies'
    responseCodes: true
    stagingSpec:
      replicas: 1
  wildcardDomain: example.com
status:
  conditions:
    - lastTransitionTime: '2022-04-20T16:34:07Z'
      status: 'False'
      type: Available
  deployments:
    ready:
      - apicast-staging
      - backend-listener
      - system-memcache
      - zync
      - zync-database
      - zync-que
    starting:
      - apicast-production
      - backend-cron
      - backend-redis
      - backend-worker
      - system-mysql
      - system-redis
      - system-sidekiq
      - system-sphinx
    stopped:
      - system-app

lgtm

@eguzki eguzki merged commit b1e8dde into master Apr 20, 2022
@eguzki eguzki deleted the external-components-optional branch April 20, 2022 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants