Skip to content

Commit

Permalink
renaming the package for the onboarding key generator job
Browse files Browse the repository at this point in the history
renaming the package for the onboarding key generator job
as it does not imply what it does

Signed-off-by: rchikatw <[email protected]>
  • Loading branch information
rchikatw committed Mar 3, 2024
1 parent 7d8646a commit 8893c73
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ARG LDFLAGS

RUN GOOS="$GOOS" GOARCH="$GOARCH" go build -ldflags "$LDFLAGS" -tags netgo,osusergo -o ocs-operator main.go
RUN GOOS="$GOOS" GOARCH="$GOARCH" go build -tags netgo,osusergo -o provider-api services/provider/main.go
RUN GOOS="$GOOS" GOARCH="$GOARCH" go build -tags netgo,osusergo -o onboarding-secret-generator onboarding/main.go
RUN GOOS="$GOOS" GOARCH="$GOARCH" go build -tags netgo,osusergo -o onboarding-validation-keys-gen onboarding-validation-keys-generator/main.go
RUN GOOS="$GOOS" GOARCH="$GOARCH" go build -tags netgo,osusergo -o ux-backend-server services/ux-backend/main.go

# Build stage 2
Expand All @@ -21,7 +21,7 @@ FROM registry.access.redhat.com/ubi9/ubi-minimal

COPY --from=builder workspace/ocs-operator /usr/local/bin/ocs-operator
COPY --from=builder workspace/provider-api /usr/local/bin/provider-api
COPY --from=builder workspace/onboarding-secret-generator /usr/local/bin/onboarding-secret-generator
COPY --from=builder workspace/onboarding-validation-keys-gen /usr/local/bin/onboarding-validation-keys-gen
COPY --from=builder workspace/metrics/deploy/*rules*.yaml /ocs-prometheus-rules/
COPY --from=builder workspace/ux-backend-server /usr/local/bin/ux-backend-server

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func initStorageClusterResourceCreateUpdateTestProviderMode(t *testing.T, runtim

os.Setenv(providerAPIServerImage, "fake-image")
os.Setenv(util.WatchNamespaceEnvVar, "")
os.Setenv(onboardingSecretGeneratorImage, "fake-image")
os.Setenv(onboardingValidationKeysGeneratorImage, "fake-image")

deployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{Name: ocsProviderServerName},
Expand Down
24 changes: 12 additions & 12 deletions controllers/storagecluster/provider_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import (
)

const (
ocsProviderServerName = "ocs-provider-server"
providerAPIServerImage = "PROVIDER_API_SERVER_IMAGE"
onboardingSecretGeneratorImage = "ONBOARDING_SECRET_GENERATOR_IMAGE"
onboardingJobName = "onboarding-secret-generator"
onboardingTicketPublicKeySecretName = "onboarding-ticket-key"
ocsProviderServerName = "ocs-provider-server"
providerAPIServerImage = "PROVIDER_API_SERVER_IMAGE"
onboardingValidationKeysGeneratorImage = "ONBOARDING_VALIDATION_KEYS_GENERATOR_IMAGE"
onboardingValidationKeysGeneratorJobName = "onboarding-validation-keys-generator"
onboardingValidationPublicKeySecretName = "onboarding-ticket-key"

ocsProviderServicePort = int32(50051)
ocsProviderServiceNodePort = int32(31659)
Expand Down Expand Up @@ -451,7 +451,7 @@ func getOnboardingJobObject(instance *ocsv1.StorageCluster) *batchv1.Job {

return &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Name: onboardingJobName,
Name: onboardingValidationKeysGeneratorJobName,
Namespace: instance.Namespace,
},
Spec: batchv1.JobSpec{
Expand All @@ -460,12 +460,12 @@ func getOnboardingJobObject(instance *ocsv1.StorageCluster) *batchv1.Job {
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
RestartPolicy: corev1.RestartPolicyOnFailure,
ServiceAccountName: onboardingJobName,
ServiceAccountName: onboardingValidationKeysGeneratorJobName,
Containers: []corev1.Container{
{
Name: onboardingJobName,
Image: os.Getenv(onboardingSecretGeneratorImage),
Command: []string{"/usr/local/bin/onboarding-secret-generator"},
Name: onboardingValidationKeysGeneratorJobName,
Image: os.Getenv(onboardingValidationKeysGeneratorImage),
Command: []string{"/usr/local/bin/onboarding-validation-keys-gen"},
Env: []corev1.EnvVar{
{
Name: util.OperatorNamespaceEnvVar,
Expand All @@ -482,7 +482,7 @@ func getOnboardingJobObject(instance *ocsv1.StorageCluster) *batchv1.Job {

func (o *ocsProviderServer) createJob(r *StorageClusterReconciler, instance *ocsv1.StorageCluster) (reconcile.Result, error) {
var err error
if os.Getenv(onboardingSecretGeneratorImage) == "" {
if os.Getenv(onboardingValidationKeysGeneratorImage) == "" {
err = fmt.Errorf("OnboardingSecretGeneratorImage env var is not set")
r.Log.Error(err, "No value set for env variable")

Expand All @@ -491,7 +491,7 @@ func (o *ocsProviderServer) createJob(r *StorageClusterReconciler, instance *ocs

actualSecret := &corev1.Secret{}
// Creating the job only if public is not found
err = r.Client.Get(context.Background(), types.NamespacedName{Name: onboardingTicketPublicKeySecretName,
err = r.Client.Get(context.Background(), types.NamespacedName{Name: onboardingValidationPublicKeySecretName,
Namespace: instance.Namespace}, actualSecret)

if errors.IsNotFound(err) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/storagecluster/provider_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func createSetupForOcsProviderTest(t *testing.T, allowRemoteStorageConsumers boo
}

os.Setenv(providerAPIServerImage, "fake-image")
os.Setenv(onboardingSecretGeneratorImage, "fake-image")
os.Setenv(onboardingValidationKeysGeneratorImage, "fake-image")
os.Setenv(util.WatchNamespaceEnvVar, "openshift-storage")

return r, instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3093,7 +3093,7 @@ spec:
value: docker.io/centos/postgresql-12-centos8
- name: PROVIDER_API_SERVER_IMAGE
value: quay.io/ocs-dev/ocs-operator:latest
- name: ONBOARDING_SECRET_GENERATOR_IMAGE
- name: ONBOARDING_VALIDATION_KEYS_GENERATOR_IMAGE
value: quay.io/ocs-dev/ocs-operator:latest
- name: OPERATOR_NAMESPACE
valueFrom:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: onboarding-secret-generator
name: onboarding-validation-keys-generator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: onboarding-secret-generator
name: onboarding-validation-keys-generator
subjects:
- kind: ServiceAccount
name: onboarding-secret-generator
name: onboarding-validation-keys-generator
namespace: openshift-storage
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: onboarding-secret-generator
name: onboarding-validation-keys-generator
rules:
- apiGroups:
- ""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kind: ServiceAccount
apiVersion: v1
metadata:
name: onboarding-validation-keys-generator
File renamed without changes.
5 changes: 0 additions & 5 deletions rbac/onboarding-secret-generator-sa.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: onboarding-secret-generator
name: onboarding-validation-keys-generator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: onboarding-secret-generator
name: onboarding-validation-keys-generator
subjects:
- kind: ServiceAccount
name: onboarding-secret-generator
name: onboarding-validation-keys-generator
namespace: openshift-storage
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: onboarding-secret-generator
name: onboarding-validation-keys-generator
rules:
- apiGroups:
- ""
Expand Down
4 changes: 4 additions & 0 deletions rbac/onboarding-validation-keys-generator-sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kind: ServiceAccount
apiVersion: v1
metadata:
name: onboarding-validation-keys-generator
2 changes: 1 addition & 1 deletion tools/csv-merger/csv-merger.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func unmarshalCSV(filePath string) *csvv1.ClusterServiceVersion {
Value: *ocsContainerImage,
},
{
Name: "ONBOARDING_SECRET_GENERATOR_IMAGE",
Name: "ONBOARDING_VALIDATION_KEYS_GENERATOR_IMAGE",
Value: *ocsContainerImage,
},
{
Expand Down

0 comments on commit 8893c73

Please sign in to comment.