Skip to content

Conversation

@akashshinde
Copy link
Contributor

@akashshinde akashshinde commented Jan 24, 2020

This PR adds following helm service routes CC: @sbose78 @pedjak

  1. /api/helm/manifests?ns=namespace&release_name=release_name

To Test

curl /api/helm/releases?ns=namespace&release_name=release-name
Response should return yaml array of all installed kube resources by respective release.

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. component/backend Related to backend labels Jan 24, 2020
@akashshinde
Copy link
Contributor Author

/test analyze

@sbose78
Copy link

sbose78 commented Jan 24, 2020

/hold
Checking if UI really needs it.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 24, 2020
@pedjak
Copy link
Contributor

pedjak commented Jan 24, 2020

Not sure if we really need the additional endpoint, because recently merged /api/helm/releases (#3826) gives you the list of all available releases, and the returned response containing these manifests and much more (i.e. all relevant Helm release infos). For example, for /api/helm/releases?namespace=foo, you might get on a cluster the following:

[
  {
    "name": "foo3",
    "info": {
      "first_deployed": "2020-01-22T13:59:18.293548246+01:00",
      "last_deployed": "2020-01-22T13:59:18.293548246+01:00",
      "deleted": "",
      "description": "Install complete",
      "status": "deployed",
      "notes": "1. Get the application URL by running these commands:\n  export POD_NAME=$(kubectl get pods --namespace foo -l \"app=foo3-mink\" -o jsonpath=\"{.items[0].metadata.name}\")\n  echo \"Visit http://127.0.0.1:8080 to use your application\"\n  kubectl port-forward $POD_NAME 8080:80\n"
    },
    "chart": {
      "metadata": {
        "name": "mink",
        "version": "0.1.0",
        "description": "A Helm chart for Kubernetes",
        "apiVersion": "v1"
      },
      "lock": null,
      "templates": [
        {
          "name": "templates/NOTES.txt",
          "data": "MS4gR2V0IHRoZSBhcHBsaWNhdGlvbiBVUkwgYnkgcnVubmluZyB0aGVzZSBjb21tYW5kczoKe3stIGlmIGNvbnRhaW5zICJOb2RlUG9ydCIgLlZhbHVlcy5zZXJ2aWN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nRmICIlcy0lcyIgLlJlbGVhc2UuTmFtZSAkbmFtZSB8IHRydW5jIDI0IC19fQp7ey0gZW5kIC19fQo="
        },
        {
          "name": "templates/deployment.yaml",
          "data": "YXBpVmVyc2lvbjogZXh0ZW5zaW9ucy92MWJldGExCmtpbmQ6IERlcGxveW1lbnQKbWV0YWRhdGE6CiAgbmFtZToge3sgdGVtcGxhdGUgImZ1bGxuYW1lIiAuIH19CiAgbGFiZWxzOgogICAgY2hhcnQ6ICJ7eyAuQ2hhcnQuTmFtZSB9fS17eyAuQ2hhcnQuVmVyc2lvbiB9fSIKc3BlYzoKICByZXBsaWNhczoge3sgLlZhbHVlcy5yZXBsaWNhQ291bnQgfX0KICB0ZW1wbGF0ZToKICAgIG1ldGFkYXRhOgogICAgICBsYWJlbHM6CiAgICAgICAgYXBwOiB7eyB0ZW1wbGF0ZSAiZnVsbG5hbWUiIC4gfX0KICAgIHNwZWM6CiAgICAgIGNvbnRhaW5lcnM6CiAgICAgIC0gbmFtZToge3sgLkNoYXJ0Lk5hbWUgfX0KICAgICAgICBpbWFnZTogInt7IC5WYWx1ZXMuaW1hZ2UucmVwb3NpdG9yeSB9fTp7eyAuVmFsdWVzLmltYWdlLnRhZyB9fSIKICAgICAgICBpbWFnZVB1bGxQb2xpY3k6IHt7IC5WYWx1ZXMuaW1hZ2UucHVsbFBvbGljeSB9fQogICAgICAgIHBvcnRzOgogICAgICAgIC0gY29udGFpbmVyUG9ydDoge3sgLlZhbHVlcy5zZXJ2aWNlLmludGVybmFsUG9ydCB9fQogICAgICAgIGxpdmVuZXNzUHJvYmU6CiAgICAgICAgICBodHRwR2V0OgogICAgICAgICAgICBwYXRoOiAvCiAgICAgICAgICAgIHBvcnQ6IHt7IC5WYWx1ZXMuc2VydmljZS5pbnRlcm5hbFBvcnQgfX0KICAgICAgICByZWFkaW5lc3NQcm9iZToKICAgICAgICAgIGh0dHBHZXQ6CiAgICAgICAgICAgIHBhdGg6IC8KICAgICAgICAgICAgcG9ydDoge3sgLlZhbHVlcy5zZXJ2aWNlLmludGVybmFsUG9ydCB9fQogICAgICAgIHJlc291cmNlczoKe3sgdG9ZYW1sIC5WYWx1ZXMucmVzb3VyY2VzIHwgaW5kZW50IDEyIH19Cg=="
        },
        {
          "name": "templates/service.yaml",
          "data": "YXBpVmVyc2lvbjogdjEKa2luZDogU2VydmljZQptZXRhZGF0YToKICBuYW1lOiB7eyB0ZW1wbGF0ZSAiZnVsbG5hbWUiIC4gfX0KICBsYWJlbHM6CiAgICBjaGFydDogInt7IC5DaGFydC5OYW1lIH19LXt7IC5DaGFydC5WZXJzaW9uIH19IgpzcGVjOgogIHR5cGU6IHt7IC5WYWx1ZXMuc2VydmljZS50eXBlIH19CiAgcG9ydHM6CiAgLSBwb3J0OiB7eyAuVmFsdWVzLnNlcnZpY2UuZXh0ZXJuYWxQb3J0IH19CiAgICB0YXJnZXRQb3J0OiB7eyAuVmFsdWVzLnNlcnZpY2UuaW50ZXJuYWxQb3J0IH19CiAgICBwcm90b2NvbDogVENQCiAgICBuYW1lOiB7eyAuVmFsdWVzLnNlcnZpY2UubmFtZSB9fQogIHNlbGVjdG9yOgogICAgYXBwOiB7eyB0ZW1wbGF0ZSAiZnVsbG5hbWUiIC4gfX0K"
        }
      ],
      "values": {
        "image": {
          "pullPolicy": "IfNotPresent",
          "repository": "nginx",
          "tag": "stable"
        },
        "replicaCount": 1,
        "resources": {
          "limits": {
            "cpu": "100m",
            "memory": "128Mi"
          },
          "requests": {
            "cpu": "100m",
            "memory": "128Mi"
          }
        },
        "service": {
          "externalPort": 80,
          "internalPort": 80,
          "name": "nginx",
          "type": "ClusterIP"
        }
      },
      "schema": null,
      "files": [
        {
          "name": ".helmignore",
          "data": "IyBQYXR0ZXJucyB0byBpZ25vcmUgd2hlbiBidWlsZGluZyBwYWNrYWdlcy4KIyBUaGlzIHN1cHBvcnRzIHNoZWxsIGdsb2IgbWF0Y2hpbmcsIHJlbGF0aXZlIHBhdGggbWF0Y2hpbmcsIGFuZAojIG5lZ2F0aW9uIChwcmVmaXhlZCB3aXRoICEpLiBPbmx5IG9uZSBwYXR0ZXJuIHBlciBsaW5lLgouRFNfU3RvcmUKIyBDb21tb24gVkNTIGRpcnMKLmdpdC8KLmdpdGlnbm9yZQouYnpyLwouYnpyaWdub3JlCi5oZy8KLmhnaWdub3JlCi5zdm4vCiMgQ29tbW9uIGJhY2t1cCBmaWxlcwoqLnN3cAoqLmJhawoqLnRtcAoqfgojIFZhcmlvdXMgSURFcwoucHJvamVjdAouaWRlYS8KKi50bXByb2oK"
        }
      ]
    },
    "manifest": "---\n# Source: mink/templates/service.yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: foo3-mink\n  labels:\n    chart: \"mink-0.1.0\"\nspec:\n  type: ClusterIP\n  ports:\n  - port: 80\n    targetPort: 80\n    protocol: TCP\n    name: nginx\n  selector:\n    app: foo3-mink\n---\n# Source: mink/templates/deployment.yaml\napiVersion: extensions/v1beta1\nkind: Deployment\nmetadata:\n  name: foo3-mink\n  labels:\n    chart: \"mink-0.1.0\"\nspec:\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: foo3-mink\n    spec:\n      containers:\n      - name: mink\n        image: \"nginx:stable\"\n        imagePullPolicy: IfNotPresent\n        ports:\n        - containerPort: 80\n        livenessProbe:\n          httpGet:\n            path: /\n            port: 80\n        readinessProbe:\n          httpGet:\n            path: /\n            port: 80\n        resources:\n            limits:\n              cpu: 100m\n              memory: 128Mi\n            requests:\n              cpu: 100m\n              memory: 128Mi\n",
    "version": 1,
    "namespace": "foo"
  }
]

If we really want an additional endpoint, then adding GET /api/helm/release?name=myRelease&namespace=myNS returning the full Helm release info for the given Helm release name and the namespace would be more useful in the long run.

@akashshinde
Copy link
Contributor Author

Closing this since the way Pregrag suggested is adequate.

@christianvogt
Copy link
Contributor

@sbose78 @pedjak
It would make more sense to support a single release in the API. Otherwise to display details of one release, we need to fetch all releases in the namespace and then filter client side, thus overfetching a lot of information.

@sbose78
Copy link

sbose78 commented Jan 27, 2020

Sure, before providing the API, I wanted to ensure we really want it.

@akashshinde akashshinde reopened this Jan 28, 2020
@akashshinde
Copy link
Contributor Author

/retest

@akashshinde akashshinde changed the title [WIP] Add helm endpoint to get manifests of installed release. Add helm endpoint to get manifests of installed release. Jan 28, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 28, 2020
@akashshinde
Copy link
Contributor Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 28, 2020
@akashshinde akashshinde force-pushed the helm_endpoints branch 2 times, most recently from d6a1800 to 9d6e0e8 Compare January 28, 2020 10:45
@akashshinde
Copy link
Contributor Author

/test e2e-gcp-console

@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 7, 2020
@akashshinde akashshinde requested a review from pedjak February 10, 2020 04:33
@akashshinde
Copy link
Contributor Author

/test backend

Copy link
Contributor

@pedjak pedjak left a comment

Choose a reason for hiding this comment

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

+1, I would make GetRelease function private.

@pedjak
Copy link
Contributor

pedjak commented Feb 11, 2020

/retitle Added helm endpoint to get infos about the given release

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 20, 2020
@christianvogt
Copy link
Contributor

@sbose78 no bugzilla needed right now to get into master / 4.5
We only need a bugzilla to get changes into 4.4.

This needs approval from someone else though @spadgett @benjaminapetersen @rhamilto

@christianvogt
Copy link
Contributor

@akashshinde you're going to want to squash your commits appropriately

Copy link
Member

Choose a reason for hiding this comment

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

403 is "Forbidden", 400 is "Bad Request". But it looks like we're actually returning "Bad Gateway"?

Copy link
Member

Choose a reason for hiding this comment

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

Check for errors?

Copy link
Member

Choose a reason for hiding this comment

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

This should be 405, Method Not Allowed, with an Allow response header

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2020
@pedjak
Copy link
Contributor

pedjak commented Feb 21, 2020

@christianvogt squeshed
@spadgett pushed fixes.

@akashshinde
Copy link
Contributor Author

/test e2e-gcp-console

1 similar comment
@akashshinde
Copy link
Contributor Author

/test e2e-gcp-console

@pedjak
Copy link
Contributor

pedjak commented Feb 24, 2020

/assign spadgett

@christianvogt
Copy link
Contributor

@benjaminapetersen needs approval for backend change

fyi @rohitkrai03

@akashshinde
Copy link
Contributor Author

/test backend

@pedjak
Copy link
Contributor

pedjak commented Feb 26, 2020

/retest

@akashshinde
Copy link
Contributor Author

/test e2e-gcp-console

1 similar comment
@akashshinde
Copy link
Contributor Author

/test e2e-gcp-console

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 27, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akashshinde, pedjak, spadgett

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 27, 2020
@openshift-merge-robot openshift-merge-robot merged commit da92d43 into openshift:master Feb 27, 2020
@spadgett spadgett added this to the v4.5 milestone Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/backend Related to backend lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants