carvel-dev / carvel-dev/kapp-controller

Add ability to fetch resources from the cluster

Open
#410 24 comments 8 reactions 0 assignees View on GitHub
carvel-accepted enhancement priority/important-longterm
Dominant language
Go
Stars
323
Forks
127
Avg merge
2d 10h
Merged PRs (30d)
6

Description

**Describe the problem/challenge you have**
I need as part of my packages processing to query information that lives in the cluster so that I can take some decisions. An example would be that my package would create HTTPProxy resources if contour is available in the cluster, otherwise it would use Ingress.
Currently, the user needs to query for that information and provide it as a data value to the instantiation of a PackageInstall (via de data values secret)

**Describe the solution you'd like**
We have been thinking of 2 possible ways of achieving this:

Adding a fetch capabillity that will query resources from the cluster and that will use as data.values:
```
apiVersion: data.packaging.carvel.dev/v1alpha1
kind: Package
metadata:
name: package.example.com.1.0.0
spec:
refName: package.example.com
version: 1.0.0
template:
spec:
fetch:
- imgpkgBundle:
image: registry.tkg.vmware.run/tkg-fluent-bit@sha256:...
- resources:
- name: contour
kind: Deployment
namespace: projectcontour
template:
- ytt:
paths:
- config/
- kbld:
paths:
# - must be quoted when included with paths
- "-"
- .imgpkg/images.yml
deploy:
- kapp: {}
```
There's some dependency work in progress, but this would get specific details about the existing resources so that information can be used as data values.

The other option would be to extend the PackageInstall:

```
apiVersion: packaging.carvel.dev/v1alpha1
kind: PackageInstall
metadata:
name: package
spec:
serviceAccountName: package-sa
packageRef:
refName: package.example.com
versionSelection:
constraints: ">v1.0.0"
prereleases: {}
values:
- secretRef:
name: package-values
- resourceRef:
name: contour
kind: Deployment
namespace: projectcontour
```

This are just to possible implementation options to address the feature, but it's really needed to be able to query existing resources in the cluster for data-values.

cc/ @grahamdumpleton

---
Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.