Skip to content

Commit

Permalink
Allow deleting disappeared groups (#13)
Browse files Browse the repository at this point in the history
* Allow passing additional parameters to GroupSync

* Update underlying version to `v0.2.0`

* Document new parameter `deleteDisappearedGroups`

* Remove annotation no longer required
  • Loading branch information
bastjan authored Nov 24, 2021
1 parent 188aa59 commit bc52533
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 21 deletions.
2 changes: 1 addition & 1 deletion class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
operator:
registry: quay.io
repository: appuio/group-sync-operator
tag: v0.1.0
tag: v0.2.0

manifest_version: ${group_sync_operator:images:operator:tag}
manifest_url: https://raw.githubusercontent.com/appuio/group-sync-operator/${group_sync_operator:manifest_version}/config
Expand Down
6 changes: 1 addition & 5 deletions component/config.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@ local groupSyncs = std.filter(
name: k,
namespace: params.namespace,
labels+: labels,
annotations+: {
'argocd.argoproj.io/sync-options': 'SkipDryRunOnMissingResource=true',
},
},
spec: {
schedule: params.sync[k].schedule,
spec: params.sync[k] {
providers: [
{ name: p } + patchProvider(params.sync[k].providers[p])
for p in std.objectFields(params.sync[k].providers)
Expand Down
19 changes: 10 additions & 9 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ The namespace in which to deploy this component.

[horizontal]
type:: dictionary
default::
+
[source,yaml]
----
operator:
registry: quay.io
repository: redhat-cop/group-sync-operator
tag: v0.0.14
----

Dictionary containing the container images used by this component.

Expand All @@ -45,6 +36,15 @@ A crontab based schedule configuration, for when to synchronize the groups.
If no schedule is provided, synchronization will only occur when the `GroupSync` object is reconciled by the platform.


== `sync[].deleteDisappearedGroups`

[horizontal]
type:: bool
default:: false

Controls if groups disappeared from the source should be removed. The deletion of groups is provider scoped.


== `sync[].providers`

[horizontal]
Expand Down Expand Up @@ -92,6 +92,7 @@ parameters:
scope: sub
bar:
schedule: '* * 2 * *'
deleteDisappearedGroups: true
providers:
bar-azure:
azure:
Expand Down
1 change: 1 addition & 0 deletions tests/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ parameters:
scope: sub
other:
schedule: '* * 2 * *'
deleteDisappearedGroups: true
providers:
foo:
azure:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ spec:
spec:
description: GroupSyncSpec defines the desired state of GroupSync
properties:
deleteDisappearedGroups:
description: DeleteDisappearedGroups controls if disappeared groups should be removed. The deletion of groups is provider scoped.
type: boolean
providers:
description: List of Providers that can be mounted by containers belonging to the pod.
items:
Expand Down Expand Up @@ -574,6 +577,27 @@ spec:
- credentialsSecret
- url
type: object
static:
description: Static represents the Static provider
properties:
groups:
description: Groups represents a list of groups to synchronize
items:
description: StaticProvider allow statically setting Groups
properties:
name:
description: Name represents the name of the group
type: string
users:
description: Users represents a list of users to apply to the synchronized group.
items:
type: string
type: array
required:
- name
type: object
type: array
type: object
required:
- name
type: object
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
apiVersion: redhatcop.redhat.io/v1alpha1
kind: GroupSync
metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
labels:
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: group-sync-operator
Expand Down Expand Up @@ -35,15 +33,14 @@ spec:
apiVersion: redhatcop.redhat.io/v1alpha1
kind: GroupSync
metadata:
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
labels:
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: group-sync-operator
app.kubernetes.io/part-of: syn
name: other
namespace: syn-group-sync-operator
spec:
deleteDisappearedGroups: true
providers:
- azure:
credentialsSecret:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: quay.io/appuio/group-sync-operator:v0.1.0
image: quay.io/appuio/group-sync-operator:v0.2.0
livenessProbe:
httpGet:
path: /healthz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ spec:
spec:
description: GroupSyncSpec defines the desired state of GroupSync
properties:
deleteDisappearedGroups:
description: DeleteDisappearedGroups controls if disappeared groups should be removed. The deletion of groups is provider scoped.
type: boolean
providers:
description: List of Providers that can be mounted by containers belonging to the pod.
items:
Expand Down Expand Up @@ -574,6 +577,27 @@ spec:
- credentialsSecret
- url
type: object
static:
description: Static represents the Static provider
properties:
groups:
description: Groups represents a list of groups to synchronize
items:
description: StaticProvider allow statically setting Groups
properties:
name:
description: Name represents the name of the group
type: string
users:
description: Users represents a list of users to apply to the synchronized group.
items:
type: string
type: array
required:
- name
type: object
type: array
type: object
required:
- name
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: quay.io/appuio/group-sync-operator:v0.1.0
image: quay.io/appuio/group-sync-operator:v0.2.0
livenessProbe:
httpGet:
path: /healthz
Expand Down

0 comments on commit bc52533

Please sign in to comment.