create a garden file of this cmdkubectl apply -n t...
# 🤖|ask-kapa
g
@microscopic-river-74022 create a garden file of this cmd kubectl apply -n tikv -f https://raw.githubusercontent.com/pingcap/tidb-operator/v1.4.5/examples/basic/tidb-cluster.yaml
m
Please stand by @gentle-umbrella-55872 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
---------------------- To create a Garden configuration file that applies the same Kubernetes manifest as your
kubectl apply
command, you would use a
Deploy
action of type
kubernetes
. Here's an example:
Copy code
yaml
kind: Deploy
name: tikv
type: kubernetes
description: Deploy a TiDB cluster
spec:
  manifests:
    - apiVersion: v1
      kind: Namespace
      metadata:
        name: tikv
    - apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: tidb-cluster
        namespace: tikv
      spec:
        # ... rest of the tidb-cluster.yaml content goes here ...
In this example, you would replace the
# ... rest of the tidb-cluster.yaml content goes here ...
comment with the actual content of the
tidb-cluster.yaml
file you're applying. Please note that Garden does not currently support fetching Kubernetes manifests from URLs directly in the
garden.yml
file. You would need to download the
tidb-cluster.yaml
file and include its content in the
garden.yml
file. For more information on how to use Garden with Kubernetes, you can refer to the Garden documentation (). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
message has been deleted
g
@microscopic-river-74022 can is reference to the url?
m
Let me check the knowledge base for you. One moment! :books:
---------------------- I'm sorry, but according to the provided knowledge sources, Garden does not currently support referencing a URL for a Kubernetes manifest directly in the
garden.yml
file. You would need to download the manifest file and include its content in the
garden.yml
file. However, Garden does support referencing a remote git repository URL in the
repositoryUrl
field for certain module types and actions. This URL must point to a git server and contain a hash suffix pointing to a specific branch or tag. For example:
Copy code
yaml
modules:
 - repositoryUrl: "git+<https://github.com/org/repo.git#v2.0">
In this case, Garden will import the repository source code into this module, but read the module's config from the local
garden.yml
file. You can find more information about this in the Garden documentation (). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
message has been deleted
b
I'd absolutely go the route of using helm to install if you can @gentle-umbrella-55872 - it simplifies the process. It hink there are helm charts available for this?
g
I try to follow this tutorial. there they mentioned to create a Custom Resource by this way but the software TiDB itself is already hosted by a helm chart: https://surrealdb.com/docs/surrealdb/deployment/kubernetes#2-create-the-tidb-cluster Here i opened a thread to get this tutorial running https://discord.com/channels/817392104711651328/1241787261683761243
b
Honestly, in that case - I tend to copy those manifests in to my Kubernetes module to deploy it - I want to be in charge of changing versions so whether its pointing to remote URL or I've just copied the CRD it makes no difference to me.
g
Thank you @big-solstice-45894 for sharing you approaches 🙂 i already try to copy the CRDs (https://raw.githubusercontent.com/pingcap/tidb-operator/v1.5.3/manifests/crd.yaml) into a local file, sadly i get the following error:
Copy code
sh
Failed to apply Kubernetes manifests. This is the output of the kubectl command:

Warning: resource customresourcedefinitions/tidbclusters.pingcap.com is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
The CustomResourceDefinition "tidbclusters.pingcap.com" is invalid: metadata.annotations: Too long: must have at most 262144 bytes
Also i tired to seperate the large into multiple smaller files, but there is still one very large left wich will still trigger the same error (https://github.com/pingcap/tidb-operator/blob/master/manifests/crd/v1/pingcap.com_tidbclusters.yaml)
Just for testing, adding
Copy code
ts
  args.push("--server-side=true")
after line 122 in https://github.com/garden-io/garden/blob/main/core/src/plugins/kubernetes/kubectl.ts#L122 it's working 😅