ניהול משאבים של Cloud Load Balancing באמצעות אילוצים בהתאמה אישית

בדף הזה מוסבר איך להשתמש באילוצים בהתאמה אישית של שירות מדיניות הארגון כדי להגביל פעולות ספציפיות במשאבי Google Cloud הבאים:

  • compute.googleapis.com/BackendBucket
  • compute.googleapis.com/BackendService
  • compute.googleapis.com/ForwardingRule
  • compute.googleapis.com/HealthCheck
  • compute.googleapis.com/NetworkEndpointGroup
  • networkservices.googleapis.com/ServiceLbPolicy
  • compute.googleapis.com/SslPolicy
  • compute.googleapis.com/TargetInstance
  • compute.googleapis.com/TargetPool
  • compute.googleapis.com/TargetTcpProxy
  • compute.googleapis.com/TargetSslProxy
  • compute.googleapis.com/TargetHttpProxy
  • compute.googleapis.com/TargetHttpsProxy
  • compute.googleapis.com/TargetGrpcProxy
  • compute.googleapis.com/UrlMap

מידע נוסף על מדיניות הארגון בהתאמה אישית

מידע על כללי מדיניות ואילוצים של הארגון

Google Cloud שירות מדיניות הארגון נותן לכם שליטה מרוכזת ופרוגרמטית על המשאבים של הארגון. אדמינים של מדיניות הארגון יכולים להגדיר את מדיניות הארגון, שהיא קבוצה של הגבלות שנקראות אילוצים. האילוצים חלים על משאביGoogle Cloud ועל הצאצאים של המשאבים האלה בGoogle Cloud היררכיית המשאבים. אפשר לאכוף את מדיניות הארגון ברמת הארגון, התיקייה או הפרויקט.

מדיניות הארגון מספקת אילוצים מנוהלים מובְנים לשירותים שונים של Google Cloud . עם זאת, אם אתם רוצים שליטה מפורטת יותר וניתנת להתאמה אישית על השדות הספציפיים שמוגבלים במדיניות הארגון, אתם יכולים גם ליצור אילוצים בהתאמה אישית ולהשתמש בהם במדיניות הארגון.

ירושה של מדיניות

כברירת מחדל, מדיניות הארגון עוברת בירושה לצאצאים של המשאבים שעליהם אתם אוכפים את המדיניות. לדוגמה, אם אוכפים מדיניות בתיקייה, Google Cloud אוכף את המדיניות בכל הפרויקטים שבתיקייה. למידע נוסף על ההתנהגות הזו ואיך לשנות אותה, קראו את המאמר כללי הערכה של היררכיה.

יתרונות

  • ניהול עלויות: שימוש במדיניות הארגון המותאמת אישית כדי להגביל את תדירות בדיקת התקינות.
  • אבטחה, תאימות ופיקוח: אתם יכולים להשתמש בכללי מדיניות מותאמים אישית של הארגון כדי לאכוף כללי מדיניות. לדוגמה:

    • כדי לאכוף את השימוש בפרוטוקולים ספציפיים של בדיקת תקינות או בטווחי יציאות ספציפיים
    • כדי לא לאפשר פרוטוקולים מסוימים של תנועה בקצה העורפי
    • כדי לדרוש שקטגוריות הקצה העורפי יפעילו את Cloud CDN
    • כדי לדרוש שכללי ההעברה ישתמשו במסלולי שירות רשת ספציפיים

מגבלות

  • אין תמיכה בבדיקות תקינות מדור קודם (Legacy global (HTTP)‎ ו-Legacy global (HTTPS)‎).

  • במשאבים של מדיניות SSL ב-Compute Engine, אילוצים בהתאמה אישית נאכפים גם ב-method‏ UPDATE.

לפני שמתחילים

  1. נכנסים לחשבון Google Cloud . אנחנו ממליצים למשתמשים חדשים ב- Google Cloud ליצור חשבון כדי שיוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Install the Google Cloud CLI.

  5. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  6. To initialize the gcloud CLI, run the following command:

    gcloud init
  7. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  8. Verify that billing is enabled for your Google Cloud project.

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  11. To initialize the gcloud CLI, run the following command:

    gcloud init
  12. חשוב לוודא שאתם יודעים מהו מזהה הארגון שלכם.

התפקידים הנדרשים

כדי לקבל את ההרשאות שדרושות לניהול של מדיניות ארגון בהתאמה אישית, צריך לבקש מהאדמין להקצות לכם את התפקיד אדמין של מדיניות הארגון (roles/orgpolicy.policyAdmin) ב-IAM במשאב הארגון. כדי לקרוא הסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.

יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.

משאבים נתמכים ב-Cloud Load Balancing

ב-Cloud Load Balancing, אפשר להגדיר אילוצים בהתאמה אישית במשאבים ובשדות הבאים.

משאב שדה
compute.googleapis.com/BackendBucket resource.bucketName
resource.cdnPolicy.bypassCacheOnRequestHeaders.headerName
resource.cdnPolicy.cacheKeyPolicy.includeHttpHeaders
resource.cdnPolicy.cacheKeyPolicy.queryStringWhitelist
resource.cdnPolicy.cacheMode
resource.cdnPolicy.clientTtl
resource.cdnPolicy.defaultTtl
resource.cdnPolicy.maxTtl
resource.cdnPolicy.negativeCaching
resource.cdnPolicy.negativeCachingPolicy.code
resource.cdnPolicy.negativeCachingPolicy.ttl
resource.cdnPolicy.requestCoalescing
resource.cdnPolicy.serveWhileStale
resource.cdnPolicy.signedUrlCacheMaxAgeSec
resource.compressionMode
resource.customResponseHeaders
resource.description
resource.enableCdn
resource.loadBalancingScheme
resource.name
compute.googleapis.com/BackendService resource.affinityCookieTtlSec
resource.backends.balancingMode
resource.backends.capacityScaler
resource.backends.description
resource.backends.failover
resource.backends.maxConnections
resource.backends.maxConnectionsPerEndpoint
resource.backends.maxConnectionsPerInstance
resource.backends.maxRate
resource.backends.maxRatePerEndpoint
resource.backends.maxRatePerInstance
resource.backends.maxSessions
resource.backends.maxSessionsPerEndpoint
resource.backends.maxSessionsPerInstance
resource.backends.maxUtilization
resource.backends.preference
resource.backends.trafficDuration
resource.cdnPolicy.bypassCacheOnRequestHeaders.headerName
resource.cdnPolicy.cacheKeyPolicy.includeHost
resource.cdnPolicy.cacheKeyPolicy.includeHttpHeaders
resource.cdnPolicy.cacheKeyPolicy.includeNamedCookies
resource.cdnPolicy.cacheKeyPolicy.includeProtocol
resource.cdnPolicy.cacheKeyPolicy.includeQueryString
resource.cdnPolicy.cacheKeyPolicy.queryStringBlacklist
resource.cdnPolicy.cacheKeyPolicy.queryStringWhitelist
resource.cdnPolicy.cacheMode
resource.cdnPolicy.clientTtl
resource.cdnPolicy.defaultTtl
resource.cdnPolicy.maxTtl
resource.cdnPolicy.negativeCaching
resource.cdnPolicy.negativeCachingPolicy.code
resource.cdnPolicy.negativeCachingPolicy.ttl
resource.cdnPolicy.requestCoalescing
resource.cdnPolicy.serveWhileStale
resource.cdnPolicy.signedUrlCacheMaxAgeSec
resource.circuitBreakers.maxConnections
resource.circuitBreakers.maxPendingRequests
resource.circuitBreakers.maxRequests
resource.circuitBreakers.maxRequestsPerConnection
resource.circuitBreakers.maxRetries
resource.compressionMode
resource.connectionDraining.drainingTimeoutSec
resource.connectionTrackingPolicy.connectionPersistenceOnUnhealthyBackends
resource.connectionTrackingPolicy.enableStrongAffinity
resource.connectionTrackingPolicy.idleTimeoutSec
resource.connectionTrackingPolicy.trackingMode
resource.consistentHash.httpCookie.name
resource.consistentHash.httpCookie.path
resource.consistentHash.httpCookie.ttl.nanos
resource.consistentHash.httpCookie.ttl.seconds
resource.consistentHash.minimumRingSize
resource.customRequestHeaders
resource.customResponseHeaders
resource.description
resource.enableCDN
resource.failoverPolicy.disableConnectionDrainOnFailover
resource.failoverPolicy.dropTrafficIfUnhealthy
resource.failoverPolicy.failoverRatio
resource.haPolicy.fastIPMove
resource.haPolicy.leader.backendGroup
resource.haPolicy.leader.networkEndpoint.instance
resource.iap.enabled
resource.iap.oauth2ClientId
resource.ipAddressSelectionPolicy
resource.loadBalancingScheme
resource.localityLbPolicies.customPolicy.data
resource.localityLbPolicies.customPolicy.name
resource.localityLbPolicies.policy.name
resource.logConfig.enable
resource.logConfig.optionalFields
resource.logConfig.optionalMode
resource.logConfig.sampleRate
resource.maxStreamDuration.nanos
resource.maxStreamDuration.seconds
resource.name
resource.outlierDetection.baseEjectionTime.nanos
resource.outlierDetection.baseEjectionTime.seconds
resource.outlierDetection.consecutiveGatewayFailure
resource.outlierDetection.enforcingConsecutiveErrors
resource.outlierDetection.enforcingConsecutiveGatewayFailure
resource.outlierDetection.enforcingSuccessRate
resource.outlierDetection.maxEjectionPercent
resource.outlierDetection.successRateMinimumHosts
resource.outlierDetection.successRateRequestVolume
resource.outlierDetection.successRateStdevFactor
resource.portName
resource.protocol
resource.securitySettings.awsV4Authentication.accessKeyId
resource.securitySettings.awsV4Authentication.accessKeyVersion
resource.securitySettings.subjectAltNames
resource.sessionAffinity
resource.strongSessionAffinityCookie.name
resource.strongSessionAffinityCookie.path
resource.strongSessionAffinityCookie.ttl.nanos
resource.strongSessionAffinityCookie.ttl.seconds
resource.subsetting.policy
resource.timeoutSec
compute.googleapis.com/ForwardingRule resource.allowGlobalAccess
resource.allowPscGlobalAccess
resource.allPorts
resource.description
resource.IPProtocol
resource.ipVersion
resource.isMirroringCollector
resource.loadBalancingScheme
resource.metadataFilters.filterLabels.name
resource.metadataFilters.filterLabels.value
resource.metadataFilters.filterMatchCriteria
resource.name
resource.networkTier
resource.noAutomateDnsZone
resource.portRange
resource.ports
resource.serviceDirectoryRegistrations.namespace
resource.serviceDirectoryRegistrations.service
resource.serviceDirectoryRegistrations.serviceDirectoryRegion
resource.serviceLabel
resource.sourceIpRanges
resource.target
compute.googleapis.com/HealthCheck resource.checkIntervalSec
resource.description
resource.grpcHealthCheck.grpcServiceName
resource.grpcHealthCheck.port
resource.grpcHealthCheck.portSpecification
resource.healthyThreshold
resource.http2HealthCheck.host
resource.http2HealthCheck.port
resource.http2HealthCheck.portSpecification
resource.http2HealthCheck.proxyHeader
resource.http2HealthCheck.requestPath
resource.http2HealthCheck.response
resource.httpHealthCheck.host
resource.httpHealthCheck.port
resource.httpHealthCheck.portSpecification
resource.httpHealthCheck.proxyHeader
resource.httpHealthCheck.requestPath
resource.httpHealthCheck.response
resource.httpsHealthCheck.host
resource.httpsHealthCheck.port
resource.httpsHealthCheck.portSpecification
resource.httpsHealthCheck.proxyHeader
resource.httpsHealthCheck.requestPath
resource.httpsHealthCheck.response
resource.logConfig.enable
resource.name
resource.sourceRegions
resource.sslHealthCheck.port
resource.sslHealthCheck.portSpecification
resource.sslHealthCheck.proxyHeader
resource.sslHealthCheck.request
resource.sslHealthCheck.response
resource.tcpHealthCheck.port
resource.tcpHealthCheck.portSpecification
resource.tcpHealthCheck.proxyHeader
resource.tcpHealthCheck.request
resource.tcpHealthCheck.response
resource.timeoutSec
resource.type
resource.unhealthyThreshold
compute.googleapis.com/NetworkEndpointGroup resource.annotations
resource.appEngine.service
resource.appEngine.urlMask
resource.appEngine.version
resource.cloudFunction.function
resource.cloudFunction.urlMask
resource.cloudRun.service
resource.cloudRun.tag
resource.cloudRun.urlMask
resource.defaultPort
resource.description
resource.name
resource.network
resource.networkEndpointType
resource.pscData.producerPort
resource.pscTargetService
resource.subnetwork
compute.googleapis.com/SslPolicy resource.customFeatures
resource.description
resource.minTlsVersion
resource.name
resource.profile
compute.googleapis.com/TargetGrpcProxy resource.description
resource.name
resource.validateForProxyless
compute.googleapis.com/TargetHttpProxy resource.description
resource.httpKeepAliveTimeoutSec
resource.name
resource.proxyBind
compute.googleapis.com/TargetHttpsProxy resource.description
resource.httpKeepAliveTimeoutSec
resource.name
resource.proxyBind
resource.quicOverride
resource.tlsEarlyData
compute.googleapis.com/TargetInstance resource.description
resource.name
resource.natPolicy
compute.googleapis.com/TargetPool resource.description
resource.failoverRatio
resource.name
resource.sessionAffinity
compute.googleapis.com/TargetSslProxy resource.description
resource.name
resource.proxyHeader
compute.googleapis.com/TargetTcpProxy resource.description
resource.name
resource.proxyBind
resource.proxyHeader
compute.googleapis.com/UrlMap resource.defaultCustomErrorResponsePolicy.errorResponseRules.matchResponseCodes
resource.defaultCustomErrorResponsePolicy.errorResponseRules.overrideResponseCode
resource.defaultCustomErrorResponsePolicy.errorResponseRules.path
resource.defaultRouteAction.corsPolicy.allowCredentials
resource.defaultRouteAction.corsPolicy.allowHeaders
resource.defaultRouteAction.corsPolicy.allowMethods
resource.defaultRouteAction.corsPolicy.allowOriginRegexes
resource.defaultRouteAction.corsPolicy.allowOrigins
resource.defaultRouteAction.corsPolicy.disabled
resource.defaultRouteAction.corsPolicy.exposeHeaders
resource.defaultRouteAction.corsPolicy.maxAge
resource.defaultRouteAction.faultInjectionPolicy.abort.httpStatus
resource.defaultRouteAction.faultInjectionPolicy.abort.percentage
resource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.nanos
resource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.defaultRouteAction.faultInjectionPolicy.delay.percentage
resource.defaultRouteAction.maxStreamDuration.nanos
resource.defaultRouteAction.maxStreamDuration.seconds
resource.defaultRouteAction.retryPolicy.numRetries
resource.defaultRouteAction.retryPolicy.perTryTimeout.nanos
resource.defaultRouteAction.retryPolicy.perTryTimeout.seconds
resource.defaultRouteAction.retryPolicy.retryConditions
resource.defaultRouteAction.timeout.nanos
resource.defaultRouteAction.timeout.seconds
resource.defaultRouteAction.urlRewrite.hostRewrite
resource.defaultRouteAction.urlRewrite.pathPrefixRewrite
resource.defaultRouteAction.urlRewrite.pathTemplateRewrite
resource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerName
resource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValue
resource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
resource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToRemove
resource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerName
resource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValue
resource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
resource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.defaultRouteAction.weightedBackendServices.weight
resource.defaultUrlRedirect.hostRedirect
resource.defaultUrlRedirect.httpsRedirect
resource.defaultUrlRedirect.pathRedirect
resource.defaultUrlRedirect.prefixRedirect
resource.defaultUrlRedirect.redirectResponseCode
resource.defaultUrlRedirect.stripQuery
resource.description
resource.headerAction.requestHeadersToAdd.headerName
resource.headerAction.requestHeadersToAdd.headerValue
resource.headerAction.requestHeadersToAdd.replace
resource.headerAction.requestHeadersToRemove
resource.headerAction.responseHeadersToAdd.headerName
resource.headerAction.responseHeadersToAdd.headerValue
resource.headerAction.responseHeadersToAdd.replace
resource.headerAction.responseHeadersToRemove
resource.hostRules.description
resource.hostRules.hosts
resource.hostRules.pathMatcher
resource.name
resource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.matchResponseCodes
resource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.overrideResponseCode
resource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.path
resource.pathMatchers.defaultRouteAction.corsPolicy.allowCredentials
resource.pathMatchers.defaultRouteAction.corsPolicy.allowHeaders
resource.pathMatchers.defaultRouteAction.corsPolicy.allowMethods
resource.pathMatchers.defaultRouteAction.corsPolicy.allowOriginRegexes
resource.pathMatchers.defaultRouteAction.corsPolicy.allowOrigins
resource.pathMatchers.defaultRouteAction.corsPolicy.disabled
resource.pathMatchers.defaultRouteAction.corsPolicy.exposeHeaders
resource.pathMatchers.defaultRouteAction.corsPolicy.maxAge
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abort.httpStatus
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abort.percentage
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.nanos
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.percentage
resource.pathMatchers.defaultRouteAction.maxStreamDuration.nanos
resource.pathMatchers.defaultRouteAction.maxStreamDuration.seconds
resource.pathMatchers.defaultRouteAction.retryPolicy.numRetries
resource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeout.nanos
resource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeout.seconds
resource.pathMatchers.defaultRouteAction.retryPolicy.retryConditions
resource.pathMatchers.defaultRouteAction.timeout.nanos
resource.pathMatchers.defaultRouteAction.timeout.seconds
resource.pathMatchers.defaultRouteAction.urlRewrite.hostRewrite
resource.pathMatchers.defaultRouteAction.urlRewrite.pathPrefixRewrite
resource.pathMatchers.defaultRouteAction.urlRewrite.pathTemplateRewrite
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerName
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValue
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToRemove
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerName
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValue
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.pathMatchers.defaultRouteAction.weightedBackendServices.weight
resource.pathMatchers.defaultUrlRedirect.hostRedirect
resource.pathMatchers.defaultUrlRedirect.httpsRedirect
resource.pathMatchers.defaultUrlRedirect.pathRedirect
resource.pathMatchers.defaultUrlRedirect.prefixRedirect
resource.pathMatchers.defaultUrlRedirect.redirectResponseCode
resource.pathMatchers.defaultUrlRedirect.stripQuery
resource.pathMatchers.description
resource.pathMatchers.headerAction.requestHeadersToAdd.headerName
resource.pathMatchers.headerAction.requestHeadersToAdd.headerValue
resource.pathMatchers.headerAction.requestHeadersToAdd.replace
resource.pathMatchers.headerAction.requestHeadersToRemove
resource.pathMatchers.headerAction.responseHeadersToAdd.headerName
resource.pathMatchers.headerAction.responseHeadersToAdd.headerValue
resource.pathMatchers.headerAction.responseHeadersToAdd.replace
resource.pathMatchers.headerAction.responseHeadersToRemove
resource.pathMatchers.name
resource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.matchResponseCodes
resource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.overrideResponseCode
resource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.path
resource.pathMatchers.pathRules.paths
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowCredentials
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowHeaders
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowMethods
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowOriginRegexes
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowOrigins
resource.pathMatchers.pathRules.routeAction.corsPolicy.disabled
resource.pathMatchers.pathRules.routeAction.corsPolicy.exposeHeaders
resource.pathMatchers.pathRules.routeAction.corsPolicy.maxAge
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abort.httpStatus
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abort.percentage
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelay.nanos
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.percentage
resource.pathMatchers.pathRules.routeAction.maxStreamDuration.nanos
resource.pathMatchers.pathRules.routeAction.maxStreamDuration.seconds
resource.pathMatchers.pathRules.routeAction.retryPolicy.numRetries
resource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeout.nanos
resource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeout.seconds
resource.pathMatchers.pathRules.routeAction.retryPolicy.retryConditions
resource.pathMatchers.pathRules.routeAction.timeout.nanos
resource.pathMatchers.pathRules.routeAction.timeout.seconds
resource.pathMatchers.pathRules.routeAction.urlRewrite.hostRewrite
resource.pathMatchers.pathRules.routeAction.urlRewrite.pathPrefixRewrite
resource.pathMatchers.pathRules.routeAction.urlRewrite.pathTemplateRewrite
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerName
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValue
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToRemove
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerName
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValue
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.weight
resource.pathMatchers.pathRules.urlRedirect.hostRedirect
resource.pathMatchers.pathRules.urlRedirect.httpsRedirect
resource.pathMatchers.pathRules.urlRedirect.pathRedirect
resource.pathMatchers.pathRules.urlRedirect.prefixRedirect
resource.pathMatchers.pathRules.urlRedirect.redirectResponseCode
resource.pathMatchers.pathRules.urlRedirect.stripQuery
resource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.matchResponseCodes
resource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.overrideResponseCode
resource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.path
resource.pathMatchers.routeRules.description
resource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.headerName
resource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.headerValue
resource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.replace
resource.pathMatchers.routeRules.headerAction.requestHeadersToRemove
resource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.headerName
resource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.headerValue
resource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.replace
resource.pathMatchers.routeRules.headerAction.responseHeadersToRemove
resource.pathMatchers.routeRules.matchRules.fullPathMatch
resource.pathMatchers.routeRules.matchRules.headerMatches.exactMatch
resource.pathMatchers.routeRules.matchRules.headerMatches.headerName
resource.pathMatchers.routeRules.matchRules.headerMatches.invertMatch
resource.pathMatchers.routeRules.matchRules.headerMatches.prefixMatch
resource.pathMatchers.routeRules.matchRules.headerMatches.presentMatch
resource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatch.rangeEnd
resource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatch.rangeStart
resource.pathMatchers.routeRules.matchRules.headerMatches.regexMatch
resource.pathMatchers.routeRules.matchRules.headerMatches.suffixMatch
resource.pathMatchers.routeRules.matchRules.ignoreCase
resource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabels.name
resource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabels.value
resource.pathMatchers.routeRules.matchRules.metadataFilters.filterMatchCriteria
resource.pathMatchers.routeRules.matchRules.pathTemplateMatch
resource.pathMatchers.routeRules.matchRules.prefixMatch
resource.pathMatchers.routeRules.matchRules.queryParameterMatches.exactMatch
resource.pathMatchers.routeRules.matchRules.queryParameterMatches.name
resource.pathMatchers.routeRules.matchRules.queryParameterMatches.presentMatch
resource.pathMatchers.routeRules.matchRules.queryParameterMatches.regexMatch
resource.pathMatchers.routeRules.matchRules.regexMatch
resource.pathMatchers.routeRules.priority
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowCredentials
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowHeaders
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowMethods
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowOriginRegexes
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowOrigins
resource.pathMatchers.routeRules.routeAction.corsPolicy.disabled
resource.pathMatchers.routeRules.routeAction.corsPolicy.exposeHeaders
resource.pathMatchers.routeRules.routeAction.corsPolicy.maxAge
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abort.httpStatus
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abort.percentage
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelay.nanos
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.percentage
resource.pathMatchers.routeRules.routeAction.maxStreamDuration.nanos
resource.pathMatchers.routeRules.routeAction.maxStreamDuration.seconds
resource.pathMatchers.routeRules.routeAction.retryPolicy.numRetries
resource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeout.nanos
resource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeout.seconds
resource.pathMatchers.routeRules.routeAction.retryPolicy.retryConditions
resource.pathMatchers.routeRules.routeAction.timeout.nanos
resource.pathMatchers.routeRules.routeAction.timeout.seconds
resource.pathMatchers.routeRules.routeAction.urlRewrite.hostRewrite
resource.pathMatchers.routeRules.routeAction.urlRewrite.pathPrefixRewrite
resource.pathMatchers.routeRules.routeAction.urlRewrite.pathTemplateRewrite
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerName
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValue
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToRemove
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerName
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValue
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.weight
resource.pathMatchers.routeRules.urlRedirect.hostRedirect
resource.pathMatchers.routeRules.urlRedirect.httpsRedirect
resource.pathMatchers.routeRules.urlRedirect.pathRedirect
resource.pathMatchers.routeRules.urlRedirect.prefixRedirect
resource.pathMatchers.routeRules.urlRedirect.redirectResponseCode
resource.pathMatchers.routeRules.urlRedirect.stripQuery
resource.tests.description
resource.tests.expectedOutputUrl
resource.tests.expectedRedirectResponseCode
resource.tests.headers.name
resource.tests.headers.value
resource.tests.host
resource.tests.path
networkservices.googleapis.com/ServiceLbPolicy resource.autoCapacityDrain.enable
resource.description
resource.failoverConfig.failoverHealthThreshold
resource.loadBalancingAlgorithm
resource.name

הגדרת אילוץ בהתאמה אישית

אילוץ בהתאמה אישית מוגדר בקובץ YAML לפי המשאבים, השיטות, התנאים והפעולות שנתמכים בשירות שבו אתם אוכפים את מדיניות הארגון. התנאים של האילוצים המותאמים אישית מוגדרים באמצעות Common Expression Language (CEL). בקטע CEL במאמר יצירה וניהול של אילוצים בהתאמה אישית מוסבר איך ליצור תנאים באילוצים בהתאמה אישית באמצעות CEL.

המסוף

כדי ליצור אילוץ בהתאמה אישית:

  1. במסוף Google Cloud , נכנסים לדף מדיניות הארגון.

    כניסה לדף Organization policies

  2. בכלי לבחירת פרויקטים, בוחרים את הפרויקט שרוצים להגדיר לו את מדיניות הארגון.
  3. לוחצים על Custom constraint.
  4. בתיבה Display name, מזינים שם לאילוץ שיהיה קריא לאנשים. השם הזה מופיע בהודעות שגיאה ואפשר להשתמש בו לזיהוי ולניפוי באגים. אל תשתמשו בפרטים אישיים מזהים (PII) או במידע רגיש בשמות לתצוגה, כי השם הזה עלול להיחשף בהודעות שגיאה. השדה הזה יכול להכיל עד 200 תווים.
  5. בתיבה Constraint ID, מזינים את המזהה שרוצים לתת לאילוץ החדש בהתאמה אישית. אילוץ בהתאמה אישית יכול להכיל רק אותיות (כולל אותיות רישיות וקטנות) או מספרים, לדוגמה custom.enforceTCPHealthCheckPort1024. השדה הזה יכול להכיל עד 70 תווים, לא כולל הקידומת (custom.), לדוגמה, organizations/123456789/customConstraints/custom. אל תכללו פרטים אישיים מזהים או מידע רגיש במזהה האילוץ, כי הם עלולים להיחשף בהודעות שגיאה.
  6. בתיבה Description, מזינים תיאור קריא לאנשים של האילוץ. התיאור הזה משמש כהודעת שגיאה כשיש הפרה של המדיניות. ציינו פרטים על הסיבה להפרת המדיניות ואיך לפתור את הבעיה. אל תכללו פרטים אישיים מזהים או מידע רגיש בתיאור, כי הם עלולים להיחשף בהודעות שגיאה. השדה הזה יכול להכיל עד 2,000 תווים.
  7. בתיבה Resource type, בוחרים את השם של משאב ה- Google Cloud REST שמכיל את האובייקט והשדה שרוצים להגביל, לדוגמה container.googleapis.com/Cluster. רוב סוגי המשאבים תומכים בעד 20 אילוצים בהתאמה אישית. אם תנסו ליצור יותר אילוצים בהתאמה אישית, הפעולה תיכשל.
  8. בקטע Enforcement method, בוחרים אם לאכוף את האילוץ על שיטת REST CREATE או על השיטות CREATE ו-UPDATE. אם אוכפים את האילוץ באמצעות השיטה UPDATE במשאב שמפר את האילוץ, מדיניות הארגון חוסמת את השינויים במשאב הזה, אלא אם השינוי פותר את ההפרה.
  9. כדי לראות את השיטות הנתמכות לכל שירות, חפשו את השירות במאמר שירותים שתומכים באילוצים בהתאמה אישית.

  10. כדי להגדיר תנאי, לוחצים על עריכת התנאי.
    1. בחלונית Add condition, יוצרים תנאי CEL שמתייחס למשאב שירות נתמך, לדוגמה resource.management.autoUpgrade == false. השדה הזה יכול להכיל עד 1,000 תווים. לפרטים על השימוש ב-CEL, קראו את המאמר Common Expression Language. מידע נוסף על משאבי השירות שבהם אפשר להשתמש באילוצים המותאמים אישית מופיע במאמר שירותים שנתמכים באילוצים מותאמים אישית.
    2. לוחצים על Save.
  11. בקטע Action, בוחרים אם לאשר או לדחות את השיטה שנבדקה אם התנאי מתקיים.
  12. פעולת הדחייה פירושה שהפעולה ליצירה או לעדכון של המשאב נחסמת אם התנאי מקבל את הערך true.

    פעולת ההרשאה מאפשרת ליצור או לעדכן את המשאב רק אם התנאי מתקיים. כל מקרה אחר, מלבד אלה שרשומים במפורש בתנאי, נחסם.

  13. לוחצים על Create constraint.
  14. אחרי שמזינים ערך בכל שדה, הגדרת ה-YAML המקבילה לאילוץ המותאם אישית הזה מופיעה בצד שמאל.

gcloud

  1. כדי ליצור אילוץ בהתאמה אישית, יוצרים קובץ YAML בפורמט הבא:
  2. name: organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME
    resourceTypes: RESOURCE_NAME
    methodTypes:
      - CREATE
    - UPDATE
    condition: "CONDITION" actionType: ACTION displayName: DISPLAY_NAME description: DESCRIPTION

    מחליפים את מה שכתוב בשדות הבאים:

    • ‫ORGANIZATION_ID: מזהה הארגון, למשל 123456789.
    • ‫CONSTRAINT_NAME: השם שרוצים לתת לאילוץ החדש בהתאמה אישית. אילוץ בהתאמה אישית יכול להכיל רק אותיות (כולל אותיות רישיות וקטנות) או מספרים, לדוגמה, custom.enforceTCPHealthCheckPort1024. השדה הזה יכול להכיל עד 70 תווים, לא כולל הקידומת (custom.) – לדוגמה, organizations/123456789/customConstraints/custom. אל תכללו פרטים אישיים מזהים (PII) או מידע רגיש במזהה האילוץ, כי הם עלולים להיחשף בהודעות שגיאה.
    • ‫RESOURCE_NAME: השם המלא של המשאב ב- Google Cloudשמכיל את האובייקט והשדה שרוצים להגביל. לדוגמה, compute.googleapis.com/HealthCheck. רוב סוגי המשאבים תומכים בעד 20 אילוצים בהתאמה אישית. אם תנסו ליצור יותר אילוצים בהתאמה אישית, הפעולה תיכשל.
    • ‫methodTypes: שיטות ה-REST שעליהן נאכף האילוץ. יכול להיות CREATE או גם CREATE וגם UPDATE. אם אוכפים את האילוץ באמצעות השיטה UPDATE במשאב שמפר את האילוץ, מדיניות הארגון חוסמת את השינויים במשאב הזה, אלא אם השינוי פותר את ההפרה.
    • כדי לראות את השיטות הנתמכות בכל שירות, חפשו את השירות במאמר שירותים שתומכים באילוצים בהתאמה אישית.

    • ‫CONDITION: תנאי CEL שנכתב כנגד ייצוג של משאב שירות נתמך. השדה הזה יכול להכיל עד 1,000 תווים. לדוגמה, "resource.tcpHealthCheck.port >= 1024".
    • למידע נוסף על המשאבים הזמינים לכתיבת תנאים, ראו משאבים נתמכים.

    • ‫ACTION: הפעולה שצריך לבצע אם התנאי condition מתקיים. הערכים האפשריים הם ALLOW ו-DENY.
    • הפעולה allow פירושה שאם התנאי מקבל את הערך true, מותר ליצור או לעדכן את המשאב. זה גם אומר שכל מקרה אחר, מלבד המקרה שמופיע במפורש בתנאי, חסום.

      פעולת הדחייה פירושה שאם התנאי מקבל את הערך True, הפעולה ליצירה או לעדכון של המשאב נחסמת.

    • ‫DISPLAY_NAME: שם קריא לאנשים של האילוץ. השם הזה מופיע בהודעות שגיאה ואפשר להשתמש בו לזיהוי ולניפוי באגים. אל תשתמשו בפרטים אישיים מזהים (PII) או במידע רגיש בשמות המוצגים, כי השם הזה עלול להיחשף בהודעות שגיאה. השדה הזה יכול להכיל עד 200 תווים.
    • ‫DESCRIPTION: תיאור ידידותי למשתמש של האילוץ, שיוצג כהודעת שגיאה במקרה של הפרת המדיניות. השדה הזה יכול להכיל עד 2,000 תווים.
  3. אחרי שיוצרים את קובץ ה-YAML לאילוץ חדש בהתאמה אישית, צריך להגדיר אותו כדי שיהיה זמין למדיניות הארגון. כדי להגדיר אילוץ בהתאמה אישית, משתמשים בפקודה gcloud org-policies set-custom-constraint:
  4. gcloud org-policies set-custom-constraint CONSTRAINT_PATH

    מחליפים את CONSTRAINT_PATH בנתיב המלא לקובץ האילוץ בהתאמה אישית. לדוגמה, /home/user/customconstraint.yaml.

    בסיום הפעולה, האילוצים המותאמים אישית יהיו זמינים כמדיניות של הארגון ברשימת Google Cloud כללי המדיניות של הארגון.

  5. כדי לוודא שהאילוץ המותאם אישית קיים, משתמשים בפקודה gcloud org-policies list-custom-constraints:
  6. gcloud org-policies list-custom-constraints --organization=ORGANIZATION_ID

    מחליפים את ORGANIZATION_ID במזהה של משאב הארגון.

    למידע נוסף, קראו את המאמר הצגת מדיניות הארגון.

אכיפה של מדיניות ארגונית בהתאמה אישית

כדי לאכוף אילוץ, אתם יכולים ליצור מדיניות ארגון שמפנה אליו, ואז להחיל את מדיניות הארגון על משאב ב- Google Cloud .

המסוף

  1. במסוף Google Cloud , נכנסים לדף מדיניות הארגון.

    כניסה לדף Organization policies

  2. בכלי לבחירת פרויקטים, בוחרים את הפרויקט שרוצים להגדיר לו את מדיניות הארגון.
  3. ברשימה שבדף מדיניות הארגון, בוחרים את האילוץ כדי להציג את הדף Policy details של אותו אילוץ.
  4. כדי להגדיר את מדיניות הארגון למשאב הזה, לוחצים על ניהול המדיניות.
  5. בדף עריכת המדיניות, בוחרים באפשרות במקום המדיניות של המשאב הראשי.
  6. לוחצים על Add a rule.
  7. בקטע Enforcement, בוחרים אם לאכוף את מדיניות הארגון הזו או לא.
  8. אופציונלי: כדי להוסיף תנאי למדיניות הארגון על סמך תג, לוחצים על Add condition. שימו לב: אם מוסיפים כלל מותנה למדיניות הארגון, צריך להוסיף לפחות כלל אחד לא מותנה, אחרת אי אפשר לשמור את המדיניות. מידע נוסף מופיע במאמר הגדרת ההיקף של מדיניות הארגון באמצעות תגים.
  9. לוחצים על בדיקת השינויים כדי לדמות את ההשפעה של מדיניות הארגון. למידע נוסף, קראו את המאמר בדיקת שינויים במדיניות הארגון באמצעות סימולטור המדיניות.
  10. כדי לאכוף את מדיניות הארגון במצב פרימטר לבדיקות, לוחצים על הגדרת המדיניות להרצת בדיקה. למידע נוסף, קראו את המאמר בדיקת כללי מדיניות של הארגון.
  11. אחרי שמוודאים שמדיניות הארגון במצב פרימטר לבדיקות פועלת כמו שצריך, לוחצים על Set policy כדי להגדיר את המדיניות הפעילה.

gcloud

  1. כדי ליצור מדיניות ארגונית עם כללים בוליאניים, יוצרים קובץ YAML של מדיניות שמפנה לאילוץ:
  2. name: projects/PROJECT_ID/policies/CONSTRAINT_NAME
    spec:
      rules:
      - enforce: true
    
    dryRunSpec:
      rules:
      - enforce: true

    מחליפים את מה שכתוב בשדות הבאים:

    • ‫PROJECT_ID: הפרויקט שבו רוצים לאכוף את האילוץ.
    • ‫CONSTRAINT_NAME: השם שהגדרתם לאילוץ המותאם אישית. לדוגמה, custom.enforceTCPHealthCheckPort1024.
  3. כדי לאכוף את מדיניות הארגון במצב פרימטר לבדיקות, מריצים את הפקודה הבאה עם הדגל dryRunSpec:
  4. gcloud org-policies set-policy POLICY_PATH --update-mask=dryRunSpec

    מחליפים את POLICY_PATH בנתיב המלא לקובץ ה-YAML של מדיניות הארגון. המדיניות תיכנס לתוקף תוך 15 דקות לכל היותר.

  5. אחרי שמוודאים שמדיניות הארגון במצב פרימטר לבדיקות פועלת כמצופה, מגדירים את המדיניות הפעילה באמצעות הפקודה org-policies set-policy והדגל spec:
  6. gcloud org-policies set-policy POLICY_PATH --update-mask=spec

    מחליפים את POLICY_PATH בנתיב המלא לקובץ ה-YAML של מדיניות הארגון. המדיניות תיכנס לתוקף תוך 15 דקות לכל היותר.

בדיקת מדיניות הארגון בהתאמה אישית

בדוגמה הבאה נוצר אילוץ בהתאמה אישית שדורש שהיציאות של בדיקת תקינות של TCP יהיו 1024 או יותר, כדי למנוע שימוש ביציאות מוכרות (0-1023).

יצירת האילוץ בהתאמה אישית

  1. כדי להגדיר אילוץ בהתאמה אישית, יוצרים קובץ בשם constraint-tcp-health-check-ports.yaml.

    name: organizations/ORGANIZATION_ID/customConstraints/custom.enforceTCPHealthCheckPort1024
    resource_types:
    – compute.googleapis.com/HealthCheck
    condition: "resource.tcpHealthCheck.port >= 1024"
    method_types:
    – CREATE
    – UPDATE
    action_type: ALLOW
    display_name: Only TCP health check ports >= 1024 allowed.
    description: Prevent TCP health checks on well-known ports.

    מחליפים את ORGANIZATION_ID במזהה הארגון.

  2. מחילים את האילוץ המותאם אישית.

    gcloud org-policies set-custom-constraint constraint-tcp-health-check-ports
    

יצירת מדיניות הארגון

  1. כדי להגדיר מדיניות לארגון, יוצרים קובץ בשם policy-tcp-health-check-ports.yaml. בדוגמה הזו אנחנו אוכפים את האילוץ ברמת הפרויקט, אבל אפשר גם להגדיר אותו ברמת הארגון או התיקייה.

    name: projects/PROJECT_ID/policies/custom.enforceTCPHealthCheckPort1024
    spec:
      rules:
      – enforce: true

    מחליפים את PROJECT_ID במזהה הפרויקט.

  2. אוכפים את מדיניות הארגון.

    gcloud org-policies set-policy policy-tcp-health-check-ports
    
  3. מוודאים שמדיניות הארגון קיימת.

    gcloud org-policies list --project PROJECT_ID
    

    הפלט אמור להיראות כך:

    CONSTRAINT: custom.enforceTCPHealthCheckPort1024
    LIST_POLICY: SET
    BOOLEAN_POLICY: -
    ETAG: CNHuh7kGEJiatFo=-
    

בדיקת המדיניות

  1. כדי לבדוק את האילוץ, יוצרים בדיקת תקינות של TCP ביציאה 80.

    gcloud compute health-checks create tcp my-tcp-health-check \
        --project=PROJECT_ID \
        --region=us-central1 \
        --port=80 \
        --check-interval=5s \
        --timeout=5s \
        --healthy-threshold=4 \
        --unhealthy-threshold=5 \
    

    הפעולה לא מותרת והפלט דומה לזה:

    ERROR: (gcloud.compute.healthChecks.create) Could not fetch resource:
    – Operation denied by custom org policies: [customConstraints/custom.enforceTCPHealthCheckPort1024]: Only TCP health check ports >= 1024 allowed.
    

דוגמאות למדיניות ארגונית בהתאמה אישית לתרחישים נפוצים

בטבלה הבאה מופיע התחביר של כמה אילוצים נפוצים בהתאמה אישית.

תיאור תחביר של אילוצים
צריך להפעיל את Cloud CDN בכל קטגוריות הקצה העורפי
    name: organizations/ORGANIZATION_ID/customConstraints/custom.backendBucketEnableCdn
    resourceTypes:
    - compute.googleapis.com/BackendBucket
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.enableCdn == true"
    actionType: ALLOW
    displayName: Require all backend buckets to have Cloud CDN enabled
    description: All backend buckets must have Cloud CDN enabled.
    
איסור על שימוש ב-HTTP וב-TCP כפרוטוקולים של שירות לקצה העורפי
    name: organizations/ORGANIZATION_ID/customConstraints/custom.backendBucketEnableCdn
    resourceTypes:
    - compute.googleapis.com/BackendService
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.protocol == 'HTTP' || resource.protocol == 'TCP'"
    actionType: DENY
    displayName: Disallow the use of HTTP and TCP as backend service protocols
    description: Backend services cannot configure HTTP or TCP as the backend service protocol.
    
דרישה להשתמש במסלול הרגיל בכללי העברה
    name: organizations/ORGANIZATION_ID/customConstraints/custom.forwardingRulesStandardTier
    resourceTypes:
    - compute.googleapis.com/ForwardingRule
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.networkTier == 'STANDARD'"
    actionType: ALLOW
    displayName: Require forwarding rules to use Standard Tier
    description: Forwarding rules must use the Standard Network Service Tier.
    
דרישה שכל הפרוטוקולים של בדיקת התקינות יתרחשו ביציאה 1024 ומעלה
    name: organizations/ORGANIZATION_ID/customConstraints/custom.healthCheckPortMin1024
    resourceTypes:
    - compute.googleapis.com/HealthCheck
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.tcpHealthCheck.port >= 1024 && resource.httpHealthCheck.port >= 1024 && resource.httpsHealthCheck.port >= 1024 && resource.sslHealthCheck.port >= 1024 && resource.sslHealthCheck.port >= 1024 &&resource.http2HealthCheck.port >= 1024 && resource.grpcHealthCheck.port >= 1024"
    actionType: ALLOW
    displayName: Require port 1024 or greater for all health checks
    description: All health check protocols must use a port of 1024 or higher, to avoid well-known ports.
    
לא לאפשר בדיקות תקינות של gRPC
    name: organizations/ORGANIZATION_ID/customConstraints/custom.disallowGRPCHealthChecks
    resourceTypes:
    - compute.googleapis.com/HealthCheck
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.type == 'GRPC'"
    actionType: DENY
    displayName: Disallow GRPC health checks
    description: Health checks aren't allowed to use GRPC.
    
מניעת בדיקות תקינות בתדירות גבוהה
    name: organizations/ORGANIZATION_ID/customConstraints/custom.minHealthCheckFrequency
    resourceTypes:
    - compute.googleapis.com/HealthCheck
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.checkIntervalSec >= 30"
    actionType: ALLOW
    displayName: Disallow fast health check probes
    description: Prevent health checks from having a probe frequency under 30 seconds.
    
אסור להגדיר ערכי זמן קצוב לתפוגה של HTTPS keepalive של לקוח שגדולים מ-1,000 שניות
    name: organizations/ORGANIZATION_ID/customConstraints/custom.clientHTTPSKeepalive1000Sec
    resourceTypes:
    - compute.googleapis.com/TargetHttpsProxy
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.httpKeepAliveTimeoutSec > 1000"
    actionType: DENY
    displayName: Disallow client HTTPS keepalive timeout greater than 1000 seconds
    description: Disallow client HTTPS keepalive timeout values greater than 1000 seconds.
    
דרישה שלמפות ה-URL תהיה מדיניות תגובה מותאמת אישית לשגיאות בקודי הסטטוס 500 של HTTP
    name: organizations/ORGANIZATION_ID/customConstraints/custom.urlMapCustomResponseHTTP500
    resourceTypes:
    - compute.googleapis.com/UrlMaps
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.defaultCustomErrorResponsePolicy.errorResponseRule.exists(value, value.matchResponseCode == 500)"
    actionType: ALLOW
    displayName: Require URL maps to have a custom error response policy for HTTP 500 errors
    description: URL maps must have a custom error response policy configured for HTTP 500 errors.
    
השמות של מכונות היעד חייבים להתחיל במחרוזת "targetInstance"
    name: organizations/ORGANIZATION_ID/customConstraints/custom.targetInstanceConstraint
    resourceTypes:
    - compute.googleapis.com/TargetInstance
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.name.startsWith('targetInstance')"
    actionType: ALLOW
    displayName: Require target instances to have a name that starts with the string "targetInstance"
    description: Target instances must have resource names that start with the string "targetInstance"
    
דרישה שלמאגרי היעד תהיה זיקה לסשן (session affinity) של CLIENT_IP
    name: organizations/ORGANIZATION_ID/customConstraints/custom.targetPoolConstraint
    resourceTypes:
    - compute.googleapis.com/TargetPool
    methodTypes:
    - CREATE
    - UPDATE
    condition: "resource.sessionAffinity == 'CLIENT_IP'"
    actionType: ALLOW
    displayName: Require target pools to use CLIENT_IP session affinity
    description: Target pools must use CLIENT_IP session affinity
    
הגבלת גרסת ה-TLS המינימלית ל-1.2
    name: organizations/ORGANIZATION_ID/customConstraints/custom.restrictLbTlsVersion
    resource_types: compute.googleapis.com/SslPolicy
    methodTypes:
    - CREATE
    - UPDATE
    condition: resource.minTlsVersion == "TLS_1_2"
    action_type: ALLOW
    display_name: Restrict Load Balancing TLS version to 1.2
    description: Only allow SSL policies to be created or updated if the minimum TLS version is 1.2 where this custom constraint is enforced.
    

אפשר ליצור משאב SSL אם מתקיימים התנאים הבאים:

  • גרסת ה-TLS המינימלית מוגדרת ל-1.2
  • למדיניות ה-SSL יש פרופיל CUSTOM שמאפשר לבחור תכונות SSL בנפרד
  • מדיניות ה-SSL לא כוללת את סט האלגוריתמים להצפנה (cipher suite) מסוג ChaCha20-Poly1305
    name: organizations/ORGANIZATION_ID/customConstraints/custom.restrictLbTlsCapabilities
    resourceTypes:
    - compute.googleapis.com/SslPolicy
    methodTypes:
    - CREATE
    - UPDATE
    condition: resource.minTlsVersion == "TLS_1_2" && resource.profile == "CUSTOM" && !resource.customFeatures.exists(feature, feature.contains("CHACHA20_POLY1305"))
    actionType: ALLOW
    displayName: Restrict Load Balancing TLS Capabilities
    description: Only allow SSL Policy resources to be created or updated if the minimum TLS version is 1.2, profile is CUSTOM, and no ChaCha20-Poly1305 cipher suite is used where this custom constraint is enforced.
    

המאמרים הבאים