Skip to content

Commit

Permalink
🚧 ✨ Basic implementation for access
Browse files Browse the repository at this point in the history
  • Loading branch information
adyanth committed Dec 19, 2022
1 parent cf8ab4d commit 0b62581
Show file tree
Hide file tree
Showing 4 changed files with 333 additions and 10 deletions.
26 changes: 19 additions & 7 deletions api/v1alpha1/accessservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,28 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// AccessServiceSpec defines the desired state of AccessService
type AccessServiceSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// FQDN to connect to for the TCP tunnel
//+kubebuilder:validation:Required
Hostname string `json:"hostname"`

// Protocol defines the protocol to use, only TCP for now, default
//+kubebuilder:validation:Enum:="tcp";"udp"
//+kubebuilder:default="tcp"
Protocol string `json:"protocol"`

// Port defines the port for the service to listen on
//+kubebuilder:validation:Minimum:=1
//+kubebuilder:validation:Maximum:=65535
Port int32 `json:"port"`

// ServiceName defines the name of the service for this port to be exposed on
//+kubebuilder:validation:Required
ServiceName string `json:"serviceName"`

// Foo is an example field of AccessService. Edit accessservice_types.go to remove/update
Foo string `json:"foo,omitempty"`
// Replicas defines the number of cloudflared access replicas to run
Replicas int32 `json:"replicas"`
}

// AccessServiceStatus defines the observed state of AccessService
Expand Down
85 changes: 85 additions & 0 deletions config/crd/bases/networking.cfargotunnel.com_accessservices.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: accessservices.networking.cfargotunnel.com
spec:
group: networking.cfargotunnel.com
names:
kind: AccessService
listKind: AccessServiceList
plural: accessservices
singular: accessservice
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: AccessService is the Schema for the accessservices 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: AccessServiceSpec defines the desired state of AccessService
properties:
hostname:
description: FQDN to connect to for the TCP tunnel
type: string
port:
description: Port defines the port for the service to listen on
format: int32
maximum: 65535
minimum: 1
type: integer
protocol:
default: tcp
description: Protocol defines the protocol to use, only TCP for now,
default
enum:
- tcp
- udp
type: string
replicas:
description: Replicas defines the number of cloudflared access replicas
to run
format: int32
type: integer
serviceName:
description: ServiceName defines the name of the service for this
port to be exposed on
type: string
required:
- hostname
- port
- protocol
- replicas
- serviceName
type: object
status:
description: AccessServiceStatus defines the observed state of AccessService
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
30 changes: 30 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,39 @@ rules:
resources:
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- networking.cfargotunnel.com
resources:
- accessservices
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- networking.cfargotunnel.com
resources:
- accessservices/finalizers
verbs:
- update
- apiGroups:
- networking.cfargotunnel.com
resources:
- accessservices/status
verbs:
- get
- patch
- update
- apiGroups:
- networking.cfargotunnel.com
resources:
Expand Down
Loading

0 comments on commit 0b62581

Please sign in to comment.