diff --git a/.coderabbit.yaml b/.coderabbit.yaml index 1c35579b..243f1b40 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -41,6 +41,5 @@ reviews: - "!package-lock.json" - "!locales/en/**" - "!**/*.snap" - - "!charts/**/*.yaml" chat: auto_reply: true diff --git a/AGENTS.md b/AGENTS.md index 25965587..bbd5a2d1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,7 +37,6 @@ integration-tests/ # Cypress E2E tests fixtures/ # Test data support/ # Cypress support files locales/ # i18n translation files (en, es, fr, ja, ko, zh) -charts/ # Helm chart for cluster deployment plugin-manifest.ts # Console plugin entry point — registers all extensions and exposed modules webpack.config.ts # Webpack config with ConsoleRemotePlugin ``` diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index d7cd86fe..6e5cef8e 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -104,12 +104,6 @@ Kubernetes API server. The plugin does not make direct API calls. - `Dockerfile` builds using the `rhel-9-base-nodejs-openshift-4.22` builder image, then serves static files via nginx. - `Dockerfile.art` is the ART (Automated Release Tooling) variant used by Red Hat build systems. -### Cluster Deployment - -- A Helm chart in `charts/openshift-console-plugin/` deploys the plugin as an nginx pod with a `ConsolePlugin` CR. -- The chart supports security context, pod security, resource limits, and a patcher job that registers the plugin with - the console operator. - ## CI/CD The project uses Prow and CI Operator (`.ci-operator.yaml`): diff --git a/README.md b/README.md index 34b9de3c..8e59cbfc 100644 --- a/README.md +++ b/README.md @@ -151,18 +151,6 @@ docker push quay.io/my-repository/networking-console-plugin:latest On Apple silicon, add `--platform=linux/amd64`. -## Deployment - -A [Helm chart](charts/openshift-console-plugin/) deploys the plugin to OpenShift: - -```bash -helm upgrade -i networking-console-plugin charts/openshift-console-plugin \ - -n plugin__networking-console-plugin --create-namespace \ - --set plugin.image= -``` - -See `charts/openshift-console-plugin/values.yaml` for all parameters. - ## Testing ### Frontend Validation @@ -193,4 +181,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for coding standards, PR process, and com |---------------------------------------------------------------------------------|-------------------------------------------------------------| | [OpenShift web console](https://github.com/openshift/console) | Web-based user interface for OpenShift | | [OpenShift Dynamic Plugin SDK](https://github.com/openshift/dynamic-plugin-sdk) | Dynamic plugin SDK for OpenShift user interfaces | -| [PatternFly](https://www.patternfly.org/) | Open-source design system used for OpenShift UI development | \ No newline at end of file +| [PatternFly](https://www.patternfly.org/) | Open-source design system used for OpenShift UI development | diff --git a/charts/openshift-console-plugin/.helmignore b/charts/openshift-console-plugin/.helmignore deleted file mode 100644 index 0e8a0eb3..00000000 --- a/charts/openshift-console-plugin/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/charts/openshift-console-plugin/Chart.yaml b/charts/openshift-console-plugin/Chart.yaml deleted file mode 100644 index 72bdd846..00000000 --- a/charts/openshift-console-plugin/Chart.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v2 -name: networking-console-plugin -description: A Helm chart for Kubernetes -type: application -version: 0.1.0 diff --git a/charts/openshift-console-plugin/templates/_helpers.tpl b/charts/openshift-console-plugin/templates/_helpers.tpl deleted file mode 100644 index 4d489739..00000000 --- a/charts/openshift-console-plugin/templates/_helpers.tpl +++ /dev/null @@ -1,72 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "openshift-console-plugin.name" -}} -{{- default (default .Chart.Name .Release.Name) .Values.plugin.name | trunc 63 | trimSuffix "-" }} -{{- end }} - - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "openshift-console-plugin.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "openshift-console-plugin.labels" -}} -helm.sh/chart: {{ include "openshift-console-plugin.chart" . }} -{{ include "openshift-console-plugin.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "openshift-console-plugin.selectorLabels" -}} -app: {{ include "openshift-console-plugin.name" . }} -app.kubernetes.io/name: {{ include "openshift-console-plugin.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -app.kubernetes.io/part-of: {{ include "openshift-console-plugin.name" . }} -{{- end }} - -{{/* -Create the name secret containing the certificate -*/}} -{{- define "openshift-console-plugin.certificateSecret" -}} -{{ default (printf "%s-cert" (include "openshift-console-plugin.name" .)) .Values.plugin.certificateSecretName }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "openshift-console-plugin.serviceAccountName" -}} -{{- if .Values.plugin.serviceAccount.create }} -{{- default (include "openshift-console-plugin.name" .) .Values.plugin.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.plugin.serviceAccount.name }} -{{- end }} -{{- end }} - -{{/* -Create the name of the patcher -*/}} -{{- define "openshift-console-plugin.patcherName" -}} -{{- printf "%s-patcher" (include "openshift-console-plugin.name" .) }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "openshift-console-plugin.patcherServiceAccountName" -}} -{{- if .Values.plugin.patcherServiceAccount.create }} -{{- default (printf "%s-patcher" (include "openshift-console-plugin.name" .)) .Values.plugin.patcherServiceAccount.name }} -{{- else }} -{{- default "default" .Values.plugin.patcherServiceAccount.name }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/charts/openshift-console-plugin/templates/configmap.yaml b/charts/openshift-console-plugin/templates/configmap.yaml deleted file mode 100644 index 07c2170e..00000000 --- a/charts/openshift-console-plugin/templates/configmap.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "openshift-console-plugin.name" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "openshift-console-plugin.labels" . | nindent 4 }} -data: - nginx.conf: | - error_log /dev/stdout info; - events {} - http { - access_log /dev/stdout; - include /etc/nginx/mime.types; - default_type application/octet-stream; - keepalive_timeout 65; - server { - listen {{ .Values.plugin.port }} ssl; - listen [::]:{{ .Values.plugin.port }} ssl; - ssl_certificate /var/cert/tls.crt; - ssl_certificate_key /var/cert/tls.key; - root /usr/share/nginx/html; - } - } diff --git a/charts/openshift-console-plugin/templates/consoleplugin.yaml b/charts/openshift-console-plugin/templates/consoleplugin.yaml deleted file mode 100644 index c70aa50e..00000000 --- a/charts/openshift-console-plugin/templates/consoleplugin.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: console.openshift.io/v1 -kind: ConsolePlugin -metadata: - name: {{ template "openshift-console-plugin.name" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "openshift-console-plugin.labels" . | nindent 4 }} -spec: - displayName: {{ default (printf "%s Plugin" (include "openshift-console-plugin.name" .)) .Values.plugin.description }} - i18n: - loadType: Preload - backend: - type: Service - service: - name: {{ template "openshift-console-plugin.name" . }} - namespace: {{ .Release.Namespace }} - port: {{ .Values.plugin.port }} - basePath: {{ .Values.plugin.basePath }} \ No newline at end of file diff --git a/charts/openshift-console-plugin/templates/deployment.yaml b/charts/openshift-console-plugin/templates/deployment.yaml deleted file mode 100644 index 4c9c74c9..00000000 --- a/charts/openshift-console-plugin/templates/deployment.yaml +++ /dev/null @@ -1,57 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "openshift-console-plugin.name" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "openshift-console-plugin.labels" . | nindent 4 }} - app.openshift.io/runtime-namespace: {{ .Release.Namespace }} -spec: - replicas: {{ .Values.plugin.replicas }} - selector: - matchLabels: - {{- include "openshift-console-plugin.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - {{- include "openshift-console-plugin.labels" . | nindent 8 }} - spec: - containers: - - name: {{ template "openshift-console-plugin.name" . }} - image: {{ required "Plugin image must be specified!" .Values.plugin.image }} - ports: - - containerPort: {{ .Values.plugin.port }} - protocol: TCP - imagePullPolicy: {{ .Values.plugin.imagePullPolicy }} - {{- if and (.Values.plugin.securityContext.enabled) (.Values.plugin.containerSecurityContext) }} - securityContext: {{ tpl (toYaml (omit .Values.plugin.containerSecurityContext "enabled")) $ | nindent 12 }} - {{- end }} - resources: - {{- toYaml .Values.plugin.resources | nindent 12 }} - volumeMounts: - - name: {{ template "openshift-console-plugin.certificateSecret" . }} - readOnly: true - mountPath: /var/cert - - name: nginx-conf - readOnly: true - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - volumes: - - name: {{ template "openshift-console-plugin.certificateSecret" . }} - secret: - secretName: {{ template "openshift-console-plugin.certificateSecret" . }} - defaultMode: 420 - - name: nginx-conf - configMap: - name: {{ template "openshift-console-plugin.name" . }} - defaultMode: 420 - restartPolicy: Always - dnsPolicy: ClusterFirst - {{- if and (.Values.plugin.securityContext.enabled) (.Values.plugin.podSecurityContext) }} - securityContext: {{ tpl (toYaml (omit .Values.plugin.podSecurityContext "enabled")) $ | nindent 8 }} - {{- end }} - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 25% - maxSurge: 25% diff --git a/charts/openshift-console-plugin/templates/patch-consoles-job.yaml b/charts/openshift-console-plugin/templates/patch-consoles-job.yaml deleted file mode 100644 index 0b2ccfe3..00000000 --- a/charts/openshift-console-plugin/templates/patch-consoles-job.yaml +++ /dev/null @@ -1,42 +0,0 @@ -{{- if .Values.plugin.jobs.patchConsoles.enabled }} -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ template "openshift-console-plugin.patcherName" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "openshift-console-plugin.labels" . | nindent 4 }} - annotations: - helm.sh/hook: post-install,post-upgrade - helm.sh/hook-delete-policy: before-hook-creation -spec: - parallelism: 1 - template: - metadata: - labels: - {{- include "openshift-console-plugin.labels" . | nindent 8 }} - spec: - restartPolicy: OnFailure - serviceAccountName: {{ template "openshift-console-plugin.patcherServiceAccountName" . }} - {{- if and (.Values.plugin.securityContext.enabled) (.Values.plugin.jobs.patchConsoles.podSecurityContext.enabled) }} - securityContext: {{ tpl (toYaml (omit .Values.plugin.jobs.patchConsoles.podSecurityContext "enabled")) $ | nindent 8 }} - {{- end }} - terminationGracePeriodSeconds: 400 - dnsPolicy: ClusterFirst - containers: - - name: {{ template "openshift-console-plugin.patcherName" . }} - image: {{ required "Patcher image must be specified!" .Values.plugin.jobs.patchConsoles.image }} - {{- if and (.Values.plugin.securityContext.enabled) (.Values.plugin.containerSecurityContext) }} - securityContext: {{ tpl (toYaml (omit .Values.plugin.jobs.patchConsoles.containerSecurityContext "enabled")) $ | nindent 12 }} - {{- end }} - resources: - {{- toYaml .Values.plugin.jobs.patchConsoles.resources | nindent 12 }} - command: - - /bin/bash - - -c - - | - existingPlugins=$(oc get consoles.operator.openshift.io cluster -o json | jq -c '.spec.plugins // []') - mergedPlugins=$(jq --argjson existingPlugins "${existingPlugins}" --argjson consolePlugin '["{{ template "openshift-console-plugin.name" . }}"]' -c -n '$existingPlugins + $consolePlugin | unique') - patchedPlugins=$(jq --argjson mergedPlugins $mergedPlugins -n -c '{ "spec": { "plugins": $mergedPlugins } }') - oc patch consoles.operator.openshift.io cluster --patch $patchedPlugins --type=merge -{{- end }} \ No newline at end of file diff --git a/charts/openshift-console-plugin/templates/patcher-clusterrole.yaml b/charts/openshift-console-plugin/templates/patcher-clusterrole.yaml deleted file mode 100644 index 31c050a5..00000000 --- a/charts/openshift-console-plugin/templates/patcher-clusterrole.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{- if .Values.plugin.jobs.patchConsoles.enabled }} -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: {{ template "openshift-console-plugin.patcherName" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "openshift-console-plugin.labels" . | nindent 4 }} -rules: - - apiGroups: ["operator.openshift.io"] - resources: ["consoles"] - verbs: ["get","list","patch", "update"] -{{- end }} \ No newline at end of file diff --git a/charts/openshift-console-plugin/templates/patcher-clusterrolebinding.yaml b/charts/openshift-console-plugin/templates/patcher-clusterrolebinding.yaml deleted file mode 100644 index d93b8721..00000000 --- a/charts/openshift-console-plugin/templates/patcher-clusterrolebinding.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if .Values.plugin.jobs.patchConsoles.enabled }} -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ template "openshift-console-plugin.patcherName" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "openshift-console-plugin.labels" . | nindent 4 }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: {{ template "openshift-console-plugin.patcherName" . }} -subjects: - - kind: ServiceAccount - name: {{ template "openshift-console-plugin.patcherServiceAccountName" . }} - namespace: {{ .Release.Namespace }} -{{- end }} \ No newline at end of file diff --git a/charts/openshift-console-plugin/templates/patcher-serviceaccount.yaml b/charts/openshift-console-plugin/templates/patcher-serviceaccount.yaml deleted file mode 100644 index 4af6a6b9..00000000 --- a/charts/openshift-console-plugin/templates/patcher-serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if and (.Values.plugin.patcherServiceAccount.create) (.Values.plugin.jobs.patchConsoles.enabled) -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "openshift-console-plugin.patcherServiceAccountName" . }} - labels: - {{- include "openshift-console-plugin.labels" . | nindent 4 }} - {{- with .Values.plugin.patcherServiceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/charts/openshift-console-plugin/templates/service.yaml b/charts/openshift-console-plugin/templates/service.yaml deleted file mode 100644 index cb6c9bfc..00000000 --- a/charts/openshift-console-plugin/templates/service.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - {{- if not .Values.certificateSecretName }} - annotations: - service.alpha.openshift.io/serving-cert-secret-name: {{ template "openshift-console-plugin.certificateSecret" . }} - {{- end }} - name: {{ template "openshift-console-plugin.name" . }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "openshift-console-plugin.labels" . | nindent 4 }} -spec: - ports: - - name: {{ .Values.plugin.port }}-tcp - protocol: TCP - port: {{ .Values.plugin.port }} - targetPort: {{ .Values.plugin.port }} - selector: - {{- include "openshift-console-plugin.selectorLabels" . | nindent 4 }} - type: ClusterIP - sessionAffinity: None diff --git a/charts/openshift-console-plugin/templates/serviceaccount.yaml b/charts/openshift-console-plugin/templates/serviceaccount.yaml deleted file mode 100644 index 5c3dffe4..00000000 --- a/charts/openshift-console-plugin/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.plugin.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "openshift-console-plugin.serviceAccountName" . }} - labels: - {{- include "openshift-console-plugin.labels" . | nindent 4 }} - {{- with .Values.plugin.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/charts/openshift-console-plugin/values.yaml b/charts/openshift-console-plugin/values.yaml deleted file mode 100644 index 6cc865ba..00000000 --- a/charts/openshift-console-plugin/values.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -plugin: - name: "" - description: "" - image: "" - imagePullPolicy: IfNotPresent - replicas: 2 - port: 9443 - securityContext: - enabled: true - podSecurityContext: - enabled: true - runAsNonRoot: true - seccompProfile: - type: RuntimeDefault - containerSecurityContext: - enabled: true - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - resources: - requests: - cpu: 10m - memory: 50Mi - basePath: / - certificateSecretName: "" - serviceAccount: - create: true - annotations: {} - name: "" - patcherServiceAccount: - create: true - annotations: {} - name: "" - jobs: - patchConsoles: - enabled: true - image: "registry.redhat.io/openshift4/ose-tools-rhel8@sha256:e44074f21e0cca6464e50cb6ff934747e0bd11162ea01d522433a1a1ae116103" - podSecurityContext: - enabled: true - runAsNonRoot: true - seccompProfile: - type: RuntimeDefault - containerSecurityContext: - enabled: true - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - resources: - requests: - cpu: 10m - memory: 50Mi diff --git a/ct.yaml b/ct.yaml deleted file mode 100644 index f178aec1..00000000 --- a/ct.yaml +++ /dev/null @@ -1,5 +0,0 @@ -chart-dirs: - - charts -validate-maintainers: false -remote: origin -target-branch: main diff --git a/install_helm.sh b/install_helm.sh deleted file mode 100755 index 3a943f5e..00000000 --- a/install_helm.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -USE_SUDO="false" -HELM_INSTALL_DIR="/tmp" - -curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 -chmod 700 get_helm.sh -source get_helm.sh - -rm -rf get_helm.sh \ No newline at end of file diff --git a/integration-tests/tests/example-page.cy.ts b/integration-tests/tests/example-page.cy.ts deleted file mode 100644 index 922011c7..00000000 --- a/integration-tests/tests/example-page.cy.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { checkErrors } from '../support'; - -const PLUGIN_TEMPLATE_NAME = 'networking-console-plugin'; -const PLUGIN_TEMPLATE_PULL_SPEC = Cypress.env('PLUGIN_TEMPLATE_PULL_SPEC'); -export const isLocalDevEnvironment = Cypress.config('baseUrl').includes('localhost'); - -const installHelmChart = (path: string) => { - cy.exec( - `cd ../../networking-console-plugin && ${path} upgrade -i ${PLUGIN_TEMPLATE_NAME} charts/openshift-console-plugin -n ${PLUGIN_TEMPLATE_NAME} --create-namespace --set plugin.image=${PLUGIN_TEMPLATE_PULL_SPEC}`, - { - failOnNonZeroExit: false, - }, - ) - .get('[data-test="refresh-web-console"]', { timeout: 300000 }) - .should('exist') - .then((result) => { - cy.reload(); - cy.visit(`/dashboards`); - cy.log('Error installing helm chart: ', result.stderr); - cy.log('Successfully installed helm chart: ', result.stdout); - }); -}; -const deleteHelmChart = (path: string) => { - cy.exec( - `cd ../../networking-console-plugin && ${path} uninstall ${PLUGIN_TEMPLATE_NAME} -n ${PLUGIN_TEMPLATE_NAME} && oc delete namespaces ${PLUGIN_TEMPLATE_NAME}`, - { - failOnNonZeroExit: false, - }, - ).then((result) => { - cy.log('Error uninstalling helm chart: ', result.stderr); - cy.log('Successfully uninstalled helm chart: ', result.stdout); - }); -}; - -describe.skip('Console plugin template test', () => { - before(() => { - cy.login(); - - if (!isLocalDevEnvironment) { - console.log('this is not a local env, installig helm'); - - cy.exec('cd ../../networking-console-plugin && ./install_helm.sh', { - failOnNonZeroExit: false, - }).then((result) => { - cy.log('Error installing helm binary: ', result.stderr); - cy.log('Successfully installed helm binary in "/tmp" directory: ', result.stdout); - - installHelmChart('/tmp/helm'); - }); - } else { - console.log('this is a local env, not installing helm'); - - installHelmChart('helm'); - } - }); - - afterEach(() => { - checkErrors(); - }); - - after(() => { - if (!isLocalDevEnvironment) { - deleteHelmChart('/tmp/helm'); - } else { - deleteHelmChart('helm'); - } - cy.logout(); - }); - - it('Verify the example page title', () => { - cy.get('[data-quickstart-id="qs-nav-home"]').click(); - cy.get('[data-test="nav"]').contains('Plugin Example').click(); - cy.url().should('include', '/example'); - cy.get('[data-test="example-page-title"]').should('contain', 'Hello, Plugin!'); - }); -});