-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from damsien/dev
Release beta 0.1.0
- Loading branch information
Showing
139 changed files
with
4,416 additions
and
6,469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ helm repo add syngit https://syngit-org.github.io/syngit | |
1. Install the operator | ||
You can customize the values before installing the Helm chart. | ||
```sh | ||
helm install syngit syngit/syngit --version 1.0.1 -n syngit --create-namespace | ||
helm install syngit syngit/syngit --version 0.1.0 -n syngit --create-namespace | ||
``` | ||
|
||
syngit is now installed on your cluster! | ||
|
@@ -70,34 +70,33 @@ stringData: | |
``` | ||
```yaml | ||
apiVersion: syngit.syngit.io/v1alpha4 | ||
apiVersion: syngit.syngit.io/v1beta1 | ||
kind: RemoteUser | ||
metadata: | ||
name: remoteuser-sample | ||
spec: | ||
gitBaseDomainFQDN: "github.com" | ||
testAuthentication: true | ||
email: [email protected] | ||
ownRemoteUserBinding: true | ||
associatedRemoteUserBinding: true | ||
secretRef: | ||
name: git-server-my_git_username-auth | ||
``` | ||
Now, if you look at the status of the object, the user should be connected to the git server. | ||
Now, if you look at the status of the object, the secret should be correctly bound. | ||
```sh | ||
kubectl get remoteuser remoteuser-sample -o=jsonpath='{.status.connexionStatus}' | ||
kubectl get remoteuser remoteuser-sample -o=jsonpath='{.status.secretBoundStatus}' | ||
``` | ||
|
||
### RemoteUserBinding | ||
|
||
The RemoteUserBinding bind the Kubernetes user with the remote git user. This is used by syngit when the user apply changes on the cluster. syngit will push on the git server with the associated git user. | ||
|
||
By default, the `ownRemoteUserBinding` field of the RemoteUser object automatically creates a RemoteUserBinding. The name of the object is `owned-rub-<kubernetes_user_id>`. | ||
By default, the `associatedRemoteUserBinding` field of the RemoteUser object automatically creates a RemoteUserBinding. The name of the object is `associated-rub-<kubernetes_user_id>`. | ||
|
||
To get the associated RemoteUserBinding object, run : | ||
```sh | ||
kubectl get remoteuserbinding owned-rub-$(kubectl auth whoami -o=jsonpath='{.status.userInfo.username}') | ||
kubectl get remoteuserbinding associated-rub-$(kubectl auth whoami -o=jsonpath='{.status.userInfo.username}') | ||
``` | ||
|
||
### RemoteSyncer | ||
|
@@ -107,15 +106,17 @@ The RemoteSyncer object contains the whole logic part of the operator. | |
In this example, the RemoteSyncer will intercept all the *configmaps*. It will push them to *https://github.com/my_repo_path.git* in the branch *main* under the path `my_configmaps/`. Because the `commitProcess` is set to `CommitApply`, the changes will be pushed and then applied to the cluster. `CommitOnly` will only push the resource on the git server without applying it on the cluster. | ||
|
||
```yaml | ||
apiVersion: syngit.syngit.io/v1alpha4 | ||
apiVersion: syngit.syngit.io/v1beta1 | ||
kind: RemoteSyncer | ||
metadata: | ||
name: remotesyncer-sample | ||
spec: | ||
remoteRepository: https://github.com/my_repo_path.git | ||
branch: main | ||
commitProcess: CommitApply | ||
defaultBranch: main | ||
processMode: CommitApply | ||
pushMode: SameBranch | ||
defaultUnauthorizedUserMode: Block | ||
rootPath: "my_configmaps" | ||
excludedFields: | ||
- metadata.managedFields | ||
- metadata.creationTimestamp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
Copyright 2024. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"sigs.k8s.io/controller-runtime/pkg/conversion" | ||
v1beta1 "syngit.io/syngit/api/v1beta1" | ||
) | ||
|
||
func (src *RemoteSyncer) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*v1beta1.RemoteSyncer) | ||
|
||
// Common conversion | ||
dst.ObjectMeta = src.ObjectMeta | ||
|
||
dst.Spec.DefaultBranch = src.Spec.Branch | ||
dst.Spec.BypassInterceptionSubjects = src.Spec.BypassInterceptionSubjects | ||
dst.Spec.DefaultBlockAppliedMessage = src.Spec.DefaultBlockAppliedMessage | ||
dst.Spec.DefaultUnauthorizedUserMode = v1beta1.DefaultUnauthorizedUserMode(src.Spec.DefaultUnauthorizedUserMode) | ||
dst.Spec.DefaultRemoteUserRef = src.Spec.DefaultUserBind | ||
dst.Spec.ExcludedFields = src.Spec.ExcludedFields | ||
dst.Spec.RemoteRepository = src.Spec.RemoteRepository | ||
|
||
// Breaking changes | ||
dst.Spec.ProcessMode = v1beta1.ProcessMode(src.Spec.CommitProcess) | ||
dst.Spec.PushMode = v1beta1.SameBranch | ||
|
||
return nil | ||
} | ||
|
||
func (dst *RemoteSyncer) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*v1beta1.RemoteSyncer) | ||
|
||
// Common conversion | ||
dst.ObjectMeta = src.ObjectMeta | ||
|
||
dst.Spec.Branch = src.Spec.DefaultBranch | ||
dst.Spec.BypassInterceptionSubjects = src.Spec.BypassInterceptionSubjects | ||
dst.Spec.DefaultBlockAppliedMessage = src.Spec.DefaultBlockAppliedMessage | ||
dst.Spec.DefaultUnauthorizedUserMode = DefaultUnauthorizedUserMode(src.Spec.DefaultUnauthorizedUserMode) | ||
dst.Spec.DefaultUserBind = src.Spec.DefaultRemoteUserRef | ||
dst.Spec.ExcludedFields = src.Spec.ExcludedFields | ||
dst.Spec.RemoteRepository = src.Spec.RemoteRepository | ||
|
||
// Breaking changes | ||
dst.Spec.CommitProcess = CommitProcess(src.Spec.ProcessMode) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.