Skip to content

Commit

Permalink
undo remaining changes
Browse files Browse the repository at this point in the history
Signed-off-by: Jaideep Rao <jaideep.r97@gmail.com>
  • Loading branch information
jaideepr97 committed Jan 4, 2024
1 parent 23ab470 commit cca6426
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 29 deletions.
2 changes: 1 addition & 1 deletion controllers/argocd/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ func deploymentDefaultTolerations() []corev1.Toleration {
return toleration
}

func TestReconcileArgoCD_reconcileRepoServerRedisTLS(t *testing.T) {
func TestReconcileArgocd_reconcileRepoServerRedisTLS(t *testing.T) {
t.Run("with DisableTLSVerification = false (the default)", func(t *testing.T) {
logf.SetLogger(ZapLogger(true))
a := makeTestArgoCD()
Expand Down
17 changes: 5 additions & 12 deletions controllers/argocd/keycloak.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/common"
"github.com/argoproj-labs/argocd-operator/pkg/argoutil"
"github.com/argoproj-labs/argocd-operator/pkg/util"
oappsv1client "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1"

appsv1 "github.com/openshift/api/apps/v1"
Expand Down Expand Up @@ -82,12 +81,11 @@ const (

var (
// client secret for keycloak, argocd and openshift-v4 IdP.
oAuthClientSecret string

graceTime int64 = 75
portTLS int32 = 8443
httpPort int32 = 8080
controllerRef bool = true
oAuthClientSecret = generateRandomString(8)
graceTime int64 = 75
portTLS int32 = 8443
httpPort int32 = 8080
controllerRef bool = true
)

// getKeycloakContainerImage will return the container image for the Keycloak.
Expand Down Expand Up @@ -833,11 +831,6 @@ func (r *ReconcileArgoCD) prepareKeycloakConfigForK8s(cr *argoproj.ArgoCD) (*key
// creates a keycloak realm configuration which when posted to keycloak using http client creates a keycloak realm.
func createRealmConfig(cfg *keycloakConfig) ([]byte, error) {

oAuthClientSecret, err := util.GenerateRandomString(8)
if err != nil {
//TO DO: handle error
}

ks := &CustomKeycloakAPIRealm{
Realm: keycloakRealm,
Enabled: true,
Expand Down
2 changes: 0 additions & 2 deletions controllers/argocd/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ func (r *ReconcileArgoCD) reconcileRole(name string, policyRules []v1.PolicyRule
}

func (r *ReconcileArgoCD) reconcileRoleForApplicationSourceNamespaces(name string, policyRules []v1.PolicyRule, cr *argoproj.ArgoCD) error {
var roles []*v1.Role

// create policy rules for each source namespace for ArgoCD Server
for _, sourceNamespace := range cr.Spec.SourceNamespaces {
Expand Down Expand Up @@ -262,7 +261,6 @@ func (r *ReconcileArgoCD) reconcileRoleForApplicationSourceNamespaces(name strin
return err
}
}
roles = append(roles, &existingRole)

if _, ok := r.ManagedSourceNamespaces[sourceNamespace]; !ok {
r.ManagedSourceNamespaces[sourceNamespace] = ""
Expand Down
14 changes: 6 additions & 8 deletions controllers/argocd/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/common"
"github.com/argoproj-labs/argocd-operator/pkg/argoutil"
"github.com/argoproj-labs/argocd-operator/pkg/mutation/openshift"
)

func getRedisHAReplicas(cr *argoproj.ArgoCD) *int32 {
Expand Down Expand Up @@ -569,9 +568,8 @@ func (r *ReconcileArgoCD) reconcileApplicationControllerStatefulSet(cr *argoproj
},
},
}}
openshift.AddSeccompProfileForOpenShift(cr, podSpec, r.Client)

podSpec.ServiceAccountName = argoutil.NameWithSuffix(cr.Name, "argocd-application-controller")
AddSeccompProfileForOpenShift(r.Client, podSpec)
podSpec.ServiceAccountName = nameWithSuffix("argocd-application-controller", cr)
podSpec.Volumes = []corev1.Volume{
{
Name: "argocd-repo-server-tls",
Expand Down Expand Up @@ -599,21 +597,21 @@ func (r *ReconcileArgoCD) reconcileApplicationControllerStatefulSet(cr *argoproj
PodAffinityTerm: corev1.PodAffinityTerm{
LabelSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
common.ArgoCDKeyName: argoutil.NameWithSuffix(cr.Name, "argocd-application-controller"),
common.ArgoCDKeyName: nameWithSuffix("argocd-application-controller", cr),
},
},
TopologyKey: common.K8sKeyHostname,
TopologyKey: common.ArgoCDKeyHostname,
},
Weight: int32(100),
},
{
PodAffinityTerm: corev1.PodAffinityTerm{
LabelSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
common.AppK8sKeyPartOf: common.ArgoCDAppName,
common.ArgoCDKeyPartOf: common.ArgoCDAppName,
},
},
TopologyKey: common.K8sKeyHostname,
TopologyKey: common.ArgoCDKeyHostname,
},
Weight: int32(5),
}},
Expand Down
2 changes: 1 addition & 1 deletion controllers/argocd/statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ func Test_ContainsValidImage(t *testing.T) {
po := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
common.AppK8sKeyName: fmt.Sprintf("%s-%s", a.Name, "application-controller"),
common.ArgoCDKeyName: fmt.Sprintf("%s-%s", a.Name, "application-controller"),
},
},
}
Expand Down
9 changes: 4 additions & 5 deletions controllers/argocd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/common"
"github.com/argoproj-labs/argocd-operator/pkg/argoutil"
"github.com/argoproj-labs/argocd-operator/pkg/util"

monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
oappsv1 "github.com/openshift/api/apps/v1"
Expand Down Expand Up @@ -275,10 +274,10 @@ func getGrafanaContainerImage(cr *argoproj.ArgoCD) string {
tag = common.ArgoCDDefaultGrafanaVersion
defaultTag = true
}
if e := os.Getenv(common.ArgoCDGrafanaImageEnvVar); e != "" && (defaultTag && defaultImg) {
if e := os.Getenv(common.ArgoCDGrafanaImageEnvName); e != "" && (defaultTag && defaultImg) {
return e
}
return util.CombineImageTag(img, tag)
return argoutil.CombineImageTag(img, tag)
}

// getGrafanaResources will return the ResourceRequirements for the Grafana container.
Expand Down Expand Up @@ -309,7 +308,7 @@ func getRedisConf(useTLSForRedis bool) string {
params := map[string]string{
"UseTLS": strconv.FormatBool(useTLSForRedis),
}
conf, err := util.LoadTemplateFile(path, params)
conf, err := loadTemplateFile(path, params)
if err != nil {
log.Error(err, "unable to load redis configuration")
return ""
Expand All @@ -330,7 +329,7 @@ func getRedisContainerImage(cr *argoproj.ArgoCD) string {
tag = common.ArgoCDDefaultRedisVersion
defaultTag = true
}
if e := os.Getenv(common.ArgoCDGrafanaImageEnvName); e != "" && (defaultTag && defaultImg) {
if e := os.Getenv(common.ArgoCDRedisImageEnvName); e != "" && (defaultTag && defaultImg) {
return e
}
return argoutil.CombineImageTag(img, tag)
Expand Down

0 comments on commit cca6426

Please sign in to comment.