From e9b3e8d3532802c1267907460fc2647a12faa2b4 Mon Sep 17 00:00:00 2001 From: devOpsHelm Date: Wed, 4 Oct 2023 11:06:28 +0000 Subject: [PATCH] [CN-822] HazelcastEndpoint CRD (#860) new hazelcastendpoint CR is introduced Signed-off-by: devOpsHelm --- .../templates/all-crds.yaml | 96 +++++++++++++++++-- .../templates/_helpers.tpl | 67 +++++++++---- .../templates/webhook.yaml | 23 +++++ 3 files changed, 162 insertions(+), 24 deletions(-) diff --git a/stable/hazelcast-platform-operator/charts/hazelcast-platform-operator-crds/templates/all-crds.yaml b/stable/hazelcast-platform-operator/charts/hazelcast-platform-operator-crds/templates/all-crds.yaml index 8db2e20f..9cbfa73e 100644 --- a/stable/hazelcast-platform-operator/charts/hazelcast-platform-operator-crds/templates/all-crds.yaml +++ b/stable/hazelcast-platform-operator/charts/hazelcast-platform-operator-crds/templates/all-crds.yaml @@ -276,6 +276,94 @@ spec: --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.10.0 + creationTimestamp: null + name: hazelcastendpoints.hazelcast.com +spec: + group: hazelcast.com + names: + kind: HazelcastEndpoint + listKind: HazelcastEndpointList + plural: hazelcastendpoints + shortNames: + - hzep + singular: hazelcastendpoint + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Type of the HazelcastEndpoint + jsonPath: .spec.type + name: Type + type: string + - description: Address of the HazelcastEndpoint + jsonPath: .status.address + name: Address + type: string + - description: Message for the current HazelcastEndpoint + jsonPath: .status.message + name: Message + priority: 1 + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: HazelcastEndpoint is the Schema for the hazelcastendpoints 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: HazelcastEndpointSpec defines the desired state of HazelcastEndpoint + properties: + hazelcastResourceName: + description: HazelcastResourceName defines the name of the Hazelcast + resource that this resource is created for. + minLength: 1 + type: string + port: + description: Port of the endpoint. + format: int32 + type: integer + type: + description: Type defines the endpoint connection. It is used to identify + the target of the endpoint. + enum: + - Discovery + - Member + - WAN + type: string + required: + - hazelcastResourceName + - port + - type + type: object + status: + description: HazelcastEndpointStatus defines the observed state of HazelcastEndpoint + properties: + address: + description: Address is the external address of the endpoint. It is + taken from the corresponding service. + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 @@ -301,14 +389,6 @@ spec: jsonPath: .status.hazelcastClusterStatus.readyMembers name: Members type: string - - description: External addresses of the Hazelcast cluster - jsonPath: .status.externalAddresses - name: External-Addresses - type: string - - description: WAN addresses of the Hazelcast cluster - jsonPath: .status.wanAddresses - name: WAN-Addresses - type: string - description: Message for the current Hazelcast Config jsonPath: .status.message name: Message diff --git a/stable/hazelcast-platform-operator/templates/_helpers.tpl b/stable/hazelcast-platform-operator/templates/_helpers.tpl index 23911858..51cd6dd3 100644 --- a/stable/hazelcast-platform-operator/templates/_helpers.tpl +++ b/stable/hazelcast-platform-operator/templates/_helpers.tpl @@ -170,9 +170,9 @@ Rules needed for operator watched namespaces - "" resources: - configmaps - - secrets - events - pods + - secrets - serviceaccounts - services verbs: @@ -214,6 +214,15 @@ Rules needed for operator watched namespaces - create - get - list + - update + - watch +- apiGroups: + - "" + resources: + - services + verbs: + - get + - list - watch - apiGroups: - apps @@ -279,6 +288,32 @@ Rules needed for operator watched namespaces - get - patch - update +- apiGroups: + - hazelcast.com + resources: + - hazelcastendpoints + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - hazelcast.com + resources: + - hazelcastendpoints/finalizers + verbs: + - update +- apiGroups: + - hazelcast.com + resources: + - hazelcastendpoints/status + verbs: + - get + - patch + - update - apiGroups: - hazelcast.com resources: @@ -334,7 +369,7 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - managementcenters + - jetjobs verbs: - create - delete @@ -346,13 +381,13 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - managementcenters/finalizers + - jetjobs/finalizers verbs: - update - apiGroups: - hazelcast.com resources: - - managementcenters/status + - jetjobs/status verbs: - get - patch @@ -360,7 +395,7 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - maps + - jetjobsnapshots verbs: - create - delete @@ -372,13 +407,13 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - maps/finalizers + - jetjobsnapshots/finalizers verbs: - update - apiGroups: - hazelcast.com resources: - - maps/status + - jetjobsnapshots/status verbs: - get - patch @@ -386,7 +421,7 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - multimaps + - managementcenters verbs: - create - delete @@ -398,13 +433,13 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - multimaps/finalizers + - managementcenters/finalizers verbs: - update - apiGroups: - hazelcast.com resources: - - multimaps/status + - managementcenters/status verbs: - get - patch @@ -412,7 +447,7 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - jetjobs + - maps verbs: - create - delete @@ -424,13 +459,13 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - jetjobs/finalizers + - maps/finalizers verbs: - update - apiGroups: - hazelcast.com resources: - - jetjobs/status + - maps/status verbs: - get - patch @@ -438,7 +473,7 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - jetjobsnapshots + - multimaps verbs: - create - delete @@ -450,13 +485,13 @@ Rules needed for operator watched namespaces - apiGroups: - hazelcast.com resources: - - jetjobsnapshots/finalizers + - multimaps/finalizers verbs: - update - apiGroups: - hazelcast.com resources: - - jetjobsnapshots/status + - multimaps/status verbs: - get - patch diff --git a/stable/hazelcast-platform-operator/templates/webhook.yaml b/stable/hazelcast-platform-operator/templates/webhook.yaml index 6c9ada12..babaa287 100644 --- a/stable/hazelcast-platform-operator/templates/webhook.yaml +++ b/stable/hazelcast-platform-operator/templates/webhook.yaml @@ -285,6 +285,29 @@ webhooks: sideEffects: None namespaceSelector: {{- include "watched-namespaces.labelSelector" . | nindent 6 }} + - admissionReviewVersions: + - v1 + clientConfig: + caBundle: {{ $ca.Cert | b64enc }} + service: + name: {{ $fullname }} + namespace: {{ .Release.Namespace }} + path: /validate-hazelcast-com-v1alpha1-hazelcastendpoint + failurePolicy: Ignore + name: vhazelcastendpoint.kb.io + rules: + - apiGroups: + - hazelcast.com + apiVersions: + - v1alpha1 + operations: + - CREATE + - UPDATE + resources: + - hazelcastendpoints + sideEffects: None + namespaceSelector: + {{- include "watched-namespaces.labelSelector" . | nindent 6 }} --- apiVersion: v1 kind: Service