-
Notifications
You must be signed in to change notification settings - Fork 15k
[fa] translate /examples/ #51963
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
Draft
xirehat
wants to merge
1
commit into
kubernetes:dev-1.33-fa.1
Choose a base branch
from
xirehat:examples
base: dev-1.33-fa.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+9,730
−0
Draft
[fa] translate /examples/ #51963
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,11 @@ | ||
برای اجرای تستهای محلیسازی، از دستور زیر استفاده کنید: | ||
|
||
``` | ||
go test k8s.io/website/content/<lang>/examples | ||
``` | ||
|
||
where `<lang>` is the two character representation of a language. For example: | ||
|
||
``` | ||
go test k8s.io/website/content/en/examples | ||
``` |
28 changes: 28 additions & 0 deletions
28
content/fa/examples/access/certificate-signing-request/clusterrole-approve.yaml
This file contains hidden or 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,28 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: csr-approver | ||
rules: | ||
- apiGroups: | ||
- certificates.k8s.io | ||
resources: | ||
- certificatesigningrequests | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- certificates.k8s.io | ||
resources: | ||
- certificatesigningrequests/approval | ||
verbs: | ||
- update | ||
- apiGroups: | ||
- certificates.k8s.io | ||
resources: | ||
- signers | ||
resourceNames: | ||
- example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain | ||
verbs: | ||
- approve | ||
|
14 changes: 14 additions & 0 deletions
14
content/fa/examples/access/certificate-signing-request/clusterrole-create.yaml
This file contains hidden or 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,14 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: csr-creator | ||
rules: | ||
- apiGroups: | ||
- certificates.k8s.io | ||
resources: | ||
- certificatesigningrequests | ||
verbs: | ||
- create | ||
- get | ||
- list | ||
- watch |
27 changes: 27 additions & 0 deletions
27
content/fa/examples/access/certificate-signing-request/clusterrole-sign.yaml
This file contains hidden or 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,27 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: csr-signer | ||
rules: | ||
- apiGroups: | ||
- certificates.k8s.io | ||
resources: | ||
- certificatesigningrequests | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- certificates.k8s.io | ||
resources: | ||
- certificatesigningrequests/status | ||
verbs: | ||
- update | ||
- apiGroups: | ||
- certificates.k8s.io | ||
resources: | ||
- signers | ||
resourceNames: | ||
- example.com/my-signer-name # example.com/* can be used to authorize for all signers in the 'example.com' domain | ||
verbs: | ||
- sign |
19 changes: 19 additions & 0 deletions
19
content/fa/examples/access/deployment-replicas-policy.yaml
This file contains hidden or 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,19 @@ | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingAdmissionPolicy | ||
metadata: | ||
name: "deploy-replica-policy.example.com" | ||
spec: | ||
paramKind: | ||
apiVersion: rules.example.com/v1 | ||
kind: ReplicaLimit | ||
matchConstraints: | ||
resourceRules: | ||
- apiGroups: ["apps"] | ||
apiVersions: ["v1"] | ||
operations: ["CREATE", "UPDATE"] | ||
resources: ["deployments"] | ||
validations: | ||
- expression: "object.spec.replicas <= params.maxReplicas" | ||
messageExpression: "'object.spec.replicas must be no greater than ' + string(params.maxReplicas)" | ||
reason: Invalid | ||
|
This file contains hidden or 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,20 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
annotations: | ||
kubernetes.io/description: |- | ||
Add endpoints write permissions to the edit and admin roles. This was | ||
removed by default in 1.22 because of CVE-2021-25740. See | ||
https://issue.k8s.io/103675. This can allow writers to direct LoadBalancer | ||
or Ingress implementations to expose backend IPs that would not otherwise | ||
be accessible, and can circumvent network policies or security controls | ||
intended to prevent/isolate access to those backends. | ||
EndpointSlices were never included in the edit or admin roles, so there | ||
is nothing to restore for the EndpointSlice API. | ||
labels: | ||
rbac.authorization.k8s.io/aggregate-to-edit: "true" | ||
name: custom:aggregate-to-edit:endpoints # you can change this if you wish | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["endpoints"] | ||
verbs: ["create", "delete", "deletecollection", "patch", "update"] |
28 changes: 28 additions & 0 deletions
28
content/fa/examples/access/image-matches-namespace-environment.policy.yaml
This file contains hidden or 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,28 @@ | ||
# This policy enforces that all containers of a deployment has the image repo match the environment label of its namespace. | ||
# Except for "exempt" deployments, or any containers that do not belong to the "example.com" organization (e.g. common sidecars). | ||
# For example, if the namespace has a label of {"environment": "staging"}, all container images must be either staging.example.com/* | ||
# or do not contain "example.com" at all, unless the deployment has {"exempt": "true"} label. | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingAdmissionPolicy | ||
metadata: | ||
name: "image-matches-namespace-environment.policy.example.com" | ||
spec: | ||
failurePolicy: Fail | ||
matchConstraints: | ||
resourceRules: | ||
- apiGroups: ["apps"] | ||
apiVersions: ["v1"] | ||
operations: ["CREATE", "UPDATE"] | ||
resources: ["deployments"] | ||
variables: | ||
- name: environment | ||
expression: "'environment' in namespaceObject.metadata.labels ? namespaceObject.metadata.labels['environment'] : 'prod'" | ||
- name: exempt | ||
expression: "'exempt' in object.metadata.labels && object.metadata.labels['exempt'] == 'true'" | ||
- name: containers | ||
expression: "object.spec.template.spec.containers" | ||
- name: containersToCheck | ||
expression: "variables.containers.filter(c, c.image.contains('example.com/'))" | ||
validations: | ||
- expression: "variables.exempt || variables.containersToCheck.all(c, c.image.startsWith(variables.environment + '.'))" | ||
messageExpression: "'only ' + variables.environment + ' images are allowed in namespace ' + namespaceObject.metadata.name" |
This file contains hidden or 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,12 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
# "namespace" omitted since ClusterRoles are not namespaced | ||
name: secret-reader | ||
rules: | ||
- apiGroups: [""] | ||
# | ||
# at the HTTP level, the name of the resource for accessing Secret | ||
# objects is "secrets" | ||
resources: ["secrets"] | ||
verbs: ["get", "watch", "list"] |
This file contains hidden or 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,13 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
# This cluster role binding allows anyone in the "manager" group to read secrets in any namespace. | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: read-secrets-global | ||
subjects: | ||
- kind: Group | ||
name: manager # Name is case sensitive | ||
apiGroup: rbac.authorization.k8s.io | ||
roleRef: | ||
kind: ClusterRole | ||
name: secret-reader | ||
apiGroup: rbac.authorization.k8s.io |
This file contains hidden or 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,9 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
namespace: default | ||
name: pod-reader | ||
rules: | ||
- apiGroups: [""] # "" indicates the core API group | ||
resources: ["pods"] | ||
verbs: ["get", "watch", "list"] |
18 changes: 18 additions & 0 deletions
18
content/fa/examples/access/simple-rolebinding-with-clusterrole.yaml
This file contains hidden or 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,18 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
# This role binding allows "dave" to read secrets in the "development" namespace. | ||
# You need to already have a ClusterRole named "secret-reader". | ||
kind: RoleBinding | ||
metadata: | ||
name: read-secrets | ||
# | ||
# The namespace of the RoleBinding determines where the permissions are granted. | ||
# This only grants permissions within the "development" namespace. | ||
namespace: development | ||
subjects: | ||
- kind: User | ||
name: dave # Name is case sensitive | ||
apiGroup: rbac.authorization.k8s.io | ||
roleRef: | ||
kind: ClusterRole | ||
name: secret-reader | ||
apiGroup: rbac.authorization.k8s.io |
17 changes: 17 additions & 0 deletions
17
content/fa/examples/access/simple-rolebinding-with-role.yaml
This file contains hidden or 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,17 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
# This role binding allows "jane" to read pods in the "default" namespace. | ||
# You need to already have a Role named "pod-reader" in that namespace. | ||
kind: RoleBinding | ||
metadata: | ||
name: read-pods | ||
namespace: default | ||
subjects: | ||
# You can specify more than one "subject" | ||
- kind: User | ||
name: jane # "name" is case sensitive | ||
apiGroup: rbac.authorization.k8s.io | ||
roleRef: | ||
# "roleRef" specifies the binding to a Role / ClusterRole | ||
kind: Role #this must be Role or ClusterRole | ||
name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to | ||
apiGroup: rbac.authorization.k8s.io |
18 changes: 18 additions & 0 deletions
18
content/fa/examples/access/validating-admission-policy-audit-annotation.yaml
This file contains hidden or 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,18 @@ | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingAdmissionPolicy | ||
metadata: | ||
name: "demo-policy.example.com" | ||
spec: | ||
failurePolicy: Fail | ||
matchConstraints: | ||
resourceRules: | ||
- apiGroups: ["apps"] | ||
apiVersions: ["v1"] | ||
operations: ["CREATE", "UPDATE"] | ||
resources: ["deployments"] | ||
validations: | ||
- expression: "object.spec.replicas > 50" | ||
messageExpression: "'Deployment spec.replicas set to ' + string(object.spec.replicas)" | ||
auditAnnotations: | ||
- key: "high-replica-count" | ||
valueExpression: "'Deployment spec.replicas set to ' + string(object.spec.replicas)" |
22 changes: 22 additions & 0 deletions
22
content/fa/examples/access/validating-admission-policy-match-conditions.yaml
This file contains hidden or 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,22 @@ | ||
apiVersion: admissionregistration.k8s.io/v1 | ||
kind: ValidatingAdmissionPolicy | ||
metadata: | ||
name: "demo-policy.example.com" | ||
spec: | ||
failurePolicy: Fail | ||
matchConstraints: | ||
resourceRules: | ||
- apiGroups: ["*"] | ||
apiVersions: ["*"] | ||
operations: ["CREATE", "UPDATE"] | ||
resources: ["*"] | ||
matchConditions: | ||
- name: 'exclude-leases' # Each match condition must have a unique name | ||
expression: '!(request.resource.group == "coordination.k8s.io" && request.resource.resource == "leases")' # Match non-lease resources. | ||
- name: 'exclude-kubelet-requests' | ||
expression: '!("system:nodes" in request.userInfo.groups)' # Match requests made by non-node users. | ||
- name: 'rbac' # Skip RBAC requests. | ||
expression: 'request.resource.group != "rbac.authorization.k8s.io"' | ||
validations: | ||
- expression: "!object.metadata.name.contains('demo') || object.metadata.namespace == 'demo'" | ||
|
This file contains hidden or 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,73 @@ | ||
# This is an example of how to set up cloud-controller-manager as a Daemonset in your cluster. | ||
# It assumes that your masters can run pods and has the role node-role.kubernetes.io/master | ||
# Note that this Daemonset will not work straight out of the box for your cloud, this is | ||
# meant to be a guideline. | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: cloud-controller-manager | ||
namespace: kube-system | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: system:cloud-controller-manager | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: cluster-admin | ||
subjects: | ||
- kind: ServiceAccount | ||
name: cloud-controller-manager | ||
namespace: kube-system | ||
--- | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
labels: | ||
k8s-app: cloud-controller-manager | ||
name: cloud-controller-manager | ||
namespace: kube-system | ||
spec: | ||
selector: | ||
matchLabels: | ||
k8s-app: cloud-controller-manager | ||
template: | ||
metadata: | ||
labels: | ||
k8s-app: cloud-controller-manager | ||
spec: | ||
serviceAccountName: cloud-controller-manager | ||
containers: | ||
- name: cloud-controller-manager | ||
# for in-tree providers we use registry.k8s.io/cloud-controller-manager | ||
# this can be replaced with any other image for out-of-tree providers | ||
image: registry.k8s.io/cloud-controller-manager:v1.8.0 | ||
command: | ||
- /usr/local/bin/cloud-controller-manager | ||
- --cloud-provider=[YOUR_CLOUD_PROVIDER] # Add your own cloud provider here! | ||
- --leader-elect=true | ||
- --use-service-account-credentials | ||
# these flags will vary for every cloud provider | ||
- --allocate-node-cidrs=true | ||
- --configure-cloud-routes=true | ||
- --cluster-cidr=172.17.0.0/16 | ||
tolerations: | ||
# this is required so CCM can bootstrap itself | ||
- key: node.cloudprovider.kubernetes.io/uninitialized | ||
value: "true" | ||
effect: NoSchedule | ||
# these tolerations are to have the daemonset runnable on control plane nodes | ||
# remove them if your control plane nodes should not run pods | ||
- key: node-role.kubernetes.io/control-plane | ||
operator: Exists | ||
effect: NoSchedule | ||
- key: node-role.kubernetes.io/master | ||
operator: Exists | ||
effect: NoSchedule | ||
# this is to restrict CCM to only run on master nodes | ||
# the node selector may vary depending on your cluster setup | ||
nodeSelector: | ||
node-role.kubernetes.io/master: "" |
This file contains hidden or 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,14 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: busybox | ||
namespace: default | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.28 | ||
command: | ||
- sleep | ||
- "3600" | ||
imagePullPolicy: IfNotPresent | ||
restartPolicy: Always |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.