Skip to content

Commit a20e2c2

Browse files
authored
feat: Initial working Nutanix IPAM CAPI provider (#1)
1 parent 5d56001 commit a20e2c2

File tree

107 files changed

+8783
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+8783
-1
lines changed

.envrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Automatically sets up your devbox environment whenever you cd into this
2+
# directory via our direnv integration:
3+
4+
eval "$(devbox generate direnv --print-envrc)"
5+
6+
# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
7+
# for more details

.github/actionlint.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright 2024 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
self-hosted-runner:
5+
# Labels of self-hosted runner in array of string
6+
labels:
7+
- self-hosted-ncn-dind

.github/dependabot.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2023 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# To get started with Dependabot version updates, you'll need to specify which
5+
# package ecosystems to update and where the package manifests are located.
6+
# Please see the documentation for all configuration options:
7+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
8+
9+
version: 2
10+
updates:
11+
- package-ecosystem: "gomod"
12+
directories:
13+
- "/"
14+
schedule:
15+
interval: "weekly"
16+
groups:
17+
all-go-mod-patch-and-minor:
18+
patterns: [ "*" ]
19+
update-types: [ "patch", "minor" ]
20+
ignore:
21+
# Ignore controller-runtime major and minor as it's upgraded together with sigs.k8s.io/cluster-api.
22+
- dependency-name: "sigs.k8s.io/controller-runtime"
23+
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
24+
# Ignore k8s modules major and minor as they are upgraded together with controller-runtime.
25+
- dependency-name: "k8s.io/*"
26+
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
27+
# Ignore ntnx-api-golang-clients modules major, minor, and patch as they are upgraded together with prism-go-client.
28+
- dependency-name: "github.com/nutanix/ntnx-api-golang-clients/*"
29+
update-types: [ "version-update:semver-major", "version-update:semver-minor", "version-update:semver-patch" ]
30+
31+
- package-ecosystem: "npm"
32+
directory: "/docs"
33+
schedule:
34+
interval: "weekly"
35+
36+
- package-ecosystem: "github-actions"
37+
directory: "/"
38+
schedule:
39+
interval: "weekly"

.github/pull_request_template.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
**What problem does this PR solve?**:
2+
3+
**Which issue(s) this PR fixes**:
4+
Fixes #
5+
6+
**How Has This Been Tested?**:
7+
<!--
8+
Please describe the tests that you ran to verify your changes.
9+
Provide output from the tests and any manual steps needed to replicate the tests.
10+
-->
11+
12+
**Special notes for your reviewer**:
13+
<!--
14+
Use this to provide any additional information to the reviewers.
15+
This may include:
16+
- Best way to review the PR.
17+
- Where the author wants the most review attention on.
18+
- etc.
19+
-->

.github/release.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2023 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
changelog:
5+
exclude:
6+
labels:
7+
- ignore-for-release
8+
- dependencies
9+
authors:
10+
- octocat
11+
- dependabot
12+
categories:
13+
- title: Breaking Changes 🛠
14+
labels:
15+
- breaking
16+
- title: Exciting New Features 🎉
17+
labels:
18+
- feature
19+
- title: Fixes 🔧
20+
labels:
21+
- fix
22+
- title: Other Changes
23+
labels:
24+
- "*"

.github/workflows/backport.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2023 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
on:
5+
pull_request_target:
6+
types:
7+
- labeled
8+
- closed
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
backport:
16+
name: Backport PR
17+
runs-on: ubuntu-22.04
18+
if: |
19+
github.event.pull_request.merged == true
20+
&& contains(github.event.pull_request.labels.*.name, 'auto-backport')
21+
&& (
22+
(github.event.action == 'labeled' && github.event.label.name == 'auto-backport')
23+
|| (github.event.action == 'closed')
24+
)
25+
steps:
26+
- name: Backport Action
27+
uses: sqren/[email protected]
28+
with:
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
auto_backport_label_prefix: backport-to-
31+
32+
- name: Backport log
33+
if: always()
34+
run: cat /home/runner/.backport/backport.log

.github/workflows/checks.yml

+200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Copyright 2023 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: checks
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
types:
12+
- opened
13+
- synchronize
14+
- reopened
15+
merge_group:
16+
types:
17+
- checks_requested
18+
19+
permissions:
20+
contents: read
21+
22+
defaults:
23+
run:
24+
shell: bash
25+
26+
jobs:
27+
unit-test:
28+
runs-on: ubuntu-22.04
29+
steps:
30+
- name: Check out code
31+
uses: actions/checkout@v4
32+
33+
- name: Install devbox
34+
uses: jetify-com/[email protected]
35+
with:
36+
enable-cache: true
37+
38+
- name: Go cache
39+
uses: actions/cache@v4
40+
with:
41+
path: |
42+
~/.cache/go-build
43+
~/go/pkg/mod
44+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
45+
restore-keys: |
46+
${{ runner.os }}-go-
47+
48+
- name: Run unit tests
49+
run: devbox run -- make test
50+
51+
- name: Annotate tests
52+
if: always()
53+
uses: guyarb/[email protected]
54+
with:
55+
test-results: test.json
56+
57+
lint-go:
58+
runs-on: ubuntu-22.04
59+
permissions:
60+
contents: read
61+
pull-requests: write
62+
steps:
63+
- name: Check out code
64+
uses: actions/checkout@v4
65+
66+
- name: Install devbox
67+
uses: jetify-com/[email protected]
68+
with:
69+
enable-cache: true
70+
71+
- name: Export golang and golangci-lint versions
72+
id: versions
73+
run: |
74+
echo "golangci-lint=$(devbox run -- golangci-lint version --format short)" >>"${GITHUB_OUTPUT}"
75+
echo "golang=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>"${GITHUB_OUTPUT}"
76+
77+
- name: golangci-lint
78+
uses: reviewdog/action-golangci-lint@v2
79+
with:
80+
fail_on_error: true
81+
reporter: github-pr-review
82+
golangci_lint_version: v${{ steps.versions.outputs.golangci-lint }}
83+
go_version: v${{ steps.versions.outputs.golang }}
84+
golangci_lint_flags: "--config=${{ github.workspace }}/.golangci.yml"
85+
86+
lint-gha:
87+
runs-on: ubuntu-22.04
88+
permissions:
89+
contents: read
90+
pull-requests: write
91+
steps:
92+
- name: Check out code
93+
uses: actions/checkout@v4
94+
95+
- name: actionlint
96+
uses: reviewdog/action-actionlint@v1
97+
with:
98+
fail_on_error: true
99+
reporter: github-pr-review
100+
101+
pre-commit:
102+
runs-on: ubuntu-22.04
103+
steps:
104+
- name: Check out code
105+
uses: actions/checkout@v4
106+
with:
107+
ref: ${{ github.event.pull_request.head.sha }}
108+
109+
- name: Install devbox
110+
uses: jetify-com/[email protected]
111+
with:
112+
enable-cache: true
113+
114+
- name: Go cache
115+
uses: actions/cache@v4
116+
with:
117+
path: |
118+
~/.cache/go-build
119+
~/go/pkg/mod
120+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
121+
restore-keys: |
122+
${{ runner.os }}-go-
123+
124+
- name: Set up pre-commit cache
125+
uses: actions/cache@v4
126+
with:
127+
path: ~/.cache/pre-commit
128+
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }}
129+
130+
- name: Run pre-commit
131+
run: devbox run -- make pre-commit
132+
env:
133+
SKIP: no-commit-to-branch,golangci-lint,actionlint-system
134+
135+
lint-test-helm:
136+
runs-on: ubuntu-22.04
137+
env:
138+
KIND_CLUSTER_NAME: chart-testing
139+
KIND_KUBECONFIG: ct-kind-kubeconfig
140+
steps:
141+
- name: Checkout
142+
uses: actions/checkout@v4
143+
with:
144+
fetch-depth: 0
145+
146+
- name: Install devbox
147+
uses: jetify-com/[email protected]
148+
with:
149+
enable-cache: true
150+
151+
- name: Run chart-testing (list-changed)
152+
id: list-changed
153+
run: |
154+
changed="$(devbox run -- \
155+
ct list-changed --config charts/ct-config.yaml \
156+
)"
157+
if [[ -n "$changed" ]]; then
158+
echo "changed=true" >> "$GITHUB_OUTPUT"
159+
fi
160+
161+
- if: steps.list-changed.outputs.changed == 'true'
162+
name: Run chart-testing (lint)
163+
run: |
164+
devbox run -- \
165+
ct lint --config charts/ct-config.yaml
166+
167+
- if: steps.list-changed.outputs.changed == 'true'
168+
name: Create kind cluster
169+
run: devbox run -- make kind.create
170+
171+
- if: steps.list-changed.outputs.changed == 'true'
172+
name: Build Docker images
173+
run: devbox run -- make release-snapshot
174+
175+
- if: steps.list-changed.outputs.changed == 'true'
176+
name: Sideload docker image
177+
run: |
178+
devbox run -- \
179+
kind load docker-image \
180+
--name "${KIND_CLUSTER_NAME}" \
181+
"ko.local/${{ github.event.repository.name }}:$(devbox run -- gojq -r '.version+"-"+.runtime.goarch' dist/metadata.json)"
182+
183+
- if: steps.list-changed.outputs.changed == 'true'
184+
name: Setup Cluster API and cert-manager
185+
run: devbox run -- make clusterctl.init
186+
187+
- if: steps.list-changed.outputs.changed == 'true'
188+
name: Run chart-testing (install)
189+
run: |
190+
devbox run -- \
191+
ct install \
192+
--config charts/ct-config.yaml \
193+
--helm-extra-set-args "--set-string image.repository=ko.local/${{ github.event.repository.name }} --set-string image.tag=$(devbox run -- gojq -r '.version+"-"+.runtime.goarch' dist/metadata.json)"
194+
env:
195+
KUBECONFIG: ${{ env.KIND_KUBECONFIG }}
196+
197+
- if: steps.list-changed.outputs.changed == 'true' && always()
198+
name: Delete chart-testing KinD cluster
199+
run: |
200+
devbox run -- make kind.delete

.github/workflows/codeql-analysis.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2023 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: codeql
5+
6+
on:
7+
schedule:
8+
- cron: '32 21 * * 2'
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
analyze:
16+
name: Analyze
17+
runs-on: ubuntu-22.04
18+
permissions:
19+
actions: read
20+
contents: read
21+
security-events: write
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
language: [ 'go' ]
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Initialize CodeQL
33+
uses: github/codeql-action/init@v3
34+
with:
35+
languages: ${{ matrix.language }}
36+
37+
- name: Install devbox
38+
uses: jetify-com/[email protected]
39+
with:
40+
enable-cache: true
41+
42+
- name: Build
43+
run: devbox run -- make build-snapshot
44+
45+
- name: Perform CodeQL Analysis
46+
uses: github/codeql-action/analyze@v3
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2023 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: conventional-release-labels
5+
on:
6+
pull_request_target:
7+
types:
8+
- opened
9+
- edited
10+
jobs:
11+
label:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- uses: bcoe/conventional-release-labels@v1

0 commit comments

Comments
 (0)