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

Reference Starlark Function #4126

Closed
kferrone opened this issue Aug 18, 2021 · 8 comments
Closed

Reference Starlark Function #4126

kferrone opened this issue Aug 18, 2021 · 8 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/under-consideration

Comments

@kferrone
Copy link

kferrone commented Aug 18, 2021

I am particularly interested in using this example and modifying for myself: https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/someteam.example.com/v1/starlarkmixer

My issue is the mixer.star file must be relative of where my terminal is. So if I dom something like cd ../ the function will not reference the mixer.start anymore. I honestly would like to place the function in $XDG_CONFIG_HOME/kustomize/functions.

This way I always know where they are and they become reusable.

Here is the files I am using:
mixer.yaml

apiVersion: mmsg
kind: StarlarkMixer
metadata:
  name: mixer-instance
  annotations:
    # super strict here
    # can't use ../ nor can I use /
    config.kubernetes.io/function: |
      starlark:
        path: mixer.star 

conf.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: some-cm
data:
  foo: bar
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: delete-me

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- conf.yaml
transformers:
- mixer.yaml

How can I safely share the mixer file with any function who want to use it?

Shouldn't the reference to these files be like every other kind of reference and be relative to the file it's in. Then the $(pwd) in the terminal would not matter.

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 18, 2021
@KnVerey
Copy link
Contributor

KnVerey commented Sep 1, 2021

/assign @KnVerey

@KnVerey
Copy link
Contributor

KnVerey commented Sep 22, 2021

I agree that the path should not depend on the current working directory. It should be relative to the Kustomization including the transformer config, as we did for exec in #4125.

That said, there is an open proposal that includes deprecating dedicated starlark support: kubernetes/enhancements#2954. Although it has its advantages, it is a problem for us to maintain and notably causes a permanent inconsistency with kubectl kustomize due to the dependencies it requires. We would accept a PR to fix this issue in the meantime, but you may wish to consider using container- or exec-based function invocation instead in light of that (still tentative) plan.

/triage accepted
/kind bug
/unassign

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. kind/bug Categorizes issue or PR as related to a bug. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Sep 22, 2021
@kferrone
Copy link
Author

I was only curious about Starlark. Not too worried if it gets deprecated. I did like the idea of a dedicated scripting language for Kustomize. I am wondering though the direction of plugins vs functions in kustomize? Are plugins and functions two different ideas and one is going to win over the other? Or are they two separate ideas and they will live alongside each other?

@KnVerey
Copy link
Contributor

KnVerey commented Sep 22, 2021

I'd characterize functions as a subcategory of plugins, and yes, the KEP proposes retaining function-style Exec and Container plugins only, and deprecating the rest. Please read the Motivation section for more background.

@KnVerey KnVerey added triage/under-consideration and removed triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Sep 30, 2021
@k8s-ci-robot
Copy link
Contributor

@kferrone: This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Sep 30, 2021
@KnVerey KnVerey removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Sep 30, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 29, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 28, 2022
@kferrone
Copy link
Author

new updates and new ideas. No need for this issue. Starlark is getting deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/under-consideration
Projects
None yet
Development

No branches or pull requests

4 participants