如何通过Oracle Function删除Pod?

问题描述 投票:0回答:1

我在OKE内有一个带有一些部署/服务/等...的集群,通常我从我的电脑通过kubectl连接到该集群。

问题是:是否可以从Oracle Function中删除该集群内的Pod?我想做的是建立一条CI / CD链,通过网关触发我的功能以执行我的“ ci-function”,这部分工作得很好。

我正在使用oci-go-sdk在Go中编写函数,但这是问题所在:

我可以通过以下方式获取群集的Kubeconfig文件:

   resp, err := client.CreateKubeconfig(ctx, containerengine.CreateKubeconfigRequest{

  ClusterId: &cID,

  })

但是此Kubeconfig文件包含:

- name: user-**********
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - ce
      - cluster
      - generate-token
      - --cluster-id
      - ocid1.cluster.oc1.*************************
      - --region
      - eu-frankfurt-1
      command: oci
      env: []

需要在功能env内安装oci,但我无法安装。

[此外,oci-cli使用的是开源的,以下是生成此处使用的令牌的有趣部分:https://github.com/oracle/oci-cli/blob/cf04fa4f08238cb1ee4287f0354603ba92e60647/services/container_engine/src/oci_cli_co…但是我无法重新创建此部分并直接在kubeconfig中使用它。

有人知道这样做的任何方法吗?

提前感谢

oci oracle-cloud-infrastructure fn oci-go-sdk
1个回答
0
投票

您应该能够使用Go SDK来更新https://docs.cloud.oracle.com/en-us/iaas/Content/API/SDKDocs/gosdk.htm中提到的OCI函数中的集群和NodePool。>

或者,您还应该能够在OCI函数中的Go代码中启动HTTP客户端,并调用OKE的UpdateCluster和UpdateNodePool REST API,例如, https://docs.cloud.oracle.com/en-us/iaas/api/#/en/containerengine/20180222/NodePool/UpdateNodePool

© www.soinside.com 2019 - 2024. All rights reserved.