Skip to content

Commit

Permalink
feat: remove kam resources from operator (#765)
Browse files Browse the repository at this point in the history
* feat: remove kam resources from gitops-operator

Signed-off-by: saumeya <saumeyakatyal@gmail.com>

* remove comments

Signed-off-by: saumeya <saumeyakatyal@gmail.com>

* bundle

Signed-off-by: saumeya <saumeyakatyal@gmail.com>

* change

Signed-off-by: saumeya <saumeyakatyal@gmail.com>

* remove ds_store

Signed-off-by: saumeya <saumeyakatyal@gmail.com>

* Remove .DS_Store from controllers folder

Signed-off-by: saumeya <saumeyakatyal@gmail.com>

---------

Signed-off-by: saumeya <saumeyakatyal@gmail.com>
  • Loading branch information
saumeya authored Aug 27, 2024
1 parent 991add7 commit 1878342
Show file tree
Hide file tree
Showing 36 changed files with 33 additions and 826 deletions.
31 changes: 12 additions & 19 deletions bundle/manifests/gitops-operator.clusterserviceversion.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ spec:
- devtools
- gitops
- pipelines
links:
- name: Day 1 Operations
url: https://github.com/redhat-developer/kam/tree/master/docs/journey/day1
- name: Day 2 Operations
url: https://github.com/redhat-developer/kam/tree/master/docs/journey/day2
maintainers:
- email: shbose@redhat.com
name: shoubhik
Expand Down
4 changes: 1 addition & 3 deletions config/manifests/patches/description.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
target OpenShift and Kubernetes clusters\n* Support for the Helm and Kustomize
templating tools\n* Configuration drift detection and visualization on live clusters\n*
Audit trails of rollouts to the clusters\n* Monitoring and logging integration
with OpenShift\n* Automated GitOps bootstrapping using Tekton and Argo CD with
[GitOps Application Manager CLI](https://github.com/redhat-developer/kam)\n\n##
Components\n* Argo CD 2.7.6\n* GitOps Application Manager CLI ([download](https://github.com/redhat-developer/kam/releases))\n\n##
with OpenShift\n##Components\n* Argo CD 2.7.6\n\n##
How to Install \nAfter installing the OpenShift GitOps operator, an instance of
Argo CD is installed in the `openshift-gitops` namespace which has sufficent privileges
for managing cluster configurations. You can create additional Argo CD instances
Expand Down
1 change: 1 addition & 0 deletions controllers/consoleplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
kubeAppLabelPartOf = "app.kubernetes.io/part-of"
kubeAppLabelRuntimeNamespace = "app.kubernetes.io/runtime-namespace"
httpdConfigMapName = "httpd-cfg"
kubeAppLabelName = "app.kubernetes.io/name"
)

func getPluginPodSpec() corev1.PodSpec {
Expand Down
4 changes: 0 additions & 4 deletions controllers/gitopsservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,6 @@ func (r *ReconcileGitopsService) Reconcile(ctx context.Context, request reconcil
return result, err
}

if result, err := r.reconcileCLIServer(instance, request); err != nil {
return result, err
}

dynamicPluginStartOCPVersion := os.Getenv(dynamicPluginStartOCPVersionEnv)
if dynamicPluginStartOCPVersion == "" {
dynamicPluginStartOCPVersion = common.DefaultDynamicPluginStartOCPVersion
Expand Down
67 changes: 0 additions & 67 deletions controllers/gitopsservice_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,6 @@ func TestImageFromEnvVariable(t *testing.T) {
}
})

t.Run("Kam Image present as env variable", func(t *testing.T) {
image := "quay.io/org/test"
t.Setenv(cliImageEnvName, image)

deployment := newDeploymentForCLI()

got := deployment.Spec.Template.Spec.Containers[0].Image
if got != image {
t.Errorf("Image mismatch: got %s, want %s", got, image)
}
})
t.Run("env variable for Kam image not found", func(t *testing.T) {
deployment := newDeploymentForCLI()

got := deployment.Spec.Template.Spec.Containers[0].Image
if got != cliImage {
t.Errorf("Image mismatch: got %s, want %s", got, cliImage)
}
})

}

func TestReconcileDefaultForArgoCDNodeplacement(t *testing.T) {
Expand Down Expand Up @@ -497,53 +477,6 @@ func TestReconcile_BackendSecurityContext(t *testing.T) {
assert.DeepEqual(t, securityContext, want)
}

func TestReconcile_KamSecurityContext(t *testing.T) {
logf.SetLogger(argocd.ZapLogger(true))
s := scheme.Scheme
addKnownTypesToScheme(s)

util.SetConsoleAPIFound(true)
defer util.SetConsoleAPIFound(false)

// Testing on OCP versions < 4.11.0
fakeClient := fake.NewClientBuilder().WithScheme(s).WithObjects(util.NewClusterVersion("4.12.1"), newGitopsService()).Build()
reconciler := newReconcileGitOpsService(fakeClient, s)

_, err := reconciler.Reconcile(context.TODO(), newRequest("test", "test"))
assertNoError(t, err)

deployment := appsv1.Deployment{}
err = fakeClient.Get(context.TODO(), types.NamespacedName{Name: cliName, Namespace: serviceNamespace}, &deployment)
assertNoError(t, err)

// Testing on OCP versions < 4.11.0

fakeClient = fake.NewClientBuilder().WithScheme(s).WithObjects(util.NewClusterVersion("4.12.1"), newGitopsService()).Build()
reconciler = newReconcileGitOpsService(fakeClient, s)

_, err = reconciler.Reconcile(context.TODO(), newRequest("test", "test"))
assertNoError(t, err)

deployment = appsv1.Deployment{}
err = fakeClient.Get(context.TODO(), types.NamespacedName{Name: cliName, Namespace: serviceNamespace}, &deployment)
assertNoError(t, err)

securityContext := deployment.Spec.Template.Spec.Containers[0].SecurityContext
want := &corev1.SecurityContext{
AllowPrivilegeEscalation: util.BoolPtr(false),
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{
"ALL",
},
},
RunAsNonRoot: util.BoolPtr(true),
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
},
}
assert.DeepEqual(t, securityContext, want)
}

func TestReconcile_testArgoCDForOperatorUpgrade(t *testing.T) {
logf.SetLogger(argocd.ZapLogger(true))
s := scheme.Scheme
Expand Down
Loading

0 comments on commit 1878342

Please sign in to comment.