{"id":21518153,"url":"https://github.com/ucloud/uk8s-cni-vpc","last_synced_at":"2025-04-09T21:44:59.036Z","repository":{"id":64297478,"uuid":"557753283","full_name":"ucloud/uk8s-cni-vpc","owner":"ucloud","description":"The underlay container networking plugin for UK8S based on UVPC.","archived":false,"fork":false,"pushed_at":"2024-12-18T06:02:37.000Z","size":289,"stargazers_count":7,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-23T23:36:05.911Z","etag":null,"topics":["cni-plugin","kubernetes"],"latest_commit_sha":null,"homepage":"https://docs.ucloud.cn/uk8s/network/uk8s_network","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ucloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-26T08:35:49.000Z","updated_at":"2025-03-13T05:23:56.000Z","dependencies_parsed_at":"2023-11-23T07:21:58.168Z","dependency_job_id":"c7b7cf5a-011c-45c2-bf5c-bc4c1e362328","html_url":"https://github.com/ucloud/uk8s-cni-vpc","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ucloud%2Fuk8s-cni-vpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ucloud%2Fuk8s-cni-vpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ucloud%2Fuk8s-cni-vpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ucloud%2Fuk8s-cni-vpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ucloud","download_url":"https://codeload.github.com/ucloud/uk8s-cni-vpc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119438,"owners_count":21050754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cni-plugin","kubernetes"],"created_at":"2024-11-24T00:50:20.499Z","updated_at":"2025-04-09T21:44:59.008Z","avatar_url":"https://github.com/ucloud.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eUCloud K8s CNI-VPC Plugin\u003c/h1\u003e\n\nThis is a [CNI plugin](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/) to implement the underlay container networking based on [UCloud VPC 2.0](https://docs.ucloud.cn/vpc/README).\n\n## Install\n\nThe `uk8s-cni-vpc` will be installed in the uk8s cluster by default, and you do not need to perform additional installation operations.\n\nYou can login to any machine in the uk8s cluster and confirm the plugin version with the following command:\n\n```bash\n/opt/cni/bin/cnivpc version\n```\n\nThe [ipamd](https://docs.ucloud.cn/uk8s/network/ipamd) is an independent component of the plugin that manages the IP addresses of Pods. It is deployed in the form of [DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/), and you can check the version of ipamd through the following command:\n\n```bash\nkubectl get -n kube-system ds cni-vpc-ipamd -oyaml\n```\n\nFor more information, please refer to our documentation.\n\n## Documentation\n\nYou can find complete documentation about the UK8S cluster network [here](https://docs.ucloud.cn/uk8s/network/uk8s_network).\n\n## Contribution\n\n### Generate grpc code\n\nIf you modify the file [rpc/ipamd.proto](rpc/ipamd.proto), the grpc code needs to be regenerated.\n\nThe grpc code generation is based on the [protoc](https://developers.google.com/protocol-buffers/docs/downloads) tool. You have to make sure it is properly installed on your system. You can install it through different ways, such as package managers of different systems:\n\n```bash\nsudo pacman -S protoc        # For archlinux\nbrew install protoc          # For macos\nsudo apt-get install protoc  # For ubuntu or debain\nyum install protoc           # For centos\n```\n\nIn addition, [protoc-gen-go](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go) needs to be installed, which can be done by the following command:\n\n```bash\ngo install github.com/golang/protobuf/protoc-gen-go@latest\n```\n\nNow, you can regenerate the grpc code:\n\n```bash\nmake generate-grpc\n```\n\nView the differences:\n\n```bash\ngit diff rpc/*.go\n```\n\n### Generate kubernetes code\n\n`uk8s-cni-vpc` needs to use some [Kubernetes Custom Resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/). These Custom Resources are defined in the [kubernetes/apis](kubernetes/apis) directory.\n\nIf you modify the `types.go` file, the code needs to be regenerated, you can run the following command:\n\n```bash\nmake generate-k8s\n```\n\nIf you want to create a new Custom Resource, you need to create the corresponding files under the [kubernetes/apis](kubernetes/apis) directory. You can use the Custom Resource has already been created as example, such as [kubernetes/apis/ipamd](kubernetes/apis/ipamd).\n\nThe new Custom Resource also needs to be added in [hack/update-codegen.sh](hack/update-codegen.sh).\n\nThere are two places that need to be changed. First, find the `bash code-generator/generate-groups.sh` command and add your new Custom Resource to the args. Suppose the new Custom Resource is called `example` and the version is `v1beta1`, the updated command will be:\n\n```bash\nbash code-generator/generate-groups.sh \"deepcopy,client,informer,lister\" \\\n  github.com/ucloud/uk8s-cni-vpc/kubernetes/generated  github.com/ucloud/uk8s-cni-vpc/kubernetes/apis \\\n  \"ipamd:v1beta1 vipcontroller:v1beta1 example:v1beta1\" \\ # Add your new CR here\n  --output-base generated_tmp \\\n  --go-header-file hack/boilerplate.go.txt\n```\n\nThen, you also need to add the copy command of the deepcopy file before `rm -rf generated_tmp`:\n\n```bash\ncp -r generated_tmp/github.com/ucloud/uk8s-cni-vpc/kubernetes/apis/exmaple/v1beta1/zz_generated.deepcopy.go ./kubernetes/apis/example/v1beta1\n```\n\nDon't forget to replace `exmaple` and `v1beta1` with your own Custom Resource name and version.\n\nFinally, use `make generate-k8s`, the new Custom Resource code will be generated.\n\nIn addition, Custom Resource's yaml needs to be written manually, which is generally defined under [deploy](deploy) directory, you can refer to the following example:\n\n```yaml\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n  name: ipamds.vpc.uk8s.ucloud.cn\nspec:\n  group: vpc.uk8s.ucloud.cn\n  versions:\n    - name: v1beta1\n      served: true\n      storage: true\n      schema:\n        openAPIV3Schema:\n          type: object\n          properties:\n            spec:\n              type: object\n              properties:\n              # TODO: change spec fields here.\n            status:\n              type: object\n              properties:\n              # TODO: change status fields here.\n  scope: Namespaced\n  names:\n    plural: ipamds\n    singular: ipamd\n    kind: Ipamd\n```\n\n### Build\n\nRequires your machine to have **Docker** and **Golang** to build cnivpc. Please use the following command to build:\n\n```bash\nmake cnivpc-bin     # Build cnivpc binary files only\nmake cnivpc         # Build cnivpc binary files and docker image\nmake ipamd          # Build ipamd binary file and docker image\nmake vip-controller # Build vip-controller binary file and docker image\n```\n\n### Release\n\nAs long as you create a tag, all docker images will be automatically built and published through [Github Action](https://docs.github.com/en/actions). See: [release workflow](.github/workflows/release.yml).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fucloud%2Fuk8s-cni-vpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fucloud%2Fuk8s-cni-vpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fucloud%2Fuk8s-cni-vpc/lists"}