Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onboarding key generator package rename as it does not implies what it does #2452

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
@@ -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

Original file line number Diff line number Diff line change
@@ -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},
24 changes: 12 additions & 12 deletions controllers/storagecluster/provider_server.go
nb-ohad marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -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)
@@ -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{
@@ -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,
@@ -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")

@@ -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) {
2 changes: 1 addition & 1 deletion controllers/storagecluster/provider_server_test.go
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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:

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:
- ""
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:
- ""
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
@@ -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,
},
{