Skip to content

Commit 94c9c4f

Browse files
Merge pull request #551 from mbaldessari/ui-poc-pr
Initial UI support
2 parents 18989d3 + d358c64 commit 94c9c4f

128 files changed

Lines changed: 20391 additions & 13 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@
3434
# Govulncheck stuff
3535
govulncheck.results
3636
/database
37+
38+
*Dockerfile

Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
55
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
66
VERSION ?= 0.0.4
7+
SUPPORTED_OCP_VERSIONS ?= v4.20-v4.21
78
OPERATOR_NAME ?= patterns
89
GOFLAGS=-mod=vendor
910
REGISTRY ?= localhost
1011
UPLOADREGISTRY ?= quay.io/validatedpatterns
1112
GOLANGCI_IMG ?= docker.io/golangci/golangci-lint
1213
GOLANGCI_VERSION ?= 2.11.3
1314

15+
1416
# CI uses a non-writable home dir, make sure .cache is writable
1517
ifeq ("${HOME}", "/")
1618
HOME=/tmp
@@ -69,6 +71,13 @@ BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
6971
# Image URL to use all building/pushing image targets
7072
IMG ?= $(IMAGE_TAG_BASE):$(VERSION)
7173
OPERATOR_IMG ?= $(OPERATOR_NAME)-operator:$(VERSION)
74+
75+
# always release the console with the same tag as the operator and the other way around!
76+
# Image base URL of the console plugin
77+
CONSOLE_PLUGIN_IMAGE_BASE ?= $(IMAGE_TAG_BASE)-console
78+
CONSOLE_PLUGIN_IMAGE ?= $(CONSOLE_PLUGIN_IMAGE_BASE):$(VERSION)
79+
CONSOLE_PLUGIN_DOCKERFILE ?= console-plugin.Dockerfile
80+
7281
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
7382
ENVTEST_K8S_VERSION = 1.30
7483

@@ -205,11 +214,16 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
205214
.PHONY: deploy
206215
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
207216
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
217+
cd config/console-plugin && $(KUSTOMIZE) edit set image console-plugin=${CONSOLE_PLUGIN_IMAGE}
208218
$(KUSTOMIZE) build config/default | kubectl apply -f -
219+
$(KUSTOMIZE) build config/console-plugin | kubectl apply -f -
220+
$(KUSTOMIZE) build config/pattern-ui-catalog | kubectl apply -f -
209221

210222
.PHONY: undeploy
211223
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
212224
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
225+
$(KUSTOMIZE) build config/console-plugin | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
226+
$(KUSTOMIZE) build config/pattern-ui-catalog | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
213227

214228
## Location to install dependencies to
215229
LOCALBIN ?= $(shell pwd)/bin
@@ -293,6 +307,7 @@ endef
293307
bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
294308
$(OPERATOR_SDK) generate kustomize manifests -q
295309
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
310+
cd config/console-plugin && $(KUSTOMIZE) edit set image console-plugin=$(CONSOLE_PLUGIN_IMAGE)
296311
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
297312
$(MAKE) bundle-fixes bundle-date
298313
./hack/set_openshift_minimum_version.sh
@@ -352,6 +367,22 @@ ifneq ($(origin CATALOG_BASE_IMG), undefined)
352367
FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG)
353368
endif
354369

370+
# Generate Dockerfile using the template. It uses envsubst to replace the value of the version label in the container
371+
.PHONY: generate-dockerfile-console-plugin
372+
generate-dockerfile-console-plugin:
373+
VERSION=$(VERSION) SUPPORTED_OCP_VERSIONS=$(SUPPORTED_OCP_VERSIONS) envsubst < templates/console-plugin.Dockerfile.template > $(CONSOLE_PLUGIN_DOCKERFILE)
374+
375+
.PHONY: console-build
376+
console-build: generate-dockerfile-console-plugin ## Build the console image
377+
@echo "Building console image with cache optimization..."
378+
@podman pull $(CONSOLE_PLUGIN_IMAGE_BASE):latest 2>/dev/null || true
379+
podman build -f $(CURPATH)/$(CONSOLE_PLUGIN_DOCKERFILE) -t ${CONSOLE_PLUGIN_IMAGE} .
380+
podman tag ${CONSOLE_PLUGIN_IMAGE} $(CONSOLE_PLUGIN_IMAGE_BASE):latest
381+
382+
.PHONY: console-push
383+
console-push: ## Push the console image
384+
podman push $(CONSOLE_PLUGIN_IMAGE)
385+
355386
# Build an OLM catalog image by adding the bundle image to a simple catalog using the
356387
# operator package manager tool, 'opm'. For more information see:
357388
# https://olm.operatorframework.io/docs/reference/catalog-templates

TODO.ui

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
- Tie down the RBACs
2+
- Next to Catalog, can we show the single Pattern CR (reusing the existing UI)?
3+
- Add one or two screenshots (logo, screenshot, etc)
4+
- AI based pattern with extra bits (one AI quickstart vs the other quickstart)
5+
- Can we prettify the install part (maybe poke the pattern CR status?)
6+
Or the metadata of the pattern can include some steps
7+
- Need to think about workflows around the catalog
8+
- Add some requirements
9+
- We need to come up with a plan for the versioning of catalogs (i.e. the tags of the catalog container)
10+
Default is stable-v1, future operators could switch defaults. Maybe we could show if we're using an
11+
outdated tag in the console
12+
- Test plan
13+
- Deploy a pattern via CLI, will it show as installed in the UI catalog
14+
15+
[DONE]
16+
- Add a button to load the secrets separately ?
17+
- Did the random secret injection not work?
18+
- If a pattern is already installed then show it is so in the catalog (or add the uninstall button)
19+
- Finish job loading to work
20+
- Make sure we delete the secret used by the secret loading job
21+
- Fix IE when no secrets
22+
- Add a description, drop owners (maybe also org)
23+
- Add where the catalog came from
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
data:
3+
nginx.conf: |
4+
error_log /dev/stdout info;
5+
events {}
6+
http {
7+
access_log /dev/stdout;
8+
include /etc/nginx/mime.types;
9+
default_type application/octet-stream;
10+
keepalive_timeout 65;
11+
server {
12+
listen 9443 ssl;
13+
listen [::]:9443 ssl;
14+
ssl_certificate /var/cert/tls.crt;
15+
ssl_certificate_key /var/cert/tls.key;
16+
root /usr/share/nginx/html;
17+
}
18+
}
19+
kind: ConfigMap
20+
metadata:
21+
labels:
22+
app.kubernetes.io/component: patterns-operator-console-plugin
23+
name: patterns-operator-console-plugin
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
service.beta.openshift.io/serving-cert-secret-name: patterns-operator-console-plugin-cert
6+
creationTimestamp: null
7+
labels:
8+
app.kubernetes.io/component: patterns-operator-console-plugin
9+
name: patterns-operator-console-plugin
10+
spec:
11+
ports:
12+
- name: 9443-tcp
13+
port: 9443
14+
protocol: TCP
15+
targetPort: https
16+
selector:
17+
app.kubernetes.io/component: patterns-operator-console-plugin
18+
sessionAffinity: None
19+
type: ClusterIP
20+
status:
21+
loadBalancer: {}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
creationTimestamp: null
5+
name: patterns-operator-patterns-secret-injector-role
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- namespaces
11+
verbs:
12+
- get
13+
- list
14+
- apiGroups:
15+
- ""
16+
resources:
17+
- secrets
18+
verbs:
19+
- get
20+
- list
21+
- create
22+
- update
23+
- patch
24+
- delete
25+
- apiGroups:
26+
- ""
27+
resources:
28+
- pods
29+
verbs:
30+
- get
31+
- list
32+
- apiGroups:
33+
- ""
34+
resources:
35+
- pods/exec
36+
verbs:
37+
- create
38+
- apiGroups:
39+
- batch
40+
resources:
41+
- jobs
42+
verbs:
43+
- get
44+
- list
45+
- create
46+
- update
47+
- patch
48+
- delete
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
creationTimestamp: null
5+
name: patterns-operator-patterns-secret-injector-rolebinding
6+
roleRef:
7+
apiGroup: rbac.authorization.k8s.io
8+
kind: ClusterRole
9+
name: patterns-operator-patterns-secret-injector-role
10+
subjects:
11+
- kind: ServiceAccount
12+
name: patterns-operator-patterns-secret-injector
13+
namespace: patterns-operator-system
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
creationTimestamp: null
5+
name: patterns-operator-patterns-secret-injector
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
creationTimestamp: null
5+
name: patterns-operator-secret-injector-role
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- namespaces
11+
verbs:
12+
- get
13+
- list
14+
- apiGroups:
15+
- ""
16+
resources:
17+
- secrets
18+
verbs:
19+
- get
20+
- list
21+
- create
22+
- update
23+
- patch
24+
- delete
25+
- apiGroups:
26+
- ""
27+
resources:
28+
- pods
29+
verbs:
30+
- get
31+
- list
32+
- apiGroups:
33+
- ""
34+
resources:
35+
- pods/exec
36+
verbs:
37+
- get
38+
- create
39+
- apiGroups:
40+
- batch
41+
resources:
42+
- jobs
43+
verbs:
44+
- get
45+
- list
46+
- create
47+
- update
48+
- patch
49+
- delete
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
creationTimestamp: null
5+
name: patterns-operator-secret-injector-rolebinding
6+
roleRef:
7+
apiGroup: rbac.authorization.k8s.io
8+
kind: ClusterRole
9+
name: patterns-operator-secret-injector-role
10+
subjects:
11+
- kind: ServiceAccount
12+
name: patterns-operator-secret-injector
13+
namespace: patterns-operator

0 commit comments

Comments
 (0)