Skip to content

Commit 21874d8

Browse files
authored
feat: support SNCloud Connection & Compute Workspace & Compute FlinkDeployment (#278)
* add new api crds * add controller * add to main * fix const * fix ci * fix version * try SNBOT_GITHUB_TOKEN * bump pulsar-client-go * fix build * goimport * fix build * fix golangci-lint errors * fix header * fix docker build * add docs * add docs * go mod tidy * fix charts * copy crds
1 parent 2872f9f commit 21874d8

File tree

96 files changed

+17383
-1172
lines changed

Some content is hidden

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

96 files changed

+17383
-1172
lines changed

.github/workflows/chart-test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ on:
2323
- 'charts/**'
2424
- '.github/workflows/chart-test.yml'
2525

26+
env:
27+
GOPRIVATE: github.com/streamnative
28+
2629
jobs:
2730
lint-test:
2831
runs-on: ubuntu-22.04
@@ -47,7 +50,10 @@ jobs:
4750
diff config/crd/bases/resource.streamnative.io_pulsarsources.yaml charts/pulsar-resources-operator/crds/resource.streamnative.io_pulsarsources.yaml && \
4851
diff config/crd/bases/resource.streamnative.io_pulsarpackages.yaml charts/pulsar-resources-operator/crds/resource.streamnative.io_pulsarpackages.yaml && \
4952
diff config/crd/bases/resource.streamnative.io_pulsartopics.yaml charts/pulsar-resources-operator/crds/resource.streamnative.io_pulsartopics.yaml && \
50-
diff config/crd/bases/resource.streamnative.io_pulsarnsisolationpolicies.yaml charts/pulsar-resources-operator/crds/resource.streamnative.io_pulsarnsisolationpolicies.yaml
53+
diff config/crd/bases/resource.streamnative.io_pulsarnsisolationpolicies.yaml charts/pulsar-resources-operator/crds/resource.streamnative.io_pulsarnsisolationpolicies.yaml && \
54+
diff config/crd/bases/resource.streamnative.io_streamnativecloudconnections.yaml charts/pulsar-resources-operator/crds/resource.streamnative.io_streamnativecloudconnections.yaml && \
55+
diff config/crd/bases/resource.streamnative.io_computeworkspaces.yaml charts/pulsar-resources-operator/crds/resource.streamnative.io_computeworkspaces.yaml && \
56+
diff config/crd/bases/resource.streamnative.io_computeflinkdeployments.yaml charts/pulsar-resources-operator/crds/resource.streamnative.io_computeflinkdeployments.yaml
5157
5258
- name: Set up Helm
5359
uses: azure/setup-helm@v3

.github/workflows/e2e_test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ on:
2121
paths:
2222
- '**.go'
2323
- '.github/workflows/e2e_test.yml'
24+
env:
25+
GOPRIVATE: github.com/streamnative
2426
jobs:
2527
e2e-test:
2628
name: E2e tests for Operators
@@ -31,7 +33,7 @@ jobs:
3133
env:
3234
ALWAYS_UPDATE_PULSAR_RESOURCE: ${{ matrix.alwaysUpdatePulsar }}
3335
GOPRIVATE: github.com/streamnative
34-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
36+
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
3537
IMAGE: streamnative/sn-platform:2.10.4.3
3638
WATCH_CERT_MANAGER_CRDS: "false"
3739
steps:

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ permissions:
2525
contents: read
2626
# Optional: allow read access to pull request. Use with `only-new-issues` option.
2727
# pull-requests: read
28+
env:
29+
GOPRIVATE: github.com/streamnative
2830
jobs:
2931
golangci:
3032
name: lint
3133
runs-on: ubuntu-22.04
3234
env:
33-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
35+
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
3436
GOPRIVATE: github.com/streamnative
3537
steps:
3638
- name: Set up git token

.github/workflows/release-certificated-olm.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ on:
2828
required: true
2929
default: alpha
3030

31+
env:
32+
GOPRIVATE: github.com/streamnative
3133
jobs:
3234
operatorhub-prod:
3335
name: Create PR to the redhat
3436
runs-on: ubuntu-22.04
3537
env:
3638
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
3739
GOPRIVATE: github.com/streamnative
38-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
40+
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
3941
steps:
4042
- name: Sync up the prod upstream
4143
run: |

.github/workflows/release-community-olm.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ on:
2828
required: true
2929
default: alpha
3030

31+
env:
32+
GOPRIVATE: github.com/streamnative
3133
jobs:
3234
operatorhub:
3335
name: Create PR to the operatorhub
3436
runs-on: ubuntu-22.04
3537
env:
3638
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
3739
GOPRIVATE: github.com/streamnative
38-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
40+
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
3941
steps:
4042
- name: Sync up the upstream
4143
run: |

.github/workflows/release-operator.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ on:
1919
tags:
2020
- 'v[0-9]+.[0-9]+.[0-9]+-?*'
2121

22+
env:
23+
GOPRIVATE: github.com/streamnative
2224
jobs:
2325
build:
2426
name: Build image and bundle
2527
runs-on: ubuntu-22.04
2628
env:
2729
GOPRIVATE: github.com/streamnative
28-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
30+
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
2931
IMAGE_TAG_BASE: docker.cloudsmith.io/streamnative/operators/pulsar-resources-operator
3032
IMAGE_TAG_BASE_QUAY: quay.io/streamnativeio/pulsar-resources-operator
3133
IMAGE_TAG_BASE_DOCKERHUB: docker.io/streamnative/pulsar-resources-operator

.github/workflows/style.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ on:
2222
pull_request:
2323
branches:
2424
- '*'
25+
env:
26+
GOPRIVATE: github.com/streamnative
2527
jobs:
26-
2728
build:
2829
name: Build
2930
runs-on: ubuntu-22.04
3031
env:
31-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
32+
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
3233
GOPRIVATE: github.com/streamnative
3334
steps:
3435
- name: Set up Go 1.21

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ test: manifests generate fmt vet envtest ## Run tests.
120120
##@ Build
121121

122122
.PHONY: build
123-
build: generate fmt vet ## Build manager binary.
123+
build: generate fmt vet license-fix ## Build manager binary.
124124
go build -o bin/manager main.go
125125

126126
.PHONY: run
@@ -129,7 +129,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
129129

130130
.PHONY: docker-build
131131
docker-build: test ## Build docker image with the manager.
132-
docker build -t ${IMG} .
132+
docker build -t ${IMG} . --build-arg ACCESS_TOKEN=${ACCESS_TOKEN}
133133

134134
# Build image for redhat certification
135135
.PHONY: docker-build-redhat

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ In this tutorial, a Kubernetes namespace called `test` is used for examples, whi
130130
- [PulsarSource](docs/pulsar_source.md)
131131
- [PulsarGeoReplication](docs/pulsar_geo_replication.md)
132132
- [NS-Isolation-Policy](docs/pulsar_ns_isolation_policy.md)
133+
- [StreamNativeCloudConnection](docs/streamnative_cloud_connection.md)
134+
- [ComputeWorkspace](docs/compute_workspace.md)
135+
- [ComputeFlinkDeployment](docs/compute_flink_deployment.md)
133136

134137
# Contributing
135138

api/v1alpha1/common.go

Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 StreamNative
1+
// Copyright 2025 StreamNative
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,6 +17,8 @@ package v1alpha1
1717
import (
1818
"reflect"
1919

20+
corev1 "k8s.io/api/core/v1"
21+
2022
"k8s.io/apimachinery/pkg/api/meta"
2123
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2224

@@ -217,3 +219,141 @@ type FunctionSecretKeyRef struct {
217219
Path string `json:"path"`
218220
Key string `json:"key"`
219221
}
222+
223+
// PodTemplate defines the pod template configuration
224+
type PodTemplate struct {
225+
// Standard object's metadata.
226+
// +optional
227+
ObjectMeta ObjectMeta `json:"metadata,omitempty"`
228+
229+
// Specification of the desired behavior of the pod.
230+
// +optional
231+
Spec PodTemplateSpec `json:"spec,omitempty"`
232+
}
233+
234+
// ObjectMeta is metadata that all persisted resources must have
235+
type ObjectMeta struct {
236+
// Name of the resource
237+
// +optional
238+
Name string `json:"name,omitempty"`
239+
240+
// Namespace of the resource
241+
// +optional
242+
Namespace string `json:"namespace,omitempty"`
243+
244+
// Labels of the resource
245+
// +optional
246+
Labels map[string]string `json:"labels,omitempty"`
247+
248+
// Annotations of the resource
249+
// +optional
250+
Annotations map[string]string `json:"annotations,omitempty"`
251+
}
252+
253+
// PodTemplateSpec describes the data a pod should have when created from a template
254+
type PodTemplateSpec struct {
255+
// List of volumes that can be mounted by containers belonging to the pod.
256+
// +optional
257+
Volumes []Volume `json:"volumes,omitempty"`
258+
259+
// List of initialization containers belonging to the pod.
260+
// +optional
261+
InitContainers []Container `json:"initContainers,omitempty"`
262+
263+
// List of containers belonging to the pod.
264+
// +optional
265+
Containers []Container `json:"containers,omitempty"`
266+
267+
// ServiceAccountName is the name of the ServiceAccount to use to run this pod.
268+
// +optional
269+
ServiceAccountName string `json:"serviceAccountName,omitempty"`
270+
271+
// NodeSelector is a selector which must be true for the pod to fit on a node.
272+
// +optional
273+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
274+
275+
// SecurityContext holds pod-level security attributes and common container settings.
276+
// +optional
277+
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
278+
279+
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
280+
// +optional
281+
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
282+
283+
// If specified, the pod's scheduling constraints
284+
// +optional
285+
Affinity *corev1.Affinity `json:"affinity,omitempty"`
286+
287+
// If specified, the pod's tolerations.
288+
// +optional
289+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
290+
}
291+
292+
// Container defines a single application container
293+
type Container struct {
294+
// Name of the container specified as a DNS_LABEL.
295+
// +optional
296+
Name string `json:"name,omitempty"`
297+
298+
// Docker image name.
299+
// +optional
300+
Image string `json:"image,omitempty"`
301+
302+
// Entrypoint array. Not executed within a shell.
303+
// +optional
304+
Command []string `json:"command,omitempty"`
305+
306+
// Arguments to the entrypoint.
307+
// +optional
308+
Args []string `json:"args,omitempty"`
309+
310+
// Container's working directory.
311+
// +optional
312+
WorkingDir string `json:"workingDir,omitempty"`
313+
314+
// List of environment variables to set in the container.
315+
// +optional
316+
Env []corev1.EnvVar `json:"env,omitempty"`
317+
318+
// List of sources to populate environment variables in the container.
319+
// +optional
320+
EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
321+
322+
// Compute Resources required by this container.
323+
// +optional
324+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
325+
326+
// Pod volumes to mount into the container's filesystem.
327+
// +optional
328+
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
329+
330+
// Image pull policy.
331+
// +optional
332+
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
333+
334+
// Security context at container level
335+
// +optional
336+
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
337+
}
338+
339+
// Volume represents a named volume in a pod
340+
type Volume struct {
341+
// Volume's name.
342+
// +required
343+
Name string `json:"name"`
344+
345+
// VolumeSource represents the location and type of the mounted volume.
346+
// +required
347+
VolumeSource `json:",inline"`
348+
}
349+
350+
// VolumeSource represents the source location of a volume to mount.
351+
type VolumeSource struct {
352+
// ConfigMap represents a configMap that should populate this volume
353+
// +optional
354+
ConfigMap *corev1.ConfigMapVolumeSource `json:"configMap,omitempty"`
355+
356+
// Secret represents a secret that should populate this volume.
357+
// +optional
358+
Secret *corev1.SecretVolumeSource `json:"secret,omitempty"`
359+
}

0 commit comments

Comments
 (0)