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

Feat: State Getting Logic Enhancement with DevLake Plugin #1169

Merged
merged 1 commit into from
Oct 12, 2022

Conversation

daniel-hutao
Copy link
Member

@daniel-hutao daniel-hutao commented Oct 12, 2022

Signed-off-by: Daniel Hu tao.hu@merico.dev

Pre-Checklist

Note: please complete ALL items in the following checklist.

  • I have read through the CONTRIBUTING.md documentation.
  • My code has the necessary comments and documentation (if needed).
  • I have added relevant tests

Description

State getting logic enhancement with devlake plugin.

  1. Add values.yaml config to DevStream state;
  2. Add devlake url to outputs.

Related Issues

N/A

New Behavior (screenshots if needed)

Test

  • config
---
# core config
varFile: "" # If not empty, use the specified external variables config file
toolFile: "" # If not empty, use the specified external tools config file
pluginDir: "~/.devstream/plugins"
state: # state config, backend can be local or s3
  backend: local
  options:
    stateFile: devstream.state

---
tools:
  # name of the tool
  - name: devlake
    # id of the tool instance
    instanceID: default
    # format: name.instanceID; If specified, dtm will make sure the dependency is applied first before handling this tool.
    dependsOn: [ ]
    # options for the plugin
    options:
      # Helm repo information, this section is optional
      repo:
        # name of the Helm repo
        name: devlake
        # url of the Helm repo
        url: https://merico-dev.github.io/devlake-helm-chart
      # Helm chart information
      chart:
        # local path of the chart; if chartPath != "", repo.name and repo.url will be ignored. e.g. "foo.tgz", "./foo.tgz", "/tmp/foo.tgz"
        chartPath: ""
        # name of the chart
        chartName: devlake/devlake
        # version of the chart
        version: ""
        # release name of the chart
        releaseName: devlake
        # k8s namespace where DevLake will be installed
        namespace: devlake
        # whether to wait for the release to be deployed or not
        wait: true
        # the time to wait for any individual Kubernetes operation (like Jobs for hooks). This defaults to 5m0s
        timeout: 5m
        # whether to perform a CRD upgrade during installation
        upgradeCRDs: true
        # custom configuration (Optional)
        valuesYaml: |
          replicaCount: 1
  • apply
./dtm apply -f config-devlake.yaml 
2022-10-12 10:04:43 ℹ [INFO]  Apply started.
2022-10-12 10:04:43 ℹ [INFO]  Using dir </Users/danielhu/.devstream/plugins> to store plugins.
2022-10-12 10:04:43 ℹ [INFO]  Using local backend. State file: devstream.state.
2022-10-12 10:04:43 ℹ [INFO]  Tool (devlake/default) found in config but doesn't exist in the state, will be created.
Continue? [y/n]
Enter a value (Default is n): y

2022-10-12 10:04:44 ℹ [INFO]  Start executing the plan.
2022-10-12 10:04:44 ℹ [INFO]  Changes count: 1.
2022-10-12 10:04:44 ℹ [INFO]  -------------------- [  Processing progress: 1/1.  ] --------------------
2022-10-12 10:04:44 ℹ [INFO]  Processing: (devlake/default) -> Create ...
2022-10-12 10:04:45 ℹ [INFO]  Creating or updating helm chart ...
2022/10/12 10:04:47 creating 9 resource(s)
2022/10/12 10:04:47 beginning wait for 9 resources with timeout of 5m0s
2022/10/12 10:04:47 Deployment is not ready: devlake/devlake-grafana. 0 out of 1 expected pods are ready
...
2022/10/12 10:05:17 StatefulSet is not ready: devlake/devlake-lake. 0 out of 1 expected pods are ready
2022/10/12 10:05:19 release installed successfully: devlake/devlake-0.2.0
2022-10-12 10:05:19 ✔ [SUCCESS]  Tool (devlake/default) Create done.
2022-10-12 10:05:19 ℹ [INFO]  -------------------- [  Processing done.  ] --------------------
2022-10-12 10:05:19 ✔ [SUCCESS]  All plugins applied successfully.
2022-10-12 10:05:19 ✔ [SUCCESS]  Apply finished.
  • state
devlake_default:
  name: devlake
  instanceid: default
  dependson: []
  options:
    chart:
      chartName: devlake/devlake
      chartPath: ""
      namespace: devlake
      releaseName: devlake
      timeout: 5m
      upgradeCRDs: true
      valuesYaml: |
        replicaCount: 1
      version: ""
      wait: true
    repo:
      name: devlake
      url: https://merico-dev.github.io/devlake-helm-chart
  resource:
    outputs:
      devlake_url: http://10.110.50.23:8080
    valuesYaml: |
      replicaCount: 1
    workflows: |
      deployment:
        - name: devlake-grafana
          ready: true
        - name: devlake-ui
          ready: true
      statefulset:
        - name: devlake-lake
          ready: true
        - name: devlake-mysql
          ready: true
      daemonset: []

Signed-off-by: Daniel Hu <tao.hu@merico.dev>
@daniel-hutao daniel-hutao marked this pull request as ready for review October 12, 2022 02:10
@daniel-hutao daniel-hutao requested a review from a team as a code owner October 12, 2022 02:10
Copy link
Contributor

@warren830 warren830 left a comment

Choose a reason for hiding this comment

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

LGTM

@daniel-hutao daniel-hutao merged commit 1aa6873 into devstream-io:main Oct 12, 2022
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.

3 participants