Skip to content

Commit

Permalink
fix(RELEASE-1441): remove rsc from being managed
Browse files Browse the repository at this point in the history
- the rsc needs to managed outside of the release
  service so that clusters can have a specific version
  for testing.
- A version can be deployed and managed by ArgoCD
  via infra-deployments for a specific cluster
- The controller will automatically persist an empty
  release service config if one is not present. This
  is needed for testing.

Signed-off-by: Scott Hebert <[email protected]>
  • Loading branch information
scoheb committed Feb 11, 2025
1 parent 5954f10 commit a22c085
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 0 additions & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
resources:
- manager.yaml
- network_policy.yaml
- release_service_config.yaml

generatorOptions:
disableNameSuffixHash: true
Expand Down
3 changes: 3 additions & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ resources:
- releaseplan_editor_role.yaml
- releaseplan_role_binding.yaml
- releaseplan_viewer_role.yaml
- releaseserviceconfig_editor_role.yaml
- releaseserviceconfig_role_binding.yaml
- releaseserviceconfig_viewer_role.yaml
- snapshotenvironmentbinding_editor_role.yaml
- snapshotenvironmentbinding_role_binding.yaml
- snapshot_editor_role.yaml
Expand Down
12 changes: 12 additions & 0 deletions config/rbac/releaseserviceconfig_role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: releaseserviceconfig-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: releaseserviceconfig-editor-role
subjects:
- kind: ServiceAccount
name: controller-manager
namespace: system
9 changes: 9 additions & 0 deletions controllers/release/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,24 @@ func (a *adapter) EnsureConfigIsLoaded() (controller.OperationResult, error) {
}

var err error
a.logger.Info("Getting Release Service Config")
a.releaseServiceConfig, err = a.loader.GetReleaseServiceConfig(a.ctx, a.client, v1alpha1.ReleaseServiceConfigResourceName, namespace)
if err != nil && !errors.IsNotFound(err) {
return controller.RequeueWithError(err)
}

if err != nil {
a.logger.Info("Creating Empty Release Service Config")
a.releaseServiceConfig = a.getEmptyReleaseServiceConfig(namespace)
patch := client.MergeFrom(a.releaseServiceConfig.DeepCopy())
err := a.client.Patch(a.ctx, a.releaseServiceConfig, patch)
if err != nil && !errors.IsNotFound(err) {
return controller.RequeueWithError(err)
}

Check warning on line 106 in controllers/release/adapter.go

View check run for this annotation

Codecov / codecov/patch

controllers/release/adapter.go#L105-L106

Added lines #L105 - L106 were not covered by tests
a.logger.Info("Persisted Empty Release Service Config")
}

a.logger.Info("Release Service Config Loaded")
return controller.ContinueProcessing()
}

Expand Down

0 comments on commit a22c085

Please sign in to comment.