Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NET-9152] CRD for service registeration #3943

Merged
merged 19 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3943.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
control-plane: Add the ability to register services via CRD.
```
2 changes: 2 additions & 0 deletions charts/consul/templates/connect-inject-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ rules:
- routetimeoutfilters
- routeauthfilters
- gatewaypolicies
- registrations
{{- if .Values.global.peering.enabled }}
- peeringacceptors
- peeringdialers
Expand Down Expand Up @@ -61,6 +62,7 @@ rules:
- terminatinggateways/status
- samenessgroups/status
- controlplanerequestlimits/status
- registrations/status
{{- if .Values.global.peering.enabled }}
- peeringacceptors/status
- peeringdialers/status
Expand Down
254 changes: 254 additions & 0 deletions charts/consul/templates/crd-registrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
{{- if .Values.connectInject.enabled }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.1
labels:
app: {{ template "consul.name" . }}
chart: {{ template "consul.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: crd
name: registrations.consul.hashicorp.com
spec:
group: consul.hashicorp.com
names:
kind: Registration
listKind: RegistrationList
plural: registrations
singular: registration
scope: Cluster
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Registration defines the resource for working with service registrations.
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: Spec defines the desired state of Registration.
properties:
address:
type: string
check:
description: HealthCheck is used to represent a single check.
properties:
checkId:
type: string
definition:
description: HealthCheckDefinition is used to store the details
about a health check's execution.
properties:
body:
type: string
deregisterCriticalServiceAfterDuration:
type: string
grpc:
type: string
grpcUseTLS:
type: boolean
header:
additionalProperties:
items:
type: string
type: array
type: object
http:
type: string
intervalDuration:
type: string
method:
type: string
osService:
type: string
tcp:
type: string
tcpUseTLS:
type: boolean
timeoutDuration:
type: string
tlsServerName:
type: string
tlsSkipVerify:
type: boolean
udp:
type: string
required:
- deregisterCriticalServiceAfterDuration
- intervalDuration
- timeoutDuration
type: object
exposedPort:
type: integer
name:
type: string
namespace:
type: string
node:
type: string
notes:
type: string
output:
type: string
partition:
type: string
serviceId:
type: string
serviceName:
type: string
status:
type: string
type:
type: string
required:
- checkId
- definition
- name
- node
- serviceId
- serviceName
- status
type: object
datacenter:
type: string
id:
type: string
locality:
properties:
region:
type: string
zone:
type: string
type: object
node:
type: string
nodeMeta:
additionalProperties:
type: string
type: object
partition:
type: string
service:
properties:
address:
type: string
enableTagOverride:
type: boolean
id:
type: string
locality:
properties:
region:
type: string
zone:
type: string
type: object
meta:
additionalProperties:
type: string
type: object
name:
type: string
namespace:
type: string
partition:
type: string
port:
type: integer
socketPath:
type: string
taggedAddresses:
additionalProperties:
properties:
address:
type: string
port:
type: integer
required:
- address
- port
type: object
type: object
tags:
items:
type: string
type: array
weights:
properties:
passing:
type: integer
warning:
type: integer
required:
- passing
- warning
type: object
required:
- address
- name
- port
type: object
skipNodeUpdate:
type: boolean
taggedAddresses:
additionalProperties:
type: string
type: object
type: object
status:
description: RegistrationStatus defines the observed state of Registration.
properties:
conditions:
description: Conditions indicate the latest available observations
of a resource's current state.
items:
description: 'Conditions define a readiness condition for a Consul
resource. See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties'
properties:
lastTransitionTime:
description: LastTransitionTime is the last time the condition
transitioned from one status to another.
format: date-time
type: string
message:
description: A human readable message indicating details about
the transition.
type: string
reason:
description: The reason for the condition's last transition.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of condition.
type: string
required:
- status
- type
type: object
type: array
lastSyncedTime:
description: LastSyncedTime is the last time the resource successfully
synced with Consul.
format: date-time
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
{{- end }}
1 change: 1 addition & 0 deletions control-plane/api/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
ControlPlaneRequestLimit string = "controlplanerequestlimit"
RouteAuthFilter string = "routeauthfilter"
GatewayPolicy string = "gatewaypolicy"
Registration string = "registration"

// V2 resources.
TrafficPermissions string = "trafficpermissions"
Expand Down
Loading
Loading