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

Component lifecycle hooks #13

Closed
6 of 7 tasks
oginskis opened this issue Jun 2, 2022 · 2 comments
Closed
6 of 7 tasks

Component lifecycle hooks #13

oginskis opened this issue Jun 2, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@oginskis
Copy link
Contributor

oginskis commented Jun 2, 2022

As a DevOps engineer, I assemble stacks from generic components. Sometimes, before or after I deploy a component, I need to perform an action that extends the component and often is environment or context-specific.

An example:

The Grafana component in GCP Support MGMT Stack

Responsibilities of the generic Grafana component:

  • Template values.yaml file of the corresponding Helm chart
  • Run helm install to deploy the component to Kubernetes
  • Run helm delete to undeploy the component from Kubernetes

Responsibilities of the lifecycle hooks:

  • Before deploy

    • Prepare Kubernetes context for deployment (the way how to retrieve the context differs from cloud to cloud)
  • After deploy

    • Deploy GCP Support data sources and dashboards to Grafana
  • Before undeploy

    • Prepare Kubernetes context for deployment (the way how to retrieve the context differs from cloud to cloud)

This approach allows keeping Grafana component KISS, if-less programming, and no cloud or env-specific code in the body of the component.

Agreed on:

- name: mgmt-grafana
  source:
    dir: components/grafana
    git:
      remote: https://github.com/agilestacks/google-components.git
      subDir: grafana
  hooks:
  - brief: Set GKE context
    file: .hub/gke-context
    triggers:
    - pre-*deploy
  - brief: Deploy datasource
    file: .hub/datasource
    triggers:
    - post-deploy      
  - brief: Deploy dashboard
    file: .hub/dashboard
    triggers:
    - post-deploy    

To do:

  • document hub CLI local setup
  • development
  • unit test
  • release
  • on error fail flag
  • print env vars of hooks
  • if file not found - fail
@oginskis oginskis added the enhancement New feature or request label Jun 2, 2022
@oginskis oginskis self-assigned this Jun 2, 2022
@akranga
Copy link
Contributor

akranga commented Jun 10, 2022

Shema should be also updated schema

@akranga
Copy link
Contributor

akranga commented Sep 19, 2022

Closing this issue due to inactivity

@akranga akranga closed this as completed Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants