Skip to content

Commit 95911d1

Browse files
committed
Add new CLI command to import DNS records from existing cloudflare zone
1 parent 40f8619 commit 95911d1

24 files changed

+221
-116
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ dist/
2828
.DS_Store
2929

3030
vendor
31-
31+
imported

Dockerfile.manager

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ RUN apt-get update \
66
&& apt-get -y install \
77
ca-certificates
88

9-
ADD ./bin/manager /manager
9+
ADD ./bin/kubeflare /kubeflare
1010

1111
RUN useradd -c 'kubeflare user' -m -d /home/kubeflare -s /bin/bash -u 1001 kubeflare
1212
USER kubeflare
1313
ENV HOME /home/kubeflare
1414

15-
ENTRYPOINT ["/manager", "run"]
15+
ENTRYPOINT ["/kubeflare", "manager"]

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ endef
3131
export GO111MODULE=on
3232
# export GOPROXY=https://proxy.golang.org
3333

34-
all: generate fmt vet manifests manager
34+
all: generate fmt vet manifests kubeflare
3535

3636
.PHONY: clean-and-tidy
3737
clean-and-tidy:
@@ -54,20 +54,20 @@ integration-bin: generate fmt vet manifests
5454
test: generate fmt vet manifests
5555
go test ./pkg/... ./cmd/... -coverprofile cover.out
5656

57-
.PHONY: manager
58-
manager: generate fmt vet bin/manager
57+
.PHONY: kubeflare
58+
kubeflare: generate fmt vet bin/kubeflare
5959

60-
.PHONY: bin/manager
61-
bin/manager:
60+
.PHONY: bin/kubeflare
61+
bin/kubeflare:
6262
go build \
6363
${LDFLAGS} \
6464
-i \
65-
-o bin/manager \
66-
./cmd/manager
65+
-o bin/kubeflare \
66+
./cmd/kubeflare
6767

6868
.PHONY: run
69-
run: generate fmt vet bin/manager
70-
./bin/manager run \
69+
run: generate fmt vet bin/kubeflare
70+
./bin/kubeflare run \
7171
--log-level debug
7272

7373
.PHONY: install
@@ -111,7 +111,7 @@ generate: controller-gen client-gen
111111
-h ./hack/boilerplate.go.txt
112112

113113
.PHONY: dev
114-
dev: manager
114+
dev: kubeflare
115115
docker build -t kubeflare/kubeflare-manager -f ./Dockerfile.manager .
116116
docker tag kubeflare/kubeflare-manager localhost:32000/kubeflare/kubeflare-manager:latest
117117
docker push localhost:32000/kubeflare/kubeflare-manager:latest

cmd/kubeflare/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/replicatedhq/kubeflare/pkg/cli/kubeflarecli"
4+
5+
func main() {
6+
kubeflarecli.InitAndExecute()
7+
}

cmd/manager/main.go

Lines changed: 0 additions & 7 deletions
This file was deleted.

config/crds/v1/crds.kubeflare.io_accessapplications.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: v0.2.8
7+
controller-gen.kubebuilder.io/version: v0.4.1
88
creationTimestamp: null
99
name: accessapplications.crds.kubeflare.io
1010
spec:
@@ -22,14 +22,10 @@ spec:
2222
description: DNSRecord is the Schema for the accessapplication API
2323
properties:
2424
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
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'
2826
type: string
2927
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
28+
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'
3329
type: string
3430
metadata:
3531
type: object

config/crds/v1/crds.kubeflare.io_apitokens.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: v0.2.8
7+
controller-gen.kubebuilder.io/version: v0.4.1
88
creationTimestamp: null
99
name: apitokens.crds.kubeflare.io
1010
spec:
@@ -22,14 +22,10 @@ spec:
2222
description: APIToken is the Schema for the APITokens API
2323
properties:
2424
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
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'
2826
type: string
2927
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
28+
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'
3329
type: string
3430
metadata:
3531
type: object
@@ -48,16 +44,13 @@ spec:
4844
description: SecretKeySelector selects a key of a Secret.
4945
properties:
5046
key:
51-
description: The key of the secret to select from. Must be
52-
a valid secret key.
47+
description: The key of the secret to select from. Must be a valid secret key.
5348
type: string
5449
name:
55-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
56-
TODO: Add other useful fields. apiVersion, kind, uid?'
50+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
5751
type: string
5852
optional:
59-
description: Specify whether the Secret or its key must be
60-
defined
53+
description: Specify whether the Secret or its key must be defined
6154
type: boolean
6255
required:
6356
- key

config/crds/v1/crds.kubeflare.io_dnsrecords.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: v0.2.8
7+
controller-gen.kubebuilder.io/version: v0.4.1
88
creationTimestamp: null
99
name: dnsrecords.crds.kubeflare.io
1010
spec:
@@ -22,14 +22,10 @@ spec:
2222
description: DNSRecord is the Schema for the dnsrecords API
2323
properties:
2424
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
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'
2826
type: string
2927
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
28+
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'
3329
type: string
3430
metadata:
3531
type: object

config/crds/v1/crds.kubeflare.io_pagerules.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: v0.2.8
7+
controller-gen.kubebuilder.io/version: v0.4.1
88
creationTimestamp: null
99
name: pagerules.crds.kubeflare.io
1010
spec:
@@ -22,14 +22,10 @@ spec:
2222
description: PageRule is the Schema for the pagerules API
2323
properties:
2424
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
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'
2826
type: string
2927
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
28+
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'
3329
type: string
3430
metadata:
3531
type: object

config/crds/v1/crds.kubeflare.io_zones.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: v0.2.8
7+
controller-gen.kubebuilder.io/version: v0.4.1
88
creationTimestamp: null
99
name: zones.crds.kubeflare.io
1010
spec:
@@ -22,14 +22,10 @@ spec:
2222
description: Zone is the Schema for the zones API
2323
properties:
2424
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
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'
2826
type: string
2927
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
28+
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'
3329
type: string
3430
metadata:
3531
type: object

config/crds/v1beta1/crds.kubeflare.io_accessapplications.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: v0.2.8
7+
controller-gen.kubebuilder.io/version: v0.4.1
88
creationTimestamp: null
99
name: accessapplications.crds.kubeflare.io
1010
spec:
@@ -22,14 +22,10 @@ spec:
2222
description: DNSRecord is the Schema for the accessapplication API
2323
properties:
2424
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
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'
2826
type: string
2927
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
28+
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'
3329
type: string
3430
metadata:
3531
type: object

config/crds/v1beta1/crds.kubeflare.io_apitokens.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: v0.2.8
7+
controller-gen.kubebuilder.io/version: v0.4.1
88
creationTimestamp: null
99
name: apitokens.crds.kubeflare.io
1010
spec:
@@ -20,14 +20,10 @@ spec:
2020
description: APIToken is the Schema for the APITokens API
2121
properties:
2222
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'
23+
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'
2624
type: string
2725
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'
26+
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'
3127
type: string
3228
metadata:
3329
type: object
@@ -46,12 +42,10 @@ spec:
4642
description: SecretKeySelector selects a key of a Secret.
4743
properties:
4844
key:
49-
description: The key of the secret to select from. Must be
50-
a valid secret key.
45+
description: The key of the secret to select from. Must be a valid secret key.
5146
type: string
5247
name:
53-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
54-
TODO: Add other useful fields. apiVersion, kind, uid?'
48+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
5549
type: string
5650
optional:
5751
description: Specify whether the Secret or its key must be defined

config/crds/v1beta1/crds.kubeflare.io_dnsrecords.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: v0.2.8
7+
controller-gen.kubebuilder.io/version: v0.4.1
88
creationTimestamp: null
99
name: dnsrecords.crds.kubeflare.io
1010
spec:
@@ -22,14 +22,10 @@ spec:
2222
description: DNSRecord is the Schema for the dnsrecords API
2323
properties:
2424
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
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'
2826
type: string
2927
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
28+
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'
3329
type: string
3430
metadata:
3531
type: object

0 commit comments

Comments
 (0)