Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 33bb233

Browse files
authored
Merge pull request #197 from detiber/fixes
🏃 Add support for tilt
2 parents 320e05e + e25666e commit 33bb233

File tree

59 files changed

+558
-579
lines changed

Some content is hidden

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

59 files changed

+558
-579
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ _artifacts
3939

4040
# Goreleaser
4141
dist
42+
43+
# Tilt
44+
.tiltbuild/

Makefile

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ KUBEBUILDER_VERSION ?= 2.3.1
4343
# default install location for kubebuilder; can be placed elsewhere
4444
KUBEBUILDER_DIR ?= /usr/local/kubebuilder
4545
KUBEBUILDER ?= $(KUBEBUILDER_DIR)/bin/kubebuilder
46-
CONTROLLER_GEN_VERSION ?= v0.3.0
47-
CONTROLLER_GEN=$(GOBIN)/controller-gen
4846

4947
CERTMANAGER_URL ?= https://github.com/jetstack/cert-manager/releases/download/v0.14.1/cert-manager.yaml
5048

@@ -56,6 +54,9 @@ REPO_URL ?= https://github.com/packethost/cluster-api-provider-packet
5654
BUILDARCH ?= $(shell uname -m)
5755
BUILDOS ?= $(shell uname -s | tr A-Z a-z)
5856

57+
# Allow overriding the imagePullPolicy
58+
PULL_POLICY ?= Always
59+
5960
E2E_FOCUS := "functional tests"
6061

6162
# Directories.
@@ -64,9 +65,21 @@ TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
6465
BIN_DIR := bin
6566
TEST_DIR := test
6667
TEST_E2E_DIR := $(TEST_DIR)/e2e
68+
ENVSUBST_BIN := bin/envsubst
69+
ENVSUBST := $(TOOLS_DIR)/$(ENVSUBST_BIN)
6770

6871
# Binaries.
69-
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
72+
KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/kustomize)
73+
CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/controller-gen)
74+
ENVSUBST := $(abspath $(TOOLS_BIN_DIR)/envsubst)
75+
76+
envsubst: $(ENVSUBST) ## Build a local copy of envsubst.
77+
$(ENVSUBST): $(TOOLS_DIR)/go.mod
78+
cd $(TOOLS_DIR) && go build -tags=tools -o $(ENVSUBST_BIN) github.com/drone/envsubst/cmd/envsubst
79+
80+
controller-gen: $(CONTROLLER_GEN) ## Build a local copy of controller-gen.
81+
$(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod
82+
cd $(TOOLS_DIR) && go build -tags=tools -o $(BIN_DIR)/controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen
7083

7184
kustomize: $(KUSTOMIZE)
7285
$(KUSTOMIZE): $(TOOLS_DIR)/go.mod # Build kustomize from tools folder.
@@ -120,8 +133,6 @@ GO ?= GO111MODULE=on CGO_ENABLED=0 go
120133

121134
# Image URL to use all building/pushing image targets
122135
IMG ?= packethost/cluster-api-provider-packet:latest
123-
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
124-
CRD_OPTIONS ?= "crd:trivialVersions=true"
125136

126137
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
127138
ifeq (,$(shell go env GOBIN))
@@ -245,8 +256,15 @@ deploy: crds
245256
$(KUSTOMIZE) build config/release | kubectl apply -f -
246257

247258
# Generate manifests e.g. CRD, RBAC etc.
248-
crds: controller-gen
249-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/resources/crd/bases
259+
crds: $(CONTROLLER_GEN)
260+
$(CONTROLLER_GEN) \
261+
paths=./api/... \
262+
paths=./controllers/... \
263+
crd:crdVersions=v1 \
264+
rbac:roleName=manager-role \
265+
output:crd:dir=./config/crd/bases \
266+
output:webhook:dir=./config/webhook \
267+
webhook
250268

251269
# Run go fmt against code
252270
fmt:
@@ -257,7 +275,7 @@ vet:
257275
go vet ./...
258276

259277
# Generate code
260-
generate: controller-gen
278+
generate: $(CONTROLLER_GEN)
261279
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
262280

263281
## make the images for all supported ARCH
@@ -297,14 +315,6 @@ sub-push-%:
297315
push:
298316
docker push $(IMAGENAME)
299317

300-
# find or download controller-gen
301-
# download controller-gen if necessary
302-
# version must be at least the given version
303-
.PHONY: $(CONTROLLER_GEN)
304-
controller-gen: $(CONTROLLER_GEN)
305-
$(CONTROLLER_GEN):
306-
scripts/controller-gen.sh $@ $(CONTROLLER_GEN_VERSION)
307-
308318
## generate a cluster using clusterctl and setting defaults
309319
cluster:
310320
./scripts/generate-cluster.sh
@@ -328,10 +338,10 @@ manifest: kustomize semver release-manifests release-clusterctl release-cluster-
328338

329339
release-manifests: semver $(RELEASE_MANIFEST) $(RELEASE_METADATA) $(RELEASE_CLUSTER_TEMPLATE)
330340
release-version:
331-
KUSTOMIZE_ENABLE_ALPHA_COMMANDS=true $(KUSTOMIZE) cfg set config/release image-tag $(VERSION)
341+
KUSTOMIZE_ENABLE_ALPHA_COMMANDS=true $(KUSTOMIZE) cfg set config image-tag $(VERSION)
332342

333343
$(RELEASE_MANIFEST): $(RELEASE_DIR) release-version ## Builds the manifests to publish with a release
334-
$(KUSTOMIZE) build config/release > $@
344+
$(KUSTOMIZE) build config > $@
335345

336346
$(RELEASE_METADATA): semver $(RELEASE_DIR)
337347
cp $(METADATA_YAML) $@
@@ -389,3 +399,8 @@ cluster-init-manual: core managerless release
389399
# because of dependencies, this is allowed to fail once or twice
390400
kubectl apply -f $(COREPATH) || kubectl apply -f $(COREPATH) || kubectl apply -f $(COREPATH)
391401
kubectl apply -f $(FULL_MANAGERLESS_MANIFEST)
402+
403+
.PHONY: modules
404+
modules: ## Runs go mod to ensure modules are up to date.
405+
go mod tidy
406+
cd $(TOOLS_DIR); go mod tidy

config/resources/certmanager/certificate.yaml renamed to config/certmanager/certificate.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# The following manifests contain a self-signed issuer CR and a certificate CR.
22
# More document can be found at https://docs.cert-manager.io
3-
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
4-
# breaking changes
53
apiVersion: cert-manager.io/v1alpha2
64
kind: Issuer
75
metadata:
@@ -13,7 +11,7 @@ spec:
1311
apiVersion: cert-manager.io/v1alpha2
1412
kind: Certificate
1513
metadata:
16-
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
14+
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
1715
namespace: system
1816
spec:
1917
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize
@@ -23,4 +21,4 @@ spec:
2321
issuerRef:
2422
kind: Issuer
2523
name: selfsigned-issuer
26-
secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize
24+
secretName: $(SERVICE_NAME)-cert # this secret will not be prefixed, since it's not managed by kustomize
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
resources:
22
- certificate.yaml
3-
43
configurations:
54
- kustomizeconfig.yaml
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
# This configuration is for teaching kustomize how to update name ref and var substitution
1+
# This configuration is for teaching kustomize how to update name ref and var substitution
22
nameReference:
33
- kind: Issuer
44
group: cert-manager.io
55
fieldSpecs:
66
- kind: Certificate
77
group: cert-manager.io
88
path: spec/issuerRef/name
9-
109
varReference:
1110
- kind: Certificate
1211
group: cert-manager.io
1312
path: spec/commonName
1413
- kind: Certificate
1514
group: cert-manager.io
1615
path: spec/dnsNames
16+
- kind: Certificate
17+
group: cert-manager.io
18+
path: spec/secretName
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
controller-gen.kubebuilder.io/version: v0.2.9
6+
creationTimestamp: null
7+
name: packetclusters.infrastructure.cluster.x-k8s.io
8+
spec:
9+
group: infrastructure.cluster.x-k8s.io
10+
names:
11+
kind: PacketCluster
12+
listKind: PacketClusterList
13+
plural: packetclusters
14+
singular: packetcluster
15+
scope: Namespaced
16+
versions:
17+
- name: v1alpha3
18+
schema:
19+
openAPIV3Schema:
20+
description: PacketCluster is the Schema for the packetclusters API
21+
properties:
22+
apiVersion:
23+
description: 'APIVersion defines the versioned schema of this representation
24+
of an object. Servers should convert recognized schemas to the latest
25+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
26+
type: string
27+
kind:
28+
description: 'Kind is a string value representing the REST resource this
29+
object represents. Servers may infer this from the endpoint the client
30+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
31+
type: string
32+
metadata:
33+
type: object
34+
spec:
35+
description: PacketClusterSpec defines the desired state of PacketCluster
36+
properties:
37+
controlPlaneEndpoint:
38+
description: ControlPlaneEndpoint represents the endpoint used to
39+
communicate with the control plane.
40+
properties:
41+
host:
42+
description: The hostname on which the API server is serving.
43+
type: string
44+
port:
45+
description: The port on which the API server is serving.
46+
format: int32
47+
type: integer
48+
required:
49+
- host
50+
- port
51+
type: object
52+
facility:
53+
description: Facility represents the Packet facility for this cluster
54+
type: string
55+
projectID:
56+
description: ProjectID represents the Packet Project where this cluster
57+
will be placed into
58+
type: string
59+
required:
60+
- projectID
61+
type: object
62+
status:
63+
description: PacketClusterStatus defines the observed state of PacketCluster
64+
properties:
65+
ready:
66+
description: Ready denotes that the cluster (infrastructure) is ready.
67+
type: boolean
68+
type: object
69+
type: object
70+
served: true
71+
storage: true
72+
subresources:
73+
status: {}
74+
status:
75+
acceptedNames:
76+
kind: ""
77+
plural: ""
78+
conditions: []
79+
storedVersions: []

0 commit comments

Comments
 (0)