-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zespre Chang <[email protected]>
- Loading branch information
Showing
4 changed files
with
313 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,12 @@ RUN if [ "${ARCH}" = "amd64" ]; then \ | |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2; \ | ||
fi | ||
|
||
## install controller-gen | ||
RUN go install sigs.k8s.io/controller-tools/cmd/[email protected] | ||
|
||
ENV DAPPER_ENV REPO PUSH TAG DRONE_TAG ARCH | ||
ENV DAPPER_SOURCE /go/src/github.com/harvester/vm-dhcp-controller | ||
ENV DAPPER_OUTPUT ./bin ./dist | ||
ENV DAPPER_OUTPUT ./bin ./dist ./chart/crds | ||
ENV DAPPER_DOCKER_SOCKET true | ||
WORKDIR ${DAPPER_SOURCE} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
{} | ||
name: ippools.network.harvesterhci.io | ||
spec: | ||
group: network.harvesterhci.io | ||
names: | ||
kind: IPPool | ||
listKind: IPPoolList | ||
plural: ippools | ||
shortNames: | ||
- ippl | ||
- ippls | ||
singular: ippool | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .spec.networkName | ||
name: NETWORK | ||
type: string | ||
- jsonPath: .status.ipv4.available | ||
name: AVAILABLE | ||
type: integer | ||
- jsonPath: .status.ipv4.used | ||
name: USED | ||
type: integer | ||
- jsonPath: .status.conditions[?(@.type=='Registered')].status | ||
name: REGISTERED | ||
type: string | ||
- jsonPath: .status.conditions[?(@.type=='CacheReady')].status | ||
name: CACHEREADY | ||
type: string | ||
- jsonPath: .status.conditions[?(@.type=='AgentReady')].status | ||
name: AGENTREADY | ||
type: string | ||
- jsonPath: .metadata.creationTimestamp | ||
name: AGE | ||
type: date | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
properties: | ||
apiVersion: | ||
description: |- | ||
APIVersion defines the versioned schema of this representation of an object. | ||
Servers should convert recognized schemas to the latest internal value, and | ||
may reject unrecognized values. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | ||
type: string | ||
kind: | ||
description: |- | ||
Kind is a string value representing the REST resource this object represents. | ||
Servers may infer this from the endpoint the client submits requests to. | ||
Cannot be updated. | ||
In CamelCase. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
properties: | ||
ipv4Config: | ||
properties: | ||
cidr: | ||
type: string | ||
dns: | ||
items: | ||
type: string | ||
type: array | ||
domainName: | ||
type: string | ||
domainSearch: | ||
items: | ||
type: string | ||
type: array | ||
leaseTime: | ||
type: integer | ||
ntp: | ||
items: | ||
type: string | ||
type: array | ||
pool: | ||
properties: | ||
end: | ||
type: string | ||
exclude: | ||
items: | ||
type: string | ||
type: array | ||
start: | ||
type: string | ||
type: object | ||
router: | ||
type: string | ||
serverIP: | ||
type: string | ||
type: object | ||
networkName: | ||
type: string | ||
paused: | ||
type: boolean | ||
type: object | ||
status: | ||
properties: | ||
agentPodRef: | ||
properties: | ||
name: | ||
type: string | ||
namespace: | ||
type: string | ||
type: object | ||
conditions: | ||
items: | ||
properties: | ||
lastTransitionTime: | ||
description: Last time the condition transitioned from one status | ||
to another. | ||
type: string | ||
lastUpdateTime: | ||
description: The last time this condition was updated. | ||
type: string | ||
message: | ||
description: Human-readable message indicating details about | ||
last transition | ||
type: string | ||
reason: | ||
description: The reason for the condition's last transition. | ||
type: string | ||
status: | ||
description: Status of the condition, one of True, False, Unknown. | ||
type: string | ||
type: | ||
description: Type of cluster condition. | ||
type: string | ||
required: | ||
- status | ||
- type | ||
type: object | ||
type: array | ||
ipv4: | ||
properties: | ||
allocated: | ||
additionalProperties: | ||
type: string | ||
type: object | ||
available: | ||
type: integer | ||
used: | ||
type: integer | ||
required: | ||
- available | ||
- used | ||
type: object | ||
lastUpdate: | ||
format: date-time | ||
type: string | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: {} |
116 changes: 116 additions & 0 deletions
116
chart/crds/network.harvesterhci.io_virtualmachinenetworkconfigs.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
{} | ||
name: virtualmachinenetworkconfigs.network.harvesterhci.io | ||
spec: | ||
group: network.harvesterhci.io | ||
names: | ||
kind: VirtualMachineNetworkConfig | ||
listKind: VirtualMachineNetworkConfigList | ||
plural: virtualmachinenetworkconfigs | ||
shortNames: | ||
- vmnetcfg | ||
- vmnetcfgs | ||
singular: virtualmachinenetworkconfig | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .spec.vmName | ||
name: VMNAME | ||
type: string | ||
- jsonPath: .status.conditions[?(@.type=='Allocated')].status | ||
name: ALLOCATED | ||
type: string | ||
- jsonPath: .metadata.creationTimestamp | ||
name: AGE | ||
type: date | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
properties: | ||
apiVersion: | ||
description: |- | ||
APIVersion defines the versioned schema of this representation of an object. | ||
Servers should convert recognized schemas to the latest internal value, and | ||
may reject unrecognized values. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | ||
type: string | ||
kind: | ||
description: |- | ||
Kind is a string value representing the REST resource this object represents. | ||
Servers may infer this from the endpoint the client submits requests to. | ||
Cannot be updated. | ||
In CamelCase. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
properties: | ||
networkConfig: | ||
items: | ||
properties: | ||
ipAddress: | ||
type: string | ||
macAddress: | ||
type: string | ||
networkName: | ||
type: string | ||
type: object | ||
type: array | ||
paused: | ||
type: boolean | ||
vmName: | ||
type: string | ||
type: object | ||
status: | ||
properties: | ||
conditions: | ||
items: | ||
properties: | ||
lastTransitionTime: | ||
description: Last time the condition transitioned from one status | ||
to another. | ||
type: string | ||
lastUpdateTime: | ||
description: The last time this condition was updated. | ||
type: string | ||
message: | ||
description: Human-readable message indicating details about | ||
last transition | ||
type: string | ||
reason: | ||
description: The reason for the condition's last transition. | ||
type: string | ||
status: | ||
description: Status of the condition, one of True, False, Unknown. | ||
type: string | ||
type: | ||
description: Type of cluster condition. | ||
type: string | ||
required: | ||
- status | ||
- type | ||
type: object | ||
type: array | ||
networkConfig: | ||
items: | ||
properties: | ||
allocatedIPAddress: | ||
type: string | ||
macAddress: | ||
type: string | ||
networkName: | ||
type: string | ||
state: | ||
type: string | ||
type: object | ||
type: array | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "Generating manifests..." | ||
|
||
# The root of the project directory | ||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" | ||
|
||
out_dir="${ROOT_DIR}/chart/crds" | ||
mkdir -p "${out_dir}" | ||
|
||
# Clean up stable CRD manifest YAMLs | ||
rm -rf "${out_dir}/*.yaml" | ||
|
||
# Generate CRD manifest YAMLs | ||
controller-gen crd \ | ||
paths="${ROOT_DIR}/pkg/apis/..." \ | ||
output:crd:dir="${out_dir}" | ||
|
||
# Remove controller-gen version info | ||
while read -r target_file; do | ||
if [[ ! -f ${target_file} ]]; then | ||
continue | ||
fi | ||
if ! sed -i 's/controller-gen\.kubebuilder\.io\/version:.*/{}/g' "${target_file}" >/dev/null 2>&1; then | ||
# back off none GNU sed | ||
sed -i '' 's/controller-gen\.kubebuilder\.io\/version:.*/{}/g' "${target_file}" | ||
fi | ||
done <<<"$(grep -rl "controller-gen.kubebuilder.io/version:" "${out_dir}")" |