Skip to content

Commit

Permalink
Merge pull request #3 from kvaps/upd-controller-gen
Browse files Browse the repository at this point in the history
Update controller-gen
  • Loading branch information
kvaps authored May 16, 2022
2 parents 7dd2859 + a394761 commit a14eb1b
Show file tree
Hide file tree
Showing 6 changed files with 278 additions and 304 deletions.
27 changes: 5 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

# Image URL to use all building/pushing image targets
IMG ?= docker.io/kvaps/dnsmasq-controller:latest
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand All @@ -11,6 +9,8 @@ else
GOBIN=$(shell go env GOBIN)
endif

CONTROLLER_GEN = go run sigs.k8s.io/controller-tools/cmd/[email protected]

all: manager

# Run tests
Expand Down Expand Up @@ -48,8 +48,8 @@ deploy: manifests
kubectl apply -n default -f config/controller/dhcp-server.yaml

# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=dnsmasq-controller paths="./..." output:crd:artifacts:config=config/crd/bases
manifests:
$(CONTROLLER_GEN) crd rbac:roleName=dnsmasq-controller paths="./..." output:crd:artifacts:config=config/crd/bases

# Run go fmt against code
fmt:
Expand All @@ -60,7 +60,7 @@ vet:
go vet ./...

# Generate code
generate: controller-gen
generate:
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

# Build the docker image
Expand All @@ -70,20 +70,3 @@ docker-build: test
# Push the docker image
docker-push:
docker push ${IMG}

# find or download controller-gen
# download controller-gen if necessary
controller-gen:
ifeq (, $(shell which controller-gen))
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/[email protected] ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif
130 changes: 64 additions & 66 deletions config/crd/bases/dnsmasq.kvaps.cf_dhcphosts.yaml
Original file line number Diff line number Diff line change
@@ -1,88 +1,86 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: dhcphosts.dnsmasq.kvaps.cf
spec:
additionalPrinterColumns:
- JSONPath: .spec.controller
name: Controller
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: dnsmasq.kvaps.cf
names:
kind: DhcpHosts
listKind: DhcpHostsList
plural: dhcphosts
singular: dhcphosts
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
description: DhcpHosts is the Schema for the dhcphosts API
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:
description: DhcpHostsSpec defines the desired state of DhcpHosts
properties:
controller:
type: string
hosts:
items:
description: DnsmasqDhcpHost holds the mapping between Macs and IP
that will be added to dnsmasq dhcp-hosts file.
properties:
clientID:
type: string
hostname:
type: string
ignore:
type: boolean
ip:
type: string
leaseTime:
type: string
macs:
items:
versions:
- additionalPrinterColumns:
- jsonPath: .spec.controller
name: Controller
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: DhcpHosts is the Schema for the dhcphosts API
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:
description: DhcpHostsSpec defines the desired state of DhcpHosts
properties:
controller:
type: string
hosts:
items:
description: DnsmasqDhcpHost holds the mapping between Macs and
IP that will be added to dnsmasq dhcp-hosts file.
properties:
clientID:
type: string
type: array
setTags:
items:
hostname:
type: string
type: array
tags:
items:
ignore:
type: boolean
ip:
type: string
type: array
type: object
type: array
type: object
status:
description: DhcpHostsStatus defines the observed state of DhcpHosts
type: object
type: object
version: v1beta1
versions:
- name: v1beta1
leaseTime:
type: string
macs:
items:
type: string
type: array
setTags:
items:
type: string
type: array
tags:
items:
type: string
type: array
type: object
type: array
type: object
status:
description: DhcpHostsStatus defines the observed state of DhcpHosts
type: object
type: object
served: true
storage: true
subresources: {}
status:
acceptedNames:
kind: ""
Expand Down
126 changes: 62 additions & 64 deletions config/crd/bases/dnsmasq.kvaps.cf_dhcpoptions.yaml
Original file line number Diff line number Diff line change
@@ -1,85 +1,83 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: dhcpoptions.dnsmasq.kvaps.cf
spec:
additionalPrinterColumns:
- JSONPath: .spec.controller
name: Controller
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: dnsmasq.kvaps.cf
names:
kind: DhcpOptions
listKind: DhcpOptionsList
plural: dhcpoptions
singular: dhcpoptions
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
description: DhcpOptions is the Schema for the dhcpoptions API
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:
description: DhcpOptionsSpec defines the desired state of DhcpOptions
properties:
controller:
type: string
options:
items:
description: DhcpOption defines dhcp-option for dnsmasq
properties:
encap:
type: string
key:
pattern: ^([0-9]+|option:.+|option6:.+)$
type: string
leaseTime:
type: string
tags:
items:
versions:
- additionalPrinterColumns:
- jsonPath: .spec.controller
name: Controller
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: DhcpOptions is the Schema for the dhcpoptions API
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:
description: DhcpOptionsSpec defines the desired state of DhcpOptions
properties:
controller:
type: string
options:
items:
description: DhcpOption defines dhcp-option for dnsmasq
properties:
encap:
type: string
type: array
values:
items:
key:
pattern: ^([0-9]+|option:.+|option6:.+)$
type: string
type: array
viEncap:
type: string
required:
- key
- values
type: object
type: array
type: object
status:
description: DhcpOptionsStatus defines the observed state of DhcpOptions
type: object
type: object
version: v1beta1
versions:
- name: v1beta1
leaseTime:
type: string
tags:
items:
type: string
type: array
values:
items:
type: string
type: array
viEncap:
type: string
required:
- key
- values
type: object
type: array
type: object
status:
description: DhcpOptionsStatus defines the observed state of DhcpOptions
type: object
type: object
served: true
storage: true
subresources: {}
status:
acceptedNames:
kind: ""
Expand Down
Loading

0 comments on commit a14eb1b

Please sign in to comment.