Skip to content

Commit 00772df

Browse files
authored
Merge pull request #30 from datainfrahq/basic-auth
add basic auth support in cp
2 parents d32c854 + eefafab commit 00772df

24 files changed

+832
-36
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# Image URL to use all building/pushing image targets
3-
IMG ?= datainfrahq/pinot-control-plane:v0.0.6
3+
IMG ?= datainfrahq/pinot-control-plane:v0.0.7
44
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
55
ENVTEST_K8S_VERSION = 1.26.0
66

api/v1beta1/pinot_types.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323

2424
// PinotSpec defines the desired state of Pinot
2525
type PinotSpec struct {
26+
// +optional
27+
Auth Auth `json:"auth"`
2628
// +optional
2729
Plugins []string `json:"plugins"`
2830
// +required
@@ -66,6 +68,19 @@ type DeepStorageConfig struct {
6668
Data string `json:"data"`
6769
}
6870

71+
type AuthType string
72+
73+
const (
74+
BasicAuth AuthType = "basic-auth"
75+
)
76+
77+
type Auth struct {
78+
// +required
79+
Type AuthType `json:"type"`
80+
// +required
81+
SecretRef v1.SecretReference `json:"secretRef"`
82+
}
83+
6984
type K8sConfig struct {
7085
// +required
7186
Name string `json:"name"`

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/datainfra.io_pinots.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,28 @@ spec:
3939
spec:
4040
description: PinotSpec defines the desired state of Pinot
4141
properties:
42+
auth:
43+
properties:
44+
secretRef:
45+
description: SecretReference represents a Secret Reference. It
46+
has enough information to retrieve secret in any namespace
47+
properties:
48+
name:
49+
description: name is unique within a namespace to reference
50+
a secret resource.
51+
type: string
52+
namespace:
53+
description: namespace defines the space within which the
54+
secret name must be unique.
55+
type: string
56+
type: object
57+
x-kubernetes-map-type: atomic
58+
type:
59+
type: string
60+
required:
61+
- secretRef
62+
- type
63+
type: object
4264
deploymentOrder:
4365
items:
4466
type: string

config/crd/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resources:
55
- bases/datainfra.io_pinots.yaml
66
- bases/datainfra.io_pinotschemas.yaml
77
- bases/datainfra.io_pinottables.yaml
8-
- bases/datainfra.io.datainfra.io_pinottenants.yaml
8+
- bases/datainfra.io_pinottenants.yaml
99
#+kubebuilder:scaffold:crdkustomizeresource
1010

1111
patchesStrategicMerge:

config/crd/patches/cainjection_in_pinottenants.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
7-
name: pinottenants.datainfra.io.datainfra.io
7+
name: pinottenants.datainfra.io

config/rbac/pinotschema_editor_role.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ rules:
2323
- patch
2424
- update
2525
- watch
26+
- apiGroups:
27+
- ""
28+
resources:
29+
- secrets
30+
verbs:
31+
- get
2632
- apiGroups:
2733
- datainfra.io
2834
resources:

config/rbac/pinottable_editor_role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ rules:
2323
- patch
2424
- update
2525
- watch
26+
- apiGroups:
27+
- ""
28+
resources:
29+
- secrets
30+
verbs:
31+
- get
32+
- list
33+
- watch
2634
- apiGroups:
2735
- datainfra.io
2836
resources:

config/rbac/pinottenant_viewer_role.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,23 @@ metadata:
1212
name: pinottenant-viewer-role
1313
rules:
1414
- apiGroups:
15-
- datainfra.io.datainfra.io
15+
- datainfra.io
1616
resources:
1717
- pinottenants
1818
verbs:
1919
- get
2020
- list
2121
- watch
2222
- apiGroups:
23-
- datainfra.io.datainfra.io
23+
- ""
24+
resources:
25+
- secrets
26+
verbs:
27+
- get
28+
- list
29+
- watch
30+
- apiGroups:
31+
- datainfra.io
2432
resources:
2533
- pinottenants/status
2634
verbs:

docs/getting_started_auth.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
### Getting Started With Auth Enabled Cluster
2+
3+
- Control Plane supports basic auth only.
4+
5+
#### Export your StorageClassName
6+
```
7+
export STORAGE_CLASS_NAME=standard
8+
```
9+
10+
#### Install Pinot Control Plane
11+
```
12+
make helm-install-pinot-control-plane
13+
```
14+
15+
#### Install Zookeeper Opoerator and CR
16+
```
17+
make helm-install-zk-operator
18+
```
19+
20+
### Install Pinot Cluster
21+
22+
```
23+
envsubst < examples/04-pinot-auth/pinotauth-basic.yaml | kubectl apply -f - -n pinot
24+
```
25+
26+
### Create a K8 secret in the namespace where pinot cluster is deployed
27+
28+
29+
- add secrets to file, the following secrets needs to be same as mentioned
30+
in pinot controller properties.
31+
```
32+
cat << EOF > pinot-control-plane-secret
33+
CONTROL_PLANE_USERNAME=controlplane
34+
CONTROL_PLANE_PASSWORD=controlplane
35+
EOF
36+
```
37+
38+
- create secret
39+
40+
```
41+
kubectl create secret generic pinot-control-plane-secret --from-env-file=pinot-control-plane-secret -n pinot
42+
```
43+
44+
### create schema
45+
46+
```
47+
kubectl apply -f examples/04-pinot-auth/pinotauth-schema.yaml -n pinot
48+
```
49+
50+
### create table
51+
52+
```
53+
kubectl apply -f examples/04-pinot-auth/pinotauth-table.yaml -n pinot
54+
```

0 commit comments

Comments
 (0)