Skip to content

Commit 976f202

Browse files
committed
wip
1 parent 30ee2eb commit 976f202

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1066
-128
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
2626

2727
# BUNDLE_IMG defines the image:tag used for the bundle.
2828
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
29-
BUNDLE_IMG ?= quay.io/yaacov/oc-gate-operator-bundle:v0.0.1
29+
BUNDLE_IMG ?= quay.io/yaacov/kube-gateway-operator-bundle:v0.0.1
3030

3131
# Image URL to use all building/pushing image targets
32-
IMG ?= quay.io/yaacov/oc-gate-operator:v0.0.1
32+
IMG ?= quay.io/yaacov/kube-gateway-operator:v0.0.1
3333
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
3434
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
3535

PROJECT

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
domain: yaacov.com
1+
domain: kubevirt.io
22
layout: go.kubebuilder.io/v3
3-
projectName: oc-gate-operator
4-
repo: github.com/yaacov/oc-gate-operator
3+
projectName: kube-gateway-operator
4+
repo: github.com/yaacov/kube-gateway-operator
55
resources:
66
- crdVersion: v1
7-
group: ocgate
7+
group: kubegateway
88
kind: GateToken
99
version: v1beta1
1010
- crdVersion: v1
11-
group: ocgate
11+
group: kubegateway
1212
kind: GateServer
1313
version: v1beta1
1414
version: 3-alpha

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
# oc-gate-operator
1+
# kube-gateway-operator
22

3-
![alt gopher network](https://raw.githubusercontent.com/yaacov/oc-gate/main/web/public/network-side.png)
3+
![alt gopher network](https://raw.githubusercontent.com/yaacov/kube-gateway/main/web/public/network-side.png)
44

5-
creates tokens for the [oc-gate](https://github.com/yaacov/oc-gate) service
5+
creates tokens for the [kube-gateway](https://github.com/yaacov/kube-gateway) service
66

7-
[![Go Report Card](https://goreportcard.com/badge/github.com/yaacov/oc-gate-operator)](https://goreportcard.com/report/github.com/yaacov/oc-gate-operator)
7+
[![Go Report Card](https://goreportcard.com/badge/github.com/yaacov/kube-gateway-operator)](https://goreportcard.com/report/github.com/yaacov/kube-gateway-operator)
88
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
99

1010
## Install
1111

1212
Install using [operator-sdk](https://sdk.operatorframework.io/docs/installation/)
1313

1414
```bash
15-
# Use oc-gate namespace
16-
oc project oc-gate
15+
# Use kube-gateway namespace
16+
oc project kube-gateway
1717

1818
# Add privileged security context to the user running the operator
19-
oc adm policy add-scc-to-user privileged -z default -n oc-gate
19+
oc adm policy add-scc-to-user privileged -z default -n kube-gateway
2020

2121
# Add the private key secret used to generate tokens
22-
oc create -n oc-gate-operator-system secret generic oc-gate-jwt-secret --from-file=test/cert.pem --from-file=test/key.pem
22+
oc create -n kube-gateway-operator-system secret generic kube-gateway-jwt-secret --from-file=test/cert.pem --from-file=test/key.pem
2323

2424
# Install the operator
25-
operator-sdk run bundle quay.io/yaacov/oc-gate-operator-bundle:v0.0.1 -n oc-gate
25+
operator-sdk run bundle quay.io/yaacov/kube-gateway-operator-bundle:v0.0.1 -n kube-gateway
2626

2727
# Un-Install
28-
operator-sdk cleanup oc-gate-operator
28+
operator-sdk cleanup kube-gateway-operator
2929
```
3030

3131
## Usage
3232

33-
Requesting a token for [oc-gate](https://github.com/yaacov/oc-gate) service is done using GateToken CRD,
33+
Requesting a token for [kube-gateway](https://github.com/yaacov/kube-gateway) service is done using GateToken CRD,
3434

3535
Available fields are:
3636

@@ -40,7 +40,7 @@ Available fields are:
4040
- duration-sec: int, duration-sec is the duration in sec the token will be validated since it's invocation. Defalut value is 3600s (1h).
4141
- from: string, from is time of token invocation, the token will not validate before this time, the token duration will start from this time. Defalut to token object creation time.
4242

43-
Creating a token requires a secret holding a RSA private-key for sighing the token in the namespace of the token (secret name: oc-gate-jwt-secret), nce token is ready it will be available in the GateToken status.
43+
Creating a token requires a secret holding a RSA private-key for sighing the token in the namespace of the token (secret name: kube-gateway-jwt-secret), nce token is ready it will be available in the GateToken status.
4444

4545
Get a token:
4646

@@ -62,28 +62,28 @@ Requires
6262
```bash
6363
# Deploy the operator, RBAC roles and CRDs
6464
export USERNAME=yaacov
65-
make deploy IMG=quay.io/$USERNAME/oc-gate-operator:v0.0.1
65+
make deploy IMG=quay.io/$USERNAME/kube-gateway-operator:v0.0.1
6666
```
6767

6868
```bash
6969
# Remove deployment of the operator, RBAC roles and CRDs
7070
export USERNAME=yaacov
71-
make undeploy IMG=quay.io/$USERNAME/oc-gate-operator:v0.0.1
71+
make undeploy IMG=quay.io/$USERNAME/kube-gateway-operator:v0.0.1
7272
```
7373

7474
## Create GateToken CR
7575

76-
Requires a secret with private key on 'oc-gate' namespace:
76+
Requires a secret with private key on 'kube-gateway' namespace:
7777

7878
```bash
79-
# Use the oc-gate namespace
80-
oc project oc-gate
79+
# Use the kube-gateway namespace
80+
oc project kube-gateway
8181

8282
# create a secret
83-
oc create -n oc-gate-operator-system secret generic oc-gate-jwt-secret --from-file=test/cert.pem --from-file=test/key.pem
83+
oc create -n kube-gateway-operator-system secret generic kube-gateway-jwt-secret --from-file=test/cert.pem --from-file=test/key.pem
8484

8585
# create a token request
86-
oc create -f config/samples/ocgate_v1beta1_gatetoken.yaml
86+
oc create -f config/samples/kubegateway_v1beta1_gatetoken.yaml
8787

8888
# check the token
8989
oc get gatetoken gatetoken-sample -o yaml
@@ -107,5 +107,5 @@ make run
107107

108108
```bash
109109
export USERNAME=yaacov
110-
make podman-build podman-push IMG=quay.io/$USERNAME/oc-gate-operator:v0.0.1
110+
make podman-build podman-push IMG=quay.io/$USERNAME/kube-gateway-operator:v0.0.1
111111
```

api/v1beta1/gatetoken_types.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,24 @@ type GateTokenSpec struct {
7272
Verbs []string `json:"verbs"`
7373

7474
// secret-name is the name of the secret holding the private key used to sign the token.
75-
// Defalut value is "kube-gateway-secret".
76-
// +kubebuilder:validation:Optional
75+
// +kubebuilder:validation:Required
7776
// +kubebuilder:validation:Type="string"
78-
// +kubebuilder:default:="1h"
77+
// +kubebuilder:default:=""
7978
SecretName string `json:"secret-name"`
8079

8180
// secret-namspace is the namespace of the secret holding the private key used to sign the token.
82-
// Defalut value is "kube-gateway".
81+
// Defalut value is "".
8382
// +kubebuilder:validation:Optional
8483
// +kubebuilder:validation:Type="string"
85-
// +kubebuilder:default:="1h"
84+
// +kubebuilder:default:=""
8685
SecretNamespace string `json:"secret-namespace"`
86+
87+
// secret-file is the file entry in the secret holding the private key used to sign the token.
88+
// Defalut value is "tls.key".
89+
// +kubebuilder:validation:Optional
90+
// +kubebuilder:validation:Type="string"
91+
// +kubebuilder:default:="tls.key"
92+
SecretFile string `json:"secret-file"`
8793
}
8894

8995
// GateTokenStatus defines the observed state of GateToken

api/v1beta1/groupversion_info.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package v1beta1 contains API Schema definitions for the ocgate v1beta1 API group
17+
// Package v1beta1 contains API Schema definitions for the kubegateway v1beta1 API group
1818
// +kubebuilder:object:generate=true
19-
// +groupName=ocgate.yaacov.com
19+
// +groupName=kubegateway.kubevirt.io
2020
package v1beta1
2121

2222
import (
@@ -26,7 +26,7 @@ import (
2626

2727
var (
2828
// GroupVersion is group version used to register these objects
29-
GroupVersion = schema.GroupVersion{Group: "ocgate.yaacov.com", Version: "v1beta1"}
29+
GroupVersion = schema.GroupVersion{Group: "kubegateway.kubevirt.io", Version: "v1beta1"}
3030

3131
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
3232
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

bundle.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM scratch
33
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
44
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
55
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
6-
LABEL operators.operatorframework.io.bundle.package.v1=oc-gate-operator
6+
LABEL operators.operatorframework.io.bundle.package.v1=kube-gateway-operator
77
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
88
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.4.2
99
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
2+
---
3+
apiVersion: apiextensions.k8s.io/v1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
annotations:
7+
controller-gen.kubebuilder.io/version: v0.4.1
8+
creationTimestamp: null
9+
name: gateservers.kubegateway.kubevirt.io
10+
spec:
11+
group: kubegateway.kubevirt.io
12+
names:
13+
kind: GateServer
14+
listKind: GateServerList
15+
plural: gateservers
16+
singular: gateserver
17+
scope: Namespaced
18+
versions:
19+
- name: v1beta1
20+
schema:
21+
openAPIV3Schema:
22+
description: GateServer is the Schema for the gateservers API
23+
properties:
24+
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'
28+
type: string
29+
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'
33+
type: string
34+
metadata:
35+
type: object
36+
spec:
37+
description: GateServerSpec defines the desired state of GateServer
38+
properties:
39+
admin-resources:
40+
default: ""
41+
description: admin-resources is a comma seperated list of resources
42+
athorization role of the service if left empty service could access
43+
any resource. Defalut value is "".
44+
maxLength: 1024
45+
type: string
46+
admin-role:
47+
default: reader
48+
description: admin-role is the verbs athorization role of the service
49+
(reader/admin) if service is role is reader, clients getting tokens
50+
to use this service will be able to excute get, watch and list verbs.
51+
if service is role is admin, clients getting tokens to use this
52+
service will be able to excute get, watch, list, patch, creat and
53+
delete verbs. Defalut value is "reader".
54+
maxLength: 1024
55+
pattern: ^(reader|admin)$
56+
type: string
57+
api-url:
58+
default: https://kubernetes.default.svc
59+
description: api-url is the k8s API url. Defalut value is "https://kubernetes.default.svc".
60+
maxLength: 1024
61+
pattern: ^(http|https)://.*
62+
type: string
63+
img:
64+
default: quay.io/kubevirt-ui/kube-gateway:latest
65+
description: img is the kube-gateway image to use. Defalut value is
66+
"quay.io/yaacov/kube-gateway:latest".
67+
maxLength: 1024
68+
type: string
69+
route:
70+
description: route for the gate proxy server.
71+
maxLength: 226
72+
pattern: ^([a-z0-9-_])+[.]([a-z0-9-_])+[.]([a-z0-9-._])+$
73+
type: string
74+
type: object
75+
status:
76+
description: GateServerStatus defines the observed state of GateServer
77+
properties:
78+
conditions:
79+
description: Conditions represent the latest available observations
80+
of an object's state
81+
items:
82+
description: "Condition contains details for one aspect of the current
83+
state of this API Resource. --- This struct is intended for direct
84+
use as an array at the field path .status.conditions. For example,
85+
type FooStatus struct{ // Represents the observations of a
86+
foo's current state. // Known .status.conditions.type are:
87+
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
88+
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
89+
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
90+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
91+
\n // other fields }"
92+
properties:
93+
lastTransitionTime:
94+
description: lastTransitionTime is the last time the condition
95+
transitioned from one status to another. This should be when
96+
the underlying condition changed. If that is not known, then
97+
using the time when the API field changed is acceptable.
98+
format: date-time
99+
type: string
100+
message:
101+
description: message is a human readable message indicating
102+
details about the transition. This may be an empty string.
103+
maxLength: 32768
104+
type: string
105+
observedGeneration:
106+
description: observedGeneration represents the .metadata.generation
107+
that the condition was set based upon. For instance, if .metadata.generation
108+
is currently 12, but the .status.conditions[x].observedGeneration
109+
is 9, the condition is out of date with respect to the current
110+
state of the instance.
111+
format: int64
112+
minimum: 0
113+
type: integer
114+
reason:
115+
description: reason contains a programmatic identifier indicating
116+
the reason for the condition's last transition. Producers
117+
of specific condition types may define expected values and
118+
meanings for this field, and whether the values are considered
119+
a guaranteed API. The value should be a CamelCase string.
120+
This field may not be empty.
121+
maxLength: 1024
122+
minLength: 1
123+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
124+
type: string
125+
status:
126+
description: status of the condition, one of True, False, Unknown.
127+
enum:
128+
- "True"
129+
- "False"
130+
- Unknown
131+
type: string
132+
type:
133+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
134+
--- Many .condition.type values are consistent across resources
135+
like Available, but because arbitrary conditions can be useful
136+
(see .node.status.conditions), the ability to deconflict is
137+
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
138+
maxLength: 316
139+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
140+
type: string
141+
required:
142+
- lastTransitionTime
143+
- message
144+
- reason
145+
- status
146+
- type
147+
type: object
148+
type: array
149+
phase:
150+
description: Token generation phase (ready|error)
151+
type: string
152+
required:
153+
- conditions
154+
- phase
155+
type: object
156+
type: object
157+
served: true
158+
storage: true
159+
subresources:
160+
status: {}
161+
status:
162+
acceptedNames:
163+
kind: ""
164+
plural: ""
165+
conditions: []
166+
storedVersions: []

0 commit comments

Comments
 (0)