Skip to content

Commit f505195

Browse files
committed
Add bits to deploy site via netlify
Add bits to deploy site to the official k8s url via netlify Add reference section to automatically display the api reference online. Remove stale make targets Update versions of controller-gen regenerate manifests/crds Some small website fixes. Signed-off-by: astoycos <[email protected]>
1 parent 7ac5178 commit f505195

24 files changed

+1036
-125
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea/
22
vendor/
3+
site/

Makefile

Lines changed: 17 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
2-
# Image URL to use all building/pushing image targets
3-
IMG ?= controller:latest
4-
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
5-
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
6-
71
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
82
ifeq (,$(shell go env GOBIN))
93
GOBIN=$(shell go env GOPATH)/bin
104
else
115
GOBIN=$(shell go env GOBIN)
126
endif
137

14-
all: generate manifests fmt vet
15-
168
##@ General
179

1810
# The help target prints out all targets with their descriptions organized
@@ -31,58 +23,32 @@ help: ## Display this help.
3123

3224
##@ Development
3325

34-
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
35-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
26+
manifests: ## Generate ClusterRole and CustomResourceDefinition objects.
27+
go run sigs.k8s.io/controller-tools/cmd/controller-gen rbac:roleName=manager-role crd paths=./apis/... output:crd:dir=./config/crd/bases output:stdout
3628

37-
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
38-
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
29+
generate: ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
30+
go run sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
3931

4032
fmt: ## Run go fmt against code.
4133
go fmt ./...
4234

4335
vet: ## Run go vet against code.
4436
go vet ./...
4537

46-
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
47-
test: manifests generate fmt vet ## Run tests.
48-
mkdir -p ${ENVTEST_ASSETS_DIR}
49-
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0/hack/setup-envtest.sh
50-
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
38+
all: generate manifests fmt vet ## Runs all the development targets
5139

5240
##@ Deployment
53-
54-
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
55-
$(KUSTOMIZE) build config/crd | kubectl apply -f -
41+
install: manifests ## Install CRDs into the K8s cluster specified in ~/.kube/config.
42+
kubectl kustomize config/crd | kubectl apply -f -
5643

5744
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
58-
$(KUSTOMIZE) build config/crd | kubectl delete -f -
59-
60-
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
61-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
62-
$(KUSTOMIZE) build config/default | kubectl apply -f -
63-
64-
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
65-
$(KUSTOMIZE) build config/default | kubectl delete -f -
66-
67-
68-
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
69-
controller-gen: ## Download controller-gen locally if necessary.
70-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
71-
72-
KUSTOMIZE = $(shell pwd)/bin/kustomize
73-
kustomize: ## Download kustomize locally if necessary.
74-
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
75-
76-
# go-get-tool will 'go get' any package $2 and install it to $1.
77-
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
78-
define go-get-tool
79-
@[ -f $(1) ] || { \
80-
set -e ;\
81-
TMP_DIR=$$(mktemp -d) ;\
82-
cd $$TMP_DIR ;\
83-
go mod init tmp ;\
84-
echo "Downloading $(2)" ;\
85-
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
86-
rm -rf $$TMP_DIR ;\
87-
}
88-
endef
45+
kubectl kustomize config/crd | kubectl delete -f -
46+
47+
.PHONY: docs ## Build the documentation website
48+
docs:
49+
./hack/make-docs.sh
50+
51+
.PHONY: local-docs ## Deploy the docs locally
52+
local-docs:
53+
mkdocs serve
54+

apis/doc.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
Copyright 2020 The Kubernetes Authors.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
package apis

apis/v1alpha1/adminnetworkpolicy_types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
/*
2-
Copyright 2022.
2+
Copyright 2020 The Kubernetes Authors.
3+
34
Licensed under the Apache License, Version 2.0 (the "License");
5+
46
you may not use this file except in compliance with the License.
57
You may obtain a copy of the License at
8+
69
http://www.apache.org/licenses/LICENSE-2.0
10+
711
Unless required by applicable law or agreed to in writing, software
812
distributed under the License is distributed on an "AS IS" BASIS,
913
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

apis/v1alpha1/doc.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
Copyright 2020 The Kubernetes Authors.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
// Package v1alpha1 contains API Schema definitions for the
15+
// policy.networking.k8s.io API group.
16+
// +kubebuilder:object:generate=true
17+
// +groupName=policy.networking.k8s.io
18+
package v1alpha1

apis/v1alpha1/groupversion_info.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package v1alpha1 contains API Schema definitions for the policy.networking.k8s.io v1alpha1 API group
18-
//+kubebuilder:object:generate=true
19-
//+groupName=policy.networking.k8s.io
2017
package v1alpha1
2118

2219
import (

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/controller-gen

-19.3 MB
Binary file not shown.

config/crd/bases/policy.networking.k8s.io_adminnetworkpolicies.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
21
---
32
apiVersion: apiextensions.k8s.io/v1
43
kind: CustomResourceDefinition
54
metadata:
65
annotations:
7-
controller-gen.kubebuilder.io/version: v0.4.1
6+
controller-gen.kubebuilder.io/version: v0.9.2
87
creationTimestamp: null
98
name: adminnetworkpolicies.policy.networking.k8s.io
109
spec:
@@ -206,6 +205,7 @@ spec:
206205
The requirements are ANDed.
207206
type: object
208207
type: object
208+
x-kubernetes-map-type: atomic
209209
notSameLabels:
210210
description: NotSameLabels is used to select a set
211211
of Namespaces that do not have a set of label(s).
@@ -298,6 +298,7 @@ spec:
298298
"value". The requirements are ANDed.
299299
type: object
300300
type: object
301+
x-kubernetes-map-type: atomic
301302
notSameLabels:
302303
description: NotSameLabels is used to select a
303304
set of Namespaces that do not have a set of
@@ -378,6 +379,7 @@ spec:
378379
The requirements are ANDed.
379380
type: object
380381
type: object
382+
x-kubernetes-map-type: atomic
381383
required:
382384
- namespaces
383385
- podSelector
@@ -482,6 +484,7 @@ spec:
482484
The requirements are ANDed.
483485
type: object
484486
type: object
487+
x-kubernetes-map-type: atomic
485488
notSameLabels:
486489
description: NotSameLabels is used to select a set
487490
of Namespaces that do not have a set of label(s).
@@ -574,6 +577,7 @@ spec:
574577
"value". The requirements are ANDed.
575578
type: object
576579
type: object
580+
x-kubernetes-map-type: atomic
577581
notSameLabels:
578582
description: NotSameLabels is used to select a
579583
set of Namespaces that do not have a set of
@@ -654,6 +658,7 @@ spec:
654658
The requirements are ANDed.
655659
type: object
656660
type: object
661+
x-kubernetes-map-type: atomic
657662
required:
658663
- namespaces
659664
- podSelector
@@ -805,6 +810,7 @@ spec:
805810
"value". The requirements are ANDed.
806811
type: object
807812
type: object
813+
x-kubernetes-map-type: atomic
808814
pods:
809815
description: Pods is used to select pods via namespace AND pod
810816
selectors.
@@ -855,6 +861,7 @@ spec:
855861
only "value". The requirements are ANDed.
856862
type: object
857863
type: object
864+
x-kubernetes-map-type: atomic
858865
podSelector:
859866
description: PodSelector is used to explicitly select pods
860867
within a namespace; if empty, it selects all Pods.
@@ -901,6 +908,7 @@ spec:
901908
only "value". The requirements are ANDed.
902909
type: object
903910
type: object
911+
x-kubernetes-map-type: atomic
904912
required:
905913
- namespaceSelector
906914
- podSelector
@@ -918,13 +926,12 @@ spec:
918926
description: "Condition contains details for one aspect of the current
919927
state of this API Resource. --- This struct is intended for direct
920928
use as an array at the field path .status.conditions. For example,
921-
type FooStatus struct{ // Represents the observations of a
922-
foo's current state. // Known .status.conditions.type are:
923-
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
924-
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
925-
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
926-
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
927-
\n // other fields }"
929+
type FooStatus struct{ // Represents the observations of a foo's
930+
current state. // Known .status.conditions.type are: \"Available\",
931+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
932+
// +listType=map // +listMapKey=type Conditions []metav1.Condition
933+
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
934+
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
928935
properties:
929936
lastTransitionTime:
930937
description: lastTransitionTime is the last time the condition
@@ -993,9 +1000,3 @@ spec:
9931000
storage: true
9941001
subresources:
9951002
status: {}
996-
status:
997-
acceptedNames:
998-
kind: ""
999-
plural: ""
1000-
conditions: []
1001-
storedVersions: []

config/crd/bases/policy.networking.k8s.io_baselineadminnetworkpolicies.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
21
---
32
apiVersion: apiextensions.k8s.io/v1
43
kind: CustomResourceDefinition
54
metadata:
65
annotations:
7-
controller-gen.kubebuilder.io/version: v0.4.1
6+
controller-gen.kubebuilder.io/version: v0.9.2
87
creationTimestamp: null
98
name: baselineadminnetworkpolicies.policy.networking.k8s.io
109
spec:
@@ -203,6 +202,7 @@ spec:
203202
The requirements are ANDed.
204203
type: object
205204
type: object
205+
x-kubernetes-map-type: atomic
206206
notSameLabels:
207207
description: NotSameLabels is used to select a set
208208
of Namespaces that do not have a set of label(s).
@@ -295,6 +295,7 @@ spec:
295295
"value". The requirements are ANDed.
296296
type: object
297297
type: object
298+
x-kubernetes-map-type: atomic
298299
notSameLabels:
299300
description: NotSameLabels is used to select a
300301
set of Namespaces that do not have a set of
@@ -375,6 +376,7 @@ spec:
375376
The requirements are ANDed.
376377
type: object
377378
type: object
379+
x-kubernetes-map-type: atomic
378380
required:
379381
- namespaces
380382
- podSelector
@@ -475,6 +477,7 @@ spec:
475477
The requirements are ANDed.
476478
type: object
477479
type: object
480+
x-kubernetes-map-type: atomic
478481
notSameLabels:
479482
description: NotSameLabels is used to select a set
480483
of Namespaces that do not have a set of label(s).
@@ -567,6 +570,7 @@ spec:
567570
"value". The requirements are ANDed.
568571
type: object
569572
type: object
573+
x-kubernetes-map-type: atomic
570574
notSameLabels:
571575
description: NotSameLabels is used to select a
572576
set of Namespaces that do not have a set of
@@ -647,6 +651,7 @@ spec:
647651
The requirements are ANDed.
648652
type: object
649653
type: object
654+
x-kubernetes-map-type: atomic
650655
required:
651656
- namespaces
652657
- podSelector
@@ -788,6 +793,7 @@ spec:
788793
"value". The requirements are ANDed.
789794
type: object
790795
type: object
796+
x-kubernetes-map-type: atomic
791797
pods:
792798
description: Pods is used to select pods via namespace AND pod
793799
selectors.
@@ -838,6 +844,7 @@ spec:
838844
only "value". The requirements are ANDed.
839845
type: object
840846
type: object
847+
x-kubernetes-map-type: atomic
841848
podSelector:
842849
description: PodSelector is used to explicitly select pods
843850
within a namespace; if empty, it selects all Pods.
@@ -884,6 +891,7 @@ spec:
884891
only "value". The requirements are ANDed.
885892
type: object
886893
type: object
894+
x-kubernetes-map-type: atomic
887895
required:
888896
- namespaceSelector
889897
- podSelector
@@ -900,13 +908,12 @@ spec:
900908
description: "Condition contains details for one aspect of the current
901909
state of this API Resource. --- This struct is intended for direct
902910
use as an array at the field path .status.conditions. For example,
903-
type FooStatus struct{ // Represents the observations of a
904-
foo's current state. // Known .status.conditions.type are:
905-
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
906-
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
907-
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
908-
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
909-
\n // other fields }"
911+
type FooStatus struct{ // Represents the observations of a foo's
912+
current state. // Known .status.conditions.type are: \"Available\",
913+
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
914+
// +listType=map // +listMapKey=type Conditions []metav1.Condition
915+
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
916+
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
910917
properties:
911918
lastTransitionTime:
912919
description: lastTransitionTime is the last time the condition
@@ -975,9 +982,3 @@ spec:
975982
storage: true
976983
subresources:
977984
status: {}
978-
status:
979-
acceptedNames:
980-
kind: ""
981-
plural: ""
982-
conditions: []
983-
storedVersions: []

0 commit comments

Comments
 (0)