Skip to content

Commit

Permalink
Merge pull request #2569 from leelavg/remove-rotate
Browse files Browse the repository at this point in the history
remove rotation of keys endpoint from ux-backend
  • Loading branch information
openshift-merge-bot[bot] authored Apr 22, 2024
2 parents faced96 + a209a03 commit 81bee97
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,6 @@ spec:
- name: ONBOARDING_TOKEN_LIFETIME
- name: UX_BACKEND_PORT
- name: TLS_ENABLED
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: quay.io/ocs-dev/ocs-operator:latest
imagePullPolicy: IfNotPresent
name: ux-backend-server
Expand Down
8 changes: 0 additions & 8 deletions deploy/ocs-operator/manifests/ux_backend_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@ rules:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- secrets
resourceNames:
- onboarding-ticket-key
verbs:
- delete
8 changes: 0 additions & 8 deletions rbac/ux_backend_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@ rules:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- secrets
resourceNames:
- onboarding-ticket-key
verbs:
- delete
18 changes: 0 additions & 18 deletions services/ux-backend/handlers/common.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
package handlers

import (
"os"
)

const (
ContentTypeTextPlain = "text/plain"
)

var namespace string

// returns namespace found in env value, will panic if value is empty
func GetPodNamespace() string {
if namespace != "" {
return namespace
}
if ns := os.Getenv("POD_NAMESPACE"); ns != "" {
namespace = ns
return namespace
}
panic("Value for env var 'POD_NAMESPACE' is empty")
}
62 changes: 0 additions & 62 deletions services/ux-backend/handlers/rotatekeys/handler.go

This file was deleted.

27 changes: 0 additions & 27 deletions services/ux-backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import (
"k8s.io/klog/v2"

"github.com/red-hat-storage/ocs-operator/v4/services/ux-backend/handlers/onboardingtokens"
"github.com/red-hat-storage/ocs-operator/v4/services/ux-backend/handlers/rotatekeys"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
)

type serverConfig struct {
Expand Down Expand Up @@ -54,20 +51,6 @@ func loadAndValidateServerConfig() (*serverConfig, error) {
return &config, nil
}

func newKubeClient() (client.Client, error) {
cfg, err := config.GetConfig()
if err != nil {
return nil, err
}

newClient, err := client.New(cfg, client.Options{})
if err != nil {
return nil, err
}

return newClient, nil
}

func main() {

klog.Info("Starting ux backend server")
Expand All @@ -78,19 +61,9 @@ func main() {
klog.Info("shutting down!")
os.Exit(-1)
}

cl, err := newKubeClient()
if err != nil {
klog.Errorf("failed to create kubernetes api client: %v", err)
klog.Exit("shutting down!")
}

http.HandleFunc("/onboarding-tokens", func(w http.ResponseWriter, r *http.Request) {
onboardingtokens.HandleMessage(w, r, config.tokenLifetimeInHours)
})
http.HandleFunc("/rotate-keys", func(w http.ResponseWriter, r *http.Request) {
rotatekeys.HandleMessage(w, r, cl)
})

klog.Info("ux backend server listening on port ", config.listenPort)

Expand Down
8 changes: 0 additions & 8 deletions tools/csv-merger/csv-merger.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,14 +663,6 @@ func getUXBackendServerDeployment() appsv1.DeploymentSpec {
Name: "TLS_ENABLED",
Value: os.Getenv("TLS_ENABLED"),
},
{
Name: "POD_NAMESPACE",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "metadata.namespace",
},
},
},
},
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.To(true),
Expand Down

0 comments on commit 81bee97

Please sign in to comment.