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

Auth proxy status fix #465

Merged
merged 27 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
579cbbb
actions
jooseppi-luna Feb 12, 2024
204ad55
working on auth proxy status check
jooseppi-luna Feb 13, 2024
c50c068
finished status check
jooseppi-luna Feb 13, 2024
d4bb334
fix 1
jooseppi-luna Feb 13, 2024
9e920ba
fix or
jooseppi-luna Feb 13, 2024
1cf11eb
code compiles
jooseppi-luna Feb 13, 2024
b7bd55c
keep auth proxy out of daemonset check
jooseppi-luna Feb 13, 2024
d477487
trying to figure out deployment name
jooseppi-luna Feb 13, 2024
d16a842
formatting
jooseppi-luna Feb 13, 2024
cb0b8c3
fix auth name in if condition
jooseppi-luna Feb 13, 2024
9c225bb
no daemonset
jooseppi-luna Feb 13, 2024
8a5d31c
fix
jooseppi-luna Feb 13, 2024
0a336f7
added log statements
jooseppi-luna Feb 13, 2024
6c8629f
added another log statement
jooseppi-luna Feb 13, 2024
0a6f9d9
fix log statement
jooseppi-luna Feb 13, 2024
c68cc0e
logs logs logs
jooseppi-luna Feb 13, 2024
c9f9c91
compile
jooseppi-luna Feb 13, 2024
dd1e1ad
more logs
jooseppi-luna Feb 13, 2024
ae54129
add logs and try updating status from handlesuccess
jooseppi-luna Feb 13, 2024
f6e5c33
remove UpdateStatus call for now
jooseppi-luna Feb 13, 2024
a5793e0
adding csm label to auth
jooseppi-luna Feb 13, 2024
8aa9080
remove extraneous string replacement
jooseppi-luna Feb 13, 2024
c2f5f41
removing commented code
jooseppi-luna Feb 13, 2024
7fb9492
Merge branch 'fixed-release-v1.4.2' into auth-proxy-status-fix
jooseppi-luna Feb 13, 2024
32408be
Update actions.yml
jooseppi-luna Feb 13, 2024
b387b64
fix merge issue
jooseppi-luna Feb 13, 2024
0bd0124
fix fmt
jooseppi-luna Feb 13, 2024
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
15 changes: 9 additions & 6 deletions controllers/csm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (r *ContainerStorageModuleReconciler) handleDeploymentUpdate(oldObj interfa
return
}

log.Debugw("deployment modified generation", d.Generation, old.Generation)
log.Debugw("deployment modified generation", d.Name, d.Generation, old.Generation)

desired := d.Status.Replicas
available := d.Status.AvailableReplicas
Expand Down Expand Up @@ -687,7 +687,8 @@ func (r *ContainerStorageModuleReconciler) SyncCSM(ctx context.Context, cr csmv1
log := logger.GetLogger(ctx)

// Create/Update Authorization Proxy Server
if authorizationEnabled, _ := utils.IsModuleEnabled(ctx, cr, csmv1.AuthorizationServer); authorizationEnabled {
authorizationEnabled, _ := utils.IsModuleEnabled(ctx, cr, csmv1.AuthorizationServer)
if authorizationEnabled {
log.Infow("Create/Update authorization")
if err := r.reconcileAuthorization(ctx, false, operatorConfig, cr, ctrlClient); err != nil {
return fmt.Errorf("failed to deploy authorization proxy server: %v", err)
Expand Down Expand Up @@ -851,9 +852,11 @@ func (r *ContainerStorageModuleReconciler) SyncCSM(ctx context.Context, cr csmv1
return err
}

// Create/Update DeamonSet
if err = daemonset.SyncDaemonset(ctx, node.DaemonSetApplyConfig, cluster.ClusterK8sClient, cr.Name); err != nil {
return err
// Create/Update DeamonSet, except for auth proxy
if !authorizationEnabled {
if err = daemonset.SyncDaemonset(ctx, node.DaemonSetApplyConfig, cluster.ClusterK8sClient, cr.Name); err != nil {
return err
}
}

if replicationEnabled {
Expand Down Expand Up @@ -1204,7 +1207,7 @@ func (r *ContainerStorageModuleReconciler) removeDriver(ctx context.Context, ins
return nil
}

// removeModule - remove authorization proxy server
// removeModule - remove standalone modules
func (r *ContainerStorageModuleReconciler) removeModule(ctx context.Context, instance csmv1.ContainerStorageModule, operatorConfig utils.OperatorConfig, ctrlClient client.Client) error {
log := logger.GetLogger(ctx)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: proxy-server
spec:
containers:
Expand Down Expand Up @@ -92,6 +93,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: tenant-service
spec:
containers:
Expand Down Expand Up @@ -176,6 +178,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: role-service
spec:
serviceAccountName: role-service
Expand Down Expand Up @@ -254,6 +257,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: storage-service
spec:
serviceAccountName: storage-service
Expand Down Expand Up @@ -316,6 +320,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: redis
role: primary
tier: backend
Expand Down Expand Up @@ -367,6 +372,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: redis-commander
tier: backend
spec:
Expand Down Expand Up @@ -496,4 +502,4 @@ roleRef:
subjects:
- kind: Group
name: system:serviceaccounts:authorization
apiGroup: rbac.authorization.k8s.io
apiGroup: rbac.authorization.k8s.io
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app.kubernetes.io/component: controller
app.kubernetes.io/instance: <NAMESPACE>
app.kubernetes.io/name: ingress-nginx
Expand Down Expand Up @@ -660,4 +661,4 @@ webhooks:
resources:
- ingresses
sideEffects: None


Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: proxy-server
spec:
containers:
Expand Down Expand Up @@ -92,6 +93,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: tenant-service
spec:
containers:
Expand Down Expand Up @@ -176,6 +178,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: role-service
spec:
serviceAccountName: role-service
Expand Down Expand Up @@ -254,6 +257,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: storage-service
spec:
serviceAccountName: storage-service
Expand Down Expand Up @@ -316,6 +320,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: redis
role: primary
tier: backend
Expand Down Expand Up @@ -367,6 +372,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: redis-commander
tier: backend
spec:
Expand Down Expand Up @@ -496,4 +502,4 @@ roleRef:
subjects:
- kind: Group
name: system:serviceaccounts:authorization
apiGroup: rbac.authorization.k8s.io
apiGroup: rbac.authorization.k8s.io
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app.kubernetes.io/component: controller
app.kubernetes.io/instance: <NAMESPACE>
app.kubernetes.io/name: ingress-nginx
Expand Down Expand Up @@ -660,4 +661,4 @@ webhooks:
resources:
- ingresses
sideEffects: None


Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
metadata:
labels:
app: proxy-server
csm: <NAME>
spec:
containers:
- name: proxy-server
Expand Down Expand Up @@ -93,6 +94,7 @@ spec:
metadata:
labels:
app: tenant-service
csm: <NAME>
spec:
containers:
- name: tenant-service
Expand Down Expand Up @@ -176,6 +178,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: role-service
spec:
serviceAccountName: role-service
Expand Down Expand Up @@ -254,6 +257,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: storage-service
spec:
serviceAccountName: storage-service
Expand Down Expand Up @@ -316,6 +320,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: redis
role: primary
tier: backend
Expand Down Expand Up @@ -367,6 +372,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: redis-commander
tier: backend
spec:
Expand Down Expand Up @@ -496,4 +502,4 @@ roleRef:
subjects:
- kind: Group
name: system:serviceaccounts:authorization
apiGroup: rbac.authorization.k8s.io
apiGroup: rbac.authorization.k8s.io
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app.kubernetes.io/component: controller
app.kubernetes.io/instance: <NAMESPACE>
app.kubernetes.io/name: ingress-nginx
Expand Down Expand Up @@ -660,4 +661,4 @@ webhooks:
resources:
- ingresses
sideEffects: None


Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
metadata:
labels:
app: proxy-server
csm: <NAME>
spec:
containers:
- name: proxy-server
Expand Down Expand Up @@ -93,6 +94,7 @@ spec:
metadata:
labels:
app: tenant-service
csm: <NAME>
spec:
containers:
- name: tenant-service
Expand Down Expand Up @@ -176,6 +178,7 @@ spec:
template:
metadata:
labels:
csm: <NAME>
app: role-service
spec:
serviceAccountName: role-service
Expand Down Expand Up @@ -255,6 +258,7 @@ spec:
metadata:
labels:
app: storage-service
csm: <NAME>
spec:
serviceAccountName: storage-service
containers:
Expand Down Expand Up @@ -319,6 +323,7 @@ spec:
app: redis
role: primary
tier: backend
csm: <NAME>
spec:
containers:
- name: primary
Expand Down Expand Up @@ -369,6 +374,7 @@ spec:
labels:
app: redis-commander
tier: backend
csm: <NAME>
spec:
containers:
- name: redis-commander
Expand Down Expand Up @@ -496,4 +502,4 @@ roleRef:
subjects:
- kind: Group
name: system:serviceaccounts:authorization
apiGroup: rbac.authorization.k8s.io
apiGroup: rbac.authorization.k8s.io
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ spec:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: <NAMESPACE>
app.kubernetes.io/name: ingress-nginx
csm: <NAME>
spec:
containers:
- args:
Expand Down Expand Up @@ -660,4 +661,4 @@ webhooks:
resources:
- ingresses
sideEffects: None


2 changes: 0 additions & 2 deletions pkg/modules/application_mobility.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ const (
AppMobCertManagerComponent = "cert-manager"
// AppMobVeleroComponent - velero component
AppMobVeleroComponent = "velero"
// CSMName - name
CSMName = "<NAME>"
)

// getAppMobilityModule - get instance of app mobility module
Expand Down
4 changes: 4 additions & 0 deletions pkg/modules/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ func getAuthorizationServerDeployment(op utils.OperatorConfig, cr csmv1.Containe
YamlString = strings.ReplaceAll(YamlString, AuthStorageServiceImage, component.StorageService)
YamlString = strings.ReplaceAll(YamlString, AuthRedisImage, component.Redis)
YamlString = strings.ReplaceAll(YamlString, AuthRedisCommanderImage, component.Commander)
YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)

for _, env := range component.Envs {
if env.Name == "REDIS_STORAGE_CLASS" {
Expand All @@ -504,6 +505,7 @@ func getAuthorizationServerDeployment(op utils.OperatorConfig, cr csmv1.Containe

YamlString = strings.ReplaceAll(YamlString, AuthNamespace, authNamespace)
YamlString = strings.ReplaceAll(YamlString, AuthRedisStorageClass, redisStorageClass)
YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)

return YamlString, nil
}
Expand Down Expand Up @@ -570,6 +572,7 @@ func getAuthorizationIngressRules(op utils.OperatorConfig, cr csmv1.ContainerSto
YamlString = strings.ReplaceAll(YamlString, AuthProxyHost, authHostname)
YamlString = strings.ReplaceAll(YamlString, AuthProxyIngressHost, proxyIngressHost)
YamlString = strings.ReplaceAll(YamlString, AuthProxyIngressClassName, proxyIngressClassName)
YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)

return YamlString, nil
}
Expand Down Expand Up @@ -625,6 +628,7 @@ func getNginxIngressController(op utils.OperatorConfig, cr csmv1.ContainerStorag
YamlString = string(buf)
authNamespace := cr.Namespace
YamlString = strings.ReplaceAll(YamlString, AuthNamespace, authNamespace)
YamlString = strings.ReplaceAll(YamlString, CSMName, cr.Name)

return YamlString, nil
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/modules/commonconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const (
CertManagerManifest = "cert-manager.yaml"
// CommonNamespace -
CommonNamespace = "<NAMESPACE>"
// CSMName - name
CSMName = "<NAME>"
)

// SupportedDriverParam -
Expand Down
Loading
Loading