SAN FRANCISCO — The corporate campuses of the Bay Area’s technology companies have become independent fiefs with dry cleaning, gyms, doctors, shuttle buses and bountiful free meals, made by the best chefs poached from the region’s famous restaurants. Now, local officials are knocking at the gates.

And they are coming for the food.

Two San Francisco supervisors introduced an ordinance last week that would forbid employee cafeterias in new corporate construction. It is not clear whether the measure will pass, but it is a direct attack on one of the modern tech industry’s most entrenched traditions.

The ordinance, which seeks to force tech workers out of their subsidized cafeterias and into neighborhood restaurants, is the latest attempt by San Francisco leaders to make the tech companies that are migrating north from Silicon Valley adapt to life in the city.

The issue is an emotional one in San Francisco, where the flood of new workers and existing residents have struggled to mesh as the cost of living has spiraled. Income inequality in the city — often defined as “the haves who work for tech companies versus just about everyone else” — is among the highest in the country. Renting a one-bedroom apartment now costs on average $3,258 a month. The median home price rose to $1.6 million earlier this year.