Documentation
¶
Index ¶
- Constants
- func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object, ...) (controllerutil.OperationResult, error)
- func GetSecretKeys(ctx context.Context, c client.Client, sRef types.NamespacedName) map[string]bool
- func PollingPeriod(envName string, defaultValue time.Duration) time.Duration
- func ReconcilerResourceName(reconcilerName, resourceName string) string
- func RepoSyncPermissionsName() string
- func RootSyncPermissionsName() string
- func SkipForAuth(auth configsync.AuthType) bool
- type Controller
- type ObjectOperationError
- func NewObjectOperationError(err error, obj client.Object, op Operation) *ObjectOperationError
- func NewObjectOperationErrorForList(err error, objList client.ObjectList, op Operation) *ObjectOperationError
- func NewObjectOperationErrorForListWithNamespace(err error, objList client.ObjectList, op Operation, namespace string) *ObjectOperationError
- func NewObjectOperationErrorWithID(err error, id core.ID, op Operation) *ObjectOperationError
- func NewObjectOperationErrorWithKey(err error, obj client.Object, op Operation, objKey client.ObjectKey) *ObjectOperationError
- type ObjectReconcileError
- type Operation
- type OtelReconciler
- type OtelSAReconciler
- type ReconcilerType
- type RepoSyncReconciler
- type RootSyncReconciler
Constants ¶
const ( // GitSecretConfigKeySSH is the key at which an ssh cert is stored GitSecretConfigKeySSH = "ssh" // GitSecretConfigKeyCookieFile is the key at which the git cookiefile is stored GitSecretConfigKeyCookieFile = "cookie_file" // GitSecretConfigKeyToken is the key at which a token's value is stored GitSecretConfigKeyToken = "token" // GitSecretConfigKeyTokenUsername is the key at which a token's username is stored GitSecretConfigKeyTokenUsername = "username" )
Git secret configmap key names
const ( // HelmSecretKeyToken is the key at which a token's value is stored HelmSecretKeyPassword = "password" // HelmSecretKeyUsername is the key at which a token's username is stored HelmSecretKeyUsername = "username" )
Helm secret data key names
const ( // OperationCreate is the create operation OperationCreate = Operation("create") // OperationUpdate is the update operation OperationUpdate = Operation("update") // OperationPatch is the patch operation OperationPatch = Operation("patch") // OperationDelete is the delete operation OperationDelete = Operation("delete") // OperationGet is the get operation OperationGet = Operation("get") // OperationList is the list operation OperationList = Operation("list") // OperationWatch is the watch operation OperationWatch = Operation("watch") )
const ( // DefaultSyncRev is the default git revision. DefaultSyncRev = "HEAD" // DefaultSyncBranch is the default git branch. DefaultSyncBranch = "master" // DefaultSyncDir is the default sync directory. DefaultSyncDir = "." // DefaultSyncWaitSecs is the default wait seconds. DefaultSyncWaitSecs = 15 // SyncDepthNoRev is the default git depth if syncing with default sync revision (`HEAD`). SyncDepthNoRev = "1" // SyncDepthRev is the default git depth if syncing with a specific sync revision (tag or hash). SyncDepthRev = "500" )
const ( // ReconcilerTemplateConfigMapKey is the key used to specify the reconciler // deployment template in the "reconciler-manager-cm" ConfigMap. // Defined in configmap manifests/templates/reconciler-manager-configmap.yaml ReconcilerTemplateConfigMapKey = "deployment.yaml" // ReconcilerTemplateConfigMapName is the name of the ConfigMap used to // specify the reconciler deployment template. // Defined in configmap manifests/templates/reconciler-manager-configmap.yaml ReconcilerTemplateConfigMapName = "reconciler-manager-cm" )
const ( // RootReconcilerType defines the type for a root reconciler RootReconcilerType = ReconcilerType("root") // NamespaceReconcilerType defines the type for a namespace reconciler NamespaceReconcilerType = ReconcilerType("namespace") )
const CACertPath = "/etc/ca-cert"
CACertPath is the path where the certificate is mounted.
const CACertSecretKey = "cert"
CACertSecretKey is the name of the key in the Secret's data map whose value holds the CA cert
const CACertVolume = "ca-cert"
CACertVolume is the volume name of the CA certificate.
const ( // GCPSAAnnotationKey is used to annotate the following service accounts: // 1) the RepoSync/RootSync controller SA when // spec.git.auth: gcpserviceaccount is used with Workload Identity enabled on a // GKE cluster. // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity // 2) the `default` SA in the `config-management-monitoring` namespace, which // is used by the `otel-collector` Deployment. Adding this annotation allows // the `otel-collector` Deployment to impersonate GCP service accounts to // export metrics to Cloud Monitoring and Cloud Monarch on a GKE cluster with // Workload Identity eanbled. GCPSAAnnotationKey = "iam.gke.io/gcp-service-account" )
const GitCredentialVolume = "git-creds"
GitCredentialVolume is the volume name of the git credentials.
const HelmCredentialVolume = "helm-creds"
HelmCredentialVolume is the volume name of the git credentials.
const (
// OtelSALoggerName defines the logger name for OtelSAReconciler
OtelSALoggerName = "OtelSA"
)
Variables ¶
This section is empty.
Functions ¶
func CreateOrUpdate ¶ added in v1.16.0
func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object, f controllerutil.MutateFn) (controllerutil.OperationResult, error)
CreateOrUpdate creates or updates the given object in the Kubernetes cluster. The object's desired state must be reconciled with the existing state inside the passed in callback MutateFn.
The MutateFn is called regardless of creating or updating an object.
Returns the executed operation and an error.
Similar to controllerutil.CreateOrUpdate, except it returns ObjectOperationError when possible, with added context for error handling.
func GetSecretKeys ¶
GetSecretKeys returns the keys that are contained in the Secret.
func PollingPeriod ¶
PollingPeriod parses the polling duration from the environment variable. If the variable is not present, it returns the default value.
func ReconcilerResourceName ¶
ReconcilerResourceName returns resource name in the format <reconciler-name>-<resource-name>.
func RepoSyncPermissionsName ¶
func RepoSyncPermissionsName() string
RepoSyncPermissionsName returns namespace reconciler permissions name. e.g. configsync.gke.io:ns-reconciler
func RootSyncPermissionsName ¶
func RootSyncPermissionsName() string
RootSyncPermissionsName returns root reconciler permissions name. e.g. configsync.gke.io:root-reconciler
func SkipForAuth ¶
func SkipForAuth(auth configsync.AuthType) bool
SkipForAuth returns true if the passed auth is either 'none' or 'gcenode' or 'gcpserviceaccount'.
Types ¶
type Controller ¶ added in v1.16.0
type Controller interface { reconcile.Reconciler // SetupWithManager registers the controller with the controller-manager SetupWithManager(mgr controllerruntime.Manager, watchFleetMembership bool) error }
Controller implements Reconciler, but can also self-register with SetupWithManager
type ObjectOperationError ¶ added in v1.16.0
type ObjectOperationError struct { // ID of the managed object ID core.ID // Operation attempted on the managed object Operation Operation // Cause of the operation failure Cause error }
ObjectOperationError is an error from the reconciler-manager regarding failure to perform an operation on a managed Kubernetes resource or resource object.
func NewObjectOperationError ¶ added in v1.16.0
func NewObjectOperationError(err error, obj client.Object, op Operation) *ObjectOperationError
NewObjectOperationError constructs a new ObjectOperationError
func NewObjectOperationErrorForList ¶ added in v1.16.0
func NewObjectOperationErrorForList(err error, objList client.ObjectList, op Operation) *ObjectOperationError
NewObjectOperationErrorForList constructs a new ObjectOperationError for a list of objects with the same resource.
func NewObjectOperationErrorForListWithNamespace ¶ added in v1.16.0
func NewObjectOperationErrorForListWithNamespace(err error, objList client.ObjectList, op Operation, namespace string) *ObjectOperationError
NewObjectOperationErrorForListWithNamespace constructs a new ObjectOperationError for a list of objects with the same resource and namespace.
func NewObjectOperationErrorWithID ¶ added in v1.16.0
func NewObjectOperationErrorWithID(err error, id core.ID, op Operation) *ObjectOperationError
NewObjectOperationErrorWithID constructs a new ObjectOperationError with a specific ID.
func NewObjectOperationErrorWithKey ¶ added in v1.16.0
func NewObjectOperationErrorWithKey(err error, obj client.Object, op Operation, objKey client.ObjectKey) *ObjectOperationError
NewObjectOperationErrorWithKey constructs a new ObjectOperationError and overrides the Object's key with the specified ObjectKey. This is useful if you don't know whether the Object's key will be populated.
func (*ObjectOperationError) Error ¶ added in v1.16.0
func (ooe *ObjectOperationError) Error() string
Error returns the error string
func (*ObjectOperationError) Unwrap ¶ added in v1.16.0
func (ooe *ObjectOperationError) Unwrap() error
Unwrap returns the cause of the error, to allow type checking with errors.Is and errors.As.
type ObjectReconcileError ¶ added in v1.16.0
type ObjectReconcileError struct { // ID of the managed object ID core.ID // Status of the managed object Status kstatus.Status // Cause of the operation failure Cause error }
ObjectReconcileError is an error from the status of a managed resource object
func NewObjectReconcileError ¶ added in v1.16.0
func NewObjectReconcileError(err error, obj client.Object, status kstatus.Status) *ObjectReconcileError
NewObjectReconcileError constructs a new ObjectReconcileError
func NewObjectReconcileErrorWithID ¶ added in v1.16.0
func NewObjectReconcileErrorWithID(err error, id core.ID, status kstatus.Status) *ObjectReconcileError
NewObjectReconcileErrorWithID constructs a new ObjectReconcileError with the specified ID.
func (*ObjectReconcileError) Error ¶ added in v1.16.0
func (oripe *ObjectReconcileError) Error() string
Error returns the error string
func (*ObjectReconcileError) Unwrap ¶ added in v1.16.0
func (oripe *ObjectReconcileError) Unwrap() error
Unwrap returns the cause of the error, to allow type checking with errors.Is and errors.As.
type Operation ¶ added in v1.16.0
type Operation string
Operation performed on a Kubernetes resource or object
type OtelReconciler ¶
type OtelReconciler struct {
// contains filtered or unexported fields
}
OtelReconciler reconciles OpenTelemetry ConfigMaps.
func NewOtelReconciler ¶
func NewOtelReconciler(clusterName string, client client.Client, log logr.Logger, scheme *runtime.Scheme) *OtelReconciler
NewOtelReconciler returns a new OtelReconciler.
func (*OtelReconciler) Reconcile ¶
func (r *OtelReconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)
Reconcile the otel ConfigMap and update the Deployment annotation.
func (*OtelReconciler) SetupWithManager ¶
func (r *OtelReconciler) SetupWithManager(mgr controllerruntime.Manager) error
SetupWithManager registers otel controller with reconciler-manager.
type OtelSAReconciler ¶ added in v1.15.1
type OtelSAReconciler struct {
// contains filtered or unexported fields
}
OtelSAReconciler reconciles the default service account under the config-management-monitoring namespace.
func NewOtelSAReconciler ¶ added in v1.15.1
func NewOtelSAReconciler(clusterName string, client client.Client, log logr.Logger, scheme *runtime.Scheme) *OtelSAReconciler
NewOtelSAReconciler returns a new OtelSAReconciler.
func (*OtelSAReconciler) Reconcile ¶ added in v1.15.1
func (r *OtelSAReconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)
Reconcile reconciles the default service account under the config-management-monitoring namespace and updates the Deployment annotation. This triggers the `otel-collector` Deployment to restart in the event of an annotation update.
func (*OtelSAReconciler) SetupWithManager ¶ added in v1.15.1
func (r *OtelSAReconciler) SetupWithManager(mgr controllerruntime.Manager) error
SetupWithManager registers otel Service Account controller with reconciler-manager.
type RepoSyncReconciler ¶
type RepoSyncReconciler struct {
// contains filtered or unexported fields
}
RepoSyncReconciler reconciles a RepoSync object.
func NewRepoSyncReconciler ¶
func NewRepoSyncReconciler(clusterName string, reconcilerPollingPeriod, hydrationPollingPeriod time.Duration, client client.Client, watcher client.WithWatch, dynamicClient dynamic.Interface, log logr.Logger, scheme *runtime.Scheme) *RepoSyncReconciler
NewRepoSyncReconciler returns a new RepoSyncReconciler.
func (*RepoSyncReconciler) Reconcile ¶
func (r *RepoSyncReconciler) Reconcile(ctx context.Context, req controllerruntime.Request) (controllerruntime.Result, error)
Reconcile the RepoSync resource.
func (*RepoSyncReconciler) SetupWithManager ¶
func (r *RepoSyncReconciler) SetupWithManager(mgr controllerruntime.Manager, watchFleetMembership bool) error
SetupWithManager registers RepoSync controller with reconciler-manager.
type RootSyncReconciler ¶
type RootSyncReconciler struct {
// contains filtered or unexported fields
}
RootSyncReconciler reconciles a RootSync object
func NewRootSyncReconciler ¶
func NewRootSyncReconciler(clusterName string, reconcilerPollingPeriod, hydrationPollingPeriod time.Duration, client client.Client, watcher client.WithWatch, dynamicClient dynamic.Interface, log logr.Logger, scheme *runtime.Scheme) *RootSyncReconciler
NewRootSyncReconciler returns a new RootSyncReconciler.
func (*RootSyncReconciler) Reconcile ¶
func (r *RootSyncReconciler) Reconcile(ctx context.Context, req controllerruntime.Request) (controllerruntime.Result, error)
Reconcile the RootSync resource.
func (*RootSyncReconciler) SetupWithManager ¶
func (r *RootSyncReconciler) SetupWithManager(mgr controllerruntime.Manager, watchFleetMembership bool) error
SetupWithManager registers RootSync controller with reconciler-manager.
Source Files
¶
- build_names.go
- constants.go
- controller.go
- create_or_update.go
- errors.go
- garbage_collector.go
- gcenode_askpass_sidecar.go
- gitsync_env.go
- hash.go
- helm_value_files.go
- jsonpath.go
- logger.go
- otel_controller.go
- otel_sa_controller.go
- parse.go
- permissions.go
- reconciler_base.go
- reposync_controller.go
- rootsync_controller.go
- secret.go
- util.go
- validate_secret.go
- volumes.go